vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   mysql_fetch_field() and mysql_num_fields() Warnings (https://vborg.vbsupport.ru/showthread.php?t=147972)

BamaStangGuy 05-23-2007 10:36 PM

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.

ZomgStuff 05-23-2007 11:09 PM

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

Paul M 05-23-2007 11:29 PM

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']; 


ZomgStuff 05-23-2007 11:35 PM

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!

BamaStangGuy 05-24-2007 02:38 AM

Thanks Paul. It is still returning that error within the Explain though :(


All times are GMT. The time now is 03:53 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.00931 seconds
  • Memory Usage 1,724KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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