When I run the following script in PHP:

$temp="select max(id) as num from `$album_id`";
$max_id=mysql_query($temp) or die("error");

I get the following when I echo $max_id:

Resource id #4

any idea how to get just a number not resource id #4?

Thanks
Campsoup1988

    Hi,

    you need to fetch the record:

     $temp="select max(id) as num from `$album_id`";
    $res=mysql_query($temp) or die("error"); 
    $row = mysql_fetch_assoc($res);
    $max_id=$row['num'];
    

    Does $album_id contain a table name ? The variable name looks suspicious ...

    Thomas

      ok, $album_id contains the table number, in this case -1, which is stored in $album_id, and to access a table that is a number, you must have a on either side of the number, so in this case$album_idwould result in-1` which is the correct access to the table

      what do you mean fetch?

      Do I need to teach one of my dogs php? LoL

      oh, I see what you mean!

      ah thanks! it worked!

      THANK YOU!
      campsoup1988

        Write a Reply...