Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2004, 11:23 PM
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Location: Winnipeg
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Quote:
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 04-22-2004, 03:33 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The non-object error is referencing to this area of your code:

PHP Code:
$query->query_mysql("CREATE TABLE $db_table_name
$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


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:02 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03818 seconds
  • Memory Usage 2,197KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_attachment
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete