Jump to content

update query question


bhavin_85

Recommended Posts

hi guys

 

im trying to write an update query that updates a few fields in a row on my sql database

 

im gettin a parse error and i cant figure out why

 

<?php
session_start();
if ( empty($_SESSION['username'])){
header("location:default.php");
exit;
}
$id=$_SESSION['cust_id'];

include('config.php')

$sql="UPDATE customer SET first_name = ".$_POST['first_name']" WHERE cust_id = '$id'";
mysql_query($sql) or die ("Couldnt execute $sql: " . mysql_error()); 
?>

ive used post because there is a form on the previous page which the user enters their updated values into

Link to comment
https://forums.phpfreaks.com/topic/41431-update-query-question/
Share on other sites

cheers :)

 

i realised i was missing the . after the post

 

if i have a date field set in one of the fields and the user has to update it how would i do it?

 

the date is currently set at yyyy/mm/dd if i want it to be entered as dd/mm/yyyy but converted before its stored in the database?

 

would a drop down list work?

Link to comment
https://forums.phpfreaks.com/topic/41431-update-query-question/#findComment-200721
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.