bleured27 Posted February 17, 2013 Share Posted February 17, 2013 (edited) 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 February 17, 2013 by bleured27 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 17, 2013 Share Posted February 17, 2013 (edited) Do you have something similar in your connection.php file: $conn = mysql_connect('localhost','jazzman','password', 3306); or die(mysql_error()); Edited February 17, 2013 by jazzman1 Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 yes i have <?php $con = mysql_connect("localhost","*****","*****"); mysql_select_db("game", $con); $table="accaunts"; $table_kingdom="members"; $table_messages="messages"; ?> Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 17, 2013 Share Posted February 17, 2013 No, you don't have it. I don't see "or" operator in your string. Do you have a "OR" operator somewhere in the connection.php file? Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 no that was where i stucked to i dont have anything like OR those are the full documents u see there Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 17, 2013 Share Posted February 17, 2013 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";} */ ?> Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 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";} ?> Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 (edited) 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 February 17, 2013 by bleured27 Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 how every when i put (mysql_error()); on again the same error comes Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 Stop putting the ; before the or. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 17, 2013 Share Posted February 17, 2013 (edited) By the way, read is a reserved word in mysql, you must use backticks. Edited February 17, 2013 by jazzman1 Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 By the way someone who can't resolve a simple syntax error is not a pro in php. I'm also not confident you know the difference between Java and Javascript. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 17, 2013 Share Posted February 17, 2013 But.... how is possible to get "Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)" without an "OR" operator in the connection.php file? Jessi, what do you think about that? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 I think OP isn't posting his entire code, just random bits of it, because he doesn't even know what it all does. Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 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 Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 !btw i know what it does i just include this in to my whole code when im finisched! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 That code could not produce that error. If you look at the error it will tell you the file and the line number. Quote Link to comment Share on other sites More sharing options...
salathe Posted February 17, 2013 Share Posted February 17, 2013 (edited) 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 February 17, 2013 by salathe Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 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 Quote Link to comment Share on other sites More sharing options...
bleured27 Posted February 17, 2013 Author Share Posted February 17, 2013 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 Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 17, 2013 Share Posted February 17, 2013 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. Quote Link to comment Share on other sites More sharing options...
salathe Posted February 18, 2013 Share Posted February 18, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.