jtjohnson260 Posted August 17, 2007 Share Posted August 17, 2007 I have the first part of the page working fine. But once I submit any info i get this message. I got the code from neur0n (one of the games in the contest) Fatal error: Call to a member function on a non-object in /home/content/z/h/a/zhahaman2001/html/jtjohnson260/register.php on line 45 this is line 45 if (! $sql->query("INSERT INTO users (username, password, email, date_registered) VALUES ('$username', '$password', '$email', NOW())") ) { I attached the code in case there is other stuff [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/65482-cant-get-register-to-work/ Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 you need to declare the $sql ie include "myclass.php" $sql = new myclass(); Quote Link to comment https://forums.phpfreaks.com/topic/65482-cant-get-register-to-work/#findComment-326944 Share on other sites More sharing options...
jtjohnson260 Posted August 17, 2007 Author Share Posted August 17, 2007 can u tell me where to put that. i'm still kinda new Quote Link to comment https://forums.phpfreaks.com/topic/65482-cant-get-register-to-work/#findComment-326947 Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 erm.. in another file that uses $sql-> your find a line like include "something"; $sql = new something; best bet is to find that.. and copy it Quote Link to comment https://forums.phpfreaks.com/topic/65482-cant-get-register-to-work/#findComment-326954 Share on other sites More sharing options...
ToonMariner Posted August 17, 2007 Share Posted August 17, 2007 if you switch to the wonderful php5 you can use the __autoload function which - if you follow the rules - loads those scripts contianing the class you have written for you - saving you time and resources as it only loads those files required... Quote Link to comment https://forums.phpfreaks.com/topic/65482-cant-get-register-to-work/#findComment-326979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.