Jump to content

[SOLVED] SQL syntax update


FaRmBoX

Recommended Posts

I have a piece of code that is just not updating my SQL database. Its giving me a headache. I had success with it before, but not this time.

 

Here is my form tag

<form action="index.php?editsave=true" method="POST" enctype="multipart/form-data">

It also has a file upload, which is the only part that works...

 

Here is the PHP code for receiving the form:

("save_edit" is the name of the submit button)

if ($_POST['save_edit'])
	saveEdit($_POST['id'], $_POST['imagelink'], $_POST['name'], $_POST['price'], $_POST['desc'], $_POST['imagewidth'], $_POST['imageheight']);

 

Which goes to a function called saveEdit:

function saveEdit($id, $imagelink, $name, $price, $desc, $imagewidth, $imageheight) {
$q = 'UPDATE main SET imagelink = "'.$imagelink.'", imagewidth = "'.$imagewidth.'", imageheight = "'.$imageheight.'", name = "'.$name.'", price = "'.$price.'", desc = "'.$desc.'" WHERE id = '.$id.'';
//  Run query
$r = mysql_query($q);

}

 

My problem is that the above code does not update. The connection to the database works. The values from the form are saved to the correct variables. The value of q is in single quotes from my attempt to switch things around in case it worked when the double quotes didnt. Please help.

 

Edit: I forgot to mention I get no errors with

error_reporting(E_ALL);

ini_set('display_errors', '1');.

I find myself looking at a blank page.

Link to comment
https://forums.phpfreaks.com/topic/178080-solved-sql-syntax-update/
Share on other sites

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.