Re: Plz help w/ query
| From: | David Robley | Date: | Thu, 31 Jan 2002 22:30:00 +0000 |
| Subject: | Re: Plz help w/ query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83012@lists.php.net to get a copy of this message | ||
In article <4.3.2.7.2.20020131082019.00ae89b0@mailbox.bellatlantic.net>,
sbwi@bellatlantic.net says...
> The following query displays 0 e-mails. Why?
>
> Tbl con_inf holds 51 records w/ 51 usernames. Tbl scr_149 holds 37
> records with 37 equivalent usernames of which 14 show date_done=0.
>
> <?php
>
> $connection=mysql_connect("localhost","wagner","xxx") or die
> ("No
> connection!");
>
> $db=mysql_select_db("sbwresearch",$connection) or die ("No database!");
>
> $qry_1="select con_inf.e_mail from con_inf, scr_149 where
> scr_149.date_done=\"0\" AND con_inf.username=scr_149.username";
This looks suspicious. What type of field is date_done? If it is integer,
the value you are testing for should not be in quotes. If it is char, it
should be in single quotes. Same for username.
>
> $result_1=mysql_query($qry_1,$connection) or die ("No query # 1!");
If you still have problems, try adding before while:
if(mysql_errno()) {
echo 'Error: ' . mysql_error() . '<BR>';
}
> while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
> {
> $e_mail=$row_1["e_mail"];
> echo "$e_mail\n";
> };
>
> mysql_free_result($result_1);
> mysql_close($connection);
> exit;
> ?>
>
> Thanks!
>
> Anthony F. Rodriguez
> (afrodriguez@att.net)
>
>
--
David Robley
Temporary Kiwi!