Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any1 see probs with this?

Status
Not open for further replies.

boab

Programmer
May 30, 2001
75
GB
Hi folks any1 see a problem with this sql?

$query = "update products
set productId='$productId',
name = '$name',
avail = '1',
catid = '$catid',
price = '$price',
lng_desc = '$lng_desc'
where productId = '$oldproductId'";
 

What client and RDMS are you using? What are the problems? No rows updated? Too many rows updated? Wrong data inserted in the table? Error message from the client or from the RDMS?

At first glance, it would appear that you are trying to query the database using a SQL string generated in the client. The SQL string is stored into a variable and is created using other variables. However, the the other variables are not being interpreted by the client software. You are actually creating the SQL string using the names of the additional variables.

Try printing the SQL statement before executing it. Make sure it has the proper syntax and content. I would guess that you need to create the SQL statement with code similar to the following.
[tt]
$query = "update products
set productId='" & $productId & "',
name = '" & $name & "',
avail = '1',
catid = '" & $catid & "',
price = '" & $price & "',
lng_desc = '" & $lng_desc & "'
where productId = '" & $oldproductId';"[/tt] Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top