Jump to content

PHP UPDATE


karnegyhall

Recommended Posts

<?php

$conn = mysql_connect("**********.3869157.hostedresource.com", "[database]", "password"); 

if (!$conn)
{
  die('Could not connect: ' . mysql_error());
}

$select = mysql_select_db('sportstalkadmin', $conn);

if (!$select)
{
  die('could not select db: sportstalkadmin ' . mysql_error());
}

$ID = $_SESSION['SESS_MEMBER_ID'];

<?php $login = $_POST['Login']?><br />;
<?php $lname = $_POST['Lname']?><br />;
<?php $fname = $_POST['Fname']?><br />;
<?php $jersey = $_POST['Jersey']?><br />;
<?php $height = $_POST['Height']?><br />;
<?php $weight = $_POST['Weight']?><br />;
<?php $email = $_POST['Email']?><br />;


$update = mysql_query("UPDATE tblathletes SET strEMailAddress = '$email'
WHERE intAthleteID = '$ID'");



if (!$update)
{header("location: sports-memberindex.php");
	exit();
}
die('Could not post your data: ' . mysql_error());
}

mysql_close($con);

 

the script processes and does not die.  But when i go to the DB and do a SELECT statement on any of the fields i'm sending in the form.  They're not there.

 

thanks

Link to comment
Share on other sites

<?php
$conn = mysql_connect
("********.db.3869157.hostedresource.com", 
"[database]", "[Password]"); 
if (!$conn)
{
  die('Could not connect: ' . mysql_error());
}
$select = mysql_select_db('sportstalkadmin', $conn);
if (!$select)
{
  die('could not select db: sportstalkadmin ' . mysql_error());
}
$ID = $_SESSION['SESS_MEMBER_ID'];
?>
<?php $login = $_POST['Login']?><br />;
<?php $lname = $_POST['Lname']?><br />;
<?php $fname = $_POST['Fname']?><br />;
<?php $jersey = $_POST['Jersey']?><br />;
<?php $height = $_POST['Height']?><br />;
<?php $weight = $_POST['Weight']?><br />;
<?php $email = $_POST['Email']?><br />;
<?php
$update = mysql_query(UPDATE tblathletes SET 
strEMailAddress='$email'
WHERE intAthleteID='$ID');
if (!$update)
{header("location: sports-memberindex.php");
	exit();
}
die('Could not post your data: ' . mysql_error());
}
mysql_close($con);
?>

 

i hear what you're saying, but unfortunately I get the same result despite the change.  the page processes to the header page, but the db does not reflect the update sent from my form.

Link to comment
Share on other sites

If you echo out the query (something very helpful to do when a query seems to be misbehaving), you might notice that $ID is not being put into the query correctly.

 

 

 

You forgot session_start().

 

 

(Unless of course there is some circumstance about which I don't know.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.