MySQL Forums
Forum List  »  PHP

Problem wit UPDATE query syntax
Posted by: Lubomir Mravec
Date: May 10, 2006 05:01PM

Hai All.
I'am problem with sql UPDATE syntax.

This is select query - is ok.

$menu = $HTTP_GET_VARS["menu"];
$link = mysql_connect('localhost', 'db', 'password')
or die('Could not connect: ' . mysql_error());

mysql_select_db('db') or die('Could not select database: '. mysql_error());

$query_d = 'SELECT obsah FROM ' . mysql_real_escape_string($menu) . ' WHERE id = 1';
$results_d = mysql_query($query_d) or die(mysql_error());
while ($row_d = mysql_fetch_array($results_d))
//echo $row_d["obsah"];
mysql_free_result($results_d);
mysql_Close();
------------------------------------------------------------------------

Problem is UPDATE.
I'am send multiline form.

$clanok = ($_POST['body']);
$menu = $HTTP_GET_VARS["menu"];

$query_d = 'UPDATE obsah SET' . mysql_real_escape_string($menu) . = . $clanok . WHERE id = '1';
$results_d = mysql_query($query_d) or die(mysql_error());

$menu is table name, $clanok is values /send multiline form...
Please help.
Thanks....

Options: ReplyQuote


Subject
Written By
Posted
Problem wit UPDATE query syntax
May 10, 2006 05:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.