Jump to content

can't get it to Read and Update


happypete

Recommended Posts

This is for a simple photo upload script, i want to be able to display the description e image order in a text box so they can be edited and update, but it doesn't save the update. Im ne to this and have spend the last 2 days trying to get it to work...

 

<form method="POST" action="">

 

<?

include('config.php');

 

$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC")

or die("Bad query: ".mysql_error());

while ( $row = mysql_fetch_array($result) )

 

$result = mysql_query("UPDATE photo SET rank='{$_POST['rank']}', description='{$_POST['description']}' WHERE id=$id");

mysql_query($result) or die(mysql_error());

echo (mysql_affected_rows()) ? "Photo Edited.<br />" : "Nothing changed. <br />";

{

 

?>

<input type="text" name="<? print $row['rank'] ;?>" size="2" value="<? print $row['rank'] ;?>">

<input type="text" name="<? print $row['description'] ;?>" size="" value="<? print $row['description'] ;?>">

<input type="text" name="<? print $row['id'] ;?>" size="" value="<? print $row['id'] ;?>">

<?

echo "<img src=\"".$row['tn_src']."\"/>";

echo " <a href=delete1.php?id={$row['id']}>Delete</a>";

?><br>

<?

} // END WHILE

?>

<input type="submit" value="    Update    " name="submit">

</form>

 

Link to comment
https://forums.phpfreaks.com/topic/176018-cant-get-it-to-read-and-update/
Share on other sites

tried that but it just printed the words...

 

ok the above code produces the result: "Query was empty"

 

so basically i'm trying to get the script to print to output multiple 'rank' and 'descriptions' and Update them.... I can get it to work with just a single ID query but not the array..

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.