vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   why does this php page only work sometimes ? (https://vborg.vbsupport.ru/showthread.php?t=57165)

rseidl 09-17-2003 03:51 PM

why does this php page only work sometimes ?
 
<noob-alert />

I am trying to do my first DB fetches from a web page (.../forum/example.php) and am using this code:


<html><head></head><body>

<?php
error_reporting(7);
echo("Latest posts<p>");
include( "global.php");
$latestthread=$DB_site->query("SELECT title,threadid,dateline FROM thread ORDER BY dateline DESC LIMIT 20");
while ($latestthreads=$DB_site->fetch_array($latestthread)) {
echo ("$latestthreads[title]<br>");
}
?>

</body></html>


Now the strange thing is it only works sometimes, at other times I get a standard error template (including some goobledigook about being "Unable to add cookies, header already sent") back from PHP which I assume means it could not get the data for some reason ?
Perhaps relevant: the forum directory is a passworded realm for my apache server, but IE correctly asks me for the pw/login for example2.php


(I have a feeling it is the include("global.php") statement that is bombing, since taking everything else but that away i still get the error)

The server is running on Win2K, and I am browsing from an XP HE/IE 6 client.

Thanks
Robert

halo 09-18-2003 11:20 PM

try,

PHP Code:

<?php
require( "global.php");  
?>

im not sure if that is the right require code but i will check l8r when i have time

Link14716 09-19-2003 01:11 AM

Quote:

Originally Posted by rseidl
<noob-alert />

I am trying to do my first DB fetches from a web page (.../forum/example.php) and am using this code:


<html><head></head><body>

<?php
error_reporting(7);
echo("Latest posts<p>");
include( "global.php");
$latestthread=$DB_site->query("SELECT title,threadid,dateline FROM thread ORDER BY dateline DESC LIMIT 20");
while ($latestthreads=$DB_site->fetch_array($latestthread)) {
echo ("$latestthreads[title]<br>");
}
?>

</body></html>


Now the strange thing is it only works sometimes, at other times I get a standard error template (including some goobledigook about being "Unable to add cookies, header already sent") back from PHP which I assume means it could not get the data for some reason ?
Perhaps relevant: the forum directory is a passworded realm for my apache server, but IE correctly asks me for the pw/login for example2.php


(I have a feeling it is the include("global.php") statement that is bombing, since taking everything else but that away i still get the error)

The server is running on Win2K, and I am browsing from an XP HE/IE 6 client.

Thanks
Robert

Use this:
PHP Code:

<?php
require('./global.php'); 
?>

<html><head></head><body>

<?php 
error_reporting
(7);
echo(
"Latest posts<p>");
$latestthread=$DB_site->query("SELECT title,threadid,dateline FROM thread ORDER BY dateline DESC LIMIT 20"); 
while (
$latestthreads=$DB_site->fetch_array($latestthread)) { 
echo (
"$latestthreads[title]<br>"); 
}
?>


rseidl 09-19-2003 03:19 PM

Thanks guys, that was it !

I guess the global.php has to come before any HTML.


All times are GMT. The time now is 12:34 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.01135 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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