Jump to content

Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)


bleured27

Recommended Posts

hy there im so ashamed to ask this.What does this mean

Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)

i don't know i never seen it before in all my php codes well here's the full code

<?php    
require('connection.php');
   $result = mysql_query("SELECT * FROM $table_messages where reciver='$user' and read !='1'", $con);
           $num_rows = mysql_num_rows($result);
               if($num_rows =0    ){echo " no messages";}else{ echo $num_rows." messages";}

?>

 

you know i checked all the names in db and other places and they are all correct!

 

please help

Edited by bleured27
Link to comment
Share on other sites

That one is not correct:

 

$num_rows =0

 

Use double equal to compare to values.

 

If you comment the code do you get the same error?

 

Example:

<?php  
require('connection.php');
/**
    $result = mysql_query("SELECT * FROM $table_messages where reciver='$user' and read !='1'", $con);
				    $num_rows = mysql_num_rows($result);
						    if($num_rows =0 ){echo " no messages";}else{ echo $num_rows." messages";}
*/

?>

Link to comment
Share on other sites

same error whith this

 

<?php
require('connection.php');
$user=1;
$result = mysql_query("SELECT * FROM $table_messages where reciver='$user' and read !='1'", $con);or die(mysql_error());
  $num_rows = mysql_num_rows($result);
   if($num_rows ="0" ){echo " no messages";}else{ echo $num_rows." messages";}

?>

Link to comment
Share on other sites

hy i found something

it is working whith other variables or get away a bit it works when i do

$result = mysql_query("SELECT * FROM $table_messages where reciver='$user'", $con);
//i rechecked the variables in my db and they are right i don't understand why this cant

the error must be in

'$user' and read !='1'", $con);or die(mysql_error());

Edited by bleured27
Link to comment
Share on other sites

i was just eating but this is the entire code

 

 

 

CTRL + Q to Enable/Disable GoPhoto.it

i was just eating and i will ignore your nonsens

stilll this is the entire code . for you to post again

<?php
require('connection.php');
$user=1;
$result = mysql_query("SELECT * FROM $table_messages where reciver='$user'", $con);
  $num_rows = mysql_num_rows($result);
   if($num_rows ="0" ){echo " no messages";}else{ echo $num_rows." messages";}

?>

 

<?php  $con = mysql_connect("localhost","sh","onyou");
  mysql_select_db("game", $con);
  $table="accaunts";
  $table_kingdom="members";
  $table_messages="messages";
  ?>

if you can't solve this problem il go read some more books and hey
don't be to hard for me im just an starting programmer who isn't even an adult so keep your smartass notices in front of you

Link to comment
Share on other sites

i was just eating but this is the entire code

 

That code will not give the error you are quoting. Please make sure that A) the error still appears, and B) you show us the actual code.  It would be most helpful to be shown the full error text (and all errors, if there are more than one), and the full content of the file(s) containing the error(s).

 

P.S. Jessica simply found it amusing that it you claim to be "pro" at PHP, at least given the list of proficiencies in your signature. At least, a list like that is commonly used to show the author's current level of knowledge in those areas. If your signature is not such a list then please forgive any comments made. If it is such a list, perhaps it needs some amendment.

Edited by salathe
Link to comment
Share on other sites

ow jhea thank you jazz i didn't knew it was pre determent in mysql when i did that it worked fine it only is still a bid starnge that it gives an OR error and you jessica tnx for being so enoying it helped me not at all why do you even post here when you have nothing to bring in>??

btw do you know the meaning of newb. Lulz

Link to comment
Share on other sites

Then don't call yourself a pro.

 

Being 16 is not an excuse to be a whiny baby. You're well old enough to:

A. Use correct grammar and spelling in your posts

B. Take responsibility for your own education. Especially if you've been programming various languages for 4 years. When you learn something new, don't whine about how you didn't know it before. 

C. Read the rules and guidelines of this forum and follow them.

Link to comment
Share on other sites

salathe im just 16 years old and programming for 4 years you can't expect me to know evry liddle thing the most people learn while they r studying

 

I can't particularly care either way whether you're really "pro" or don't have the first clue about the subject, or wherever you lie on that scale.  I only aim to point out that it's silly getting upset when someone calls you out on claiming to be "pro" when you're very clearly not anywhere near close.  Hardly anyone here knows every little thing about PHP, and I doubt anyone knows every little thing about programming in general. Everyone here is learning, every day.

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.