View Single Post
Old 02-17-2013, 08:54 PM   PM User | #2
Ctechinfo
New Coder

 
Join Date: Sep 2012
Posts: 88
Thanks: 3
Thanked 3 Times in 3 Posts
Ctechinfo is an unknown quantity at this point
ok so after a lot of tweaking I got the code redone and it works to the point the the table row data is displayed. I hard coded the table header for now til I figure out how to display table names like the rows..

I had a little trouble with the sorting, was using DESC, but determined ASC was what I wanted for my purpose..

Not I need to figure out how to fill the voids (blank spots in the html table based off the database..

PHP Code:
<!doctype html public "-//W3C//DTD HTML 4.01 transitional//EN">
<html>
    <head>
         <title>Ctechinfo - Motherboard Database</title>
        <meta name="description" content='Ctechinfo - Your unofficial #1 Compaq/HP resource website. The largest database of Compaq/HP motherboard information on the internet.'/>
        <meta http-equiv="content-type" content="text/html; charset="utf-8">
        <meta name="keywords" content='Compaq, HP, Hewlett-Packard, motherboard information, Asus, BCM/GVC, BIOSTAR, Chaintech, ECS, Elite Group, FIC, First International Computer, Foxconn, Gigabyte, Intel, LiteOn, Mitac, MSI, Microstar International, Privas, Quanta, Tatung, Tekram, TPV-Inventa, Trigem'>
        <meta name="author" content="Toby Bibeau"> 
        <meta name="robots" content="noindex,nofollow">
</head>

<body bgcolor="#ffffff" margin="5px">

<table width="98%" border="1" cellpadding="5"><tr><th bgcolor="#c2c2c2" colspan="6">Asus/Pegatron</th></tr>
<tr><td><center>Real Name</center></td><td><center>Version/Revision</center></td><td><center>Codname</td><td><center>Part Number</center></td><td><center>Board Colors</center></td><td><center>Notes</center></td></tr>
<?php
        
//Connect to the server and select database; you may need it
        
$dbc mysqli_connect('localhost''root''5GH9A4X1''boards')
          or die(
"Could not connect to the database.");
            
    
$query "SELECT * FROM `asus/pegatron` ORDER BY `codename` ASC";
    
$data mysqli_query($dbc$query);
    

while (
$row mysqli_fetch_array($data)) {
    
//Show results table
    
echo '<tr><td>' $row['realname'].'</td><td>'.$row['ver'].'</td><td>'.$row['codename'].'</td></tr>'.$row['partnumber'].'</td><td>'.$row['colors'].'</td><td>'.$row['notes'].'</td></tr>';
}
mysqli_close($dbc);
?>
</table>
</body>
</html>
Ctechinfo is offline   Reply With Quote