Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2013, 09:16 PM
Authorized User
 
Join Date: Apr 2013
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
Default trying to update

Hello all, I have this one record database file used to hold several last used values, I've confirmed validity of the record. I don't get an error so ....? Will someone take look at this feeble attempt and advise?
thanks in advance!
PHP Code:
    <?php 
    
// error_reporting(0);
    
error_reporting(E_ALL E_NOTICE); 
    
mysql_connect("localhost","root",""); 
    
mysql_select_db("numbersdb") or die( "Unable to select database"); 
    if(!empty(
$_POST["submit"])) 
    { 
     
$taxrate $_POST['taxrate']; 
     
$query="SELECT * FROM numbdata Where id='$id'"
     
$result=mysql_query($query); 
     if(
mysql_num_rows($result)) 
     {  
    }else{echo 
"No listing for taxrate $taxrate .<br />Select another? .<br />";} 
    } 
    if(!empty(
$_POST["update"])) 
    { 
    
$sql "UPDATE numbdata SET 
    taxrate = '" 
.mysql_real_escape_string($_POST['taxrate']) . "', 
    WHERE taxrate='"
.$_POST['taxrate']."'"
    
mysql_query($sql) or die(mysql_error());
     echo 
"Record for taxrate ".$_POST["taxrate"]." has been updated"
     } 
    
?>





Similar Threads
Thread Thread Starter Forum Replies Last Post
RECORDSET.UPDATE vs UPDATE QUERY biswa VB Databases Basics 1 October 10th, 2009 04:46 PM
Gridview Update not firing in Update Panel akshay144 Ajax 1 August 13th, 2009 10:20 AM
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
Update link doesn't update in FormsView shaly ASP.NET 2.0 Basics 0 December 6th, 2006 04:33 PM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.