Jump to content


This topic is now archived and is closed to further replies.


Getting data from MySQL w/ validation.

Recommended Posts

Well.. ryt now im working with a WAP site.
Here's my site. [a href=\"http://www.wapthesis-ml.net\" target=\"_blank\"]WAPTHESIS[/a].

Ok here's the scenario, after a successful login, the user will prompt to choose
PRELIM MIDTERM and FINALS. I want to display the Data from DATABASE(Name,year_level,etc..) of that user who just made a successful login, what i meannot all the DATA in the database just for the user who made i successful login. Im Really stuck ryt now..
Hope someone help a Noob like me.

Share this post

Link to post
Share on other sites
can I suggest you show us your login script so we can have a clue what the problem is?

Share this post

Link to post
Share on other sites
//convert the field values to simple variables

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

//set the database connection variables

$dbHost = "localhost";
$dbUser = "";
$dbPass = "";
$dbDatabase = "wpthes_mobilegrades";

//connect to the database

$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");

mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");

$result=mysql_query("select login_id from login where username='$username' AND password='$password'", $db);

//check that at least one row was returned

$rowCheck = mysql_num_rows($result);
if($rowCheck > 0){
while($row = mysql_fetch_array($result)){

  //successful login code will go here...
  header("Location: period.php");

  else {

  //if nothing is returned by the query, unsuccessful login code goes here...

  echo 'Incorrect login name or password. Please try again.';
  ?> [/code]

Share this post

Link to post
Share on other sites


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.