FAIL

having problems getting this to update my table in my mysql DB… i looked it over and over but i can figure out what im doing wrong… any help would be great :’(

[php]<?php
// This file is www.developphp.com curriculum material
// Written by Adam Khoury January 01, 2011
// http://www.youtube.com/view_play_list?p=442E340A42191003
// Script Error Reporting
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);
?>

<?php // Include config file include "config.php"; // If form button has been pressed then do the following if(isset($_POST['update'])){ // Get id of post $id = $_GET['id']; $lname = $_POST['lname']; $laddress = $_POST['laddress']; $lcity = $_POST['lcity']; $lstate = $_POST['lstate']; $lzip = $_POST['lzip']; $Mname = $_POST['Mname']; $maddress = $_POST['maddress']; $mcity = $_POST['mcity']; $mstate = $_POST['mstate']; $mzip = $_POST['mzip']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; // Update database table $query = "UPDATE Contactinfo SET lname = '$lname', laddress = '$laddress', lcity = '$lcity', lstate =$'lstate', lzip ='$lzip', Mname ='$Mname', maddress = '$maddress', mcity ='$mcity', mstate = '$mstate', mzip ='$mzip', phone = '$phone', fax ='$fax', email1 ='$email1', email2 ='$email2' WHERE id = 'id' LIMIT 1"; $result = mysql_query($query); if ($result){ echo "Successfully edited entry"; } else { echo "There was error editing entry"; } } ?>[/php]

the only thing i can think of is that in my mysql DB its not in this order

Hi there,

I’m guessing you haven’t noticed this:

lstate =$'lstate',

thanks Smokey i got it and now its reporting that it has edited the table… i must have looked over that error a million times… thanks for the help

Haha, no problem - it often just takes a fresh pair of eyes to spot mistakes, you end up looking at the code for so long that you no longer actually read it properly! Glad to have helped.

Sponsor our Newsletter | Privacy Policy | Terms of Service