Jump to content
Sign in to follow this  
Panta

How Do I Pull Out Pix From Database

Recommended Posts

Please nice friends i have been trying to write a script that will upload pix to database and also pull it out to the browser, But i have been having problem with my code, Plz help me out. This is the code. Thanks

<?php$db = mysql_connect("localhost","Austin","password");mysql_select_db("school");$pname = $_REQUEST['pname'];$pdesc = $_REQUEST['pdesc'];$ftype = $_FILES['pfile']['type'];$fname = $_FILES['pfile']['name'];if ($_FILES['pfile']['size'] <= $_REQUEST['MAX_FILE_SIZE']){$fdata = fread(fopen($_FILES['pfile']['tmp_name'], "rb"),$_FILES['pfile']['size']);$fdata = base64_encode($fdata);$sql = "INSERT INTO pictures “;$sql .= “(poster_name,pdesc,ftype,fname,fdata) VALUES “;$sql .= “(\"${pname}\",\"${pdesc}\",”;$sql .= “\"${ftype}\",\"${fname}\",\"${fdata}\")";$query = mysql_query($sql) or die(mysql_error());echo "File Uploaded!";} elseecho "File Too Large";?>

Share this post


Link to post
Share on other sites
What problems are you having?
THE PROBLEM IS THAT THE SCRIPT IS NOT CORRECT. I DONT KNOW WHERE THE PROBLEM IS FROM, THE MORE I TRIED TO CORRCT IT THE MORE ERROR I SEE

Share this post


Link to post
Share on other sites

Specifically, what errors are you seeing? Are you getting error messages? Is the script doing something that it shouldn't be doing, or does it not do something that it should be doing? What happens when you use it?One thing I notice is that your SQL query contains invalid characters, specifically this character:“That might look like a quote, but it's not, it's some other character that things like MS Word and Wordpress like to use, but PHP doesn't see that as a quote. Make sure that your script only contains actual double quotes, not the stuff from Word or Wordpress. The semicolons look a little strange also, but that might just be the forum. Basically, don't copy and paste code from Wordpress, look at the code and just write it yourself.

Share this post


Link to post
Share on other sites
One thing I notice is that your SQL query contains invalid characters, specifically this character:“thanks so much. this has been the problem. is now working

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...