Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 06-10-2016, 02:38 AM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default help me to make this query compatible with vb4.2.3

Hi

I have this code
PHP Code:
$sql "SELECT a.pagetext,a.contentid, a.previewimage, node.nodeid, node.parentnode, node.url, info.title, node.myfeaturetype
            FROM " 
TABLE_PREFIX "cms_article as a
            LEFT JOIN " 
TABLE_PREFIX "cms_node AS node ON a.contentid = node.contentid
            INNER JOIN " 
TABLE_PREFIX "cms_nodeinfo AS info ON info.nodeid = node.nodeid
            WHERE node.myfeaturetype = '4'
            ORDER BY node.publishdate DESC "
;
    

    
$result $vbulletin->db->query_read_slave($sql);
    
$sections = array();
    while (
$section $vbulletin->db->fetch_array($result)) {
        
  
$pagetext $section["pagetext"];
        
$sections[] = array(
                
'title' => $section['title'],
                
'link' => $vbulletin->options['bburl']."/content.php?".$section['nodeid'].'-'.$section['url'],
                       
'description' => get_summary($pagetext,$des_length),
                       
'image' => $previewimage
               
); 
I want to make it compatible with vb4.2.3 syntax
for example in this line
PHP Code:
 $pagetext $section["pagetext"]; 
If I changed $section["pagetext"] with any other variable form the query it works, but if I use it with variable with type mediumtext it returns NULL.
Any help?
Reply With Quote
  #2  
Old 06-10-2016, 10:00 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont really know what you mean by "make it compatible with vb4.2.3 syntax".

There isnt such a thing as 4.2.3 Syntax.

That query is clearly designed for vB4 as its reading the cms tables, and aside from the fact there is no such column as "myfeaturetype" in the node table (I assume thats something you added) then the query is fine.

Have you actually run the query ?
What makes you think pagetext is empty/null ?

(and where is $des_length set ?)
Reply With Quote
  #3  
Old 06-10-2016, 03:49 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I mean compatible with mysqli

I run the query and it gives me output if the pagetext not mediumtext type.

if I changed this line
PHP Code:
  $pagetext $section["pagetext"]; 
with
PHP Code:
  $pagetext $section["contentid"]; 
it works
or
PHP Code:
  $pagetext $section["previewimage"]; 
only fields with mediumtext retutrn blank.

BTW this code was work perfectly with vb4.2.1
Reply With Quote
  #4  
Old 06-10-2016, 04:01 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here is the complete file
Attached Files
File Type: php include.php (10.9 KB, 4 views)
Reply With Quote
  #5  
Old 06-11-2016, 01:38 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

I dont see what relevance pagetext being mediumtext is, php does not care (nor does vbulletin, and and its always been that type anyway).

Quote:
I run the query and it gives me output if the pagetext not mediumtext type
What you mean by this, run the query how ?
I dont believe you are running this query direct on the server, and changing the column type (and to what would you change it anyway).

The code you posted above isnt in the file you attached, though some similar looking code is.

Have you done any debugging to print $section directly after the start of the While loop ?
I seriously doubt pagetext is actually empty, more likely all the functions you are running it through are doing something.
Reply With Quote
  #6  
Old 06-11-2016, 03:48 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes the code is not same, I modified it a little bit in debugging process.

I run the query by running the file

Anyway pagetext not empty it is the pagetext of the the articles on my site.
Reply With Quote
  #7  
Old 06-12-2016, 12:19 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SilverBoy View Post
Anyway pagetext not empty it is the pagetext of the the articles on my site.
Exactly, so one of the many functions you are running it through is doing something, so you need to figure out which.
Reply With Quote
  #8  
Old 06-12-2016, 09:40 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tested all functions and it works fine and the whole file was work great with vb4.2.1 and PHP 5.3.28.

--------------- Added [DATE]1465774866[/DATE] at [TIME]1465774866[/TIME] ---------------

now I'm using PHP 5.6.22 and vb4.2.3
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:23 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.04531 seconds
  • Memory Usage 2,259KB
  • Queries Executed 12 (?)
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
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (8)postbit_onlinestatus
  • (8)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_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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete