soupy127 Posted April 21, 2010 Share Posted April 21, 2010 Hi trying to create an admin script that uses sessions, so that i can call this script so that the pages can only be viewed by admins. Here is my script so far and i keep getting error on line 13 please help im not very good at php. <?php //session start and get variable session_start(); $username = $_SESSION['username']; //connect to database $connect = mysql_connect("localhost","root","") or die ("sorry couldn't connect"); mysql_select_db("duffers") or die("couldnt connect"); $get = mysql_query("SELECT * FROM users WHERE username='$username'") while ($row = mysql_fetch_assoc($get)) { $admin = $row['admin']; } if ($admin==0) die("Your Not an Admin!"); ?> Any help would be greatly appreciated thanks Link to comment https://forums.phpfreaks.com/topic/199306-please-help-admin-pages/ Share on other sites More sharing options...
Ken2k7 Posted April 21, 2010 Share Posted April 21, 2010 $get = mysql_query("SELECT * FROM users WHERE username='$username'") ^ forgot semi-colon Link to comment https://forums.phpfreaks.com/topic/199306-please-help-admin-pages/#findComment-1046054 Share on other sites More sharing options...
soupy127 Posted April 21, 2010 Author Share Posted April 21, 2010 Your a life saver, cant believe how stupid i was haha thanks very much again!! Link to comment https://forums.phpfreaks.com/topic/199306-please-help-admin-pages/#findComment-1046058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.