Jump to content

Unable to display items located in another TABLE


crzbadboy

Recommended Posts

I'm working on creating a Realtors website.

Currently mysql DB has 4 tables. 3 of them are needed in this script to show up as 1 item.

Table called Listings has 2 fields that call on 2 other tables. one is MLS which calls on the Images Table the other agent calls on the Agents table.

I'm trying to see why I can't While loop all 3 tables together? How can I connect all 3?


<?php

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}


//mysql_select_db($database_CarneyRealty, $CarneyRealty);
//$query_Update1 = "SELECT * FROM listings";
//$Update1 = mysql_query($query_Update1, $CarneyRealty) or die(mysql_error());
//$rrows = mysql_fetch_assoc($Update1);
//$totalRows_Update1 = mysql_num_rows($Update1);

include 'dbc.php';
page_protect();

$err = array();
$msg = array();

$page_limit =4; //CHANGE FOR THE NUMBER OF LISTINGS PER PAGE!
$page_num_limit =10;

$ret = $_SERVER['HTTP_REFERER'];


$host  = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$login_path = @ereg_replace('admin','',dirname($_SERVER['PHP_SELF']));
$path   = rtrim($login_path, '/\\');

// filter GET values
foreach($_GET as $key => $value) {
$get[$key] = filter($value);
}

foreach($_POST as $key => $value) {
$post[$key] = filter($value);
}


$rs_all = mysql_query("select count(*) as total_all from listings") or die(mysql_error());
$rs_active = mysql_query("select count(*) as total_active from listings where status='ACTIVE'") or die(mysql_error());
$rs_total_contingent = mysql_query("select count(*) as tot2 from listings where status='CONTINGENT'");
$rs_total_pending = mysql_query("select count(*) as tot from listings where status='PENDING'");						   
$rs_total_sold = mysql_query("select count(*) as tot1 from listings where status='SOLD'");
$rs_resall = mysql_query("select count(*) as res from listings where class='Resident'") or die(mysql_error());
$rs_comall = mysql_query("select count(*) as com from listings where class='Commerical'");
$rs_farmall = mysql_query("select count(*) as farm from listings where class='Farmland'");						   
$rs_otherall = mysql_query("select count(*) as other from listings where class='Other'");

list($all) = mysql_fetch_row($rs_all);
list($active) = mysql_fetch_row($rs_active);
list($total_contingent) = mysql_fetch_row($rs_total_contingent);
list($total_pending) = mysql_fetch_row($rs_total_pending);
list($total_sold) = mysql_fetch_row($rs_total_sold);

list($resall) = mysql_fetch_row($rs_resall);
list($comall) = mysql_fetch_row($rs_comall);
list($farmall) = mysql_fetch_row($rs_farmall);
list($otherall) = mysql_fetch_row($rs_otherall);

///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
$sqlagents = mysql_query("select * from agents where id='$_SESSION'");
//$agentname= mysql_query($sqlagents) or die(mysql_error());
$sqllistings = mysql_query("select * from listings where id='$_SESSION'"); 
$sqlimages = mysql_query("select * from images where id='$_SESSION'");
////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title>Search CarneyRealty Listings</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <link rel="stylesheet" href="../css/mm_brochure.css" type="text/css">
  <style type="text/css">
