Reginald, On first glance, the problem's in your second query: you can't call echo inside a string like that.
You can instead use the string concatenation operator: "SELECT * FROM `users` WHERE $u == '" . $r[2] . "'" Or curly braces: "SELECT * FROM `users` WHERE $u == '{$r[2]}'" http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex For future reference, development-related questions are more appropriate for this [EMAIL PROTECTED] list instead of the main one. Matthew On Wed, 2002-07-10 at 18:51, Reginald Tchume wrote: > 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 > > _______________________________________________ > TriLUG mailing list > http://www.trilug.org/mailman/listinfo/trilug > TriLUG Organizational FAQ: > http://www.trilug.org/~lovelace/faq/TriLUG-faq.html > > _______________________________________________ Dev mailing list [EMAIL PROTECTED] http://www.trilug.org/mailman/listinfo/dev