Hello - I've created an extremely simple table in MySQL and displayed it using PHP at viewall_records.php.
The PHP code is:
<?php
// open the connection
$conn = mysql_connect ("localhost", "solidliq_ii", "");
// pick the database to use
mysql_select_db ("solidliq_ii",$conn);
// create the sql command
$sql = "Select * from shutter_inventory";
// execute the sql command
$result = mysql_query($sql, $conn) or die (mysql_error());
echo "<table border=1><tr>
<th>Customer ID</th>
<th>Last Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip Code</th>
<th>Delivery Date</th></tr>";
// go through each row and display data
while ($whatever = mysql_fetch_array($result)) {
// give a name to the fields
$id = $whatever['customer_id'];
$name = $whatever['customer_name'];
$address = $whatever['customer_address'];
$city = $whatever ['customer_city'];
$state = $whatever ['customer_state'];
$zipcode = $whatever ['customer_zipcode'];
$date = $whatever ['customer_date'];
//print the results on screen
echo "<tr><td>" .$id. "</td>";
echo "<td>" .$name. "</td>";
echo "<td>" .$address. "</td>";
echo "<td>" .$city. "</td>";
echo "<td>" .$state. "</td>";
echo "<td>" .$zipcode. "</td>";
echo "<td>" .$date. "</td></tr>";
}
echo "</table>";
?>
I want to be able to create two more simple PHP files to interact with the MySQL database I built; add_records.php and search_records.php.
add_records.php would be an area to add data to the MySQL table via fields in a web browser.
search_records.php would be an area to search by customer name or customer ID number and display matching results. For example, if the last name typed in was smith, the code would return any rows matching 'smith' in the browser.
Are these things easy and possible? I'm a PHP/MySQL newbie, and have learned a lot in the past few days - just not enough to start on the other two files. If anyone could get me started or point me to posts/documentation/URLs that would help me, I would greatly appreciate it.
Thanks in advance for your help!
-Gina