Paldo Posted June 9, 2009 Share Posted June 9, 2009 Hi guys! Somebody please have a look at this. It was working once two weaks ago and now evening before I need it, it's printing an error. It says : 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 2 Well I don't know what it mean with the 2 line couse it's pretty far from any SQL code... Thanks for any help <html> <body> <div style='position:absolute;left:10%; right:10%; top:0%; z-index: 0'> <img src='backround.jpg' width="800" height="800"> <div style="position: absolute; left: 1px; top: 1px"> <img src='banner.png'> </div> <?php $balance = $_GET['t']; echo $balance; $accountID = $_GET['c']; echo $accountID; echo $_POST[prevod]; echo'<a href="http://parobek.euweb.cz/welcome.php? c='.$accountID.'">Navrat</a>'; $con = mysql_connect("mysql.webzdarma.cz","parobek","adnddnd"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("parobek", $con); if ( $balance > $_POST[prevod] ) { mysql_query("UPDATE Zakaznici SET stav= stav + $_POST[prevod] WHERE cisuctu= $_POST[cisuctu] ") or die(mysql_error()) ; mysql_query("UPDATE Zakaznici SET stav= stav - $_POST[prevod] WHERE cisuctu= $accountID ") or die(mysql_error()) ; mysql_close($con); } else { echo '<div style="position: absolute; left: 210px; top: 420px">'; echo "Tolko nemas na ucte"; echo '</div>'; echo '<div style="position: absolute; left: 210px; top: 460px">'; echo'<a href="http://parobek.euweb.cz/transfer.php?t='.$balance.' & c='.$accountID.'"><img border="0" img src="spat.png"></a>'; echo '</div>'; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/161590-solved-sql-update-problem-please-help/ Share on other sites More sharing options...
dawsba Posted June 9, 2009 Share Posted June 9, 2009 <html> <body> <div style='position:absolute;left:10%; right:10%; top:0%; z-index: 0'> <img src='backround.jpg' width="800" height="800"> <div style="position: absolute; left: 1px; top: 1px"> <img src='banner.png'> </div> <?php $balance = $_GET['t']; echo $balance; $accountID = $_GET['c']; echo $accountID; echo $_POST[prevod]; echo'<a href="http://parobek.euweb.cz/welcome.php? c='.$accountID.'">Navrat</a>'; $con = mysql_connect("mysql.webzdarma.cz","parobek","adnddnd"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("parobek", $con); if ( $balance > $_POST[prevod] ) { mysql_query("UPDATE `Zakaznici` SET `stav`= 'stav' + '$_POST[prevod]' WHERE `cisuctu` = '$_POST[cisuctu]' ") or die(mysql_error()) ; mysql_query("UPDATE `Zakaznici` SET `stav`= 'stav' - '$_POST[prevod]' WHERE `cisuctu`= '$accountID' ") or die(mysql_error()) ; mysql_close($con); } else { echo '<div style="position: absolute; left: 210px; top: 420px">'; echo "Tolko nemas na ucte"; echo '</div>'; echo '<div style="position: absolute; left: 210px; top: 460px">'; echo'<a href="http://parobek.euweb.cz/transfer.php?t='.$balance.' & c='.$accountID.'"><img border="0" img src="spat.png"></a>'; echo '</div>'; } ?> </body> </html> i've added `` and '' to your query , any difference?? Link to comment https://forums.phpfreaks.com/topic/161590-solved-sql-update-problem-please-help/#findComment-852698 Share on other sites More sharing options...
Paldo Posted June 9, 2009 Author Share Posted June 9, 2009 I found it thanks Link to comment https://forums.phpfreaks.com/topic/161590-solved-sql-update-problem-please-help/#findComment-852726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.