Jump to content

Help with simple insert


Julian

Recommended Posts

Hello!

 

I have this code to upload files, and I want to store the file names into the database, so far I have:

$news  = ($HTTP_GET_VARS['id_noticia']);

foreach ($_FILES as $fieldName => $file) {

move_uploaded_file($file['tmp_name'], "../../images/documentos/" . $file['name']);

mysql_select_db($database_rcpc, $rcpc);

$updateSQL = "INSERT INTO documentos (id_noticia, nombre) VALUES (".$news.",".$file['name'].")";

$update = mysql_query($updateSQL);

}

 

Files upload fine.  Script to connect to db is fine also, but for some reason is not inserting... any hint?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/171343-help-with-simple-insert/
Share on other sites

OK I got some questions,

 

$news was sent via a form right?

 

If so, Maybe trying sending it via $_Post:

$news  = $_POST['id_noticia'];

 

And also,

Try running this:

$updateSQL = "INSERT INTO documentos (id_noticia) VALUES ('Test')";

 

Just to see...

 

 

 

 

 

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.