What i'm pretty much trying to accomplish. Is when i've pulled the data from MySQL which i've done already, maybe not the right way.
I want to be able to setup a Loop, that will pretty much do this for each element in the array i pull back from MySQL.
if ($value == '1') {
echo '<a href="/$key.php">$key</a>'
}
So to explain further
+--------+-------+------+
| user | links | news |
+--------+-------+------+
| culley | 1 | 0 |
+--------+-------+------+
$value would be either culley, 1, 0.
$key would be either user, links, news. So my basic setup which, I think its close is.
<?php
$connection = mysql_connect('localhost', 'xxx', 'xxxx');
mysql_select_db('usrpsw');
$query = "SELECT * FROM wlinks WHERE user='".$_SESSION['user']."'";
$result = mysql_query($query);
$info = mysql_fetch_array($result, MYSQL_BOTH);
mysql_close($connection);
foreach ($info as $key => $value) {
if ($value == '1') {
echo "<a href=\"/'$key'.php>'$key'</a>"
}
?>
Anyways, I appreciate any help, i'm stumped.
Thx.