Jump to content

Selecting Data From the Database


franknu

Recommended Posts

Ok, This here should work, i've done this many times. i just dont see the problem now

 

after the user  verify him/herself i want to display the data which is in his/her row. the problem is that after it veryfied the user it seems to stop workin here is my code

 

 


db = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());



$BusinessName = (isset($_POST['BusinessName']) ? $_POST['BusinessName'] : '');
$Slogan = (isset($_POST['Slogan']) ? $_POST['Slogan']:'');
$Business_Address = (isset($_POST['Business_Address']) ? $_POST['Business_Address']:'');
$Tel = (isset($_POST['Tel']) ? $_POST['Tel']:'');
$Website = (isset($_POST['Website']) ? $_POST['Website']:'');
$Email = (isset($_POST['Email']) ? $_POST['Email']:'');
$Member_Status = (isset($_POST['Member_Status']) ? $_POST['Member_Status']:'');
$Fax =(isset($_POST['Fax']) ? $_POST['Fax']:'');
$type = (isset($_POST['type']) ? $_POST['type']:'');
$make = (isset($_POST['make']) ? $_POST['make']:'');
$Categories = (isset($_POST['Categories']) ? $_POST['Categories']:'');
$Keyword = (isset($_POST['Keyword']) ? $_POST['Keyword']:'');
$Picture1 =  (isset($_POST['Picture1']) ? $_POST['Picture1']:'');
$Headline =  (isset($_POST['Headline']) ? $_POST['Headline']:'');
$Slogan2 = (isset($_POST['Slogan2']) ? $_POST['Slogan2']:'');
$Description1 = (isset($_POST['Description1']) ? $_POST['Description1']:'');
$Description2 = (isset($_POST['Description2']) ? $_POST['Description2']:'');
$Description3= (isset($_POST['Description3']) ? $_POST['Description3']:'');
$Contact2 = (isset($_POST['Contact2']) ? $_POST['Contact2']:'');
$Picture2 =  (isset($_POST['Picture2']) ? $_POST['Picture2']:'');
$Picture3 = (isset($_POST['Picture3']) ? $_POST['Picture3']:'');
$Picture4 =  (isset($_POST['Picture4']) ? $_POST['Picture4']:'');
$User_Name = (isset($_POST['User_Name']) ? $_POST['User_Name']:'');
$Password = (isset($_POST['Password']) ? $_POST['Password']: '');
$User_Name=strtolower($_POST['User_Name']);
$Password=strtolower($_POST['Password']);

if ( isset($_POST['User_Name']) && isset($_POST['Password']) ) {


$query = "SELECT * FROM business_info WHERE User_Name='$User_Name' AND `Password`='$Password'";


}

  if ($result = mysql_query($query)) 
{
    if (mysql_num_rows($result))
{
      $row = mysql_fetch_assoc($result);

      $BusinessName= $row['BusinessName'];
      $Keyword = $row['Keyword'];
      $Picture1 =  $row['Picture1'];
      $Headline = $row['Headline'];
      $Slogan =$row['Slogan'];
      $Slogan2 = $row['Slogan2'];
      $Description1 =$row['Description1'];
      $Description2 = $row['Description2'];
      $Description3= $row['Description3'];
      $Contact2 =  $row['Contact2'];
      $Picture2 = $row['Picture2'];
      $Picture3 = $row['Picture3'];
      $Categories=$row['Categories'];
      $Business_Address= $row['Business_Address'];
      $make=$row['make'];
      $type=$row['type'];
      $Tel= $row['Tel'];
      $Website=$row['Website'];
    } 
else 
{
      echo "<p><b>username and/or password not found. Try
again?

</b></p>";
exit;
    }
  } 
else 
{
    echo "Query failed<br />$query<br />". mysql_error();
exit;
  }

?>

<?
echo'$query';
echo'

<table width="504" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="494"><table width="497" border="0">
      <tr>
        <td width="487">Banner</td>
      </tr>
      <tr>
  

      
   
 <td background="fondo2.jpg">Welcome $BusinessName </td>

      </tr>
      <tr>

Link to comment
https://forums.phpfreaks.com/topic/53030-selecting-data-from-the-database/
Share on other sites

Archived

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

×
×
  • Create New...

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.