<!--
body {
background-image: url(http://www.carneyrealty.com/newsite/images/IMG_0161a.jpg);
}
.style1 {
font-size: 16px
}
.style2 {
font-family: Geneva, Arial, Helvetica, sans-serif
}
.style10 {
font-size: 13px;
font-weight: bold;
color: #FF0000;
}
.style7 {
color: #FF0000;
font-weight: bold;
}
.style8 {
color: #0000FF;
font-weight: bold;
}
-->
</style>
  </head>
  <body bgcolor="#bcbc85" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
    <table width="81%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#999966">
        <td width="25" nowrap="nowrap"><center>
        <img src="../images/mm_spacer.gif" alt="" width="15" height="1" border="0" /></td>
        <td height="60" colspan="3" class="logo" nowrap="nowrap"><div align="center"><img src="images/Carney_Logo1_000.jpg" width="630" height="158" /><br />
          </div></td>
        <td width="4"></td>
      </tr>
    <tr bgcolor="#797947">
        <td width="25" nowrap="nowrap"></td>
        <td colspan="3" valign="top"><div align="center">
            <table width="460" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="59" align="center" nowrap="nowrap"><div align="center"><a href="../index.htm" class="style1"><strong>HOME</a></div></td>
                <td width="127" align="center" nowrap="nowrap"><div align="center"><strong><a href="../SearchCarneyRealtyListings.php" class="style5">LISTINGSEARCH</a></strong></div></td>
                <td width="94" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Aboutus.html" class="style5">ABOUT US</a></strong></div></td>
                <td width="10" align="center" nowrap="nowrap"><div align="center"></div></td>
                <td width="95" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Community.htm" class="style5">COMMUNITY </a></strong></div></td>
                <td width="81" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Login.php" class="style5">LOGIN</a></strong></div></td>
              </tr>
          </table>
            <table width="307" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="84" align="center" nowrap="nowrap"><div align="center"><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Resident" class="style1">Residential</a></div></td>
                <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Commerical" class="style5">Commercial</a></strong></div></td>
                <td width="102" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Farmland" class="style5">Farms & Land</a></strong></div></td>
                <td width="18" align="center" nowrap="nowrap"><div align="center"></div></td>
              </tr>
          </table>
            <table width="573" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="72" align="center" nowrap="nowrap"><div align="center"><a href="residental0-60.php" class="style1">$0-$60K</a></div></td>
                <td width="80" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental61-85.php" class="style5">$61K-$85K</a></strong></div></td>
                <td width="87" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental86-115.php" class="style5">$86K-$115K</a></strong></div></td>
                <td width="1" align="center" nowrap="nowrap"><div align="center"></div></td>
                <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental116-160.php" class="style5">$116K-$160K</a></strong></div></td>
                <td width="93" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental161-230.php" class="style5">$161K-230K</a></strong></div></td>
                <td width="126" align="center" nowrap="nowrap"><div align="center"><strong><a href="residential231up.php" class="style5">$231K-And Up</a></strong></div></td>
                <td width="11" align="center" nowrap="nowrap"> </td>
              </tr>
          </table>
          </div></td>
      </tr>
    
        <td width="25" valign="top"><?php 
/*********************** MY MLS MENU ****************************
This code shows MLS account menu only to logged in users. 
Copy this code till END and place it in a new html or php where
you want to show myaccount options. This is only visible to logged in users
*******************************************************************/
?>
        <?php 
  if(!empty($msg)) {
  echo $msg[0];
  }
  ?>
        <? //$row_settings1=mysql_fetch_array($sqllistings1);?>
        <?php while ($row_settings1 = mysql_fetch_array($sqllistings)){
		$row_settings2=mysql_fetch_array($sqlimages);
		$row_settings3=mysql_fetch_array($sqlagents);
		?>
        <?php } ?>
  </table>
    <table width="81%" border="0" align="center" cellpadding="10" cellspacing="0" style="background-color: #FF9933;padding: 2px 5px;border: 1px solid #F90;" >
    <tr>
        <td height="44" align="center"><form name="form1" method="get" action="listingsearch.php">
            <p>
            <input name="doSearch" type="submit" id="doSearch2" value="MLS Search" />
            <input name="q" type="text" id="q" size="40">
            <strong> S CARNEY& ASSOCIATES INC 800-757-5783</strong> <br>
          </p>
          </form></td>
      </tr>
  </table>
    </td>
    </tr>
    </table>
  </div>
<p>
    <?php if ($get['doSearch'] == 'MLS Search') {
  $cond = '';
  if($get['qoption'] == 'active') {
  $cond = "where `status`='ACTIVE' order by date desc";
  }
  if($get['qoption'] == 'contingent') {
  $cond = "where `status`='CONTINGENT' order by date desc";
  }
  if($get['qoption'] == 'pending') {
  $cond = "where `status`='PENDING' order by date desc";
  }
  if($get['qoption'] == 'sold') {
  $cond = "where `status`='SOLD' order by date desc";
  }
  if($get['qoption'] == 'resident') {
  $cond = "where `class`='Resident' order by price desc";
  }
  if($get['qoption'] == 'farmland') {
  $cond = "where `class`='Farmland' order by price desc";
  }
  if($get['qoption'] == 'commerical') {
  $cond = "where `class`='Commerical' order by price desc";
  }
  if($get['qoption'] == 'other') {
  $cond = "where `class`='Other' order by price desc";
  }
   //if($get['qoption'] == '') {
   if($get['q'] == '') { 
$sql = "select * from listings order by price asc";
 // $sql = "select * from listings $cond"; 
 // } 
  } 
  else { 
  $sql = "select * from listings where `price` = '$_REQUEST[q]' or `mls`='$_REQUEST[q]' or `seller`='$_REQUEST[q]' or `class`='$_REQUEST[q]' or `status`='$_REQUEST[q]' order by `price` asc";
//$sql1="select * from images where `mls`='$sql'";
//$sql2="select * from agents where `tag`='$sql'";
//  $sql = "select * from listings where `mls`='$_REQUEST[q]' or `price`='$_REQUEST[q]'";
  }

  //$rs_total1=mysql_query($sql1) or die(mysql_error());
  $rs_total = mysql_query($sql) or die(mysql_error());
  $total = mysql_num_rows($rs_total);
 // $total1=mysql_num_rows($rs_total1);
  if (!isset($_GET['page']) )
	{ $start=0; } else
	{ $start = ($_GET['page'] - 1) * $page_limit; }
  
  $rs_results = mysql_query($sql . " limit $start,$page_limit") or die(mysql_error());
  $total_pages = ceil($total/$page_limit);
 // $rs_results1 = mysql_query($sql1 ."limit $start,$page_limit") or die (mysql_error());
  ?>
    <?php 
  
  // outputting the pages
	if ($total > $page_num_limit)
	{
	echo "<table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: ";
	$i = 0;
	while ($i < $page_num_limit)
	{


	$page_no = $i+1;
	$qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']);
	echo "<a href=\"listingsearch.php?$qstr&page=$page_no\">$page_no</a> ";
	$i++;
	}
	echo "</span></td></table>";
	}  ?>
    <? 
//while ($rrows3 = mysql_fetch_array($rrows3)){

?>
  <form name "searchform" action="listingsearch.php" method="post">
  </form>
</table>
<?php
//////////////////////////////////////////////////////////////////////////////
while ($rrows = mysql_fetch_array($rs_results)) {
 $rrows2=mysql_fetch_array($sqlimages);
$rrows3=mysql_fetch_array($sqlagents);

///////////////////////////////////////////////////////////////////////////////
//$imagenamevar=($rrows['mls']=$rrows2['mls']);
//echo $rrows3['id'];
//$agentpicvar=($rrows['seller']=$rrow3['tag']);

	?>
<tr>
    <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd">
    <?  echo $rrows['agents'.'seller_id'];?>
    
        <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/<?php echo $rrows['mls'];?>/<? echo $mainimagevar; ?> width="214" height="160" />
            </p>
          </div>
        <p class="tagline">Click for Additional Pictures</p></td>
        <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left">
            <table width="592" height="180" border="1">
            <tr valign="top">
                <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td>
                <td width="249" bgcolor="#fcfcdd"><strong><?php echo $rrows['location'];?> <br>
                  <?  echo $rrows['location1'];?>
                  <br>
                  <? echo $rrows3['tag'];?> </strong></td>
                <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center">
                    <table width="180" height="62" border="1">
                    <tr valign="top">
                        <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/<?php echo $rrows['mls'];?>/<? echo "SD_disp.pdf";?>"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td>
                        <td width="50" class="tagline"><div align="left">Status </div></td>
                        <td width="68"><div align="right" class="subHeader"><?php echo $rrows['status']; ?></div></td>
                      </tr>
                    <tr valign="top">
                        <td height="24" class="tagline"><div align="left">PRICE</div></td>
                        <td align="center" valign="top"><div align="right"><strong class="subHeader"><?php echo $rrows['price']; ?></strong></div></td>
                      </tr>
                  </table>
                    <span style="color: #fcfcdd"><strong><a href="mailto:<? echo $rrows['selleremail'];?>"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" /><? echo $rrows['seller'];?></a></strong></span></div></td>
                <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div>
                <span style="color: #fcfcdd"><img src="<? 
		    
			/////////////////////////////////////////////////////////////

			while ($rrows3=($rrows['seller']=$rrows3['seller_id'])){
			   echo $rrows3['agentimage'];
		   }
		   //////////////////////////////////////////////////////////////
		   ?>" width="60" height="91" /></a></span></td>
              </tr>
            <tr valign="top">
                <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td>
                <td bgcolor="#fcfcdd"><strong><?php echo $rrows['specs']; ?></strong></td>
              </tr>
            <tr valign="top">
                <td height="77" bgcolor="#fcfcdd"  class="tagline">Description</td>
                <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #<?php echo $rrows['mls'];?><br>
                  <? echo $rrows['description'];?></strong>
                <p><strong>Call <? echo $rrows['seller'];?> at <? echo agentnumbervar;?> to view   or for more information.</strong></p></td>
              </tr>
          </table>
            
            <tr>
                <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S   Carney & Associates Real Estate Brokerage 800 757 5783             </span></td>
              </tr>
        </div></td>
      </tr>
      </span>
    
    <? } ?>
    
        <td height="4"></td>
    </table>
    <? } ?>
    <? //} ?>
  </tr>
<?php 
  

  
  // outputting the pages
	if ($total > $page_limit)
	{
	echo "<table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: ";
	$i = 0;
	while ($i < $page_num_limit)
	{


	$page_no = $i+1;
	$qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']);
	echo "<a href=\"listings.php?$qstr&page=$page_no\">$page_no</a> ";
	$i++;
	}
	echo "</span></td></table>";
	}  ?>
</td>
</tr>
<tr>
    <td height="22" class="bodyText"><?
			 include 'footer1.shtml';
			  ?>
</td>
</tr>
<tr>
    <td height="194" class="bodyText"><div align="center">
        <table width="513" border="0">
        <tr valign="top">
            <th width="94" scope="col"><div align="center"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument"><img src="images/index.1.gif" width="43" height="42" border="0" /></a></div></th>
            <th width="46" scope="col"><div align="center"></div></th>
            <th width="100" valign="middle" scope="col"><div align="center" class="style7">
                <div align="center"><a href="http://www.nacogdochesmls.com/nag/passwd.php"><img src="images/MLS_a_94-50.gif" width="92" height="51" alt="Multiple Listing Service" /></a></div>
              </div></th>
            <th width="119" scope="col"><div align="center"><a href="http://www.hud.gov/offices/fheo/FHLaws/"><img src="http://www.habitatwhitley.org/equal_housing_logo.jpg" alt="Equal Housing Opportunity" width="60" height="62" border="0" /></a></div></th>
            <th width="129" scope="col"><div align="center"></div></th>
          </tr>
        <tr valign="top">
            <td height="32"><div align="center" class="style8"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument">REALTOR.ORG</a></div></td>
            <td><div align="center"></div></td>
            <td valign="middle"><div align="center"><span class="style10"><a href="http://www.nacogdochesmls.com/nag/passwd.php">Multiple Listing System</a></span></div></td>
            <td><div align="center"><strong><a href="http://www.hud.gov/offices/fheo/FHLaws/">Equal Housing Opportunity</a></strong></div></td>
            <td><div align="center"><a href="http://www.bbb.org/">BETTER BUSINESS BUREAU</a></div></td>
          </tr>
      </table>
      </div></td>
  </tr>
</table>
<div align="left"> <br />
  </div>
</div>
</td>
<td valign="top"><div align="left"></div></td>
<td width="4"><div align="left"></div></td>
</tr>
<tr>
    <td width="15"> </td>
    <td width="35"> </td>
    <td width="698"><div align="center">
    <?php
  include 'footer.shtml';
  ?>
  </div>
  </td>
  <td width="1"><div align="center"></div></td>
  <td width="4"> </td>
  </tr>
  </table>
  </table>
  </table>
  </div>
  </body>
  </html>

 

 

 

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

I've placed a bunch of //////////////////////////////////////////// marks around the area's I need help in.

THe first section of these pulls all the SQL's from the 3 tables.

the second and 3rd are the WHILE loops.

 

I need help really bad on this or I'm out of a job, It shows the items and pulls good from the LISTINGS table but fails to pull information from the IMAGES and AGENTS tables

I need it so when It DISPLAYS i can put like in

<? echo rrows['recordset'];?> 

for the var to show it works on all the rrows[????] but not for rrows2 and rrows3

 

 

Link to comment
Share on other sites

You are asking the database to pull from the listings and images table via the variable $_SESSION, which is a superglobal ARRAY, and therefore, you are looking for an id named 'Array'.

 

2 suggestions.

 

Make sure you are getting the query you want, by echoing the query out.

 

$images = "select * from images where id='$_SESSION'";
$sqlimages = mysql_query($images);
  echo $images;

 

I suspect you will not get what you think you should be getting.

 

And,

 

Don't write PHP in Dreamweaver, it tends to bloat a script with a lot of useless stuff.  Leading to a confusing mess, that is difficult to debug.

Link to comment
Share on other sites

When I put that in it gave back the echo of

 

select * from images where id='Array'

on my screen at the top

 

I placed it in the area lines 94-103 like so.

///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
$sqlagents = mysql_query("select * from agents where id='$_SESSION'");
//$agentname= mysql_query($sqlagents) or die(mysql_error());
$sqllistings = mysql_query("select * from listings where id='$_SESSION'"); 
$images = "select * from images where id='$_SESSION'";
$sqlimages = mysql_query($images);
echo $images;
////////////////////////////////////////////////////////////////////////////////////////////////////////

 

 

I mean the query of LISTINGS works, my problem is trying to get the other 2 query's and connecting them.

when you go down the page you'll see the WHILE loops I need to figure out how to make a basic connector so it'll loop in the array, till it matches a specific field.

 

LISTINGS        IMAGES

1a(info)-          6z(info)

2a(info) \        7c(info)

3b(info)  \/---  5c(info)

4d(info) /  \---  1a(info)

5c(info)/          2c(info)

So the OUTPUT on a listing like 1a will show it's info along with the Images info that corrsponds with 1a there as well. The same for 5c.

sorry for the bad array drawing. or am I heading in the wrong direction?

 

 

Link to comment
Share on other sites

Why is $_SESSION being used in your query? There are no $_SESSION variables being defined within your code. $_SESSION will return an empty array, as it is a superglobal array. What are you trying to do here?

$sqlagents = mysql_query("select * from agents where id='$_SESSION'");
//$agentname= mysql_query($sqlagents) or die(mysql_error());
$sqllistings = mysql_query("select * from listings where id='$_SESSION'"); 
$images = "select * from images where id='$_SESSION'";
$sqlimages = mysql_query($images);
echo $images;

Link to comment
Share on other sites

I'm needing it to pull all data from the 3 Tables

and place them in 3 seperate arrays, then connect the 3 arrays.

it works with the Listings table but not for the Images and Agents.

I'm not sure if it's how i'm pulling the query or if it's all within the WHILE loops, maybe both. I really need as much help as possible I've beat my self to death almost trying to figure this out with a hugh lack of sleep. :confused:

Link to comment
Share on other sites

This is the Database Structure minus all the extra stuff. So you can emulate the database.

-- phpMyAdmin SQL Dump
-- version 2.11.9.4
-- http://www.phpmyadmin.net
--
-- Host: xx.xx.xx.xx
-- Generation Time: Jul 31, 2010 at 12:45 PM
-- Server version: 4.1.24
-- PHP Version: 5.2.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `mysql`
--
CREATE DATABASE `mysql` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `mysql`;

-- --------------------------------------------------------

--
-- Table structure for table `agents`
--

CREATE TABLE `agents` (
  `id` int(20) NOT NULL auto_increment,
  `seller_id` varchar(20) default NULL,
  `agentname` text NOT NULL,
  `title` text,
  `agentprofile` text NOT NULL,
  `agentimage` text NOT NULL,
  `contact1` text NOT NULL,
  `contact2` text NOT NULL,
  `email` text NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `seller_id` (`seller_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

-- --------------------------------------------------------

--
-- Table structure for table `images`
--

CREATE TABLE `images` (
  `id` int(20) NOT NULL auto_increment,
  `mls` varchar(20) NOT NULL default '',
  `imagename` text,
  `imagedesc` text,
  `filename` text,
  `filenamedesc` text,
  `type` text NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`),
  KEY `mls` (`mls`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `images`
--


-- --------------------------------------------------------

--
-- Table structure for table `listings`
--

CREATE TABLE `listings` (
  `id` int(20) NOT NULL auto_increment,
  `mls` varchar(20) NOT NULL default '',
  `location` text NOT NULL,
  `location1` text,
  `description` text NOT NULL,
  `specs` text NOT NULL,
  `status` text NOT NULL,
  `price` text NOT NULL,
  `seller` varchar(20) NOT NULL default '1',
  `selleremail` text NOT NULL,
  `datasheetlink` text NOT NULL,
  `imagename` text,
  `addimagelink` text NOT NULL,
  `date` date NOT NULL default '0000-00-00',
  `class` text NOT NULL,
  `type` text,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `mls` (`mls`),
  KEY `seller` (`seller`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=89 ;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL auto_increment,
  `md5_id` varchar(200) collate latin1_general_ci NOT NULL default '',
  `full_name` tinytext collate latin1_general_ci NOT NULL,
  `user_name` varchar(200) collate latin1_general_ci NOT NULL default '',
  `user_email` varchar(220) collate latin1_general_ci NOT NULL default '',
  `user_level` tinyint(4) NOT NULL default '1',
  `pwd` varchar(220) collate latin1_general_ci NOT NULL default '',
  `address` text collate latin1_general_ci NOT NULL,
  `country` varchar(200) collate latin1_general_ci NOT NULL default '',
  `tel` varchar(200) collate latin1_general_ci NOT NULL default '',
  `fax` varchar(200) collate latin1_general_ci NOT NULL default '',
  `website` text collate latin1_general_ci NOT NULL,
  `date` date NOT NULL default '0000-00-00',
  `users_ip` varchar(200) collate latin1_general_ci NOT NULL default '',
  `approved` int(1) NOT NULL default '0',
  `activation_code` int(10) NOT NULL default '0',
  `banned` int(1) NOT NULL default '0',
  `ckey` varchar(220) collate latin1_general_ci NOT NULL default '',
  `ctime` varchar(220) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `user_email` (`user_email`),
  FULLTEXT KEY `idx_search` (`full_name`,`address`,`user_email`,`user_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=60 ;
--
--
-- Constraints for table `agents`
--
ALTER TABLE `agents`
  ADD CONSTRAINT `agents_ibfk_1` FOREIGN KEY (`seller_id`) REFERENCES `listings` (`seller`);

--
-- Constraints for table `images`
--
ALTER TABLE `images`
  ADD CONSTRAINT `images_ibfk_1` FOREIGN KEY (`mls`) REFERENCES `listings` (`mls`);

Link to comment
Share on other sites

I know trying to match them Arrays up is messy and complicated.

but on one page of it allows you to insert the listings

on the other you can have multiple images for that one listing

they are connected by the MLS number field I know how i want it but don't know how to set it up or pull it all thats why i posted a slimmed down copy of the DB.

"Agent"--one to many-->"Listings"--one to many-->"Images"

agent_id----------------->seller,mls----------------->mls

I'm thinking I might have the Foriegn and Primary Keys wrong or something as well.                   

Link to comment
Share on other sites

Being that you want to show multiple images per listing, I don't think a join would work to well for you.  You can however do it this way.

 

$sql = "select * from listings where `price` = '$_REQUEST[q]' or `mls`='$_REQUEST[q]' or `seller`='$_REQUEST[q]' or `class`='$_REQUEST[q]' or `status`='$_REQUEST[q]' order by `price` asc";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
  while($row = mysql_fetch_assoc($result) {
      echo $rowstuff;
      $images = "SELECT * FROM images WHERE mls = '{$row['mls']}'";
        $re = mysql_query($images);
         if(mysql_num_rows($re) > 0) {
           while($image = mysql_fetch_assoc($re)) {
             echo $imagestuff;
           }
          }
     }
}

Link to comment
Share on other sites

Okay let me give it a Try and I'll tell you if it works cuz as I'm reading it, It's pulling from the Image Query where the listing'mls' is at. which is what it needs to be.  since there are multiple images they have a TYPE section on them. so I would have to put in a IF TYPE LOOP = "main image" it would show that one under the MLS number instead of a random photo.

Let me give it a shot and I'll respond back ASAP.

Still gotta Obtain the AGENTS information for that 'MLS' number as well.

remember it's 3 tables.

 

Link to comment
Share on other sites

:confused:

Okay well I think I might have to do the same for Agents to see visable results.

Right now I don't see the ECHO RESULTS for Images.

 

If you copy the CODE below and place it into an HTML file you'll see the result I got.

it's doesn't echo the $rowstuff; or echo the $imagestuff;

Do i have to put those 2 variables $rowstuff and $imagestuff into the table?

 

select * from images where id='Array'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title>Search CarneyRealty Listings</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <link rel="stylesheet" href="../css/mm_brochure.css" type="text/css">
  <style type="text/css"> 
<!--
body {
background-image: url(http://www.carneyrealty.com/newsite/images/IMG_0161a.jpg);
}
.style1 {
font-size: 16px
}
.style2 {
font-family: Geneva, Arial, Helvetica, sans-serif
}
.style10 {
font-size: 13px;
font-weight: bold;
color: #FF0000;
}
.style7 {
color: #FF0000;
font-weight: bold;
}
.style8 {
color: #0000FF;
font-weight: bold;
}
-->
</style>
  </head>
  <body bgcolor="#bcbc85" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
    <table width="81%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#999966">
        <td width="25" nowrap="nowrap"><center>
        <img src="../images/mm_spacer.gif" alt="" width="15" height="1" border="0" /></td>
        <td height="60" colspan="3" class="logo" nowrap="nowrap"><div align="center"><img src="images/Carney_Logo1_000.jpg" width="630" height="158" /><br />
          </div></td>
        <td width="4"></td>
      </tr>
    <tr bgcolor="#797947">
        <td width="25" nowrap="nowrap"></td>
        <td colspan="3" valign="top"><div align="center">
            <table width="460" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="59" align="center" nowrap="nowrap"><div align="center"><a href="../index.htm" class="style1"><strong>HOME</a></div></td>
                <td width="127" align="center" nowrap="nowrap"><div align="center"><strong><a href="../SearchCarneyRealtyListings.php" class="style5">LISTINGSEARCH</a></strong></div></td>
                <td width="94" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Aboutus.html" class="style5">ABOUT US</a></strong></div></td>
                <td width="10" align="center" nowrap="nowrap"><div align="center"></div></td>
                <td width="95" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Community.htm" class="style5">COMMUNITY </a></strong></div></td>
                <td width="81" align="center" nowrap="nowrap"><div align="center"><strong><a href="../Login.php" class="style5">LOGIN</a></strong></div></td>
              </tr>
          </table>
            <table width="307" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="84" align="center" nowrap="nowrap"><div align="center"><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Resident" class="style1">Residential</a></div></td>
                <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Commerical" class="style5">Commercial</a></strong></div></td>
                <td width="102" align="center" nowrap="nowrap"><div align="center"><strong><a href="http://www.carneyrealty.com/newsite/listingsearch.php?doSearch=MLS+Search&q=Farmland" class="style5">Farms & Land</a></strong></div></td>
                <td width="18" align="center" nowrap="nowrap"><div align="center"></div></td>
              </tr>
          </table>
            <table width="573" border="0" cellpadding="0" cellspacing="0" id="navigation">
            <tr>
                <td width="72" align="center" nowrap="nowrap"><div align="center"><a href="residental0-60.php" class="style1">$0-$60K</a></div></td>
                <td width="80" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental61-85.php" class="style5">$61K-$85K</a></strong></div></td>
                <td width="87" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental86-115.php" class="style5">$86K-$115K</a></strong></div></td>
                <td width="1" align="center" nowrap="nowrap"><div align="center"></div></td>
                <td width="103" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental116-160.php" class="style5">$116K-$160K</a></strong></div></td>
                <td width="93" align="center" nowrap="nowrap"><div align="center"><strong><a href="residental161-230.php" class="style5">$161K-230K</a></strong></div></td>
                <td width="126" align="center" nowrap="nowrap"><div align="center"><strong><a href="residential231up.php" class="style5">$231K-And Up</a></strong></div></td>
                <td width="11" align="center" nowrap="nowrap"> </td>
              </tr>
          </table>
          </div></td>
      </tr>
    
        <td width="25" valign="top">                          </table>
    <table width="81%" border="0" align="center" cellpadding="10" cellspacing="0" style="background-color: #FF9933;padding: 2px 5px;border: 1px solid #F90;" >
    <tr>
        <td height="44" align="center"><form name="form1" method="get" action="listingsearch.php">
            <p>
            <input name="doSearch" type="submit" id="doSearch2" value="MLS Search" />
            <input name="q" type="text" id="q" size="40">
            <strong> S CARNEY& ASSOCIATES INC 800-757-5783</strong> <br>
          </p>
          </form></td>
      </tr>
  </table>
    </td>
    </tr>
    </table>
  </div>
<p>
        <table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: <a href="listingsearch.php?doSearch=MLS+Search&q=&page=1">1</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=2">2</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=3">3</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=4">4</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=5">5</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=6">6</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=7">7</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=8">8</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=9">9</a> <a href="listingsearch.php?doSearch=MLS+Search&q=&page=10">10</a> </span></td></table>      <form name "searchform" action="listingsearch.php" method="post">
  </form>
</table>
<tr>
    <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd">
        
        <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/2100463/ width="214" height="160" />
            </p>
          </div>
        <p class="tagline">Click for Additional Pictures</p></td>
        <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left">
            <table width="592" height="180" border="1">
            <tr valign="top">
                <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td>
                <td width="249" bgcolor="#fcfcdd"><strong>CR 971
<br>
                  Cushing, TX 75760                  <br>
                   </strong></td>
                <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center">
                    <table width="180" height="62" border="1">
                    <tr valign="top">
                        <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/2100463/SD_disp.pdf"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td>
                        <td width="50" class="tagline"><div align="left">Status </div></td>
                        <td width="68"><div align="right" class="subHeader">ACTIVE</div></td>
                      </tr>
                    <tr valign="top">
                        <td height="24" class="tagline"><div align="left">PRICE</div></td>
                        <td align="center" valign="top"><div align="right"><strong class="subHeader">$111,078</strong></div></td>
                      </tr>
                  </table>
                    <span style="color: #fcfcdd"><strong><a href="mailto:lndcoughlin@yahoo.com?subject=CR%20971%20-%20%20Cushing,%20TX"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" />Linda_Coughlin</a></strong></span></div></td>
                <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div>
                <span style="color: #fcfcdd"><img src="" width="60" height="91" /></a></span></td>
              </tr>
            <tr valign="top">
                <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td>
                <td bgcolor="#fcfcdd"><strong></strong></td>
              </tr>
            <tr valign="top">
                <td height="77" bgcolor="#fcfcdd"  class="tagline">Description</td>
                <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #2100463<br>
                  Great property with lots of pretty trees. Some marketable timber. Nice hill site for home. Plenty of Wildlife. Creek meanders through and around property.</strong>
                <p><strong>Call  at agentnumbervar to view   or for more information.</strong></p></td>
              </tr>
          </table>
            
            <tr>
                <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S   Carney & Associates Real Estate Brokerage 800 757 5783             </span></td>
              </tr>
        </div></td>
      </tr>
      </span>
    
    <tr>
    <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd">
        
        <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/2090486/ width="214" height="160" />
            </p>
          </div>
        <p class="tagline">Click for Additional Pictures</p></td>
        <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left">
            <table width="592" height="180" border="1">
            <tr valign="top">
                <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td>
                <td width="249" bgcolor="#fcfcdd"><strong>Rayburn Wood Addition,
<br>
                  Nacogdoches, TX 75961                  <br>
                   </strong></td>
                <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center">
                    <table width="180" height="62" border="1">
                    <tr valign="top">
                        <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/2090486/SD_disp.pdf"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td>
                        <td width="50" class="tagline"><div align="left">Status </div></td>
                        <td width="68"><div align="right" class="subHeader">PENDING</div></td>
                      </tr>
                    <tr valign="top">
                        <td height="24" class="tagline"><div align="left">PRICE</div></td>
                        <td align="center" valign="top"><div align="right"><strong class="subHeader">$12,000</strong></div></td>
                      </tr>
                  </table>
                    <span style="color: #fcfcdd"><strong><a href="mailto:pcarney@swbell.net?subject=Lots%20in%20Rayburn%20Woods"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" />Phillip_Carney</a></strong></span></div></td>
                <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div>
                <span style="color: #fcfcdd"><img src="" width="60" height="91" /></a></span></td>
              </tr>
            <tr valign="top">
                <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td>
                <td bgcolor="#fcfcdd"><strong></strong></td>
              </tr>
            <tr valign="top">
                <td height="77" bgcolor="#fcfcdd"  class="tagline">Description</td>
                <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #2090486<br>
                  3/4 Mile from Lake Sam Rayburn. 3 Lots approx 75X126 Each (Being Sold Together 225' Width X 126 Depth).</strong>
                <p><strong>Call  at agentnumbervar to view   or for more information.</strong></p></td>
              </tr>
          </table>
            
            <tr>
                <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S   Carney & Associates Real Estate Brokerage 800 757 5783             </span></td>
              </tr>
        </div></td>
      </tr>
      </span>
    
    <tr>
    <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd">
        
        <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/2100546/ width="214" height="160" />
            </p>
          </div>
        <p class="tagline">Click for Additional Pictures</p></td>
        <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left">
            <table width="592" height="180" border="1">
            <tr valign="top">
                <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td>
                <td width="249" bgcolor="#fcfcdd"><strong>2319 Banita
<br>
                  Nacogdoches, TX                  <br>
                   </strong></td>
                <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center">
                    <table width="180" height="62" border="1">
                    <tr valign="top">
                        <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/2100546/SD_disp.pdf"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td>
                        <td width="50" class="tagline"><div align="left">Status </div></td>
                        <td width="68"><div align="right" class="subHeader">ACTIVE</div></td>
                      </tr>
                    <tr valign="top">
                        <td height="24" class="tagline"><div align="left">PRICE</div></td>
                        <td align="center" valign="top"><div align="right"><strong class="subHeader">$134,800</strong></div></td>
                      </tr>
                  </table>
                    <span style="color: #fcfcdd"><strong><a href="mailto:lindcoughlin@yahoo.com?subject=2319%20Banita"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" />Linda_Coughlin</a></strong></span></div></td>
                <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div>
                <span style="color: #fcfcdd"><img src="" width="60" height="91" /></a></span></td>
              </tr>
            <tr valign="top">
                <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td>
                <td bgcolor="#fcfcdd"><strong>4 Plex / 2 Story Home</strong></td>
              </tr>
            <tr valign="top">
                <td height="77" bgcolor="#fcfcdd"  class="tagline">Description</td>
                <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #2100546<br>
                  Good investment with this 3/1 house and 4-plex. All units have been re-modeled. Nearly new roof on house. Excellent location close to college and commerce.</strong>
                <p><strong>Call  at agentnumbervar to view   or for more information.</strong></p></td>
              </tr>
          </table>
            
            <tr>
                <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S   Carney & Associates Real Estate Brokerage 800 757 5783             </span></td>
              </tr>
        </div></td>
      </tr>
      </span>
    
    <tr>
    <table width="81%" border="0" align="center" cellpadding="2" cellspacing="0" background="#fcfcdd">
        
        <td width="161" height="211" align="center" valign="top" bgcolor="#fcfcdd"><div align="center"><img src="http://www.carneyrealty.com/newsite/uploads/2090632/ width="214" height="160" />
            </p>
          </div>
        <p class="tagline">Click for Additional Pictures</p></td>
        <td width="568" align="center" valign="top" bgcolor="#fcfcdd" class="calendarText"><div align="left">
            <table width="592" height="180" border="1">
            <tr valign="top">
                <td width="74" height="27" bgcolor="#fcfcdd" class="tagline">Location </td>
                <td width="249" bgcolor="#fcfcdd"><strong>Mockingbird Lane
<br>
                  Nacogdoches TX                  <br>
                   </strong></td>
                <td width="180" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="center">
                    <table width="180" height="62" border="1">
                    <tr valign="top">
                        <td width="70" rowspan="2" class="tagline"><a href="http://www.carneyrealty.com/newsite/upload/2090632/SD_disp.pdf"><img align="absbottom" src="http://www.carneyrealty.com/newsite/Listing_pages/images/datasheet_018.jpg" width="58" height="50" /></a></td>
                        <td width="50" class="tagline"><div align="left">Status </div></td>
                        <td width="68"><div align="right" class="subHeader">ACTIVE</div></td>
                      </tr>
                    <tr valign="top">
                        <td height="24" class="tagline"><div align="left">PRICE</div></td>
                        <td align="center" valign="top"><div align="right"><strong class="subHeader">$14,900</strong></div></td>
                      </tr>
                  </table>
                    <span style="color: #fcfcdd"><strong><a href="mailto:sheilacarney@swbell.net?subject=Mockingbird%20Lane-Lot"><img src="http://www.carneyrealty.com/newsite/Listing_pages/images/mail_004.gif" width="14" height="15" />Sheila_Carney</a></strong></span></div></td>
                <td width="61" rowspan="2" bgcolor="#fcfcdd" class="tagline"><div align="right"></div>
                <span style="color: #fcfcdd"><img src="" width="60" height="91" /></a></span></td>
              </tr>
            <tr valign="top">
                <td height="64" bgcolor="#fcfcdd" class="tagline">Specs</td>
                <td bgcolor="#fcfcdd"><strong></strong></td>
              </tr>
            <tr valign="top">
                <td height="77" bgcolor="#fcfcdd"  class="tagline">Description</td>
                <td colspan="3" bgcolor="#fcfcdd" ><strong>MLS #2090632<br>
                  Surveyed 09/02/2009 by Everett Griffith & Associates in Lufkin. 100X182x100X188. See Stakes on corners. Little under 1/2 Ac Lot. Pretty Lot in a Great Little Neighborhood. Appears to be fairly Level. Seller will pay 1/2 the escrow closing fee; and Realty Commission.</strong>
                <p><strong>Call  at agentnumbervar to view   or for more information.</strong></p></td>
              </tr>
          </table>
            
            <tr>
                <td height="18" colspan="2" align="center" valign="top" bgcolor="#FF9933"><span class="bodyText style2" style="color: #fcfcdd"></span><span class="bodyText style2">S   Carney & Associates Real Estate Brokerage 800 757 5783             </span></td>
              </tr>
        </div></td>
      </tr>
      </span>
    
        
        <td height="4"></td>
    </table>
          </tr>
<table width='81%' border='0' align='center' cellpadding='2' cellspacing='0' background='#fcfcdd'><span class='subHeader'><center>Pages: <a href="listings.php?doSearch=MLS+Search&q=&page=1">1</a> <a href="listings.php?doSearch=MLS+Search&q=&page=2">2</a> <a href="listings.php?doSearch=MLS+Search&q=&page=3">3</a> <a href="listings.php?doSearch=MLS+Search&q=&page=4">4</a> <a href="listings.php?doSearch=MLS+Search&q=&page=5">5</a> <a href="listings.php?doSearch=MLS+Search&q=&page=6">6</a> <a href="listings.php?doSearch=MLS+Search&q=&page=7">7</a> <a href="listings.php?doSearch=MLS+Search&q=&page=8">8</a> <a href="listings.php?doSearch=MLS+Search&q=&page=9">9</a> <a href="listings.php?doSearch=MLS+Search&q=&page=10">10</a> </span></td></table></td>
</tr>
<tr>
    <td height="22" class="bodyText"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="http://www.CarneyRealty.com/newsite/css/mm_brochure.css" rel="stylesheet" type="text/css" />
<style type="text/css"> 
<!--
.Disclaimer {
font-size: 12px;
}
.Disclaimer div p strong .Disclaimer {
font-size: 14px;
}
.Disclaimer div p strong .Disclaimer {
color: #000;
font-size: 12px;
}
.Disclaimer div p strong {
color: #000;
}
-->
</style>
</head>
<body class="Disclaimer"><div align="center">
  <p><strong><span class="Disclaimer">Disclaimer: </span>***Information from other sources deemed Reliable, but Not Guaranteed. It   is up to the Buyer to Verify the Information that we provide***</span></strong></p>
</div>
</body>
</html>
</td>
</tr>
<tr>
    <td height="194" class="bodyText"><div align="center">
        <table width="513" border="0">
        <tr valign="top">
            <th width="94" scope="col"><div align="center"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument"><img src="images/index.1.gif" width="43" height="42" border="0" /></a></div></th>
            <th width="46" scope="col"><div align="center"></div></th>
            <th width="100" valign="middle" scope="col"><div align="center" class="style7">
                <div align="center"><a href="http://www.nacogdochesmls.com/nag/passwd.php"><img src="images/MLS_a_94-50.gif" width="92" height="51" alt="Multiple Listing Service" /></a></div>
              </div></th>
            <th width="119" scope="col"><div align="center"><a href="http://www.hud.gov/offices/fheo/FHLaws/"><img src="http://www.habitatwhitley.org/equal_housing_logo.jpg" alt="Equal Housing Opportunity" width="60" height="62" border="0" /></a></div></th>
            <th width="129" scope="col"><div align="center"></div></th>
          </tr>
        <tr valign="top">
            <td height="32"><div align="center" class="style8"><a href="http://www.realtor.org/technology/crt_secure/home?opendocument">REALTOR.ORG</a></div></td>
            <td><div align="center"></div></td>
            <td valign="middle"><div align="center"><span class="style10"><a href="http://www.nacogdochesmls.com/nag/passwd.php">Multiple Listing System</a></span></div></td>
            <td><div align="center"><strong><a href="http://www.hud.gov/offices/fheo/FHLaws/">Equal Housing Opportunity</a></strong></div></td>
            <td><div align="center"><a href="http://www.bbb.org/">BETTER BUSINESS BUREAU</a></div></td>
          </tr>
      </table>
      </div></td>
  </tr>
</table>
<div align="left"> <br />
  </div>
</div>
</td>
<td valign="top"><div align="left"></div></td>
<td width="4"><div align="left"></div></td>
</tr>
<tr>
    <td width="15"> </td>
    <td width="35"> </td>
    <td width="698"><div align="center">
    <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="http://www.CarneyRealty.com/newsite/css/mm_brochure.css" rel="stylesheet" type="text/css" />
<style type="text/css"> 
<!--
.Disclaimer {
font-size: 12px;
}
.Disclaimer div p strong .Disclaimer {
font-size: 14px;
}
.Disclaimer div p strong .Disclaimer {
color: #000;
font-size: 12px;
}
.Disclaimer div p strong {
color: #000;
}
-->
</style>
</head>
<body class="Disclaimer"><div align="center">
  <p><strong><span class="Disclaimer"></span></strong><a href="http://www.carneyrealty.com/newsite/Aboutus.html"> TERMS OF USE</a></p>
</div>
</body>
</html>
  </div>
  </td>
  <td width="1"><div align="center"></div></td>
  <td width="4"> </td>
  </tr>
  </table>
  </table>
  </table>
  </div>
  </body>
  </html>

Link to comment
Share on other sites

Run this as a test script, and see what you get.

 

test.php

<?php
if(isset($_POST['submit'])) {
$sql = "select l.*,a.* from listings as l, agents as a where l.seller = a.id and (l.`price` = '$_REQUEST[q]' or l.`mls`='$_REQUEST[q]' or l.`seller`='$_REQUEST[q]' or l.`class`='$_REQUEST[q]' or l.`status`='$_REQUEST[q]') order by `price` asc";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
  while($row = mysql_fetch_assoc($result) {
	  echo $row['agentname'] . ' is selling ' . $row['description'] . ' located at ' . $row['location'] . ' for ' . $row['price'] . '<br />';
	  $images = "SELECT * FROM images WHERE mls = '{$row['mls']}'";
		$re = mysql_query($images);
		 if(mysql_num_rows($re) > 0) {
		   while($image = mysql_fetch_assoc($re)) {
			 echo '<img src="' . $image['filename'] . '" alt="' . $image['filenamedesc'] . '" /><p>' . $image['imagename']  . '</p>' . "<br />\n";
		   }
		  }
	 }
}
}
?>

<form action="" method="post">
<input type="text" name="q" value="" />
<input type="submit" name="submit" value=" Search " />
</form>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.