Announcement

Collapse
No announcement yet.

Fatal error: non-object ....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Seanie
    replied
    Originally posted by U2Lynne View Post
    Please, please edit out your database username and password!

    Do you have mktime defined somewhere?
    thats not my actual db details

    Leave a comment:


  • Boothby
    replied
    $db is not an object, but a recource. Instead of $db->query you must use mysql_query().

    Leave a comment:


  • Lynne
    replied
    Please, please edit out your database username and password!

    Do you have mktime defined somewhere?

    Leave a comment:


  • Seanie
    started a topic Fatal error: non-object ....

    Fatal error: non-object ....

    Hiya

    I'm trying to make a basic events listing for my disertation/a website i run and have so far managed to get the form to write to the database, however when it comes to pulling off the records from the database I get the following error:

    Fatal error: Call to a member function on a non-object in /home/*/*/gigs.php on line 21

    Here's the code I'm using to connect, I know it connects because the files are on the database, its just pulling them off thats casuing the problem.

    Code:
    ####################################################################
    ################ DATABASE CONFIGURE ##############################
    ####################################################################
    $hostname = "localhost";
    $db_user = "username";
    $db_password = "seanie";
    $db_name ="database";
    $db_table = "gigs";
    
    # STOP HERE
    
    ####################################################################
    # THIS CODE IS USED TO CONNECT TO THE MYSQL DATABASE
    $db = mysql_connect($hostname, $db_user, $db_password) or die ('Error connecting to mysql');
    mysql_select_db($db_name);
    
    $timecutoff = mktime(0,0,0);
    
    	$events = $db->query("SELECT * FROM `gigs` WHERE `gig_date` > $timecutoff  ORDER BY `gig_date` ASC LIMIT 25"); //THIS IS LINE 21

    its an edited version of a script i was using to pull off events from a VB database, but I need to get it working on its own without VB for my dissertation.

    Any guidence would be hugely appreciated!


    Seanie!
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X