hye guys im new here. how do i want to display data from database to web page based on login ?example i already key in john as username and password as blahblahblah . so after login i want to go another page (lala.php).
at lala php , i want it appear as "welcome ___ as __ " . the _ means data from database. means welcome john as admin . john = username from database and admin = userrole from database. i already try coding while(mysql_fetch_array) but it appear 2 times welcome because i enter 2 admin data in database(loop). how to display data from database based on which username i logged in as admin ?

if (isset($_POST['userpass']))

  include("config1.php");

  $username = $_POST['username']; 
  $userpass = $_POST['userpass'];

  $query = "select * from login where username = '$username' and userpass = '$userpass'"; 
  $result = mysql_query($query); 
while ($try = mysql_fetch_array($result, MYSQL_ASSOC)) 
{
 echo $row['username'] . " " . $row['userrole'];
  echo "<br>";
}
}
mysql_close();

at webpage it appear " Warning: mysql_close(): no MySQL-Link resource supplied in C:xampphtdocsadminmain.php on line 27 " if i remove mysql_close(); there are no data from database shows

?>

Recommended Answers

All 8 Replies

besides from using the deprecated mysql_ function, your query is not properly constructed.

It should be constructed like this. Assuming that the $db is the persistent database connection. Make sure to add an error catcher. I am just giving you the most basic example.

$result = mysql_query($query,$db); 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){

     echo $row['username'] . " " . $row['userrole'];

        echo "<br>";
}

to close the connection

   mysql_close($db);

Although it is not a problem to use $try as variable, it is highly recommended not to use PHP reserved keywords at all cost.

remember $db is something like this

$db = mysql_connect($dbhost, $dbuser, $dbpass);

if you don't want it like that, this will work also, but you will have to remove all the reference to $db from my example above

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db("Your_database_table") or die(mysql_error());

$query = "select * from login where username = '$username' and userpass = '$userpass'"; 

$result = mysql_query($query); 

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){

     echo $row['username'] . " " . $row['userrole'];

        echo "<br>";
}

then you can close it like this

mysql_close();

No what you are describing only going to happen, if you are running a query for admin, your while loop should only give you one result.

or may be you have two user, with same username,with same password and both are admin

in that why you did like that, and second post your code for form ass well and tell us what result your getting for your echo statement in while loop, and what you are doing in config.php, other might be able to help you with out those things but i cant,

english not first language if you are confuse ask again i will reply

thanks

To transfer the data:

After redirect (probably using header("Location: lala.php");) you will need to use sessions.

At the top of your code above and on lala.php, place session_start().

## Repalce this

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
     echo $row['username'] . " " . $row['userrole'];
        echo "<br>";
}

## With this

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
     $_SESSION['username'] = $row['username'];
     $_SESSION['userrole'] = $row['userrole'];
}

Then on lala.php use this code:

<?php
session_start();

echo $_SESSION['username'] . " as " . $_SESSION['userrole'];

?>

You can refine this code alot more, so it's merely a starting point.

thanks for the reply. i still cant understand . when i call

$username = $_POST['username']; 
$userpass = $_POST['userpass'];

it say in the browser undefined username and userpass. how to call username and userpass from the login to this page ? and $_session is use for what ? i already try session

<?php
    session_start();
    if (isset($_POST['userpass']))
    {
    include("config1.php");
    $username = $_POST['username']; 
    $userpass = $_POST['userpass'];
    $query = "select * from login where username = '$username' and userpass = '$userpass'"; 
    $result = mysql_query($query); 


  while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  {
     $_SESSION['username'] = $row['username'];
     $_SESSION['userrole'] = $row['userrole'];

     echo $_SESSION['username'] . " as " . $_SESSION['userrole'];
     }
}    
 ?>

