hey guys, so im trying to update but its not working when update button is clicked the page just refreshes. im new to pdo so maybe my codes wrong somewhere?
Does it try to run the query? How far through the code does it get? I’d have a look at bindParam() for adding values into prepared queries in PDO as well.
If an error occured in your query, the method “execute()” will return false as stated in the manual: http://www.php.net/manual/en/pdostatement.execute.php (Returns TRUE on success or FALSE on failure. ) So, if it’s the case, it won’t redirect and probably do nothing since you don’t check for the FALSE value.
A warning: If you plan on putting that code live, you should read on prepared statements with PDO, because you are open to SQL injections right now. With prepared statements, your query should look like:
"UPDATE event SET event_name = ?, start_date = ?, end_date = ?, etc…
And then you bind the parameters afterward, that will prevent SQL injections. Do a search on Google for “PDO prepared statements example” and you should find something.