Jump to content


Photo

Help i cant enter data


  • Please log in to reply
2 replies to this topic

#1 biscoe

biscoe
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 October 2006 - 08:55 PM

$database = mysql_connect("localhost", "myusername", "mypassword");
mysql_select_db("mydatabase",$database);

 $sql = sprintf("INSERT INTO users (image_url, image_name, user) VALUES ( '%s','%s','%s')", mysql_real_escape_string($url),mysql_real_escape_string($file_name),mysql_real_escape_string($uname));

  echo $sql;

 mysql_query($sql);

this code is ran whenever a file is uploaded successfully. I know that it is running cause it prints the sql statement correctly and the sql shows up as:


INSERT INTO users (image_url, image_name, user) VALUES ( 'upload_img/asdfsdf.txt','asdfsdf.txt','tyler')


Im not even getting any error messages....

and nothing is in the database

thanks in advance.


__________[br]Tyler Biscoe|____________[br]http://www.tylerbiscoe.com

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 October 2006 - 09:55 PM

Check the return value from mysql_query() and/or mysql_error().
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 biscoe

biscoe
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 October 2006 - 02:41 PM

problem solved........... thanks for the help
__________[br]Tyler Biscoe|____________[br]http://www.tylerbiscoe.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users