RE: [PHP] PHP/MySQL help?
| From: | Timothy Hitchens \(HiTCHO\) | Date: | Sun, 12 Jan 2003 23:52:39 +0000 |
| Subject: | RE: [PHP] PHP/MySQL help? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131375@lists.php.net to get a copy of this message | ||
You can't use numbers as vars:
$1 etc are illegal syntax for PHP
Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: tim@hitcho.com.au
> -----Original Message-----
> From: Steven M [mailto:steven@tmarwick.fsnet.co.uk]
> Sent: Monday, 13 January 2003 10:04 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] PHP/MySQL help?
>
>
> I thought i read somewhere that you could refer to the field
> by number. Was i wrong? It doesn't seem to make a difference
> anyway. It still doesn't work. Here's the code with words
> instead of numbers. I'd be grateful if you could let me know
> if there are any obvious errors.
>
> Best wishes.
>
> Steven M
>
> include 'db.php';
>
> $result = mysql_query("SELECT newtest FROM users WHERE
> newtest = '$0'");
> list($number) = mysql_fetch_row($result);
>
> if($number==0)
> {mysql_query("UPDATE users SET points = '$+2' WHERE newtest =
> '$0'"); mysql_query("UPDATE users SET newtest = '$1' WHERE
> newtest = '$0'");
> header("Location: redirect1.php");
> }
> elseif($number==1)
> {
> header("Location: redirect2.php");
> }
> else
> {
> header("Location: error.php");
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>