Jump to content

Recommended Posts

yea, but how would i go about developing the if session code... is equal to the username and so and so admin column..? i tried this
[code]
if($row['admin']== 'admin'){
  echo "test1";
}

 

and added admin to the admin column

and the top of the page

if(isset($_SESSION['username']) && !empty($_SESSION['username'])) {
$query  = "SELECT va, cash, forum, admin FROM virtuala WHERE username='{$_SESSION['username']}'";
$result = mysql_query($query);
}
?>

but no luck[/code]

Link to comment
https://forums.phpfreaks.com/topic/116510-im-trying/#findComment-599132
Share on other sites

i tried using a variable such as:

<?session_start();
include("database.php");
if($_SESSION['username']) {
$query  = "SELECT * FROM virtuala WHERE username='{$_SESSION['username']}'";
$result = mysql_query($query);
}
$admin = $row['admin'];
?>

if($admin == 'admin'){
  echo "test1";
}
  else{
    echo "help me";
}

?>

but still no luck.. and tried using a mysql error no errors..

Link to comment
https://forums.phpfreaks.com/topic/116510-im-trying/#findComment-599146
Share on other sites

this is wrong

<?session_start();

include("database.php");

if($_SESSION['username']) {

$query  = "SELECT * FROM virtuala WHERE username='{$_SESSION['username']}'";

$result = mysql_query($query);

}

$admin = $row['admin'];

?>

 

it should be , short tag should not be used

<?php

session_start();

include("database.php");

if($_SESSION['username']) {

$query  = "SELECT * FROM virtuala WHERE username='{$_SESSION['username']}'";

$result = mysql_query($query);

}

$admin = $row['admin'];

?>

Link to comment
https://forums.phpfreaks.com/topic/116510-im-trying/#findComment-599151
Share on other sites

i've tried this now too

<?php
session_start();
include("database.php");
if($_SESSION['username']) {
$query  = "SELECT * FROM virtuala WHERE username='{$_SESSION['username']}'";
$result = mysql_query($query);
}
$admin = "{$row['admin']}";
?>

 

<?php
if($admin == 'admin'){
  echo "test1";
}
  else{
    echo "help me";
}

?>

but no luck

Link to comment
https://forums.phpfreaks.com/topic/116510-im-trying/#findComment-599164
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.