Skip navigation links

MySQL Forums :: PHP :: Trouble with updating Mysql table data


Advanced Search

Re: Trouble with updating Mysql table data
Posted by: Rick James ()
Date: March 26, 2012 10:58PM

> $sql = "UPDATE library SET title = '".$_POST['Title']."', author = '".$_POST['Author']."', status = '".$_POST['Status']."' WHERE id = $Id ";

Then you are begging for "SQL Injection"!

So, you really should first escape each field:

$etitle = mysql_real_escape_string($_POST['Title']);
$eauthor = ...
Then you can interpolate:
$sql = "UPDATE library SET title = '$etitle', ... ";

Options: ReplyQuote


Subject Written By Posted
Trouble with updating Mysql table data Oliver Snyder 03/21/2012 01:15PM
Re: Trouble with updating Mysql table data Peter Brawley 03/21/2012 01:25PM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 07:56AM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 08:34AM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 10:49AM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 11:14AM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 11:20AM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 11:29AM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 11:49AM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 11:55AM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 02:44PM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 02:55PM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 04:28PM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 05:59PM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 07:17PM
Re: Trouble with updating Mysql table data Lanze Langill 03/22/2012 07:56PM
Re: Trouble with updating Mysql table data Oliver Snyder 03/22/2012 09:03PM
Re: Trouble with updating Mysql table data Barry Galbraith 03/22/2012 09:46PM
Re: Trouble with updating Mysql table data Oliver Snyder 03/23/2012 04:44AM
Re: Trouble with updating Mysql table data Rick James 03/24/2012 09:53PM
Re: Trouble with updating Mysql table data Barry Galbraith 03/25/2012 04:11AM
Re: Trouble with updating Mysql table data Rick James 03/26/2012 10:58PM
Re: Trouble with updating Mysql table data Barry Galbraith 03/27/2012 04:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.