Jump to content

Having problem with using same mysql_connection twice


xoninha

Recommended Posts

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.