View Full Version : php code to update tables in phpmyadmin

02-24-2012, 02:40 PM
I was wondering could anybody help me. I am using php myadmin and want to move data from one table to another within the same database. I want this to happen when a user clicks a button which is within the php code.

So far I have created the button and when it is clicked it updates the database but with all products, does anybody know how I can get it to update for one particular product and then remove it from the table once chosen and move it to another table?

02-24-2012, 03:35 PM
Sounds like a pretty easy issue. Whats your MySQL experience? Do you have code for us to see?

02-24-2012, 09:50 PM
I dont have much experience at all, but Im creating a website at uni.


if($num>0){ //check if more than 0 record found

echo "<table border='1'>";//start table

//creating our table heading
echo "<tr>";
echo "<th>Product</th>";
echo "<th>Add</th>";

echo "</tr>";

//retrieve our table contents
//extract row
//this will make $row['firstname'] to
//just $firstname only

//creating new table row per record
echo "<tr>";
echo "<td>{$productname}</td>";
echo "<td>
<button id='1' name='button'>Add to List</button>

$query = "INSERT INTO list(productname) VALUES('$productname')";

$result = mysql_query($query);
echo "</tr>";

echo "</table>";//end table

}else{ //if no records found
echo "No records found.";


The above code creates a button and updates the list table but i want users to be able to add specific products. And then for this product to be removed from the product table and only appear in the list table...