vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   help me to make this query compatible with vb4.2.3 (https://vborg.vbsupport.ru/showthread.php?t=322818)

SilverBoy 06-10-2016 02:38 AM

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?

Paul M 06-10-2016 10:00 AM

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 ?)

SilverBoy 06-10-2016 03:49 PM

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

SilverBoy 06-10-2016 04:01 PM

1 Attachment(s)
here is the complete file

Paul M 06-11-2016 01:38 PM

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.

SilverBoy 06-11-2016 03:48 PM

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.

Paul M 06-12-2016 12:19 AM

Quote:

Originally Posted by SilverBoy (Post 2571948)
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.

SilverBoy 06-12-2016 09:40 PM

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


All times are GMT. The time now is 02:35 AM.

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.01023 seconds
  • Memory Usage 1,743KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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