PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$user = $_SESSION['userid'];
$query = mysql_query("SELECT signoff FROM users WHERE userid = '$user'");
if ($query['signoff'] == 0) {
echo '<a href=signoff.php?var=$userid class=blue2>You have not signed the Policies and Procedures form, click here now</a>';
}
The echo statement is printed all the time, therefore my query is not obtaining the user. Echo'ing my query does not come up within anything too.
tags when posting PHP code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
$query is a recource not a variable.
$user = $_SESSION['userid'];
$query = mysql_query("SELECT signoff FROM users WHERE userid = '$user'");
$signoff = mysql_fetch_row[$query];
if ($signoff[0] == 0) {
echo '<a href=signoff.php?var=$userid class=blue2>You have not signed the Policies and Procedures form, click here now</a>';
}
$user = $_SESSION['userid'];
$query = mysql_query("SELECT signoff FROM users WHERE userid = '$user'");
$signoff = mysql_fetch_row[$query];
if ($signoff[0] == 0) {
echo '<a href=signoff.php?var=$userid class=blue2>You have not signed the Policies and Procedures form, click here now</a>';
}
first you should've used PHP Tags...
second mysql_fetch_row[$query]; should be mysql_fetch_row($query);
$user = $_SESSION['userid'];
$query = mysql_query("SELECT signoff FROM users WHERE userid = '$user'");
$signoff = mysql_fetch_assoc($query);
if ($signoff['signoff'] == 0) {
?><a href=signoff.php?var=<?= $userid ?> class=blue2>You have not signed the Policies and Procedures form, click here now</a><?
}