Page 1 of 1

need help in fetching value from qry

Posted: Tue Aug 30, 2005 6:26 am
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.

Posted: Tue Aug 30, 2005 6:38 am
by n00b Saibot
will work fine. use the query as-it-is in php.

Posted: Tue Aug 30, 2005 6:44 am
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.

Posted: Tue Aug 30, 2005 7:17 am
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