Hello all,
I'm using postgresql and PHP to set up a small website. I have a slight problem that I have been unable to explain. Basically the part that I'm trying to do is call up the maximum value in my primary serial key field in my database and post it on a webpage. But when I do that, the number is wrong...whereas the highest number record in my table field is 134, the webpage prints out "6" during testing. These are the statements I'm using:
$default_query = "SELECT t0.* FROM $table_name t0";
$max_query = "SELECT max(num_id) FROM $table_name";
$query = pg_Exec($conn, $default_query);
$maxid = pg_Exec($conn, $max_query);
$num_id = pg_Result($query, $maxid, num_id);
echo"$num_id";
Any ideas are appreciated!
Thanks,
Jisoo22
I'm using postgresql and PHP to set up a small website. I have a slight problem that I have been unable to explain. Basically the part that I'm trying to do is call up the maximum value in my primary serial key field in my database and post it on a webpage. But when I do that, the number is wrong...whereas the highest number record in my table field is 134, the webpage prints out "6" during testing. These are the statements I'm using:
$default_query = "SELECT t0.* FROM $table_name t0";
$max_query = "SELECT max(num_id) FROM $table_name";
$query = pg_Exec($conn, $default_query);
$maxid = pg_Exec($conn, $max_query);
$num_id = pg_Result($query, $maxid, num_id);
echo"$num_id";
Any ideas are appreciated!
Thanks,
Jisoo22