Selecting which record to update - mysql
Posted: Fri May 01, 2009 12:58 am
Hey Guys,
Im currently working on project, its basically an online store to sell CD's. When the site administrator searches for a CD to update a list of CD's will appear that match the search criteria entered. When the list appears they are able to click on which CD they want to update (eg. update the price) but im unsure of how to actually pass the information of what CD has been selected to the next php page. Here is an example of my code:
This is my bit of my search.php
The above code returns all CD's that matched the search criteria with a link to update.php above each CD. But whenever I click on the update.php it always returns the values of the first row, I need to somehow let update.php know which CD I want to update. Create a handle (is that the correct terminology) to each row so update.php knows which record we want to update.
Hope that makes sense, please let me know if you need more information.
Im currently working on project, its basically an online store to sell CD's. When the site administrator searches for a CD to update a list of CD's will appear that match the search criteria entered. When the list appears they are able to click on which CD they want to update (eg. update the price) but im unsure of how to actually pass the information of what CD has been selected to the next php page. Here is an example of my code:
This is my bit of my search.php
Code: Select all
$Row = mysqli_fetch_row($QueryResult);
do {
echo "<table width='100%' border='1'>";
echo "<tr><th>CD Type</th><th>CD Name</th><th>Price</th><th>Artist</th></tr>";
echo "<tr><td>{$Row[0]}</td>";
echo "<td>{$Row[1]}</td>";
echo "<td>{$Row[2]}</td>";
echo "<td>{$Row[3]}</td></tr>";
echo '<a href="update.php">Update </a>';
echo '<a href="index.html"> Delete</a>';
$Row = mysqli_fetch_row($QueryResult);
} while($Row);
Hope that makes sense, please let me know if you need more information.