Re: mysql if statement to php
| From: | David Robley | Date: | Mon, 14 Apr 2003 07:38:44 +0000 |
| Subject: | Re: mysql if statement to php | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27074@lists.php.net to get a copy of this message | ||
In article <20030414012904.11497.qmail@web41212.mail.yahoo.com>,
jusa_98@yahoo.com says...
> Hi,
>
> I am using a php page to grab information using the if
> statement. Now the mysql query works fine but I can't
> get the output to output into php. I have tried many
> things and have failed to get it to display.
>
> This is the code:
>
> <?php
> mysql_connect ("localhost", "$usr", "$pass") or die
> ('I cannot connect to the database.');
> mysql_select_db ("$db");
>
> $qr = mysql_query("SELECT IF( emailerror = ('y' ),
> 'error yes', 'do nothing' ) FROM tipping WHERE sid =
> '$sid'");
>
> ?>
>
> If I do the above query in mysql it returns correctly.
> If Y is in the table it dispalys error yes. But how
> do I get it to output to a php page with the above
> function?
>
> Thanks!
>
> http://mobile.yahoo.com.au - Yahoo! Mobile
> - Check & compose your email via SMS on your Telstra or Vodafone mobile.
>
If you take a look at http://au.php.net/mysql_fetch_array you'll find
a
few examples of how to get query results and display them; you may find
echo easier than the printf used in the examples.
--
Quod subigo farinam
$email =~ s/oz$/au/o;