Jump to content

Update Record issue


Angeleyezz

Recommended Posts

Anyone have any idea what I did wrong this time?  :(

 

This is def where my problem is

// UPDATE THE RECORD WITH THE CURRENT FORM DATA
$edit_query_insert="UPDATE client_information SET account_number = '$account_number', name_first = '$name_first', name_last = '$name_last', address = '$address', city = '$city', state = '$state', zipcode = '$zipcode', telephone = '$telephone', telephone_alt = '$telephone_alt', email = '$email'";

 

 

This is the code for the page itself:

// SELECT THE DATABASE
mysql_select_db("terra_elegante_operations", $con);


// GET THE FORM DATA FROM PREVIOUS PAGE 
// ASSIGN NEW VARIABLES
$account_number	=	$_POST['account_number'];
$name_first		=	$_POST['name_first'];
$name_last		=	$_POST['name_last'];
$address		=	$_POST['address'];
$city			=	$_POST['city'];
$state			=	$_POST['state'];
$zipcode		=	$_POST['zipcode'];
$telephone		=	$_POST['telephone'];
$telephone_alt	=	$_POST['telephone_alt'];
$email			=	$_POST['email'];


// UPDATE THE RECORD WITH THE CURRENT FORM DATA
$edit_query_insert="UPDATE client_information SET account_number = '$account_number', name_first = '$name_first', name_last = '$name_last', address = '$address', city = '$city', state = '$state', zipcode = '$zipcode', telephone = '$telephone', telephone_alt = '$telephone_alt', email = '$email'";

if (!mysql_query($edit_query_insert,$con))
  {
  die('Error: ' . mysql_error());
  }
?>


<table border="0" cellspacing="0" cellpadding="3" width="960" bordercolor="#000000">
  <tr>
    <td valign="top" width="50%"><!-- Open Main left Cell --><table border="0" cellspacing="0" cellpadding="1" width="100%" bordercolor="#000000"><tr><td colspan="4"><B>CLIENT PROFILE</B></td></tr>
    
<?php
// Query & assign to the $client_information table.
$get_client_information = "SELECT * from client_information where account_number = $account_number";
$client_information = mysql_query($get_client_information) or die (mysql_error());

// The Array & Output - Included HTML Output here for $client_information

while ($row = mysql_fetch_array($client_information))
{
?>
  <tr>
    <td width="30%"><font face="verdana" size="2" color="#000000">Account Number:</font></td><td colspan="2"><font face="verdana" size="2" color="#000000"><?php echo $row['account_number']; ?></font></td>
  </tr>
  <tr>
    <td><font face="verdana" size="2" color="#000000">Last Name:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['name_last']; ?></font></td>
  </tr>
  <tr>    
    <td><font face="verdana" size="2" color="#000000">First Name:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['name_first']; ?></font></td>
  </tr>
  <tr>
    <td><font face="verdana" size="2" color="#000000">Address:</font></td><td><font face="verdana"size="2" color="#000000"><?php echo $row['address']; ?></font></td>
  </tr>
  <tr>
    <td><font face="verdana" size="2" color="#000000">City:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['city']; ?></font></td>
  </tr>
  <tr>
    <td width="10%"><font face="verdana" size="2" color="#000000">State:<font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['state']; ?></font></td>
  </tr>
  <tr>
    <td><font face="verdana" size="2" color="#000000">Zipcode:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['zipcode']; ?></font></td>
  </tr>
  <tr>    
    <td><font face="verdana" size="2" color="#000000">Telephone:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['telephone']; ?></font></td>
  </tr>
  <tr>    
    <td><font face="verdana" size="2" color="#000000">Telephone 2:</font></td><td><font face="verdana" size="2" color="#000000"><?php echo $row['telephone_alt']; ?></font></td>
  </tr>
  <tr>    
    <td><font face="verdana" size="2" color="#000000">E-mail</td></td><td><font face="verdana" size="2" color="#000000"><?php echo "<a class=\"bubble_nav\" href='mailto:?id=$row[email]'>$row[email]</a\>"; } ?></font></td>
  </tr>
</table>




<?php
include('includes/footer.php');

?>

Link to comment
https://forums.phpfreaks.com/topic/257568-update-record-issue/
Share on other sites

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

however the record does put a field in that was null before that i filled in...... doesnt make sense, how is it giving me an error but updating the record anyway. i dont get it

Link to comment
https://forums.phpfreaks.com/topic/257568-update-record-issue/#findComment-1320185
Share on other sites

I left something out that I figured but I'm still getting the error

 

// UPDATE THE RECORD WITH THE CURRENT FORM DATA
$edit_query_insert="UPDATE client_information SET account_number = '$account_number', name_first = '$name_first', name_last = '$name_last', address = '$address', city = '$city', state = '$state', zipcode = '$zipcode', telephone = '$telephone', telephone_alt = '$telephone_alt', email = '$email' WHERE account_number = $account_number";

 

forgot the where matchup

Link to comment
https://forums.phpfreaks.com/topic/257568-update-record-issue/#findComment-1320187
Share on other sites

nothing comes up at all, just that error,

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

no update in the record, no other error message, nothing

Link to comment
https://forums.phpfreaks.com/topic/257568-update-record-issue/#findComment-1320194
Share on other sites

nothing happened with that, because i dont think the issue was where I thought it was....... seems like the information is updating correctly now, but im still getting that same error message.  I think my output is wrong, i just changed it around a bit and here is the new code, still not working correctly.

 

<?php
// Query & assign to the $client_information table.
$get_client_information = ("SELECT * from client_information WHERE account_number = $account_number") or die(mysql_error());
$client_information = mysql_query($get_client_information) or die (mysql_error());
$new_email = $row['email'];
// The Array & Output - Included HTML Output here for $client_information

while ($row = mysql_fetch_array($client_information))
{
?>

 

could this be my issue?

Link to comment
https://forums.phpfreaks.com/topic/257568-update-record-issue/#findComment-1320206
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.