473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL

hi everybody!

i have one error in sql like this. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
and i could not fine the problem there was answer but not helpfull

here is the code

Expand|Select|Wrap|Line Numbers
  1. > <?php // put the action here ?> <form
  2. > action="http://onevatan.net/?page_id=15" method="post"> <p>Please
  3. > Enter Your ID: <input name="frm" type="text" />   <input
  4. > name="searchbtn" type="submit" value="Search"  /></p>
  5. > </form>
  6. > <?php     $frm= $_POST['frm'];     $result = mysql_query("SELECT * FROM
  7. > wp_participants_database WHERE sid = $frm");     if(!$result){
  8. >         die(mysql_error());     } echo "<table border='1'> <tr> <th>photo</th>
  9. > <th>Student ID</th> <th>First Name</th> <th>Father Name</th>
  10. > <th>address</th> <th>Class</th> </tr>";
  11. > while($row = mysql_fetch_array($result))   {   echo "<tr>";   echo
  12. > "<td>" . $row['photo'] . "</td>";   echo "<td>" . $row['sid'] .
  13. > "</td>";   echo "<td>" . $row['first_name'] . "</td>";   echo "<td>" .
  14. > $row['last_name'] . "</td>";   echo "<td>" . $row['address'] .
  15. > "</td>";   echo "<td>" . $row['class'] . "</td>";   echo "</tr>";   }
  16. > echo "</table>"; ?> </body> </html>
  17. > <?php //close mysql_close(); ?>
thanks
Apr 2 '13 #1
2 1691
Rabbit
12,516 Expert Mod 8TB
You should double check your query string and see if it's returning the SQL you want. And if it is, see if it runs in MySQL without going through PHP.
Apr 2 '13 #2
Dormilich
8,658 Expert Mod 8TB
I stab a guess at missing quotes.
Apr 3 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayne | last post by:
Hi, Can someone possibly assist me in finding the error in the following: echo "<p><strong>".($i+1).". Login: "; I get the following error returned when doing a syntax check PHP Parse...
1
by: beary | last post by:
Could someone please tell me what's wrong with the code below. It worked fine the first time, then I cleared the table (results) and tried it again, but got the message "You have an error in your SQL...
8
mmarif4u
by: mmarif4u | last post by:
Hi everybody... I want to enter values to db like the following,,, Format is like this (810605-14-6356) This is the rite format, No a to z letters... 6 digits then - then 2 digits then - then 4...
6
by: markodilore | last post by:
Hey Guys, you helped me once when I tryied to create a database : "Access denied for user ''@'localhost' ". On my Mac OS 10.4, I had no problem creating database and modifying it from the terminal....
10
by: bobf | last post by:
I am using a program 'My Contact Table' which is a code generator program. It allows you to easily create a PHP/MySQL web application without writing any code. I am trying to create an additional...
4
by: FM | last post by:
Hi there: My question is about checking my sql-syntax against DB2UDB V9 throug JDBC 2.0 Is there a way to check my syntax,for example "select * from T1"? Thank you for your help. Regards,
6
by: zmee | last post by:
Hi, I'm doing a little game in OpenGL for college and I've got these 3 classes in C++: WarBalls - represents the Game's Application. It is supposed to be a singleton and holds all the Game's...
1
by: dreamy | last post by:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sum( ) VALUES ()' at line 1 This is my code <?php //make...
9
by: icemaster451 | last post by:
Hello im making a browser game and have 99% working but iv got one error i cant find / fix and would like to know if anyone can help me where im going wrong heres the error QUERY ERROR: You have an...
3
by: qdoet | last post by:
I'm newbie and I had a problem on my SQL syntax like this You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.