Forum Moderators: coopster
<ul class="nav nav-pills nav-justified">
<li class="active"><a href="#000" data-toggle="tab"><i class="icon-new-tab2"></i> Featured</a></li>
<?php $cattid = $_GET['ListingID'];?>
<?php include("inc_db/inc_connect.php"); ?>
<?php $table="c_select_sub_cat";;?>
<?php
mysql_connect ($db_host,$db_username,$db_password);
@mysql_select_db ($db_name);
$result = mysql_query("select cat_sub_area_id,cat_sub_area_title,cat_sub_tabs_order from $table where cat_area_id='$cattid'" );
$num_fields = mysql_num_fields($result);
$num_rows = mysql_num_rows($result);
$row_cnt = 0;
while ($num_rows>$row_cnt)
{
$record = @mysql_fetch_row($result);
?>
<li><a href="#<?php print "$record[2]"; ?>" data-toggle="tab"><i class="icon-menu2"></i> <?php print "$record[1]"; ?></a></li>
<?php $row_cnt++;} ?>
<?php mysql_close(); ?>
</ul>
$SitetabeValue = $record[1];
$data = array(); // Save all your data here
while ($num_rows>$row_cnt)
{
$record = @mysql_fetch_row($result);
$data[] = $record;
:
echo $data[2][1]; // 3rd record, 2nd field (arrays start at 0)
foreach ($data as $record) {
// 1st field, 2nd field (same idea as your first example)
echo $record[0].$record[1];
}
[edited by: incrediBILL at 6:21 pm (utc) on Apr 20, 2014]
[edit reason] URls removed. No site reviews. Please see forum charter and TOS [/edit]
I want the data to be available outside of the stepping thing...
$data - this is then available later in the page, wherever you want to use it. But by the very nature of this data (a series of records and fields) you are likely going to have to loop/step through it in order to be able to use it? Unless you generate your HTML in the initial data retrieval stage (assign this to a variable) and simply output the HTML later? $data[2][1];