vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Writing installer for PHP-challenged friend, need help. (https://vborg.vbsupport.ru/showthread.php?t=64219)

dstruct2k 04-21-2004 11:23 PM

Writing installer for PHP-challenged friend, need help.
 
1 Attachment(s)
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. :D

Velocd 04-22-2004 03:33 AM

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. ;)


All times are GMT. The time now is 09:05 PM.

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.01076 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete