Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 22 Apr 2004, 00:23
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Real name: Bill
Lightbulb Writing installer for PHP-challenged friend, need help.

One of my friends just got a new script he wants to install, but since he has no clue how PHP/SQL work (just installed WinLAMP as an introduction) I've decided I'd write an installer script for this password-protection script. (Attachment 1)

As for my code, I'm getting odd errors.
The installer is now running the installation queries . .
Fatal error: Call to a member function on a non-object in c:\apache\htdocs\tst\install.php on line 88
My install.php file, hand coded (although the HTML was "borrowed" from the original script to keep a consistant "feel" ) is attached (Attachment 2) and I would like some assistance.

PS - I know that to install this script, all that's needed is modify 1 PHP and run 1 query, but I would also like to expand my knowledge about PHP, and have decided to write this script as a practice. Help would be greatly appreciated.
Attached Files
File Type: zip MX-Login_v1.5.2.zip (17.9 KB, 6 views)
File Type: php install.php (3.3 KB, 7 views)
Reply With Quote
  #2  
Old 22 Apr 2004, 04:33
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Real name: Mike
The non-object error is referencing to this area of your code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

$query is not declared as an object from any class.

I think you have your syntax mixed up, and are relating it to vBulletin's $DB_site.

vBulletin uses a class that $DB_site is originated from, see includes/init.php and includes/db_mysql.php.

Take a look at the mysql functions:
www.php.net/mysql

You need only run mysql_query() to run queries, no -> notation.

Although, I highly recommend for non-vB uses, to find yourself a good MySQL class to work by. There are many out there, from simple to highly sophisticated, from sites like PHP's PEAR or Eclipse (OO library).

Here is a simple example:
http://www.sitepoint.com/forums/show...54&postcount=4

Or:
http://www.sitepoint.com/forums/show...6&postcount=64

Although there are some critical design flaws in the code of that zip, and install.php. It's a good practice and standard not to combine HTML and PHP. Being this is for your friend, it's not that critical, but for larger projects I suggest getting a template engine like Smarty.

And, in "dbinc.php", there is no reason to separate each code chunk with <?php and ?>, unless you are escaping to place HTML.
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
vBFOAF - Friend of a Friend exporter for vBulletin 3 Cloud-Warrior vBulletin 3.0 Full Releases 9 29 Nov 2007 15:13
vBFOAF - Friend of a Friend RDF metadata exporter for vBulletin 3.5 Cloud-Warrior vBulletin 3.5 Add-ons 7 29 Nov 2007 15:12

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 03:28.

Layout Options | Width: Wide Color: