View Single Post
  #7  
Old 04-18-2010, 07:12 AM
Citizen Bleys Citizen Bleys is offline
 
Join Date: Feb 2003
Location: Moncton, NB
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now we're getting somewhere! OK, the standalone test works; I couldn't get it working in my main page so I started doing some trial and error. I wrote the parseMe() function at the very top of index.php right after calling global.php. It tested OK everywhere in index.php up until I called main.php. Just to be sure, I called parseMe() right before include('main.php') and it worked, but it failed right after.

I started moving down main.php until I found the code causing the failure:

PHP Code:
include('frontconfig.php'); // contains db name, username, password, etc.

echo parseMe("[b]Hello![/b]"); // works here

if (!($db mysql_connect($db_host,$db_user,$db_password))) {
 echo 
"<p>\$db_host is $db_host</p>";
 echo 
"<p>\$db_user is $db_user</p>";
 exit(
"MySQL database connection failed!");
}

echo 
parseMe("[b]Hello![/b]"); // fails here with same reference to read_query_slave() 
This makes no sense at all...I didn't even do anything with the db, just opened a connection and made sure it didn't fail.

EDIT: More "This makes no sense" -- I tried switching to MySQLi instead and commented out the whole if statement above.

This, placed directly below the above (commented out) code fails:

PHP Code:
$db mysqli_connect($db_host,$db_user,$db_password,$db_name)
 or die (
"MySQL failed to connect!");

echo 
parseMe("[b]Hello![/b]"); 
THIS, however, works

PHP Code:
$throwaway parseMe("[b]Hello![/b]");  // This variable is never again referenced ANYWHERE.  It has the same impact on the code as a comment.
// but fails if it's commented out.

$db mysqli_connect($db_host,$db_user,$db_password,$db_name)
 or die (
"MySQL failed to connect!");

echo 
parseMe("[b]Hello![/b]"); 
The new error from commenting out the do-nothing line is:

Code:
Fatal error: Call to undefined method mysqli::query_read_slave() in /homepages/32/d89350510/htdocs/forums/includes/class_bbcode.php on line 220
Same line, same file, different error.

I eventually got my script working BUT I sure would like to know why I have to call a function for no reason in the middle of my script

EDIT: Spoke too soon -- as soon as I use a Quote tag in any of my posts, the frontsite script crashes with this error:

Code:
Fatal error: Call to undefined method mysqli::query_read_slave() in /homepages/32/d89350510/htdocs/forums/includes/functions.php on line 3912
same thing occurred with the code and php tags...I'm not sure what these bbcodes have in common what makes them blow up the front site but everything else works fine
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01274 seconds
  • Memory Usage 1,782KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete