Jump to content

show value from a mysql table selected


unistake

Recommended Posts

Hi all,

 

I am trying to make a members details section that can be updated.

 

I want to be able to "SELECT * FROM users WHERE email='$email'" and then show the values that can be changed in a html drop down box with the selection that was made when the user registered already selected="selected";

 

You will be able to see what I am attempting to do below.

 

<?php

$sql = "SELECT manufacturer FROM table1 WHERE email=$'email'";
$result = mysqli_query($cxn,$sql);
$row = mysqli_fetch_assoc($result);

foreach manufacturer in table1 { 
      if table1.manufacturer = table2.manufacturer {
               echo '<option name="manufacturer" selected="selected" value"$row['manufacturer']"</option>';
     }
     else {
              echo '<option name="manufacturer" value"$row['manufacturer']"</option>';
     }
}
?>

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.