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
https://forums.phpfreaks.com/topic/65828-updating-mysql-with-form/
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]

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.