| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2008
Posts: 13
|
Update database with PHP
Alright, I've got a problem with the php in relation to updating a mysql database. I've created a dropdown menu which is formed using the rows from the database to select a product to update. That part of the site works fine but when it loads the web page with the form to update that products details I get the following error including printing post: Last edited by Witchfinder : 17-02-2008 at 10:21. |
|
|
|
|
|
#2 (permalink) |
|
Grumpy old man
Join Date: Oct 2007
Location: North Japan
Posts: 1,672
|
A quick glance at the errors would suggest the following: It's saying that $_POST['cycleID'] doesn't exist - you need to check the code on the previous page - it's probably because your <select> is called 'edit' for some reason and not 'cycleID'. However, PHP is very forgiving, so this is just a notice, not a fatal error, and the code continues to execute. Presumably when it gets to the SELECT statement, SELECT * FROM cycles WHERE cycleID = $cycleID <-missing $cycleID has no value and so the SQL is invalid because one of the parameters is missing. Bear in mind your code is horribly insecure at the moment - be absolutely sure you nail down the referrer, or use prepared statements and mysqli otherwise you're a sitting duck for SQL Injection attacks. |
|
![]() |