vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How grab one post ? (https://vborg.vbsupport.ru/showthread.php?t=152118)

roxxx 07-13-2007 08:41 AM

How grab one post ?
 
How can I grab one post and display in other site ?

What is question to Mysql to do it ?

Dismounted 07-13-2007 09:00 AM

[sql]SELECT *
FROM `INSERTTABLEPREFIXpost`
WHERE `postid` = INSERTID[/sql]
Make sure you replace the capitalised words.

roxxx 07-13-2007 10:50 AM

thanks,

I want to connect to database and I use include("config.php") but what's next ?,
which function to co-operate with it ?

Eikinskjaldi 07-13-2007 11:03 AM

Quote:

Originally Posted by roxxx (Post 1289884)
thanks,

I want to connect to database and I use include("config.php") but what's next ?,
which function to co-operate with it ?

You dont want to include config.php, you want to include globals.php


then $vbulletin->db is ready to go.

roxxx 07-13-2007 06:16 PM

ok,

so I have:

Code:

<?
require("global.php");
$res = mysql_query("SELECT * FROM post WHERE postid='1111'");
 $row= (mysql_fetch_row($res));
echo ($row[7]);
?>

:)

and it's display this post in other site, but when I want to add new plugin file .php with this code,
forum display error:

Code:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 311296 bytes) in ............. global.php on line 472
I have limit memory in php.ini 16M.

Is it problem this code or limit ?

Eikinskjaldi 07-13-2007 11:51 PM

No where near enough information to answer your question, I am afraid.

the php memory limit is settable in php.ini. You wil have to restart apache once you change it.

Paul M 07-14-2007 12:31 AM

You shoud be using vb's query functions, not the mysql functions. :)

roxxx 07-14-2007 06:23 AM

ok, I should using vb's query functions:
Code:


require("global.php");

$getposts = $db->query_read("
SELECT post.postid AS postid, post.pagetext AS pagetext
FROM " . TABLE_PREFIX . "post AS post
WHERE postid='1111';");
//while($post = $db->fetch_array($getposts))
    $post = $db->fetch_array($getposts);

                    echo "<b>".$post['postid']."</b> - ".$post['pagetext']."<br /><br />";

but is the same error,
is it possible that only choose one post, take that isn't enough memory ?

Dismounted 07-14-2007 06:24 AM

PHP Code:

<?php
$curdir 
getcwd();
chdir('./PATH/TO/FORUMS');
require_once(
'./global.php');
chdir($curdir);

$post $vbulletin->db->query_first("
    SELECT *
    FROM `post`
    WHERE `postid` = 1111
    LIMIT 1
"
);

echo 
$post['message'];
?>



All times are GMT. The time now is 02:58 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.01126 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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