Hello,
I am new to programming and have been working on a sample database to solidify what I have learned. I have been attempting to give my database browsing capabilities, which has turned out a bit more difficult that I thought it would. I have an idea this morning, but am a little too ignorant at this point to know exactly how to implement it. If someone could assist me a little I'd really appreciate it.
I think I need to turn all the columns into an array and then extract each one as the user would click a button and navigate to the next record. Right now I am drawing a blank thought...kinda frustrating. My code is below, it isn't complete with navigation but this is were I think I need to start. Am I correct? Could you please suggest a next step? Thanks a lot in advance!
<?php
include ('connect.php');
mysql_select_db ("db1");
$query ="SELECT lname, fname, city, phone FROM db1"
$results = mysql_query($query)
or die("can't do it because " .mysql_error());
while ($row = mysql_fetch_array($results))
{
lname = $lname;
fname = $fname;
city = $city;
phone = $phone;
}
//This part was just experimenting with sending data from one page to the next.
if (isset($_POST['submit']))
{
$lname = $_POST['lname'];
$fname = $_POST['fname'];
$address = $_POST['address'];
$address2= $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$notes = $_POST['notes'];?>
Last: <input type ="text" name ="lname" value =<?php echo"$lname";?>>
First: <input type ="text" name ="fname" value =<?php echo"$fname";?>><br><br>
Address: <input type ="text" name ="address" value =<?php echo"$address";?>><br><br>
Address 2: <input type ="text" name ="address2" value =<?php echo"$address2";?>><br><br>
City: <input type ="text" name ="city" value =<?php echo"$city";?>>
State: <input type ="text" name ="state" value =<?php echo"$state";?>>
Zip code: <input type ="text" name ="zip" value =<?php echo"$zip";?>><br><br>
Phone: <input type ="text" name ="phone" value =<?php echo"$phone";?>>
Notes:<textarea name ="notes"value =""><?php echo "$notes";?></textarea><br><br>
<?php
}?>