SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: mysql syntax error
-
Apr 24, 2006, 14:10 #1
- Join Date
- Apr 2006
- Posts
- 56
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
mysql syntax error
ice created an update script to allow the admin section on my site to update the product information, but im geting an error message as follows: ive included hopefully enough information, for some one to help obtain a solution to this problem. thanks in advance for ne help
PHP Code:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'actors = 'Daniel Radcliffe ; Emma Watson ; Rupert Grint ; Jason
PHP Code:if (isset($_POST['submit']) && $_POST['submit'] == "adjust") {
$query_update = "UPDATE user SET
product_name = '" . $_POST['product_name'] . "',
product_desc = '" . $_POST['product_desc'] . "',
product_price = '" . $_POST['product_price'] . "',
catid = '" . $_POST['catid'] . "',
quantity = '" . $_POST['quantity'] . "',
director = '" . $_POST['director'] . "'
actors = '" . $_POST['actors'] . "'
certificate = '" . $_POST['certificate'] . "'
WHERE productid = '" . $_POST['productid'] ."'";
echo "<br>";
echo $query_update;
echo "<br>";
echo "<br>";
$result_update = mysql_query($query_update)
or die(mysql_error());
PHP Code:UPDATE user SET product_name = 'Harry Potter And The Goblet Of Fire', product_desc = 'Harry longs to get back inside the safe walls of Hogwarts School of Witchcraft and Wizardry, where Professor Dumbledore (Michael Gambon) can protect him. But things are going to be a little different this year. Dumbledore announces that Hogwarts will host the Triwizard Tournament, one of the most exciting and dangerous of the wizarding community\'s magical competitions. One champion will be selected from each of the three largest and most prestigious wizarding schools to compete in a series of life-threatening tasks in pursuit of winning the coveted Triwizard Cup...', product_price = '14.99', catid = '1', quantity = '5', director = 'Mike Newell' actors = 'Daniel Radcliffe ; Emma Watson ; Rupert Grint ; Jason Isaacs ; Eric Sykes ; Timothy Spall ; David Tennant ; Mark Williams ; Robbie Coltrane ; Roger Lloyd-Pack ; Katie Leung ; Michael Gambon ; Maggie Smith ; Brendan Gleeson ; Gary Oldman ; Ralph Fiennes' certificate = '12+' WHERE productid = '1'
-
Apr 24, 2006, 14:12 #2
Dunno why your code is so bunched up but you missed a comma..
director = 'Mike Newell' actors =
should be
director = 'Mike Newell', actors =
PHP Code:
<?
UPDATE user SET product_name = 'Harry Potter And The Goblet Of Fire', product_desc = 'Harry longs to get back inside the safe walls...', product_price = '14.99', catid = '1', quantity = '5', director = 'Mike Newell', actors = 'Daniel Radcliffe ...', certificate = '12+' WHERE productid = '1'
?>
soo..that tells me the input ain't right
-
Apr 24, 2006, 14:12 #3
- Join Date
- Oct 2004
- Location
- Washington DC
- Posts
- 415
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:director = '" . $_POST['director'] . "'
actors = '" . $_POST['actors'] . "'
certificate = '" . $_POST['certificate'] . "'
PHP Code:director = '" . $_POST['director'] . "',
actors = '" . $_POST['actors'] . "',
certificate = '" . $_POST['certificate'] . "' ,
For the phrase "Bethesda home architect", my clients
websites occupy 6 of the first 8 results
on the 1st page of Google. My Secret SEO Strategy Revealed
-
Apr 24, 2006, 14:16 #4
- Join Date
- Apr 2006
- Posts
- 56
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok, cheers that sorted one prob out, but i then get the follwing error
Unknown column 'productid' in 'where clause'
-
Apr 24, 2006, 14:17 #5
post your code in the new form, and try to space it out a little more?
-
Apr 24, 2006, 14:18 #6
- Join Date
- Apr 2006
- Posts
- 56
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
its ok, i just spotted the mistake, it was in my table name. thanks once again
-
Apr 24, 2006, 14:19 #7
^_^ glad ya got it working. always (usually) something simple
Bookmarks