Jump to content

Can't Insert Row from PHP


AtomicRax

Recommended Posts

This is about to drive me insane! I've double checked all of my variables, they're all assigned OK and everything (each variable has the correct value)...but for some reason, this code will NOT insert a new row!  :shrug:

 

 

$file1 = "/path/to/picture.jpg";
$file2 = "/path/to/picture.gif";
$file3 = "/path/to/picture.png";
$thumb = "/path/to/tn_picture.jpg";
$date = date('m/d/Y');
$enddate = date('m/d/Y', strtotime("+30 days"));
$uid = $mySite->user['uid'];
$user = $mySite->user['username'];
$time = time();
$category = $_POST[category];
$parish = $_POST[parish];
$title = $_POST[title];
$description = strip_tags($_POST[description]);
$description = substr($description, 0, 2000);

mysql_query("INSERT INTO ads_entries (`adID`, `uid`, `username`, `date`, `timestamp`, `enddate`, `category`, `parish`, `title`, `description`, `pictureA`, `pictureB`, `pictureC`, `tnPicture`) VALUES ('', '$uid', '$user', '$date', '$time', '$enddate', '$category', '$parish', '$title', '$description', '$file1', '$file2', '$file3', '$thumb')");

 

 

Link to comment
https://forums.phpfreaks.com/topic/210024-cant-insert-row-from-php/
Share on other sites

For some reason it needed to be:

 

mysql_query("INSERT INTO ads_entries (`adID`, `uid`, `username`, `date`, `timestamp`, `enddate`, `category`, `parish`, `title`, `description`, `pictureA`, `pictureB`, `pictureC`, `tnPicture`) VALUES (\"\", \"$uid\", \"$user\", \"$date\", \"$time\", \"$enddate\", \"$category\", \"$parish\", \"$title\", \"$description\", \"$file1\", \"$file2\", \"$file3\", \"$thumb\")");

 

Either way, I got it now.

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.