vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   would it be possible.... (https://vborg.vbsupport.ru/showthread.php?t=49381)

sabret00the 02-26-2003 12:03 PM

would it be possible....
 
...to pull a single post outta the db and have it displayed (just the post message not the whole postbit) on a non vB page?

filburt1 02-26-2003 01:27 PM

Why not?
PHP Code:

$result mysql_fetch_array(mysql_query("SELECT pagetext FROM post WHERE postid = ..."));
$pagetext $result['pagetext']; 


sabret00the 02-26-2003 03:51 PM

thanks filburt and i wouldn't have to include anyfiles would i?

Xenon 02-26-2003 04:38 PM

no, you just must have the db access :)

sabret00the 02-26-2003 06:54 PM

couldn't i just include the config.php to give it database access?

Xenon 02-26-2003 08:59 PM

nope, it's declared in global.php

sabret00the 02-26-2003 09:52 PM

thanks xenon and filburt :nervous:

sabret00the 02-27-2003 11:32 AM

sorry about this, but using

PHP Code:

$result mysql_fetch_array(mysql_query("SELECT pagetext FROM post WHERE postid = 60912"));
$pagetext $result['pagetext']; 

nothing comes up, i know it's gone into the database etc, but i dunno why it won't display the txt 0_o

Xenon 02-27-2003 11:44 AM

instead of:[code]mysql_fetch_array(mysql_query("SELECT pagetext FROM post WHERE postid = 60912"));[/php]

use
PHP Code:

$DB_site->query_first("SELECT pagetext FROM post WHERE postid = 60912")); 


sabret00the 02-27-2003 12:04 PM

i tried that and it gives me a parse error on that line

so then i tried defining $DB_site as

PHP Code:

$DB_site=mysql_connect($servername,$dbusername,$dbpassword); 

and i get the same parse error

any ideas?

Nomb 02-27-2003 12:13 PM

Instead of this:

PHP Code:

$DB_site->query_first("SELECT pagetext FROM post WHERE postid = 60912")); 

Use this:

PHP Code:

$DB_site->query("SELECT pagetext FROM post WHERE postid = 60912"); 


Sebastian 02-27-2003 01:02 PM

you are getting parse errors because there are no single quotes around the post id .. and there was an extra ) at the end.. try:

PHP Code:

$DB_site->query_first("SELECT pagetext FROM post WHERE postid = '60912'"); 


Xenon 02-27-2003 01:04 PM

Sebastian, the single quotes are not needet, just the ) was the buggy part

sabret00the 02-27-2003 01:15 PM

ok well i tried

PHP Code:

                                $result $DB_site->query("SELECT pagetext FROM post WHERE postid = 69502");
                                
$pagetext $result['pagetext']; 

and also just

PHP Code:

$DB_site->query("SELECT pagetext FROM post WHERE postid = 69502"); 

on it's own but now i get

Quote:

Fatal error: Call to a member function on a non-object in /home/sites/site18/web/test/index.php on line 138
and line 138 = the line we're trying to get to work

Xenon 02-27-2003 01:23 PM

you should use query_first as i told ya above...

sabret00the 02-27-2003 01:30 PM

done taht and i still get the same error, it's really baffling

Xenon 02-27-2003 01:39 PM

seems like you haven't required global.php so $DB_site hasn't been declared.

sabret00the 02-27-2003 02:01 PM

ok now i don't seem to have any errors however all coding beneath has dissapeared so nothing that comes after that codes appears on the page, could it be because i've already declared the $dbusername $dbpassword $servername and $dbname at the beginning of the file for use by something else?

Nomb 02-27-2003 04:16 PM

My bad on the query_first :ermm:

For sabret00the: What did you finally put in the file? Is this a core vB php file? I'm assuming it's not and in that case maybe you should post all the php.

sabret00the 02-28-2003 07:31 AM

nah it's still not working nomb

PHP Code:

                              case "poems":
                                require(
"../forums/admin/global.php");
                                
$result $DB_site->query_first("SELECT pagetext FROM post WHERE postid = 69502");
                                
$pagetext $result['pagetext'];
                              break; 

is the exact bit of code

and the whole file is

PHP Code:

