here is the code:
<?
$databasename='borlee2_cbrands'; // Name of the database
$tablename='cigars'; // Name of the table
$mysqladd='mysql4.freehostia.com'; // Address to the MySQL Server - Usually localhost but could be an IP address
$mysqluser='***'; // Your MySQL UserName
$mysqlpass='***'; // Your MySQL Password
//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());
//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());
//GET THE TABLE DATA
//you can edit the $sql= line to any sort of SELECT statement to get the desired results
//e.g. "SELECT FROM ".$tablename." WHERE name LIKE 'a%' ORDER BY name desc";
//the example would give all in table with a name that started with a or A and order the results alphabetically
$results=array();
//$sql="SELECT FROM ".$tablename."";
$sql="SELECT * FROM ".$tablename." WHERE letter LIKE 'a'";
$result = mysql_query($sql, $link) or die('Error: ' . mysql_error());
while($a_row = mysql_fetch_array($result, MYSQL_ASSOC)) array_push($results, $a_row);
if(count($results)){
//DISPLAY THE DATA
foreach($results as $r){
echo('<li><a href="'.$r[link].'"><h2>'.$r[name].'</h2></a> - '.$r[short_info].' - '.$r[special].'<br /><li><a href="'.$r[link].'"><img src="'.$r[image_link].'" /></a></li>'
);
}
}else{
echo('Sorry - no results found');
}
?>
</div>
<div style="float:left; margin-left: 60px; margin-top:15px;">
<?
$databasename='borlee2_cbrands'; // Name of the database
$tablename='cigars'; // Name of the table
$mysqladd='mysql4.freehostia.com'; // Address to the MySQL Server - Usually localhost but could be an IP address
$mysqluser='***'; // Your MySQL UserName
$mysqlpass='***'; // Your MySQL Password
//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());
//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());
//GET THE TABLE DATA
//you can edit the $sql= line to any sort of SELECT statement to get the desired results
//e.g. "SELECT FROM ".$tablename." WHERE name LIKE 'a%' ORDER BY name desc";
//the example would give all in table with a name that started with a or A and order the results alphabetically
$results=array();
$sql="SELECT FROM ".$tablename."";
//$sql="SELECT * FROM ".$tablename." WHERE letter LIKE 'a'";
$result = mysql_query($sql, $link) or die('Error: ' . mysql_error());
while($a_row = mysql_fetch_array($result, MYSQL_ASSOC)) array_push($results, $a_row);
if(count($results)){
//DISPLAY THE DATA
foreach($results as $r){
echo('<li><a href="single.php?id='.$r[key].'">'.$r[name].'</a> </li>');
}
}else{
echo('Sorry - no results found');
}
?>
</div>