Jump to content


Photo

mysql_query problem...


  • Please log in to reply
3 replies to this topic

#1 Chevy

Chevy
  • Members
  • PipPipPip
  • Advanced Member
  • 163 posts

Posted 09 October 2006 - 02:55 PM

Well I am making a friends system and I am stuck....

$fre = mysql_query("SELECT * FROM friends WHERE username_to='$player' || username_from='$player' && accepted='Yes'");

and it doesn't work properly, any info?

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 October 2006 - 03:12 PM

try this ok.
$fre = mysql_query("SELECT * FROM `friends` WHERE (`username_to`='$player') or (`username_from`='$player') and `accepted`='Yes'";

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 09 October 2006 - 03:13 PM

Use this:

$fre = mysql_query("SELECT * FROM friends WHERE (username_to = '$player' OR username_from = '$player') AND accepted='Yes'");

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 Chevy

Chevy
  • Members
  • PipPipPip
  • Advanced Member
  • 163 posts

Posted 09 October 2006 - 03:31 PM

Thank you it work excellent now




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users