|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am using an update query to update records in my mysql database using the values entered into text fields on a form. I have captured the ID of the record, which is passed to my update script, and the update data loads correctly. However, once the update is submitted, the data seems to be sent correctly, but the update makes no changes to the record. I know the database connection works, as I've entered phony values and it errors. However, the mysql_affected_rows function shows that no records were updated. My code is below, starting at the actual update query, as the rest seems fine. Any help would be appreciated.
mysql_connect("host","user","pass"); @mysql_select_db(joke) or die( "Unable to connect database"); $sql= "UPDATE joke SET JokeText='JokeText', SubmittedBy='SubmittedBy', SubmitterMail='SubmitterMail', JokeDate='JokeDate' WHERE ID='ID'"; mysql_query($sql) or die( '<p> Unable to update record: ' . mysql_error() .'</p>'); printf ("Records Updated: %d\n", mysql_affected_rows()); echo "Record Updated"; mysql_close(); ?> |
|
#2
|
|||
|
|||
|
okay so I may be way off, but... are the thigns being passed in actually variables? don't they need to be:
PHP Code:
and so on. am I off here?
__________________
hey it's the CHARKING |
|
#3
|
||||
|
||||
|
Right, and if these strings are just test values but you don't have an id "ID," no update will occur.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Update Query Doesnt Work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|