Hi,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?
It looks confused. You are modifying phpmyadmin code, right? The phpmyadmin that will be used by different users. I can't imagine a product that requires such functionality. Anyway your query needs to execute two commands UPDATE table2 with product from table 1 and then delete product from table 1. If you already has those queries for whole table, just add WHERE statement selecting only the product you need.
this is the code i have so far... this displays a button beside each product (called from the product table) and i want the user to be able to press this button and the specific product should be added tp the list table and removed from the product table, however add the minute when the button is clicked it adds all fiedls from the product table to the list table. i dont have very much coding experience and would appreciate any help! <?php 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 while($row=mysql_fetch_array($rs)){ //extract row //this will make $row['firstname'] to //just $firstname only extract($row); //creating new table row per record echo "<tr>"; echo "<td>{$productname}</td>"; echo "<td> <button id='1' name='button'>Add to List</button> </td>"; $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."; } ?>
for connection between php and database and updating phpmyadmin tables. http://ashwani-blog.blogspot.in/2012/02/database-and-tables.html
To update only 1 row, use a WHERE clause in your UPDATE statement (which you aren't showing here). BTW, there are no "phpmyadmin tables", they're MySQL tables. phpMyAdmin is just a PHP program you use to manipulate data in a MySQL database.