my objective is to select records from database to remember info, click on and go to the target and
update the date last used, visit count, time visited and if the info hasn't been saved, save it.
I do this in html, see the records, click on a button and go to target of interest... using Xampp
server w/databases, and access thru php I can update(crud).
My Xammp is running, my database is confirmed, my php doesn't seem to work in accessing the records.
I've tried other forums to no avail.
Below is my latest feeble attempt. I'm hoping for adviceI have a screenshot of resulting
display, any help? c'mon, there's room.
===========================================================
here's my code - hey I feel the lauhter
---------------------------------------
<!DOCTYPE html><html>
<head></head>
<BODY><center>
<?php
echo "<center>";echo $date->format('d-m-Y H:i:s a');echo "</center>";
$id="''";
$con=mysqli_connect("localhost","root","","homedb");
// ============== check connection
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
else
{echo "</br>";}
// ==========This creates the drop down box using records in the table
echo "<select name= 'target'>";
echo '<option value="">'.'---select email account ---'.'</option>';
$query = mysqli_query($con,"SELECT target FROM lookuptbl");
$query_display = mysqli_query($con,"SELECT * FROM lookuptbl");
while($row=mysqli_fetch_array($query))
{ echo "<option class=highlight value='". $row['target']."'>".$row['target']
.'</option>';}
echo '</select>';
?>
<input type="submit" name="submit" value="Submit"/>
</form></body></html>
<?php
error_reporting(E_ALL ^ E_NOTICE);
// error_reporting(0);
$con=mysqli_connect("localhost","root","","homedb");
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
if(isset($_POST['target']))
{
$id = $_POST['id'];
$name = $_POST['target'];
$fetch="SELECT target, purpose, username, password, emailused, visits, lastdate, lasttime, saved
FROM lookuptbl WHERE target = '".$name."'";
$result = mysqli_query($con,$fetch);
if(!$result)
{echo "Error:".(mysqli_error($con));}
// =============================== this displays the table
echo '<table border="1">'.'<tr>'.'<td bgcolor="#FFD47F" align="center">'. 'email menu'. '</td>
'.'</tr>';
echo '<tr>'.'<td>'.'<table border="1">'.'<tr bgcolor="#ccffff">'.'<td>'.'target'.'</td>'.'
<td>'.'purpose'.'</td>' '<td>'.'username'.'</td>'.'<td>'.'password'.'</td>'.'
<td>'.'emailused'.'</td>'.'<td>'.'lastdate'.'</td>'.'<td>'.'lasttime'.'</td>'.'<td>'.'saved'.'</td>'.'</tr>';
// while($data = mysqli_fetch_row($fetch))
while($data=mysqli_fetch_row($result))
{echo ("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td>
<td>$data[5]</td><td>$data[6]</td><td>$data[7]</td><td>$data[8]</td></tr>");}
echo '</table>'.'</td>'.'</tr>'.'</table>';
}
?>
</body></html>