<?
                                // username and password to log onto db server
                                $dbusername="xxxxx";
                                $dbpassword="xxxxx";

                                // hostname or ip of server
                                $servername="xxxxx";
                                
                                // name of database
                                $dbname="xxxxx";

                                $db=mysql_connect($servername,$dbusername,$dbpassword);
                                mysql_select_db($dbname);
?>


<HTML>
<HEAD>
<TITLE>EBS live</TITLE>
<link rel="stylesheet" type="text/css" href="css/css.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</HEAD>
<BODY BGCOLOR="#b0c0d0" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

<TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD ROWSPAN=2 background="images/ebslive_01.jpg" WIDTH="20%" HEIGHT="133"></TD>
        <TD ROWSPAN=2>
            <IMG SRC="images/ebslive_02.jpg" WIDTH=266 HEIGHT=133 ALT=""></TD>
        <TD COLSPAN=6>
            <IMG SRC="images/ebslive_03.jpg" WIDTH=501 HEIGHT=103 ALT=""></TD>
        <TD ROWSPAN=2 background="images/ebslive_04.jpg" WIDTH="20%" HEIGHT=133></TD>
    </TR>
    <TR>
        <TD HEIGHT=30>
            <a href="?page=life" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Life','','images/ebslive-on_05.jpg',1)"><IMG SRC="images/ebslive_05.jpg" WIDTH=59 HEIGHT=30 ALT="Life" name="Life" border="0"></a></TD>
        <TD HEIGHT=30>
            <a href="?page=music" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Music','','images/ebslive-on_06.jpg',1)"><IMG SRC="images/ebslive_06.jpg" WIDTH=88 HEIGHT=30 ALT="Music" name="Music" border="0"></a></TD>
        <TD HEIGHT=30>
            <a href="?page=screen" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Screen','','images/ebslive-on_07.jpg',1)"><IMG SRC="images/ebslive_07.jpg" WIDTH=89 HEIGHT=30 ALT="Screen" name="Screen" border="0"></a></TD>
        <TD HEIGHT=30>
            <a href="?page=sport" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Sport','','images/ebslive-on_08.jpg',1)"><IMG SRC="images/ebslive_08.jpg" WIDTH=88 HEIGHT=30 ALT="Sport" name="Sport" border="0"></a></TD>
        <TD HEIGHT=30>
            <a href="?page=games" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Games','','images/ebslive-on_09.jpg',1)"><IMG SRC="images/ebslive_09.jpg" WIDTH=89 HEIGHT=30 ALT="Games" name="Games" border="0"></a></TD>
        <TD HEIGHT=30>
            <a href="?page=web" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Web','','images/ebslive-on_10.jpg',1)"><IMG SRC="images/ebslive_10.jpg" WIDTH=88 HEIGHT=30 ALT="Web" name="Web" border="0"></a></TD>    </TR>
    <TR>
        
    <TD>&nbsp; </TD>
    <TD COLSPAN=7><br>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top" align="right">
            <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
              <TR> 
                <TD ROWSPAN=2 align="right" valign="top" nowrap width="100%"><?php include("incl/navigation.ebs.php"); ?>                </TD>
                <TD valign="top"> <IMG SRC="images/navigation.jpg" WIDTH=29 HEIGHT=133 ALT=""></TD>
              </TR>
              <TR> 
                <TD ROWSPAN=3 valign="top"></TD>
              </TR>
            </TABLE>
          </td>
          <td>&nbsp;</td>
          <td valign="top" width="450" align="center">
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD WIDTH=22 HEIGHT=22>
            <IMG SRC="images/tables_01.jpg" WIDTH=22 HEIGHT=22 ALT=""></TD>
        <TD background="images/tables_02.jpg" WIDTH="90%" HEIGHT=22 ALT=""></TD>
        <TD background="images/tables_03.jpg" WIDTH=88 HEIGHT=22 ALT="top right bit"></TD>
        <TD WIDTH=23 HEIGHT=22>
            <IMG SRC="images/tables_04.jpg" WIDTH=23 HEIGHT=22 ALT="top right corner"></TD>
    </TR>
    <TR>
        <TD background="images/tables_05.jpg"></TD>
        
                <TD COLSPAN=2 bgcolor="#FFFFFF" valign="top"> 
                  <?
                  switch ($page)
                  {
                      case "site":
                                  switch ($cat)
                          {
                              case "whatisebs":
                                  include "incl/site_whatisebs.ebs.php";
                              break;
                              case "staff":
                                  include "incl/site_staff.ebs.php";
                              break;
                              default:
                                  include "incl/site_index.ebs.php";
                          }
                  
                      break;
                      case "life":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/life_articles.ebs.php";
                              break;
                              case "gallery":
                                  include "incl/life_gallery.ebs.php";
                              break;
                              case "art":
                                  include "incl/life_art.ebs.php";
                              break;
                              case "cam":
                                  include "incl/life_cam.ebs.php";
                              break;
                              case "poems":
                                require("../forums/admin/global.php");
                                $result = $DB_site->query_first("SELECT pagetext FROM post WHERE postid = 69502");
                                $pagetext = $result['pagetext'];
                              break;
                              default:
                                  include "incl/life_index.ebs.php";
                          }
                  
                      break;
                      case "music":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/music_articles.ebs.php";
                              break;
                              case "chart":
                                  include "incl/music_chart.ebs.php";
                              break;
                              case "weekly":
                                  include "incl/music_weekly.ebs.php";
                              break;
                              case "monthly":
                                  include "incl/music_monthly.ebs.php";
                              break;
                              default:
                                  include "incl/music_index.ebs.php";
                          }
                  
                      break;
                      case "screen":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/screen_articles.ebs.php";
                              break;
                              case "reviews":
                                  include "incl/screen_reviews.ebs.php";
                              break;
                              case "recommended":
                                  include "incl/screen_recommended.ebs.php";
                              break;
                              default:
                                  include "incl/screen_index.ebs.php";
                          }
                  
                      break;
                      case "sports":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/sports_articles.ebs.php";
                              break;
                              case "ebsprem":
                                  include "incl/sports_ebsprem.ebs.php";
                              break;
                              default:
                                  include "incl/sports_index.ebs.php";
                          }
                      break;
                      case "games":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/games_articles.ebs.php";
                              break;
                              case "reviews":
                                  include "incl/games_reviews.ebs.php";
                              break;
                              default:
                                  include "incl/games_index.ebs.php";
                          }

                      break;
                      case "web":
                                  switch ($cat)
                          {
                              case "articles":
                                  include "incl/web_articles.ebs.php";
                              break;
                              case "reviews":
                                  include "incl/web_reviews.ebs.php";
                              break;
                              case "links":
                                  include "incl/web_links.ebs.php";
                              break;
                              default:
                                  include "incl/web_index.ebs.php";
                          }

                      break;
                      default:
                          include "incl/index.ebs.php";
                  }
                  
                  ?>
                </TD>
        <TD background="images/tables_07.jpg"></TD>
    </TR>
    <TR>
        <TD WIDTH=22 HEIGHT=44>
            <IMG SRC="images/tables_08.jpg" WIDTH=22 HEIGHT=44 ALT="bottom left bit"></TD>
        <TD background="images/tables_09.jpg" WIDTH="90%" HEIGHT=44 ALT=""></TD>
        <TD WIDTH=88 HEIGHT=44>
            <IMG SRC="images/tables_10.jpg" WIDTH=88 HEIGHT=44 ALT="bottom right bit"></TD>
        <TD WIDTH=23 HEIGHT=44>
            <IMG SRC="images/tables_11.jpg" WIDTH=23 HEIGHT=44 ALT="bottom right corner"></TD>
    </TR>
</TABLE>
          </td>
          <td>&nbsp;</td>
          <td width="150" valign="top" align="left">
<TABLE WIDTH="200" BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD WIDTH=22 HEIGHT=22>
            <IMG SRC="images/tables_01.jpg" WIDTH=22 HEIGHT=22 ALT=""></TD>
        <TD background="images/tables_02.jpg" WIDTH="90%" HEIGHT=22 ALT=""></TD>
        <TD background="images/tables_03.jpg" WIDTH=88 HEIGHT=22 ALT="top right bit"></TD>
        <TD WIDTH=23 HEIGHT=22>
            <IMG SRC="images/tables_04.jpg" WIDTH=23 HEIGHT=22 ALT="top right corner"></TD>
    </TR>
    <TR>
        <TD background="images/tables_05.jpg"></TD>
        
                <TD COLSPAN=2 bgcolor="#FFFFFF" valign="top" align="center" width="150"> 
                  <?
                                //Users online by Sebastian
                                $db=mysql_connect($servername,$dbusername,$dbpassword);
                                mysql_select_db($dbname);

                                if(isset($bbuserinfo["username"]) && ($bbuserinfo["username"] != "Unregistered")) { 
                                }
                                $username = $bbuserinfo["username"];
                                
                                $cookievalue = mysql_query("SELECT value FROM setting WHERE varname = 'cookietimeout'") or die("Error");
                                $cookietimeout = mysql_result($cookievalue, 0, 0);
                                $datecut = time()-$cookietimeout;
                                
                                $invisibleregmember = "0";
                                
                                if ($usernames == "on") {
                                    $regmembers = mysql_query("SELECT DISTINCT username,invisible FROM user,session WHERE session.userid=user.userid AND session.lastactivity>$datecut AND invisible='0' ORDER BY username ASC") or die("Error");
                                    while($regmember = mysql_fetch_array($regmembers)):
                                        ++$regmembercomma;
                                        if ($regmember[invisible] == 0) {
                                            $regmemberson .= $regmember[username];
                                        } else {
                                            ++$regmembercomma;
                                        }
                                        if ($regmembercomma < mysql_num_rows($regmembers)):
                                            $regmemberson .= ", ";
                                        endif;
                                    endwhile;
                                } else {
                                
                                  $regmemberson=0;
                                  $loggedins=mysql_query("SELECT DISTINCT session.userid,username,invisible,usergroupid FROM session LEFT JOIN user ON (user.userid=session.userid) WHERE session.userid>0 AND session.lastactivity>$datecut ORDER BY invisible ASC, username ASC");
                                  while ($loggedin=mysql_fetch_array($loggedins)) {
                                    $regmemberson++;}
                                }
                                
                                // get who is online
                                $guests = mysql_query("SELECT COUNT(userid) AS guestsonline FROM session WHERE userid=0 AND lastactivity>$datecut") or die("oops3");
                                while($guest = mysql_fetch_array($guests)):
                                    $guestson = number_format($guest[guestsonline]);
                                endwhile;
                                $totalon = $regmemberson+$guestson;

                                echo ("$totalon members online<br>");

                                switch ($page)
                                {
                                    case "site":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "life":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "music":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "screen":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "sport":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "games":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    case "web":
                                        include "incl/forumlist.ebs.php";
                                    break;
                                    default:
                                        include "incl/last10.ebs.php";
                                }

                  ?>
    </TD>
        <TD background="images/tables_07.jpg"></TD>
    </TR>
    <TR>
        <TD WIDTH=22 HEIGHT=44>
            <IMG SRC="images/tables_08.jpg" WIDTH=22 HEIGHT=44 ALT="bottom left bit"></TD>
        <TD background="images/tables_09.jpg" WIDTH="90%" HEIGHT=44 ALT=""></TD>
        <TD WIDTH=88 HEIGHT=44>
            <IMG SRC="images/tables_10.jpg" WIDTH=88 HEIGHT=44 ALT="bottom right bit"></TD>
        <TD WIDTH=23 HEIGHT=44>
            <IMG SRC="images/tables_11.jpg" WIDTH=23 HEIGHT=44 ALT="bottom right corner"></TD>
    </TR>
</TABLE>
          </td>
        </tr>
      </table>
      <br>
    </TD>
    <TD>&nbsp; </TD>
    </TR>
    <TR>
        <TD background="images/ebslive_14.jpg" WIDTH="20%" HEIGHT=89></TD>
        
    <TD COLSPAN=7 background="images/ebslive_15.jpg" WIDTH=767 HEIGHT=89 align="center" valign="top"><strong><font size="-2"><br>
      Copyright 2003 &copy;EBS Live.com All Rights Reserved</font></strong></TD>
        <TD background="images/ebslive_16.jpg" WIDTH="20%" HEIGHT=89></TD>
    </TR>
</TABLE>
</BODY>
</HTML>


JoeBiscuit 03-27-2004 06:34 AM

Any update to this? I am have the same exact problem.

Boofo 03-27-2004 08:07 AM

Shouldn't this:

PHP Code:

require("../forums/admin/global.php"); 

actually be this?

PHP Code:

require_once('./global.php'); 



All times are GMT. The time now is 09:10 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.01722 seconds
  • Memory Usage 1,948KB
  • 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
  • (13)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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