PDA

View Full Version : help me to make this query compatible with vb4.2.3


SilverBoy
06-10-2016, 02:38 AM
Hi

I have this 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
$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
$pagetext = $section["pagetext"];

with
$pagetext = $section["contentid"];
it works
or
$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
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).

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
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 1465774866 at 1465774866 ---------------

now I'm using PHP 5.6.22 and vb4.2.3