Jump to content

PHP SQL Update question


defroster

Recommended Posts

Hello,

 

I have sat for hours now with this code. It runs without errors but will not update the changes in the database. What am I doing wrong? I am a beginner at this. Thanks a million /df

 

<?php
session_start();
require ("incl/config.php");
require ("incl/functions.php");

//Admin stuff Users.Setting=1 
if($_SESSION['setting'] == 1) {

$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);

$id=$_POST['id'];
$title=$_POST['title'];
$titletext=$_POST['titletext'];	
$url=$_POST['url'];
$dateposted=$_POST['dateposted']; 


// To protect MySQL injection 
$title = stripslashes($title);
$titletext = stripslashes($titletext);
$url = stripslashes($url);
$dateposted = stripslashes($dateposted);
$title = mysql_real_escape_string($title);
$titletext = mysql_real_escape_string($titletext);
$url = mysql_real_escape_string($url);
$dateposted = mysql_real_escape_string($dateposted);

mysql_query("UPDATE Videos SET title='$title', titletext='$titletext', url='$url', dateposted='$dateposted'
WHERE id='$id'"); 

echo mysql_error();


}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/208798-php-sql-update-question/
Share on other sites

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.