Skip navigation links

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


Advanced Search

Trouble with updating Mysql table data
Posted by: Oliver Snyder ()
Date: March 21, 2012 01:15PM

Any help will really make my day

<!-- form to get key detail of record in database -->
<form name="form" method="POST" action="library_search.php">
Puplication ID number <input type="text" name="search"> <br><br>
<input type="submit" value="submit">
</form>

I have no problem passing the variable from above to the search file below.

$search=$_POST['search'];

$data = 'SELECT * FROM `library` WHERE `index` = "'.$search.'"';
$query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());
$data2 = mysql_fetch_array($query);

But I keep getting this error

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/mdwvo/public_html/aabees.org/library_results.php on line 12

when trying to pass it to the results file below which should update the table.

$Index=$_POST['indexfield'];
$Title=$_POST['titlefield'];
$Arthor=$_POST['authorfield'];


$data = "UPDATE `library` SET title='$Title', author='$Author', WHERE "'.$search.'"';
$query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());

I never get the die message.

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.