fm1 Posted January 24, 2008 Share Posted January 24, 2008 heres my code <? $dbcnx = mysql_connect("localhost", "fawaaz", "honda"); mysql_select_db("base64imgdb"); $img = $_REQUEST["img"]; $result = mysql_query("SELECT * FROM images WHERE imgid=" . $img . ""); if (!$result) { echo("<b>Error performing query: " . mysql_error() . "</b>"); exit(); } while ($row = mysql_fetch_array($result) ) { $imgid = $row["imgid"]; $encodeddata = $row["sixfourdata"]; } mysql_close($dbcnx); echo base64_decode($encodeddata); ?> and my error Error performing query: 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 is this a general error, or what am i doing wrong here Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/ Share on other sites More sharing options...
The Little Guy Posted January 24, 2008 Share Posted January 24, 2008 echo out $img right before $result... I am assuming you have nothing in $img. Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447831 Share on other sites More sharing options...
fm1 Posted January 24, 2008 Author Share Posted January 24, 2008 echo out $img right before $result... I am assuming you have nothing in $img. actually i do, when i view my "view.php" file with code <html> <body> .. <img src="image.php?img=1" border="0" alt="" /> .. </body> </html> i see the pic, but when i open the image.php script in browser i get that error,dont know why Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447836 Share on other sites More sharing options...
The Little Guy Posted January 24, 2008 Share Posted January 24, 2008 Try this then: $result = mysql_query("SELECT * FROM images WHERE imgid=" . addslashes($img) . ""); Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447840 Share on other sites More sharing options...
fm1 Posted January 24, 2008 Author Share Posted January 24, 2008 Try this then: $result = mysql_query("SELECT * FROM images WHERE imgid=" . addslashes($img) . ""); same result, please correct me, but doesnt the image.php file work as a css file, because i can see the image, if i view it in view.php another Q. how do I view the data inside my tables in my database, the image gets written to the database if im not mitake, whats the syntax to see if it was loaded in the database. if you dont cum rite,thanks anyway for helping Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447853 Share on other sites More sharing options...
The Little Guy Posted January 24, 2008 Share Posted January 24, 2008 Or this: $result = mysql_query("SELECT * FROM images WHERE imgid=" . addslashes($img)); A: are you using command line or PHP MyAdmin? Quote Link to comment https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447856 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.