I'm trying to read records from database into table and select a target to display a particular record and its info and url. I then want to click on that record and o to that url. below is my code: --------------------------------------------------------------------------------- <!DOCTYPE html><html> <title>email menu</title> <head> </head> <BODY bgcolor="#ccffff"><b><center> <FORM name=Form action="" method=post>
<?php echo "Date: " . date("Y/m/d"); echo "Time: " . date("h:i:sa") . "<br>"; $con=mysqli_connect("localhost","root","cookie","homedb");
if(mysqli_errno($con)) {echo 'Can't Connect to mySQL:'.mysqli_connect_error();} else {echo 'Connected to mySQL</br>';}
$query = mysqli_query($con,'SELECT target FROM emailtbl'); $query_display = mysqli_query($con,'SELECT * FROM emailtbl'); while($row=mysqli_fetch_array($query))
$target = $con->query('SELECT target FROM emailtbl'); while ($row = $target->fetch_array(MYSQLI_ASSOC)){ echo ' <option value="'.$row['target'].'">'.$row['target']. '</option>'; }
<input type="submit" name="submit" value="Submit"> </form>'; }
$con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo "Can't Connect to mySQL:".mysqli_connect_error();} if(isset($_POST['target'])) { $target = $_POST['target']; $fetch="SELECT target, purpose, username, password, emailused, lastused, count, time, saved FROM emailtbl WHERE target = "$target"; $result = mysqli_query($con,$fetch); if(!$result) {echo "Error:".(mysqli_error($con));} echo '<table border="1">'.'<tr>'.'<td bgcolor="#ccffff align="center">'. 'Email menu'. '</td>'.'</tr>'; echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.' <td bgcolor="#D4AAFF align="center">'.'target'.'</td>'.' <td bgcolor="#D4AAFF align="center">'.'purpose'. '</td>'.' <td bgcolor="#D4AAFF align="center">'.'username'.'</td>'.' <td bgcolor="#D4AAFF align="center">'.'password'.'</td>'.' <td bgcolor="#D4AAFF align="center">'.'emailused'.'</td>'.' <td bgcolor="#FFD4D4 align="center">'.'lastused'.'</td>'.' <td bgcolor="#FFD4D4 align="center">'.'count'. '</td>'.' <td bgcolor="#FFD4D4 align="center">'.'time'. '</td>'.' <td bgcolor="#FFD4D4 align="center">'. 'saved' .'</td>'.'</tr>'; 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> =============================================================== below the result: ----------------------- "; $con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo 'Can't Connect to mySQL:'.mysqli_connect_error();} else {echo 'Connected to mySQL ';} $query = mysqli_query($con,'SELECT target FROM emailtbl'); $query_display = mysqli_query($con,'SELECT * FROM emailtbl'); while($row=mysqli_fetch_array($query)) $target = $con->query('SELECT target FROM emailtbl'); while ($row = $target->fetch_array(MYSQLI_ASSOC)){ echo ' '; } '; } $con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo "Can't Connect to mySQL:".mysqli_connect_error();} if(isset($_POST['target'])) { $target = $_POST['target']; $fetch="SELECT target, purpose, username, password, emailused, lastused, visitcount, time, saved FROM emailtbl WHERE target = "$target"; $result = mysqli_query($con,$fetch); if(!$result) {echo "Error:".(mysqli_error($con));} echo ''.''.''.''; echo ''.''.''.' '. 'Email menu'. ' '.''.''.' '.' '.' '.' '.' '.' '.' '.' '.' '.''; while($data=mysqli_fetch_row($result)) {echo ("");} echo ' '.'target'.' '.'purpose'. ' '.'username'.' '.'password'.' '.'emailused'.' '.'lastused'.' '.'visitcount'. ' '.'time'. ' '. 'saved' .' $data[0] $data[1] $data[2] $data[3] $data[4] $data[5] $data[6] $data[7] $data[8] '.' '; } ?>
|
|