How do I update a foreign key

I am trying to add a foreign key table to my members table. I would like for the member to select a team and then have it updated in the members table.

if (isset($_POST[‘parse_var’])){

//// W.I.P.I.T ///
$thisWipit = $_POST[‘thisWipit’];
$sessWipit = base64_decode($_SESSION[‘wipit’]);
//
if (!isset($_SESSION[‘wipit’]) || !isset($_SESSION[‘idx’]))

___Query
if ($_POST[‘parse_var’] == “nba”){
$nba = $_POST[‘sports.nba_id’];(Not sure here, if this is whats called)

$sqlUpdate = mysql_query("UPDATE myMembers SET  myMember.id = '$nba' WHERE id='$id' LIMIT 1");
if ($sqlUpdate)

the FORM____

      <select name="nba" class="formFields">
        <?php

do {
?>

note option value is generated from Dreamweaver*****

        <option value="<?php echo $row_rsNBA['team']?>"><?php echo $row_rsNBA['team']?></option><?php

} while ($row_rsNBA = mysql_fetch_assoc($rsNBA));
$rows = mysql_num_rows($rsNBA);
if($rows > 0) {
mysql_data_seek($rsNBA, 0);
$row_rsNBA = mysql_fetch_assoc($rsNBA);
}
?>







I am not sure if I set this up right or not. Can anyone help me figure this out or tell me I have design the DB wrong

This doesn’t look right

[php]UPDATE myMembers SET myMember.id = ‘$nba’ WHERE id=’$id’ LIMIT 1[/php]

Why are you setting the id of the member? Or do you actually have a field called myMember.id ? If so, you’d maybe do this

[php]UPDATE myMembers SET myMember.id = ‘$nba’ WHERE id=’$id’ LIMIT 1[/php]

The period “.” shouldn’t be used in a field or key name, as far as I’m aware.

Sponsor our Newsletter | Privacy Policy | Terms of Service