Last Record Query Result Problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
saeen
Forum Newbie
Posts: 24
Joined: Mon Sep 22, 2003 5:35 am
Contact:

Last Record Query Result Problem

Post by saeen »

i have used
$res = mysql_query("SELECT id FROM personal_info ORDER BY id DESC LIMIT 1 ");
and i think it shud return me the value of last id field
instead when i say
echo $res; it prints something like this Resource Id #3

help
saeen
Forum Newbie
Posts: 24
Joined: Mon Sep 22, 2003 5:35 am
Contact:

Post by saeen »

and yea one thing more thrz only one record in the database at the time
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

why did you double post!!! i respond you in the original post!
saeen
Forum Newbie
Posts: 24
Joined: Mon Sep 22, 2003 5:35 am
Contact:

Post by saeen »

sorry abt the double post .. actually i needed help immediatly and then i didnt get a reply so i thought may be ppl wont read the old post so i posted again...but then u replied on the old one
sorry once again

can u tell me how to make a self call in the page..like im doin this if i don find a record i increase the value of $id+1 and then call the same page again how to do that??? used header but it says header info already sent dono any other way.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

You cant do $id + 1 because you dont know if it exists... you have to do it with the select i show you.

self call?
saeen
Forum Newbie
Posts: 24
Joined: Mon Sep 22, 2003 5:35 am
Contact:

Post by saeen »

no no $id + 1 from the database pro is solved
all i want to know is how can i make statement in a php page that actually redirects to itself u gettin me?
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

$val = mysql_result($res);
echo $val;
Post Reply