bob2006 Posted April 24, 2007 Share Posted April 24, 2007 ok the script im working on is not putting the right info in the database it should put the username and userid of the person that i click on but it is inserting readom usernames and userid here the script i have i hope that some one can help <? include'db.php'; include'userinfo.php'; include'admin_c.php'; include'admin_info.php'; if($_GET['add'] == "admin2") { //Create User In Database $INSERT=mysql_query("INSERT INTO `admin`(userid,username) VALUES ('$userid', '$username')")or die(mysql_error()); }else{ if($_GET['add'] == "admin") { include'all_users.php'; }else{ if($level==5){ echo"5"; }else{ if($level==4){ echo"level four"; }else{ if($level==3){ echo"level three"; }else{ if($level==2){ echo"level two"; }else{ if($level==1){ echo"level one"; }else{ if($level==0){ echo"<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='20%'>User Info DataBase</td> <td width='20%'>Email Accounts</td> <td width='20%'><a href=?add=admin>Add Admin</a></td> <td width='20%'>Delete Admin </td> <td width='20%'>Suspend Admin </td> </tr> <tr> <td width='20%'>Change Amin Rights </td> <td width='20%'>Add New Users </td> <td width='20%'>Changed Admin Passwords </td> <td width='20%'>Change Users Passwords </td> <td width='20%'>Read Email </td> </tr> <tr> <td width='20%'>Delete Members Accounts </td> <td width='20%'>Suspend Members Accounts</td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> </table> "; } } } } } } } } ?> Quote Link to comment Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 Your insert looks fine, can I see the code where the 2 variables get populated, also can you give an example of what you entered and what gets inserted? Quote Link to comment Share on other sites More sharing options...
bob2006 Posted April 24, 2007 Author Share Posted April 24, 2007 this scprint with anouther one here is all_users.php <? include'db.php'; $data = mysql_query("SELECT * FROM users ") or die(mysql_error()); while($info = mysql_fetch_array ( $data )) { $username=$info[username]; $userid=$info[user_id]; $password=$info['password']; echo"<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='33%'><a href=?add=admin2&userid=$userid&username=$username>$username</a> </td> <td width='33%'>$userid </td> <td width='33%'>$emial </td> </tr> </table> "; } ?> the script above pull all the username , userid,and email that is in the users table in my database make and then make the info puled from the database in to a link with all the info i pull out so i can insert in to that admin table Quote Link to comment Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 your include for allusers.php is below your insert, in the chain of events the fields wont be populated properly, try moving your include with the rest of them at the top.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.