So I have this code for my webpage but whenever I put in the "include" php code

<?php
     include('include/mysqli.inc');
?>

everything below that disappears. Basically I'm trying to enter in the appropriate variable data from the quotes database that I'm using into the correct table fields. But I can't do this if the include code line keeps making my tables disappear!

Help!

Here's the main source code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<?php
ob_start();

require ('require/dbUtil.inc');
$objDBUtil = new DbUtil;
?>

<html>
<head>
	<link rel="stylesheet" type="text/css" href="default.css" />
	<?php
		include('include/header.php');
	?>
</head>

<body>
<div id="tableMain">
	<div class="leftpanel">
		<center>
		<h2><b><u>Directory</u></b></h2>
		<a href="default.php"><b>Home</b></a>
	    <br /><br />
		<a href="findsymbol.php"><b>Find Symbol</b></a>
		<br /><br />
		<a href="quote.php"><b>Quote</b></a>
		<br /><br />
		<a href="history.php"><b>History</b></a>
		<br /><br />
		<hr align="center" width="50"></br></center>
	
		<center><b><u>**DISCLAIMER**</u></b></br></br>
	This website is intended for kicks and play--none of the    information you find within this website should be taken    into consideration when investing in stocks.
    	</center>
     </div>
     
<div class="contentbox">
    <center>
    <div class="fillbox">
    <br />     

	<form action="quote.php" method="get">Symbol:
			<input type="text" name="symbol"/>
			<input type="submit" value="Search"/>
	</form>
    
    <?php
	include('include/mysqli.inc');
	?>
    
    <br />

			<left><h2>Stock Symbol: <b><font color="yellow">
            <?php
			
			print $symSymbol;
			
			?>
            </font></b></h2></font></left>
			<h4><font color="green">2011-05-04 16:00:00 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NASDAQ</font></h4>
						

	<table width=670 border=0 cellspacing=0 cellpadding=0 align=center>
		<tr class=tblHead bgcolor="blue">
			<td align=left colspan=2><b><font color="yellow">Google, Inc.
            <?php
			
			print $symName;
			
			?>
			</font></b></td>
		</tr>
		</table>

	<table id="stockTable1" width=670 border=1 cellpadding=0 cellspacing=0 rules=rows frame=below
		bordercolor="blue" bordercolordark="white" align=center>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>Last</td>
          <td width=80 align=right><font color="black">535.79</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>Prev Close</td>
          <td width=80 align=right><font color="black">533.89</font></td>
        </tr>
        <tr>
		  <td width=10 >&nbsp;</td>
		  <td width=100>Change</td>
          <td width=80 align=right><font color="black">+1.90</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>Bid</td>
          <td width=80 align=right><font color="black">535.80</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>%Change</td>
          <td width=80 align=right><font color="black">+0.36%</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>Ask</td>
          <td width=80 align=right><font color="black">534.79</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>High</td>
          <td width=80 align=right><font color="black">539.00</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>52 Week High</td>
          <td width=80 align=right><font color="black">642.96</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>Low</td>
          <td width=80 align=right><font color="black">533.02</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>52 Week Low</td>
          <td width=80 align=right><font color="black">433.63</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>Daily Volume</td>
         <td width=80 align=right><font color="black">2,115,923</font></td>
        </tr>
    </table>

    <br />

    <table width=670 border=0 cellspacing=0 cellpadding=0 align=center>
				<tr class=tblTail bgcolor="blue">
					<td align=left colspan=2><b><font color="yellow">Fundamentals</font></b></td>
			</tr>
	</table>

    <table id="stockTable2" width=670 border=0 cellpadding=0 cellspacing=0 rules=rows frame=below
		bordercolor="blue" bordercolordark="white" align=center>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>PE Ratio</td>
          <td width=80 align=right><font color="black">19.56</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>Market Cap.</td>
          <td width=80 align=right><font color="black">133,413.0 Mil</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>Earnings/share</td>
          <td width=80 align=right><font color="black">27.29</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100># Shrs Out.</td>
          <td width=80 align=right><font color="black">321,527,000</font></td>
        </tr>
        <tr>
          <td width=10 >&nbsp;</td>
          <td width=100>Div/Share</td>
          <td width=80 align=right><font color="black">0.00</font></td>
          <td width=30 >&nbsp;</td>
          <td width=100>Div. Yield</td>
          <td width=80 align=right><font color="black">n/a</font></td>
        </tr>
	
	</table>

	</center></div></div>

<?php
include('include/footer.php');
?>

</body>
</br>
</html>

<?php
ob_end_flush();
?>

And here's my mysqli.inc code:

<?php
	include ('require/dbUtil.inc');
	ob_start();
	
	$strSymbol = @$_REQUEST["symbol"];
	if(! empty($strSymbol))
	{
		$db = $objDBUtil->Open();
		
		$query = "SELECT symSymbol, symName FROM symbols WHERE symSymbol=" . $objDBUtil->DBQuotes($strSymbol);
		
		$result = $db->query($query);
		
		if (! $result)
		{
			print "Invalid query result<br />\n";
		}
		else
		{
			$row = @$result->fetch_assoc();
		}
		
		@$result->free();
		
		$querysymbol = $objDBUtil->DBQuotes($strSymbol);
		$query = "HERETOouterjoin
	SELECT symSymbol, symName, qSymbol, qQuoteDateTime, qLastSalePrice
	 FROM symbols LEFT OUTER JOIN quotes ON symSymbol=qSymbol
	 WHERE symSymbol={$querysymbol}
	 ORDER BY qQuoteDateTime DESC
	 LIMIT 10
	HERETOouterjoin";
	
	$result = @$db->query($query);
	if($result)
	{
		while($row = @$result->fetch_assoc())
		{
			extract($row);
			
			if($qQuoteDateTime == NULL) $qQuoteDateTime = "No Quote Data";
			if($qLastSalePrice == NULL) $qLastSalePrice = "-.--";
		}
	}
	
	@$result->free();
	$objDBUtil->Close();
	}	
?>

Recommended Answers

All 7 Replies

I think you have already including

include ('require/dbUtil.inc');

in mysqli.inc, try to comment it.

I think you have already including

include ('require/dbUtil.inc');

in mysqli.inc, try to comment it.

Well I don't think that's the problem; I've removed mysqli.inc and just pasted the code where I initially put the "include" php code. It still gives me a blank where my table code is. This is so frustrating!! The issue lies within my long php code here:

<?php
	include ('require/dbUtil.inc');
	ob_start();
	
	$strSymbol = @$_REQUEST["symbol"];
	if(! empty($strSymbol))
	{
		$db = $objDBUtil->Open();
		
		$query = "SELECT symSymbol, symName FROM symbols WHERE symSymbol=" . $objDBUtil->DBQuotes($strSymbol);
		
		$result = $db->query($query);
		
		if (! $result)
		{
			print "Invalid query result<br />\n";
		}
		else
		{
			$row = @$result->fetch_assoc();
		}
		
		@$result->free();
		
		$querysymbol = $objDBUtil->DBQuotes($strSymbol);
		$query = "HERETOouterjoin
	SELECT symSymbol, symName, qSymbol, qQuoteDateTime, qLastSalePrice
	 FROM symbols LEFT OUTER JOIN quotes ON symSymbol=qSymbol
	 WHERE symSymbol={$querysymbol}
	 ORDER BY qQuoteDateTime DESC
	 LIMIT 10
	HERETOouterjoin";
	
	$result = @$db->query($query);
	if($result)
	{
		while($row = @$result->fetch_assoc())
		{
			extract($row);
			
			if($qQuoteDateTime == NULL) $qQuoteDateTime = "No Quote Data";
			if($qLastSalePrice == NULL) $qLastSalePrice = "-.--";
		}
	}
	
	@$result->free();
	$objDBUtil->Close();
	}	
?>

Something within this code is making the rest of my code disappear...but I have no clue what. Please help!

on the begining of your page write this 2 lines and then run your page

error_reporting(E_ALL); 
	ini_set("display_errors", 1);

on the begining of your page write this 2 lines and then run your page

error_reporting(E_ALL); 
	ini_set("display_errors", 1);

That doesn't seem to work for my page...It just comes out as text.

But now the problem is a little different: I can get the tables to show up but whenever I type in a a stock symbol, i.e. GOOG, in the text box and click submit it refreshes the page but shows no tables. What is going on!

you must keep those two lines under <?php tag

<?php
       error_reporting(E_ALL); 
	ini_set("display_errors", 1);
.
.
.
.
?>

you must keep those two lines under <?php tag

<?php
       error_reporting(E_ALL); 
	ini_set("display_errors", 1);
.
.
.
.
?>

The warnings that came up is as follow:

Stock Symbol: Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-7.0/DST' instead in C:\Inetpub\ftproot\Accounts\yongj\quote.php on line 101 Notice: Undefined variable: symSymbol in C:\Inetpub\ftproot\Accounts\yongj\quote.php on line 101

2011-05-04 16:00:00      NASDAQ

Google, Inc. Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-7.0/DST' instead in C:\Inetpub\ftproot\Accounts\yongj\quote.php on line 113 Notice: Undefined variable: symName in C:\Inetpub\ftproot\Accounts\yongj\quote.php on line 113

It says that $symSymbol and $symName are unidentified? How is this possible? Im extracting these variables from the database itself.

write 2 lines after fecthing it from database and before using it anywhere. then see whether its coming as expected.

echo $symSymbol ;
echo $symName;

before you use them anywhere in the code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.