Jump to content

Update a table issues


Hagbard

Recommended Posts

I'm rather new to php and still learning. I am trying to update a table on my database with a edit process. The code for the process is as follows

 

<?php require("include/config.php");

 

$id                              = $_POST['id'];

$last_name                      = $_POST['last_name'];

$first_name                      = $_POST['first_name'];

$artist2_last_name              = $_POST['artist2_last_name'];

$artist2_first_name              = $_POST['artist2_first_name'];

$ohio_tax_id_number              = $_POST['ohio_tax_id_number'];

$business_name                  = $_POST['business_name'];

$address                        = $_POST['address'];

$city                            = $_POST['city'];

$state                          = $_POST['state'];

$zip                            = $_POST['zip'];

$telephone1                      = $_POST['telephone1'];

$telephone2                      = $_POST['telephone2'];

$email1                          = $_POST['email1'];

$email2                          = $_POST['email2'];

$medium                          = $_POST['medium'];

$artist_number                  = $_POST['artist_number'];

$app_received_2007              = $_POST['app_received_2007'];

$app_received_2008              = $_POST['app_received_2008'];

$jury_decision                  = $_POST['jury_decision'];

$withdraw_date_2007              = $_POST['withdraw_date_2007'];

$withdraw_date_2008              = $_POST['withdraw_date_2008'];

$check_25                        = $_POST['check_25'];

$check_120                      = $_POST['check_120'];

$check_200                      = $_POST['check_200'];

$wci_qualified                  = $_POST['wci_qualified'];

$postcard_request                = $_POST['postcard_request'];

$notes                          = $_POST['notes'];

$winner_2008                    = $_POST['winner_2008'];

$winner_2007                    = $_POST['winner_2007'];

$winner_2006                    = $_POST['winner_2006'];

$winner_2005                    = $_POST['winner_2005'];

$wci_app_received_2008          = $_POST['wci_app_received_2008'];

$wci_app_received_2007          = $_POST['wci_app_received_2007'];

$wci_artist_number              = $_POST['wci_artist_number'];

$wci_decision                    = $_POST['wci_decision'];

$wci_notify_date                = $_POST['wci_notify_date'];

$booth_number_2008              = $_POST['booth_number_2008'];

$booth_number_2007              = $_POST['booth_number_2007'];

$hear_about_festival            = $_POST['hear_about_festival'];

 

mysql_connect("$mysql_host", "$mysql_user", "$mysql_password");

mysql_select_db("$mysql_db") or die(mysql_error());

$query = "UPDATE $mysql_table=

last_name='$last_name',

first_name='$first_name',

artist2_last_name='$artist2_last_name',

artist2_first_name='$artist2_first_name',

ohio_tax_id_number='$ohio_tax_id_number',

business_name='$business_name',

address='$address',

city='$city',

state='$state',

zip='$zip',

telephone1='$telephone1',

telephone2='$telephone2',

email1='$email1',

email2='$email2',

medium='$medium',

artist_number='$artist_number',

app_received_2007='$app_received_2007',

app_received_2008='$app_received_2008',

jury_decision='$jury_decision',

withdraw_2007='$withdraw_2007',

withdraw_2008='$withdraw_2008',

check_35='$check_35',

check_120='$check_120',

check_200='$check_200',

wci_qualified='$wci_qualified',

postcard_request='$postcard_request',

notes='$notes',

winner_2008='$winner_2008',

winner_2007='$winner_2007',

winner_2006='$winner_2006',

winner_2005='$winner_2005',

wci_app_received_2008='$wci_app_received_2008',

wci_app_received_2007='$wci_app_received_2007',

wci_artist_number='$wci_artist_number',

wci_decision='$wci_decision',

wci_notify_date='$wci_notify_date',

hear_about_festival='$hear_about_festival',

booth_number_2008='$booth_number_2008',

booth_number_2007='$booth_number_2007'

WHERE id={$id}";

$results = mysql_query ($query);

 

mysql_close();

 

//$result = mysql_query ($query);

 

mysql_close();

 

header("Location: index.php");

 

