Help with PHP Code

6 posts by 3 authors in: Forums > CMS Builder
Last Post: September 23, 2014   (RSS)

By claire - September 18, 2014 - edited: September 18, 2014

Hi Joseph, what errors are you getting with this?

added by edit - sorry, just want to confirm if you're seeing anything other than the Record Not Found problem.

Can you attach the code for this place please?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Hi Claire

i have attached the actual php page as i am not sure which part of the code is giving the error. 

error occurs on this p[age - http://www.socanews.com/music/albums/album.php?8-Mile-Riddim-190

thanks
Joseph

Attachments:

album.php 46K

Error is in line 45 where you are returning the second record from an array that is limited to 0.  if you are trying to do the same thing as for the tracks, you need to change the funcion to something like this ... I do not know how the country table constructed.

 function getCountrytitle($num)
  {
    list($countryRecords, $countryMetaData) = getRecords(array(
    'tableName'   => 'country',
    'where'       => "num ='$num'",
    // 'limit'       => '0',
    ));
    if($countryRecords){return $countryRecords['title'];}
  }

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

That isn't going to work, Ron. The error is due to the limit parameter in the getRecords function, but getRecords returns an array even if only one record is found.

So change the function like this:

function getCountrytitle($num)
{
    list($countryRecords, $countryMetaData) = getRecords(array(
        'tableName' => 'country',
        'where' => "title='$num'",
        'limit' => 1,
    ));
    return @$countryRecords[0];
}

This still might not work if the where parameter finds nothing, but that'll be a start anyway.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Thanks this worked but there are still some minor issues, I am going to recreate the page from scratch.