[TriLUG] Coding to retrieve email from database

Reginald Tchume zregt at hotmail.com
Wed Jul 10 19:51:18 EDT 2002


Would someone be kind to help refine this code for producing required 
results?

I want to retrieve the email from the database of USERS under an IF-ELSE 
condition when member_count<=4.

IF count(members)<=4, I want to retrieve email(r2[4]) of sponsor(r[2]) ELSE 
email(r[4]) of user(r[1]) from the table USERS.  Currently, I'm getting a 
warning of mysql_fetch_row() argument not valid.

Here is the complete code I've been working with:
<?php
     $conn=mysql_connect ("localhost", "UID", "PWD") or die ('Cannot connect 
to the database.');
     mysql_select_db(exec);
     $u = username;
     $r = mysql_fetch_row(mysql_query("SELECT * FROM `users` WHERE 
$u='lennie'"));
     count(members)<=5 ? $r2 = mysql_fetch_row(mysql_query("SELECT * FROM 
`users` WHERE $u == 'echo($r[2])'")) && print $r2[4] : print $r[4];
mysql_close($conn);
?>


THANKS,
reg


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the TriLUG mailing list