exit;

?>

 

 

 

 

 

however when I click on update it doesn't save to the database. I get no error message however nothing updates.

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/102323-update-a-table-issues/
Share on other sites

<?php require("include/config.php");

$id                              = $_POST['id'];
$last_name                       = $_POST['last_name'];
$first_name                      = $_POST['first_name'];
$artist2_last_name               = $_POST['artist2_last_name'];
$artist2_first_name              = $_POST['artist2_first_name'];
$ohio_tax_id_number              = $_POST['ohio_tax_id_number'];
$business_name                   = $_POST['business_name'];
$address                         = $_POST['address'];
$city                            = $_POST['city'];
$state                           = $_POST['state'];
$zip                             = $_POST['zip'];
$telephone1                      = $_POST['telephone1'];
$telephone2                      = $_POST['telephone2'];
$email1                          = $_POST['email1'];
$email2                          = $_POST['email2'];
$medium                          = $_POST['medium'];
$artist_number                   = $_POST['artist_number'];
$app_received_2007               = $_POST['app_received_2007'];
$app_received_2008               = $_POST['app_received_2008'];
$jury_decision                   = $_POST['jury_decision'];
$withdraw_date_2007              = $_POST['withdraw_date_2007'];
$withdraw_date_2008              = $_POST['withdraw_date_2008'];
$check_25                        = $_POST['check_25'];
$check_120                       = $_POST['check_120'];
$check_200                       = $_POST['check_200'];
$wci_qualified                   = $_POST['wci_qualified'];
$postcard_request                = $_POST['postcard_request'];
$notes                           = $_POST['notes'];
$winner_2008                     = $_POST['winner_2008'];
$winner_2007                     = $_POST['winner_2007'];
$winner_2006                     = $_POST['winner_2006'];
$winner_2005                     = $_POST['winner_2005'];
$wci_app_received_2008           = $_POST['wci_app_received_2008'];
$wci_app_received_2007           = $_POST['wci_app_received_2007'];
$wci_artist_number               = $_POST['wci_artist_number'];
$wci_decision                    = $_POST['wci_decision'];
$wci_notify_date                 = $_POST['wci_notify_date'];
$booth_number_2008               = $_POST['booth_number_2008'];
$booth_number_2007               = $_POST['booth_number_2007'];
$hear_about_festival             = $_POST['hear_about_festival'];

mysql_connect("$mysql_host", "$mysql_user", "$mysql_password");
mysql_select_db("$mysql_db") or die(mysql_error());
$query = "UPDATE $mysql_table=
last_name='$last_name',
first_name='$first_name',
artist2_last_name='$artist2_last_name',
artist2_first_name='$artist2_first_name',
ohio_tax_id_number='$ohio_tax_id_number',
business_name='$business_name',
address='$address',
city='$city',
state='$state',
zip='$zip',
telephone1='$telephone1',
telephone2='$telephone2',
email1='$email1',
email2='$email2',
medium='$medium',
artist_number='$artist_number',
app_received_2007='$app_received_2007',
app_received_2008='$app_received_2008',
jury_decision='$jury_decision',
withdraw_2007='$withdraw_2007',
withdraw_2008='$withdraw_2008',
check_35='$check_35',
check_120='$check_120',
check_200='$check_200',
wci_qualified='$wci_qualified',
postcard_request='$postcard_request',
notes='$notes',
winner_2008='$winner_2008',
winner_2007='$winner_2007',
winner_2006='$winner_2006',
winner_2005='$winner_2005',
wci_app_received_2008='$wci_app_received_2008',
wci_app_received_2007='$wci_app_received_2007',
wci_artist_number='$wci_artist_number',
wci_decision='$wci_decision',
wci_notify_date='$wci_notify_date',
hear_about_festival='$hear_about_festival',
booth_number_2008='$booth_number_2008',
booth_number_2007='$booth_number_2007'
WHERE id={$id}";
mysql_query ($query) or die(mysql_error());
      
mysql_close();

//$result = mysql_query ($query);

header("Location: index.php");

exit;
?>

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.