Link to home
Create AccountLog in
Avatar of TLN_CANADA
TLN_CANADAFlag for Afghanistan

asked on

Displaying elements on page based on MYSQL query result

Hi everyone,

I would like to display some text on a page if a query meets the following requirements but am not quite sure the best way to go about it.

If both user's ids (senderid and recieverid) have a value of 1 in a table I would like it to display a menu on a page.

Here is the sql where I can check the table and this part works correctly:

$query = mysql_query("SELECT vdyad_showexercises FROM phpfox_user WHERE user_id = '$recieverid' ");
      $row = mysql_fetch_array($query) ;


$query2 = mysql_query("SELECT vdyad_showexercises FROM phpfox_user WHERE user_id = '$senderid' ");
      $row2 = mysql_fetch_array($query2) ;
      


So I'm wondering would this be the best way to do it? :

If $row2['vdyad_showexercises'] = 1 && $row2['vdyad_showexercises'] = 1 { menu...}

If someone could assist me with the syntax that would be great.

Thanks,

D
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account