Putting stuff into multi-arrays
Posted: Mon Oct 17, 2005 5:09 am
hello, here is my script!
I would like to have the variables $row to be a multi variable so if I wrote:
it would say some number. I want everything it pulls out of the database in this small $row. how is that possible?
NOTE: I played around with it but didnt make it to work, listed above is my backup script.
Code: Select all
<?
//Variables
require_once('connect.php');
$cat = $_GET[id];
if ($cat == NULL) {$cat = 0;}
$resulta = mysql_query("SELECT * FROM categories WHERE cats_approved=1 AND cats_subcat=$cat");
$resultb = mysql_query("SELECT * FROM links WHERE links_cat=$cat");
//Categories
while ($row = mysql_fetch_array($resulta, MYSQL_BOTH))
{
$i++;
if ($i == 1) {echo 'categories<br><table border="1">';}
$link = "<a href=" . viewcats . "?id=" . $row['cats_id'] . ">" . $row['cats_name'] . "</a>";
echo "<tr><td>$link</td></tr>";
}
if ($i > 0) {echo "</table>";}
//echo "<a href=" . viewcats . "?id=$cat>back</a>";
//Output Links
while ($row = mysql_fetch_array($resultb, MYSQL_BOTH))
{
$o++;
if ($i == 0) {echo 'links<br><table border="1">';}
$link = "<a href=" . viewlink . "?id=" . $row['links_id'] . ">" . $row['links_name'] . "</a><br>";
$url = $row['links_url'];
$description = $row['links_desc'];
$hits = $row['links_hits'];
$banner = $row['links_banner'];
echo "<tr><td>$link<br>$description</td></tr>";
}
if ($o > 0) {echo "</table>";}
?>Code: Select all
echo "$row[1]['links_id']";NOTE: I played around with it but didnt make it to work, listed above is my backup script.