Please observe the following code
[code]<?php
$host = “localhost”;
$login = “”;
$pswd = “”;
$db = “price”;
$tbl = array(
“cpu”=>“Processor”,
“mb”=>“Mainboard”,
“pc_case”=>“PC Case”,
“memory”=>“Memory”,
“storage”=>“Storage”,
“video”=>“Video Card”,
“pc_card”=>“PC Card”,
“tv_recv”=>“TV Receiver”,
“sat_dish_acc”=>“Satellite Dish & Accessories”,
“cooler”=>“Cooler”,
“monitor”=>“Monitor”,
“printer”=>“Printer”,
“scanner”=>“Scanner”,
“modem”=>“Modem”,
“lan”=>“LAN”,
“hub”=>“HUB”,
“speaker”=>“Speaker”,
“mouse_keyb”=>“Mouse & Keyboard”,
“surge_arrest”=>“Surge Arrest”);
//$num = count($tbl);
$con = mysql_connect($host, $login, $pswd) or die ("Error Message: ".mysql_error());
?>
mysql_select_db($db) or die ("Error Message: ".mysql_error());
while (list($table, $name) = each($tbl)){
$sql = “select * from $table”;
$result = mysql_query($sql)or die("There was an error sending your query: ".mysql_error());
echo “
$name”;
while ($row = mysql_fetch_object($result)) { ?>
while ($row = mysql_fetch_object($result)) { ?>
Rename | Delete |
Please select."); }} ?>[/code]
as you can see i have a mysql database which i must update recently.
when opened the script shows all the information from all the tables and lets me to rename or delete rows. Now i want to make one SUBMIT button which will change multiple values
e.g. i want to rename something from cpu table and delete something from coolers table and then at the end press the submit button.
also can you tell if i’ve changed e.g. an information in cpu and mainboard tables how can i tell the script that i’ve changed exactly those tables, this concerns to this line
$sql = "UPDATE tables SET type=’$Type’ how can i assign a value to tables when changed smth in those tables
sorry for this kind of language i just can’t explain it better. If smth is not understood please ask