Question
already created table now need php and html
Write SQL statements to delete the above table. 3. PHP with html Write the html code to allow a user to enter a SUP_ID from t
a) use sunnysdiner; CREATE TABLE supplier ( food_item varchar(30) not null primary ley, SUP_ID INT, address varchar(100), cit
0 0
Add a comment Improve this question Transcribed image text
Answer #1
|search.php

<html>
<head><title>ViewCustomer</title>
</head>
<body>
<table width="100%">
<?php
session_start();
$supidd=$_POST['supid']; //assigning supid received from the sup_id.html to the php variable supidd
$db=new mysqli('localhost','root','','sunnysdiner'); //connection request
if (!$db) //to check whether the connection is established or not
die("Connection failed: " . mysqli_connect_error());
else
{
$sql="SELECT *FROM supplier WHERE SUP_ID='$supid'";//retriving the row from the table supplier that matches with sup_id entered by the user
}
$result=mysqli_query($db,$sql);

if (mysqli_num_rows($result) > 0) //if there are multiple rows
{
echo "<tr><th>food_item</th>
<th>SUP_ID</th>
<th>Address</th>
<th>city</th>
   <th>state</th>
<th>zipcode</th>
   <th>country</th>
   <th>phone</th>
   <th>price</th>
</tr>"."<br>"; //displaying results in table
while($row = mysqli_fetch_assoc($result))
{   
echo "<tr><td>".$row["food_item"]."</td><td>".$row["SUP_ID"]."</td><td>".$row["address"]."</td><td>".$row["city"]."</td><td>".$row["state"]."</td><td>".$row["zipcode"]."</td><td>".$row["country"]."</td><td>".$row["phone"]."</td><td>".$row["price"]."</td>";
}
}
else
{
echo "<h1>0 results</h1>";
}

mysqli_close($db); //closing database connection
?>
</table>
</body>
</html>

CODE SCREENSHOTS:

<html> <head><title>ViewCustomer</title> </head> <body> <table width=100%> <?php session_start(); $supidd=ş_POST[supid];

Add a comment
Know the answer?
Add Answer to:
already created table now need php and html Write SQL statements to delete the above table....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT