Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/87561-image-databasing/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447836
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/87561-image-databasing/#findComment-447853
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.