Advertisement

05.14.2008 at 07:48PM PDT, ID: 23403857
[x]
Attachment Details

PHP error "Call to a member function query_column"

Asked by thawts in PHP and Databases, PHP for Windows, MySQL Server

Tags:

Here is the code, i am trying to make it so when someone does a / then a name the error php actually looks at this script and i am going to save whatever they put as / name as a session variable.  I run the script and i get the error

Fatal error: Call to a member function query_column() on a non-object in /home/maxgxl/public_html/replicate.php on line 28

I marked line 28 in the code

<?PHP
session_start();

$username_lookup = rtrim($_SERVER['REDIRECT_URL'],'/');
preg_match('/\/[A-Za-z0-9_\- ]+$/', $_SERVER['REDIRECT_URL'], $matches);
$username_lookup = substr(trim($matches[0]),1);

if($username_lookup){
      
      
      $ho = '';      
   $us = '';
   $pa = '';
   $dbName = '';

   // connect and select the database
   $conn = mysql_connect($ho, $us, $pa) or die(mysql_error());
   $db = mysql_select_db($dbName, $conn) or die(mysql_error());
      unset($_SESSION["user"]);

      
      28.   if($db->query_column("select user2 from username2 where user2='" . $username_lookup . "'")){
            $_SESSION["user"]["username"] = strtolower($username_lookup);
      }else{
            if($db->query_column("select user2 from distributors where username='" . $username_lookup . "' and active=1")){
                  $_SESSION["user"]["username"] = strtolower($username_lookup);
            }      
      }
      
      if($username_lookup == 'clearsession'){
            unset($_SESSION["user"]);
      }
}

if(!$_SESSION["user"]["username"]){
      header("Location: /real404.php");
}else{
      //header("Location: /index.php");
      include('index.php');
}

echo "<!--" . @$_SESSION["user"]["username"] . "-->";
?>


Looking for any advice on the coding.
Start Free Trial
[+][-]05.14.2008 at 10:03PM PDT, ID: 21570752

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 04:34PM PDT, ID: 21591102

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP for Windows, MySQL Server
Tags: PHP
Sign Up Now!
Solution Provided By: paulop1975
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628