Jump to content

MattAdamson

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MattAdamson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks so much for that answer! I will get to trying it out and post back with how it goes :) Thanks again!
  2. Sorry I missed that, it creates the object like below [code] //require the drivers for connection to mysql require('lib/driver.inc.php'); //create a new object for page class $connect = new CDriver(); [/code] I added those two lines at the top of my script and get a fair few "Notice:" also some undefined varibles but those are not such a big deal as they are from unfinished areas of code and my original "Warnings" about the supplied argument is not a valid link. The "Notice" that appears is as follows. Notice: Use of undefined constant havoc_site - assumed 'havoc_site'
  3. It is several pages which are fairly long as I include files but I will post as much as I can :) thanks for helping. I hope this enough, I think Ive provided everything? index.php [code] //require the drivers for connection to mysql require('lib/driver.inc.php'); //start session before anything else session_start(); //create a new object for page class $connect = new CDriver(); //open connection to database and leave open for all queries to use $connect -> Connect(); //requires authorize to check if a user has tried to login, it creates a session for them require_once('lib/user_func.inc.php'); $user_func = new user_func(); $user_func->check_login(); [/code] section of user_func.php, function for checking login [code] //create a query $sql = "SELECT * FROM users"; $connect->Query($sql); [/code] driver.inc.php [code] class CDriver { var $db_conn; var $db_config; var $db_list; var $table_list; function Connect() { $this->db_conn = mysql_connect('localhost', '*', '*') or die(mysql_error());     mysql_select_db( havoc_site, $this->db_conn ) or die(mysql_error()); } //function to execute mysql query function Query($query) { $result = mysql_query($query, $this->db_conn); if($err = mysql_error($this->db_conn)) { echo "Error on query: ". $query . "<br>" . $err ; } else { return $result; } } [/code]
  4. I have indeed, this is on my main page which calls the rest of the class's and functions. [code]//open connection to database and leave open for all queries to use $connect -> Connect();[/code] Thanks again but anything else?
  5. Can anyone make anymore suggestions?  ???
  6. I create the object here [code] //create a new object for page class $connect = new CDriver(); [/code] $this->db_conn  comes from my database class, I will include the whole class below, it includes the problem code also. [code]class CDriver { var $db_conn; var $db_config; var $db_list; var $table_list; function Connect() { $this->db_conn = mysql_connect('localhost', '*', '*') or die(mysql_error());     mysql_select_db( havoc_site, $this->db_conn ) or die(mysql_error()); } //Dissconnect from the database function Dissconnect() { mysql_close($this->db_conn); } //function to execute mysql query function Query($query) { $result = mysql_query($query, $this->db_conn); if($err = mysql_error($this->db_conn)) { echo "Error on query: ". $query . "<br>" . $err ; } else { return $result; } } }[/code] [b]edit(shoz): Login details removed[/b]
  7. Hey thanks for the suggestion! :) Ive changed this back as it was something I changed to see if I could get the code working, either way I still get the same error though  :( Any other suggestions please?
  8. I have this section of code which was working fine before, I cant remember the changes I made to stop it working, it should perform a query but it keeps kicking up the "mysql_query(): supplied argument is not a valid MySQL-Link resource" so Im assuming that the query being passed to my function is not correct as the error handling for my database connection kicks up nothing. I hope this is explained enough, if I need to mention anything else please do say so. I will paste my query function below and also the piece of code passing the query to it. Thanks very much for reading :D [code] function Query($query) { $result = mysql_query($this->query, $this->db_conn); if($err = mysql_error($this->db_conn)) { echo "Error on query: ". $query . "<br>" . $err ; } else { return $result; } } [/code] [code]else { //set login error to true $login_error = true; //create a query to update the last time the user failed to login $sql = "UPDATE users SET last_failed = '$now' WHERE username = '{$mysql['username']}'"; $connect->Query($sql); }[/code]
×
×
  • 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.