Jump to content

updating mysql with form


lilwing

Recommended Posts

hey guys, i need to know an easy secure way to echo all the values in a column (like by the primary key or something) to a form list/menu, so the user can select and update.

 

i also need to know how to echo the current data in the selected row to a field in a form so it can be easily edited.

Link to comment
Share on other sites

bump.

 

here's what i have now, it echoes my failure message next to my form menu... not sure what the problem is.

 

<?php
$Host= "bleep";
$User= "bleep";
$Password= "bleep";
$TableName= "bleep";

$Link = mysql_connect ($Host, $User, $Password);
$Query = "Select updated_on from $TableName";
$results = mysql_db_query($DBName, $Query, $Link);
?>

Which Entry would you like to edit?
<select name = "drop1" size="1">
<Option Value=" ">Select One:</option>

<?php
for($u=0;$u<mysql_num_rows($results); $u++) {
$ID=mysql_result($results,$u,'updated_on');
?>

<option value="<?php echo($ID); ?>"><?php echo($ID); ?></option>

<?php
}
?>

</select>

<?php
if (mysql_db_query ($DBName, $Query, $Link)) {
print ("link was SUCCESSFUL<BR>\n");
}

else {
print ("FAILURE<BR>\n");
}

mysql_close ($Link);

?>[

/code]

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.