a65 Posted January 10, 2013 Share Posted January 10, 2013 why i am getting the above error.. <?php session_start(); /*this is for making payment by user*/ if(isset($_SESSION['sname']) && isset($_SESSION['spassword']) && isset($_SESSION['saccount_type'])) { mysql_connect("localhost","root",""); mysql_select_db("bank_acount"); $query="select * from account"; $result=mysql_query($query) or die(mysql_error()); $row=mysql_fetch_assoc($result); $num=mysql_num_rows($row); echo($query); ?> Link to comment https://forums.phpfreaks.com/topic/272927-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-1/ Share on other sites More sharing options...
Dharmender Posted January 10, 2013 Share Posted January 10, 2013 Try This <?php session_start(); /*this is for making payment by user*/ if(isset($_SESSION['sname']) && isset($_SESSION['spassword']) && isset($_SESSION['saccount_type'])) { $conn=mysql_connect("localhost","root",""); if(!$conn) { die("Cannot connect:".mysql_error()); } mysql_select_db("bank_acount"); $query="select * from account"; $result=mysql_query($query); if(!$result) { die(mysql_error();} $num=mysql_num_rows($result); echo($num); ?> Echo whatever you want. Link to comment https://forums.phpfreaks.com/topic/272927-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-1/#findComment-1404583 Share on other sites More sharing options...
a65 Posted January 10, 2013 Author Share Posted January 10, 2013 that worked..thanx Link to comment https://forums.phpfreaks.com/topic/272927-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-1/#findComment-1404584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.