Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 02-27-2003, 12:13 PM
Nomb's Avatar
Nomb Nomb is offline
 
Join Date: Nov 2002
Location: Phoenix, AZ
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"); 
Reply With Quote
  #12  
Old 02-27-2003, 01:02 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'"); 
Reply With Quote
  #13  
Old 02-27-2003, 01:04 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sebastian, the single quotes are not needet, just the ) was the buggy part
Reply With Quote
  #14  
Old 02-27-2003, 01:15 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #15  
Old 02-27-2003, 01:23 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you should use query_first as i told ya above...
Reply With Quote
  #16  
Old 02-27-2003, 01:30 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

done taht and i still get the same error, it's really baffling
Reply With Quote
  #17  
Old 02-27-2003, 01:39 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

seems like you haven't required global.php so $DB_site hasn't been declared.
Reply With Quote
  #18  
Old 02-27-2003, 02:01 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #19  
Old 02-27-2003, 04:16 PM
Nomb's Avatar
Nomb Nomb is offline
 
Join Date: Nov 2002
Location: Phoenix, AZ
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #20  
Old 02-28-2003, 07:31 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
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 06:02 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.09015 seconds
  • Memory Usage 2,403KB
  • Queries Executed 13 (?)
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
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete