Jump to content

[SOLVED] Help please!


g3mma111

Recommended Posts

Hi. Im fairly new to PHP and cant work out how to do this code properly:

 


if (mysql_num_rows($result) > 0 ) {

or ('$username' = '$ses_username') 

echo ''

  
}
else {



 

i want to make it so that if there are more than 0 results or the session username = the username then it doesnt say anything.

 

I get the error that there should be no 'or' but im not sure how to do it without the or!?

Link to comment
Share on other sites

if(mysql_num_rows($result) > 0 or $username == $ses_username) {

 

With OR it will return true only if one or both statements are true. With AND boths statements must be true to return true. Use '==' (identical operators) when comparing, cos with '=' u are assignin values. Also im assuming u have a code like this for the session part:

 

session_start();
$ses_username = $_SESSION['user'];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.