Jump to content

SQL Unknown column 'title' in 'field list'


iRoot121
Go to solution Solved by jazzman1,

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.

Link to comment
Share on other sites

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));
Link to comment
Share on other sites

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 :).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.