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]
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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