View Single Post
  #11 (permalink)  
Old Mar 22nd, 2008, 16:53
acrikey's Avatar
acrikey acrikey is offline
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP database code issue

Ok this is what I have got on the new page:

Code: Select all
<?php
ob_start();
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name

m// issue the query
$sql = "SELECT * FROM users WHERE
        username = '".$_POST["username"]."' AND
        password = PASSWORD('".$_POST["password"]."')";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
if($info = mysqli_fetch_array($result)) { 
        //display string
    $display_block = "
    <p>".$info['f_name']." <p>
    <p>".$info['l_name']." <p>";

echo $display_block; 
} else {
   echo '<p>Wrong username and password!</p>';
} 
?>
Reply With Quote