Mutley Posted October 4, 2006 Share Posted October 4, 2006 The problem I'm having is it isn't updating the database, I echod the SQL and it looks fine, yet it isn't working.Here is the code:[code]<?php$userid = $_GET['user'];$page_id = $_GET['page_id'];require_once("sec_con.php");if(isset($userid)){$title = $_POST['title'];$row['page_id'] = $_POST['page_id'];$row['description'] = $_POST['description'];$row['content'] = $_POST['content'];mysql_select_db("style");$sql = "UPDATE pages SET title='$title', page_id='$page_id', description='$description', content='$content', WHERE user_id = '".$userid."', page_id = '".$page_id."' LIMIT 1";mysql_query($sql);echo $sql; echo "The selected information was updated! "; echo "<a href='secure/style.php?user=$userid'>Click here</a> to continue editing, or <a href='./index.php?user=$userid'>click here</a> to go back to your website.";}?>[/code] Quote Link to comment Share on other sites More sharing options...
Mutley Posted October 4, 2006 Author Share Posted October 4, 2006 I ran the query in phpmyadmin, it said theirs an error in my SQL syntax on/near this line:[code=php:0] WHERE user_id = '".$userid."', page_id = '".$page_id."' LIMIT 1";[/code] Quote Link to comment Share on other sites More sharing options...
printf Posted October 4, 2006 Share Posted October 4, 2006 This line...[code] WHERE user_id = '".$userid."', page_id = '".$page_id."' LIMIT 1";----------------------------------------^[/code]remove the * , *![code] WHERE user_id = '".$userid."' AND page_id = '".$page_id."' LIMIT 1";[/code]me! Quote Link to comment Share on other sites More sharing options...
Mutley Posted October 4, 2006 Author Share Posted October 4, 2006 That hasn't worked, still get same syntax error on same line. Quote Link to comment Share on other sites More sharing options...
printf Posted October 4, 2006 Share Posted October 4, 2006 change the query to this....[code]$sql = "UPDATE pages SET title = '" . $title . "', page_id = '" . $page_id . "', description = '" . $description . "', content = '" . $content . "' WHERE user_id = '" . $userid . "' AND page_id = '" . $page_id . "' LIMIT 1";[/code]me! Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 whouldn't it be where user_id = '$user_id' and ...you need and instead of , Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.