[Freerealty] featured.php missing database name?

Patrick Fleming, EA pat at rwcinc.net
Wed Apr 27 08:31:40 MST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



If you moved common.php from its "expected" place then yes I think you
would have all kinds of "problems".

The main variable is $install_path. From there most things are relative.
I also set an include variable that gets pulled in with the
GetIncludes() function, by default that points to the includes directory
under the install directory. But the includes folder could be anywhere
the script can read, including outside of the web directory.

The images directory works the same way. Images are looked for in
$install_path/$imageloc/listings and $install_path/$imageloc/agents
So $install_path is a very important part of the configuration.

Scott Wang wrote:
| Actually... I wonder if that's the problem.  My index file (where featured
| listings are shown) is in the root directory while the FreeRealty
files are
| in the /listings/ directory.
|
| Is it possible that it was looking for root/includes/func.php while
the file
| was really located at root/listings/includes/func.php ?

Yep, yep, yep. :)

|
|  - Scott Wang
| Scott's Computing
|
|
|
| -----Original Message-----
| From: freerealty-bounces at lists.rwcinc.net
| [mailto:freerealty-bounces at lists.rwcinc.net] On Behalf Of Patrick Fleming
| Sent: Tuesday, April 26, 2005 1:04 PM
| To: Continuation of Jon Roig's OR 2.x Development
| Subject: RE: [Freerealty] featured.php missing database name?
|
|
| Scott,
|
| At the bottom of common.php there is a function GetIncludes() that pulls
| in all files ending in .php from includes. This is where it pulls in
| thumbnail.php and features.php as well.
|
|
|
| On Tue, 2005-04-26 at 10:37, Scott Wang wrote:
|
|>That's all true, however, getdb() is in the func.php file, right?
|>
|>Where in common.php or featured.php does it pull in the func.php file?
|
| How
|
|>does it know what that function does?
|>
|> - Scott Wang
|>
|>
|>-----Original Message-----
|>From: freerealty-bounces at lists.rwcinc.net
|>[mailto:freerealty-bounces at lists.rwcinc.net] On Behalf Of Patrick Fleming,
|>EA
|>Sent: Tuesday, April 26, 2005 11:08 AM
|>To: Continuation of Jon Roig's OR 2.x Development
|>Subject: Re: [Freerealty] featured.php missing database name?
|>
| Scott,
| Wow. The database connection is setup through the function getdb();
| Not only does it set up the user/password combination but selects the
| $db database as well and should throw errors if it cannot connect.
| If you have the line $link = getdb(); at the top of your files it should
| connect. Not sure why it failed for you.... unless getdb() I believe
| requires globals.
|
|
| Scott Wang wrote:
| | Argh!  Another hair-puller.  I just spent an hour trying to get the
| featured
| | listings to work and I think I found the problem.
| |
| | I had to add the ' $db. ' to the two mysql_query lines in order for it
|
|> to
|
| | stop throwing errors.  I looked and couldn't figure out how the
| mysql_query
| | knew which database it was querying.  After I did that, the two listings
| | showed up correctly, images and all.
| |
| | This is the content of featured.php, with the two $db.'s that I added in
| | red.
| |
| |
| | //EXAMPLE CODE:
| | //handles the listing of featured properties
| | //Adding random rotation of images and a limit
| | //Check to see if $noimages is set
| |
| | $result = mysql_query("SELECT distinct * from $db.".$table_prefix."homes
| | WHERE featured = 'Y' AND status != 'Held' ORDER BY RAND() LIMIT $limit",
| | $link);
| |
| | while ($a_row = mysql_fetch_array($result) )
| |  {
| |   //add commas to price
| |   $a_row['price'] = number_format ($a_row['price']);
| |   $a_row['title'] = stripslashes($a_row['title']);
| |   echo  "<p /><a
| | href=\"./propview.php?view=$a_row[id]\"><b>$a_row[title]</b></a><BR>";
| |   //select images connected to a given listing
| |   $query = "SELECT * FROM $db.".$table_prefix."tbl_Files WHERE prop_num
|
|> =
|
| | $a_row[id] LIMIT 1";
| |   $output = mysql_query("$query",$link);
| |   $count = 0;
| |   while ($image_row = mysql_fetch_array($output) )
| |    {
| |     print "<a href=\"propview.php?view=$a_row[id]\"><img
| | src='image.php?Id=$image_row[id_files] &image=thumb' border=1 width=100
| | alt=\"Photo\"></a><br>";
| |     $count++;
| |    }
| |   if($count == 0)
| |    {
| |     print "<a href=\"./propview.php?view=$a_row[id]\"><img
| | src=\"./images/nophoto.gif\" border=1 width=100 alt=\"View
| | Listing\"></a><br>";
| |    }	
| | //  print "$a_row[beds] beds/$a_row[baths] baths<BR>
| \$$a_row[price]<BR> <P
| | />";
| |  }
| |
| |
| |  - Scott Wang
| | Scott's Computing
| |
| |
| |
| |
| | ------------------------------------------------------------------------
| |
| | _______________________________________________
| | FreeRealty mailing list
| | FreeRealty at lists.rwcinc.net
| | http://lists.rwcinc.net/mailman/listinfo/freerealty
| | FreeRealty web site: http://www.rwcinc.net/freerealty

_______________________________________________
FreeRealty mailing list
FreeRealty at lists.rwcinc.net
http://lists.rwcinc.net/mailman/listinfo/freerealty
FreeRealty web site: http://www.rwcinc.net/freerealty
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCb7BcGzHR7DxVKWIRAj1RAKCKVn8TWzvfOTfxsssfGgOkFmK/VQCgmufk
+XtZkUaiDLwbj6O0qqJ2RkA=
=dLR5
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3383 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rwcinc.net/pipermail/freerealty/attachments/20050427/77d7ef9d/smime.bin


More information about the FreeRealty mailing list