xoninha Posted August 30, 2007 Share Posted August 30, 2007 Hi there! This file takes a request, requests the row in the table, decodes the data, and presents itself as an image. I am trying do connect da DB again...but, i tried and tried and I cant do it! So...see if you can help me please... the same mysql_connect was used for the first time(in another file) with no problems, then I tried to use it a second time in this file: <? $db = @mysql_connect("localhost", "username", "password", true); if (!$db) { echo( "connection to database server failed!" ); exit(); } if (! @mysql_select_db("base64imgdb") ) { echo( "Image Database Not Available!" ); exit(); } $img = $_REQUEST["img"]; $result = @mysql_query("SELECT * FROM images WHERE imgid=" . $img . ""); if (!$result) { echo("Error performing query: " . mysql_error() . ""); exit(); } while ( $row = mysql_fetch_array($result) ) { $imgid = $row["imgid"]; $encodeddata = $row["sixfourdata"]; } echo base64_decode($encodeddata); ?> The error that occurs is: 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. Thx Link to comment https://forums.phpfreaks.com/topic/67282-having-problem-with-using-same-mysql_connection-twice/ Share on other sites More sharing options...
trq Posted August 30, 2007 Share Posted August 30, 2007 Looks like $img is empty. Link to comment https://forums.phpfreaks.com/topic/67282-having-problem-with-using-same-mysql_connection-twice/#findComment-337552 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.