but it appear to white screen . (nothing display). sorry im newbie :(
and this is my config1.php

<?php
$host="localhost";    //Host name
$username="mhmdazlan";  //Mysql username
$password="baby900";  //Database password
$db_name="epbthelpdesk";   //table name
$tbl_name="login"; // Table name


//connect to server and select database
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
?>

You need to give us your form codes.

If you have one like this

<form action="" method="post">
<input type="text" name="username"/>
<input type="password" name="password"/>

<input type="submit" name="submit" value="login">

</form>

then the above codes should be wrapped with this statement

if(isset($_POST['submit'])){

    //put all of your codes here



 }   

this is my form code. login.php

<html>
<body background = "try.jpg">
<form name="form1" method="post" action="checklogin.php" onSubmit="return validate()">

  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="msc.jpg" width="769" height="200"> 
  <p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
  <p><font size="6" color="#0000A0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#00FFFF">&nbsp;&nbsp;&nbsp;<b><font face="Times New Roman, Times, serif"><u>EPBT 
    HELPDESK LOGIN PAGE</u></font></b></font></font></p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </font></b></font></p>

<p><font color="#00FFFF"><b><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PASSWORD: 
  </font></b></font><font color="#C0C0C0"><b><font size="4">&nbsp;</font></b></font><b><font size="4" color="#FFFFFF">&nbsp;</font></b><font size="4" color="#00FFFF">&nbsp;</font><font size="4">&nbsp; 
  <input type="password" name="userpass" size = "50">
  &nbsp;&n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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    <input type="submit" name ="Submit" value="Login" style="height:50px; width:120px">
    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;
    <input type="reset" name ="reset" value="Clear" style="height:50px; width:120px">
    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </p>

<p>&nbsp;</p>
  <p>&nbsp;<font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://helpdesk.epbt.net/ePBTUserGuide/UserManual.html">&nbsp;USER 
    MANUAL</a>&nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>

<SCRIPT LANGUAGE="JavaScript"> 

function validate() {
var invalid = " ";
if (document.form1.username.value == "") {
alert("INSERT YOUR USERNAME");
document.form1.username.focus();
return false;

and this is my checklogin.php

<?php
 if (isset($_POST['userpass'])) // if the password is set then the  form has been submitted on login.php page
{

 include("config1.php");
 $username =  mysql_real_escape_string($_POST['username']);
 $userpass = mysql_real_escape_string($_POST['userpass']);
 $qstr = "SELECT * from login where username ='$username' and userpass ='$userpass'";

 $result = mysql_query($qstr);
 $count =mysql_num_rows($result);

 if($count==1)
 {
   $fetch=mysql_fetch_row($result);

  if($fetch[5]=='ADMIN')
  {
     echo ("<SCRIPT LANGUAGE='JavaScript'>
    window.alert('LOGIN SUCCESS.WELCOME ADMIN')
    window.location.href='adminmain.php';
    exit();
    </SCRIPT>");
 }
  else if($fetch[5] =='USER')
   {
   echo ("<SCRIPT LANGUAGE='JavaScript'>
    window.alert('LOGIN SUCCESS.WELCOME USER')
    window.location.href='usermain.php';
    exit();
    </SCRIPT>");
    }
}   
else 
    {
    echo ("<SCRIPT LANGUAGE='JavaScript'>
    window.alert('WRONG USERNAME OR PASSWORD.PLEASE TRY AGAIN')
    window.location.href='login.php';
    exit();
    </SCRIPT>");
    }
} 

 mysql_close();



?>


}
if (document.form1.userpass.value == "") {
alert("INSERT YOUR PASSWORD");
document.form1.userpass.focus();
return false;
}

i didn't have problem go to page checklogin.php. it appear as alert box to tell admin or user that login . but when it come to adminmain.php , it didn't appear data from database based on which admin i logged in . i use the same method like checklogin.php, and use fetch array like that but didnt work too. this is my adminmain.php . (same like coding i sent first.)

<?php
    session_start();
    if (isset($_POST['userpass']))
    {
    include("config1.php");
    $username = $_POST['username']; 
    $userpass = $_POST['userpass'];
    $query = "select * from login where username = '$username' and userpass = '$userpass'"; 
    $result = mysql_query($query); 


  while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  {
     $_SESSION['username'] = $row['username'];
     $_SESSION['userrole'] = $row['userrole'];

     echo $_SESSION['username'] . " as " . $_SESSION['userrole'];
     }
}    
 ?>

It's really hard to tell what's in your code with all those nbsp;'s but.. Your form should be structured like this:

<form action="checklogin.php" method="post">
    <label>Username
        <input type="text" name="username" />
    </label>
    <label>Password
        <input type="password" name="password" />
    </label>
        <input type="submit" value="Log In" name="submit" />
</form>

From what I can tell it seems like all the pieces are broken apart across your code, they need to be organized together in a fashion liek this.

And I would highly suggest taking a little time to learn how to organize all of your formatting (fonts, colors, etc..) into CSS format.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.