Re: Using MySQL user variables in PHP
| From: | Jim MacCormaic | Date: | Sun, 26 Jan 2003 19:17:47 +0000 |
| Subject: | Re: Using MySQL user variables in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133185@lists.php.net to get a copy of this message | ||
On Sunday, January 26, 2003, at 06:26 pm, Jason Wong wrote:
You're not doing anything with $tempQuery1 & $tempQuery2 this is complete nonsense ;-)Bowing obsequiously, suitably chastened, I read on . . .
This is getting closer. Unfortunately you haven't been reading the manual. mysql_query() returns a "resource ID". See examples in manual for details on how to properly query and return results from a db.Knuckles recovering from another knock, I read further . . .
Couldn't the above be condensed to: SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1;Much neater indeed. Elegant, even.
Which means you can get by with 2 queries: $query = "SELECT presenter FROM presenters ORDER BY date DESC LIMIT 1"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $presenter = $row['presenter']; You can now use $presenter in your last query All code untested, handle with care.Code successfully incorporated and working as intended. Thanks for the help. Jim MacCormaic Dublin, Ireland iChat/AIM : curlytool@mac.com