Forum Moderators: coopster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><?php
include('db.php'); //file containing user and pass
?>
<?
if (isset($_POST['submit']))
{
mysql_select_db("tehhaxtest",$db);
$sql = 'UPDATE `links` SET `url` = \'$urlc\',`target` = \'$target\',`description` = \'$desc\',`cssclass` = \'$cssc\' WHERE `id` = \'$idc\' LIMIT 1 ;';
// the problem is in the previous statement, it is entering the unparsed variable $urlc into the database rather than what the user enters in the form for $urlc, all the other variables do the same
$result = mysql_query($sql);
echo "Thank you! Information updated. <a href=\"change.php\">other</a>";
}
else
{
?>
[edited by: jatar_k at 12:54 am (utc) on Sep. 10, 2003]
[edit reason] snipped extra code [/edit]
replace the single quotes around the string with double quotes, you also don't need the extra semi colon in there.
$sql = "UPDATE `links` SET `url` = \'$urlc\',`target` = \'$target\',`description` = \'$desc\',`cssclass` = \'$cssc\' WHERE `id` = \'$idc\' LIMIT 1";
php won't parse anything enclosed in single quotes like that ;)
$sql = "UPDATE `links` SET `url` = \"$urlc\",`target` = \"$target\",`description` = \"$desc\",`cssclass` = \"$cssc\" WHERE `id` = \"$idc\" LIMIT 1";
hope that helps someone else if they ever have this problem.