Re: PHP/MYSQL question please help!
Posted: Sun Mar 07, 2010 8:34 pm
I closed it on the bottom of the script. Am I suppose to close it after the database connection? MYSQL is not suppose to be within the php script?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?
$dbhost = 'localhost';
$dbuser = 'pm0663';
$dbpass = 'say76poj';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'pm0663';
mysql_select_db($dbname);
$id = $_GET['id'];
$name = $_GET['name'];
$desccription = $_GET['description'];
$weight = $_GET['weight'];
$price = $_GET['price'];
$qoh = $_GET['qoh'];
$sql = "UPDATE product SET name='$name',
description='$description',
price='$price',
weight ='$weight',
qoh= '$qoh'
WHERE productnumber='$id'" ;
$result = mysql_query($sql) or die (mysql_error());
header("location:edit.php");
?>
Other than the error ... could you please refresh the exact code that you have and describe again what is happening or not happening now?.... are you getting any error?.... have you tried to echo the variables before your update sentence to see if they have the expected values?....powaytitan wrote:here is my current code it still does not work....
Code: Select all
<? $dbhost = 'localhost'; $dbuser = 'pm0663'; $dbpass = 'say76poj'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'pm0663'; mysql_select_db($dbname); $id = $_GET['id']; $name = $_GET['name']; [color=#FF0000]$desccription[/color] = $_GET['description']; << IN RED... IS NOT EQUAL TO... $weight = $_GET['weight']; $price = $_GET['price']; $qoh = $_GET['qoh']; $sql = "UPDATE product SET name='$name', description=[color=#FF0000]'$description', [/color] >>> IN RED.... TO THIS price='$price', weight ='$weight', qoh= '$qoh' WHERE productnumber='$id'" ; $result = mysql_query($sql) or die (mysql_error()); header("location:edit.php"); ?>