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] Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/ 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] Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/#findComment-103873 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! Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/#findComment-103875 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. Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/#findComment-103883 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! Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/#findComment-103922 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 , Link to comment https://forums.phpfreaks.com/topic/23002-update-query-appears-fine-but-doesnt-work/#findComment-104054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.