View Single Post
Old 12-08-2008, 09:23 PM   #1 (permalink)
9three
The Contributor
 
Join Date: Oct 2008
Posts: 75
Thanks: 4
9three is on a distinguished road
Default Updating MySQL Row

I have 5 fields in total that store information into my database. Here is one of them:

PHP Code:
if(!empty($_POST['title']))
{
    
$title mysql_real_escape_string(ucfirst($_POST['title']));
    
$db_title mysql_query("UPDATE mainsettings SET WebsiteTitle='$title' WHERE WebsiteTitle='WebsiteTitle'");    

As you can tell, when the field in my html is filled it is updated in my database.

The problem, if I use:
PHP Code:
"UPDATE mainsettings SET WebsiteTitle='$title' WHERE WebsiteTitle='WebsiteTitle'" 
My information is not updated. But, if I use:
PHP Code:
"UPDATE mainsettings SET WebsiteTitle='$title'" 
It works perfectly. The problem is that it updates all columns, although I only have one table and row to worry about in this part of my script so it doesn't really matter. I'm just trying to figure it out for future purposes.
9three is offline  
Reply With Quote