Hi Gurus,
I have have a page in which I attached (3) includes. The first include generates links from a sql query and generates a menu, the second include generates a table filled with data from an sql query. The third include generates detailed info about the user that is logged in via an sql query.
The menu include somehow it is preventing the sql in the third include from running. When I comment out the sql in the menu include the third(table) include starts working again.
Is there a way php includes with sql queries can cancel one another out. If so how do you correct/prevent that.
Here is my code:
(this page has the sql that conflicts with the next set of code)
Index.php:
<?php
include 'library/config.php';
include 'library/opendb.php';
$sql = "SELECT *
FROM binary_data WHERE cid =" .$_SESSION['cid']."";
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
$num = mysql_numrows($result);
while($i < $num)
{
$link1=mysql_result($result,0,"id");
$link2=mysql_result($result,1,"id");
$link3=mysql_result($result,2,"id");
$link4=mysql_result($result,3,"id");
$i++;
}
include 'library/closedb.php';
?>
--------------------------------------------------------
properties.php
(none of the sql query comes back; nothing happens on this page unless comment out the sql on the code in the page above)
<?php ob_start(); session_start(); ?>
<?php
include 'library/config.php';
include 'library/opendb.php';
echo "<table border=0><font face=arial>";
echo "<tr><td bgcolor=khaki>";
echo "<b><font face=arial>Image</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Type</b></td>";
echo "<td bgcolor=khaki><b><font face=arial>Address</b>";
echo "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Bedrooms</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Bathrooms</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Garage</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Square Feet</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>List Date</b>" . "</td>";
echo "</tr>";
$query = "SELECT *
FROM properties
WHERE lcid = " .$_SESSION['cid']."";
$result = mysql_query($query) or die('Query failed. ' . mysql_error());
$num2=mysql_numrows($result);
while($i < $num2)
{
$media=mysql_result($result,$i,"media");
$type=mysql_result($result,$i,"type");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$bed=mysql_result($result,$i,"bed");
$bath=mysql_result($result,$i,"bath");
$garage=mysql_result($result,$i,"garage");
$sqfeet=mysql_result($result,$i,"sqfeet");
$listdate=mysql_result($result,$i,"listdate");
echo "<tr><td align=center><font face=arial>";
echo "<img src=\"$media\" width=120 height=90></img>" . "</td><td align=center><font face=arial>";
echo "$type" . "</td><td align=center><font face=arial>";
echo "$address<br>$city".","."$state"." $zip" . "</td><td align=center><font face=arial>";
echo "$bed" . "</td><td align=center><font face=arial>";
echo "$bath" . "</td><td align=center><font face=arial>";
echo "$garage" . "</td><td align=center><font face=arial>";
echo "$sqfeet" . "</td><td align=center><font face=arial>";
echo "$listdate" . "</td>";
$i++;
I have have a page in which I attached (3) includes. The first include generates links from a sql query and generates a menu, the second include generates a table filled with data from an sql query. The third include generates detailed info about the user that is logged in via an sql query.
The menu include somehow it is preventing the sql in the third include from running. When I comment out the sql in the menu include the third(table) include starts working again.
Is there a way php includes with sql queries can cancel one another out. If so how do you correct/prevent that.
Here is my code:
(this page has the sql that conflicts with the next set of code)
Index.php:
<?php
include 'library/config.php';
include 'library/opendb.php';
$sql = "SELECT *
FROM binary_data WHERE cid =" .$_SESSION['cid']."";
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
$num = mysql_numrows($result);
while($i < $num)
{
$link1=mysql_result($result,0,"id");
$link2=mysql_result($result,1,"id");
$link3=mysql_result($result,2,"id");
$link4=mysql_result($result,3,"id");
$i++;
}
include 'library/closedb.php';
?>
--------------------------------------------------------
properties.php
(none of the sql query comes back; nothing happens on this page unless comment out the sql on the code in the page above)
<?php ob_start(); session_start(); ?>
<?php
include 'library/config.php';
include 'library/opendb.php';
echo "<table border=0><font face=arial>";
echo "<tr><td bgcolor=khaki>";
echo "<b><font face=arial>Image</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Type</b></td>";
echo "<td bgcolor=khaki><b><font face=arial>Address</b>";
echo "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Bedrooms</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Bathrooms</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Garage</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>Square Feet</b>" . "</td><td bgcolor=khaki>";
echo "<b><font face=arial>List Date</b>" . "</td>";
echo "</tr>";
$query = "SELECT *
FROM properties
WHERE lcid = " .$_SESSION['cid']."";
$result = mysql_query($query) or die('Query failed. ' . mysql_error());
$num2=mysql_numrows($result);
while($i < $num2)
{
$media=mysql_result($result,$i,"media");
$type=mysql_result($result,$i,"type");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$bed=mysql_result($result,$i,"bed");
$bath=mysql_result($result,$i,"bath");
$garage=mysql_result($result,$i,"garage");
$sqfeet=mysql_result($result,$i,"sqfeet");
$listdate=mysql_result($result,$i,"listdate");
echo "<tr><td align=center><font face=arial>";
echo "<img src=\"$media\" width=120 height=90></img>" . "</td><td align=center><font face=arial>";
echo "$type" . "</td><td align=center><font face=arial>";
echo "$address<br>$city".","."$state"." $zip" . "</td><td align=center><font face=arial>";
echo "$bed" . "</td><td align=center><font face=arial>";
echo "$bath" . "</td><td align=center><font face=arial>";
echo "$garage" . "</td><td align=center><font face=arial>";
echo "$sqfeet" . "</td><td align=center><font face=arial>";
echo "$listdate" . "</td>";
$i++;