? Mr.Snowman ?
New member
$array = mysql_query("SELECT * FROM category ORDER BY row_no");
$query = mysql_fetch_array($array);
$counter = 1;
foreach($query as $category){
if($query['col_no'] == 1){
echo '<a href="#" rel="toggle['.$counter.']">'.$category['cat_title'].'</a><br />
<div id="'.$counter.'" style="width: 225px; background: #BDF381">';
$col1link = mysql_query("SELECT * FROM link WHERE cat_title ='".$category['cat_title']."' ORDER BY title");
while($link = mysql_fetch_array($col1link)){
echo '<a href="'.$link['url'].'">'.$link['title'].'</a><br />';
}
echo '</div><br />';
$counter +=1;
}
}
By the way im using "foreach" because I need to re use the query 4 times and it wont work with a while loop
$query = mysql_fetch_array($array);
$counter = 1;
foreach($query as $category){
if($query['col_no'] == 1){
echo '<a href="#" rel="toggle['.$counter.']">'.$category['cat_title'].'</a><br />
<div id="'.$counter.'" style="width: 225px; background: #BDF381">';
$col1link = mysql_query("SELECT * FROM link WHERE cat_title ='".$category['cat_title']."' ORDER BY title");
while($link = mysql_fetch_array($col1link)){
echo '<a href="'.$link['url'].'">'.$link['title'].'</a><br />';
}
echo '</div><br />';
$counter +=1;
}
}
By the way im using "foreach" because I need to re use the query 4 times and it wont work with a while loop