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 05-23-2007, 10:36 PM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default mysql_fetch_field() and mysql_num_fields() Warnings

I have been having some problems on a script I am writing for one of my forums. In debug mode when I click explain on the main page of this script I get the errors below for every query I have that isn't a standard vBulletin query, however, all these queries run and produce the desired results.

However on another page, which is suppose to pass the id of a url and then retrieve the results of that id from the database, the query to get the data is not even ran and I am just presented with a warning that a field is missing. Same error when viewing the explain only thing is the query isn't listed as being ran.

I was wondering what are the reasons for the error below to be shown?

Here is one query that produces the following error, as it is run exactly:
PHP Code:
    // Count the total Artists
    
$artists_data $db->query_read("
            SELECT
            COUNT(artistid) AS artists
            FROM " 
TABLE_PREFIX "vblyrics_artists
    "
);

    
$total_artists $db->fetch_array($artists_data);
    
$totalartists $total_artists['artists']; 
Code:
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in /home/exforum/public_html/includes/class_database_explain.php on line 94

Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in /home/exforum/public_html/includes/class_database_explain.php on line 99
Any help would be great. This is really frustrating me.
Reply With Quote
  #2  
Old 05-23-2007, 11:09 PM
ZomgStuff ZomgStuff is offline
 
Join Date: Feb 2007
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't have your solution but I'm trying to do something similar to you and I'm a begginer.

If you could please help me out
AIM: twolvsefan369
msn: twolvesfan624@msn.com
Reply With Quote
  #3  
Old 05-23-2007, 11:29 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should really use query_first for that (and use slave if it's not a time critical read).


PHP Code:
    // Count the total Artists
    
$artists_data $vbulletin->db->query_first_slave("
            SELECT
            COUNT(artistid) AS artists
            FROM " 
TABLE_PREFIX "vblyrics_artists
    "
);

    
$totalartists $artists_data['artists']; 
Reply With Quote
  #4  
Old 05-23-2007, 11:35 PM
ZomgStuff ZomgStuff is offline
 
Join Date: Feb 2007
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a question, I placed that in my .php file and then I try to call it from my template
" $totalartists" and it shows up blank. I know I'm wrong and I'm new to this, so please bare with me!
Reply With Quote
  #5  
Old 05-24-2007, 02:38 AM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Paul. It is still returning that error within the Explain though
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 11:11 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04621 seconds
  • Memory Usage 2,209KB
  • Queries Executed 13 (?)
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_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete