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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.