Page 1 of 1

only selecting user_name and password as the values in form

Posted: Thu Apr 12, 2007 11:20 am
by franknu
Ok, I have this code that i need to update the form the problem is that when the user type in his user name and password the only values that shows from the database are his user name and password so he cannot make any changes, well actually if the user hit submit it it will replace everything that is on the database


i will only show part of the code where the problem is

Code: Select all

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']);

//$query = "SELECT * FROM business_info where  
 //User_Name='$User_Name' 
//AND Password='$Password'";
//$usercheck=$query;
//$result = mysql_query($query);





//$usercheck = mysql_query("SELECT * FROM business_info where 
//User_Name='$User_Name' 
//AND Password='$Password'",$db);
//$userrow = mysql_fetch_array($usercheck);
//$num_rows = mysql_num_rows($usercheck);

$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>";
    }
  } 
else 
{
    echo "Query failed<br />$query<br />". mysql_error();
  }

echo "GET=";
print_r($_GET);
echo "<BR>POST=";
print_r($_POST);


echo ' <table border>';
 echo'<tr>';

   echo'<td>';
   echo'<table>';
the comments are old code that i change to see if that was the problem but it was not

this is what i get when i echo POST and GET

GET=Array ( )
POST=Array ( [User_Name] => franknu [Password] => abc123 [submit] => LogMeIn )

please help been trying to get this to work for months

Posted: Thu Apr 12, 2007 2:03 pm
by RobertGonzalez
What is the table structure for the table `business_info`?