Jump to content

SQL Unknown column 'title' in 'field list'


iRoot121

Recommended Posts

Can you post the exact values of your variables in the query?

It's not much :P.

$title = Test2;
$korting = 0;
$volg = 0;
$product = 1;
$visible = 1;
$metadescription = Test2;
$url = test2;
$content = Test2;
$id = 1708;

I've also tried this:

$title = Test3;
$id = 1708;

And with both he's updating now. So I'm going to try it with a select statement.

For sure, you sould have to optimize your database and tables. Watch these 9 vidoes.

 

To escape the character strings, you can try to run this update query instead yours:

$query = sprintf("UPDATE `pagina` SET `title` = '%s', 
                 `korting`='%s', `volg`='%s', 
                 `product` = '%s',`product_id`=%u,
                 `visible` = '%s', `metadescription` = '%s',
                 `url` = '%s', `content` = '%s', `headerpicture`='%s',`picture`='%s', 
                 `form_id` = %u,`related`='%s', `datum` = NOW() WHERE `id`=%u",
 mysql_real_escape_string($title),
 mysql_real_escape_string($korting),
 mysql_real_escape_string($volg),
 mysql_real_escape_string($product),
 intval($product_id),
 mysql_real_escape_string($visible),
 mysql_real_escape_string($metadescription),
 mysql_real_escape_string($url),
 mysql_real_escape_string($content),
 mysql_real_escape_string($headerpicture),
 mysql_real_escape_string($picture),
 intval($form_id),
 mysql_real_escape_string($related_string),
 intval($id));

Thanks, but I found the problem I think..

 

If I place a second connection to the database, above the $query_update script, then it works. (gonna look later why that's needed o.O)

 

Thanks for helping me alot!

 

And jazzman1, I'll watch the videos :).

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.