need help in fetching value from qry

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

need help in fetching value from qry

Post by itsmani1 »

Code: Select all

SELECT DATE_ADD(CURDATE(), INTERVAL 31 DAY)
this gives me correct result at console but how to get resut of it where i have nothing to do with table. i mean to say i want to "is it possible to get result from the above query with out giving table and filed name.


Thanx.
Mannan.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

will work fine. use the query as-it-is in php.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

n00b Saibot wrote:will work fine. use the query as-it-is in php.
i know it will work fine but i wanted to know that how to fetch value form it. i mean can u plz. tell me how to fetch date from this qry.

Thanx.
Mannan.
skhale
Forum Newbie
Posts: 6
Joined: Sat Aug 06, 2005 12:56 pm
Location: Boston, MA

Post by skhale »

You should use an alias in your query if you want to reference it in PHP

Code: Select all

SELECT DATE_ADD(CURDATE(), INTERVAL 31 DAY) AS MyNewDate

Code: Select all

$mynewdate = mysql_result($record_set, 0, 'MyNewDate');
where $record_set is the record set returned by the query
Post Reply