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
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..

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.