Re: Using strlen and substr to Shorten DB Results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try this. PHP arrays are cool! Of course there are tidier ways to implement this, but this is just an example.

Adam

<-- Code -->

$getscname = mysql_query("SELECT * FROM subcat WHERE subcatid = '$subcatid'") or die ("Couldn't get the info.<br>".mysql_error());

while($sub_cat = mysql_fetch_array($getscname)){
$subcat_id = $sub_cat['subcatid'];
$subcat_name = $sub_cat['subcatname'];

$arrCats[] = '<a href="subcat.php?catid='.$catid.'&sc='.$subcat_id.'">'.$subcat_name.'</ a>';
}

echo implode('&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;',$arrCats);

<-- Code -->


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux