Jump to content

Update query appears fine but doesn't work


Mutley

Recommended Posts

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]
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!

Archived

This topic is now archived and is closed to further replies.

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