Jump to content

Jdog

Members
  • Posts

    11
  • Joined

  • Last visited

Jdog's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks Jessica, I will have a look at that right now.
  2. I removed the error suppression and it's still outputting all the results, not just the results from that designated state.
  3. As thread title says, currently using this code to pull in listings from the "listings" table in the database <?PHP if ($_POST[limit] != $nil) $_SESSION['limit'] = $_POST['limit']; if ($_SESSION[limit] == $nil) $_SESSION['limit'] = 20; //--------------------------------------- ?> <?PHP include "bit_centerbar.php"; ?> <?php //------------------------- if (empty($rowxxx['SORT'])) $rowxxx['SORT'] = 'TITLE ASC'; else { if ($rowxxx['SORT'] == Alphabetically) $rowxxx['SORT'] = 'TITLE ASC'; if ($rowxxx['SORT'] == 'Date Added') $rowxxx['SORT'] = 'YA DESC, MA DESC, DA DESC, TITLE DESC'; if ($rowxxx['SORT'] == 'Date Updated') $rowxxx['SORT'] = 'YU DESC, MU DESC, DU DESC, TITLE ASC'; } if (empty($_GET[sortby])) $sort = $rowxxx['SORT']; $_GET[sortby] = "$sort"; $table = "LISTINGS"; $string = "WHERE STATUS = 'Active' AND CATEGORY LIKE '%-$_GET[category]-%'"; if (empty($_GET[category])) $string = "WHERE STATUS = 'Active'"; if ($_GET[category] == '') $string = "WHERE ID != ''"; $swap = "&page=$_GET &category=$_GET[category]"; //------------------------------------------------------------------------------------------- $query1 = @mysql_query ("SELECT * FROM $table INNER JOIN PACKAGES ON LISTINGS.PACKAGE = PACKAGES.ID $string $adv_search ORDER BY PACKAGES.RANK ASC, $_GET[sortby]"); //$query1 = @mysql_query ("SELECT * FROM $table $string $adv_search ORDER BY $_GET[sortby]"); $numrows= @mysql_num_rows ($query1); if (!isset ($_GET['show'])) { $display = 1; } else { $display = $_GET['show']; } $start = (($display * $_SESSION['limit']) - $_SESSION['limit']); $query2 = @mysql_query ("SELECT *, LISTINGS.ID AS LID FROM $table INNER JOIN PACKAGES ON LISTINGS.PACKAGE = PACKAGES.ID $string $adv_search ORDER BY PACKAGES.RANK ASC, $_GET[sortby] LIMIT $start,$_SESSION[limit]"); //$query2 = @mysql_query ("SELECT * FROM $table $string $adv_search ORDER BY $_GET[sortby] LIMIT $start,$_SESSION[limit]"); while ($row = @mysql_fetch_array ($query2)) { include "browse_display.php"; } //------------------------------------------------------------------------------------------- ?> <?php if ($numrows == '0') { ?> <div class="tdbox" style="width: 100%;"></div> <?php if (empty($_GET[category])) include 'bit_centerbar.php'; ?> <? echo $browse_no; ?> <?PHP } else { ?> <form action="?show=1&page=browse&category=<?php echo $_GET[category]; ?>&mode=<?php echo $_GET[mode]; ?>" method="post" name="form" id="form"> <div class="pagi" style="margin-top: 15px;"> <input type="submit" name="Submit" value="<? echo $browse_show; ?>" /> <select name="limit"> <option selected> <?php echo $_SESSION['limit']; ?> </option> <option>1</option> <option>5</option> <option>10</option> <option>20</option> <option>30</option> <option>50</option> <option>100</option> </select> <? echo $browse_lists; ?> <?php include "pagination_bot.php"; ?> </div> </form> <?PHP } ?> But now I am trying to find a way to display the results from particular states, i.e. Victoria, Queensland(this is from Australia). I am trying the following code, but currently getting the "no listings here, check back soon" message with no errors. I'm very new to PHP so not sure if I need to tweak the code to pull the results from the "LISTINGS" table, or the "LOCATIONS" <?PHP if ($_POST[limit] != $nil) $_SESSION['limit'] = $_POST['limit']; if ($_SESSION[limit] == $nil) $_SESSION['limit'] = 20; //--------------------------------------- ?> <?PHP include "bit_centerbar.php"; ?> <?php //------------------------- if (empty($rowxxx['SORT'])) $rowxxx['SORT'] = 'TITLE ASC'; else { if ($rowxxx['SORT'] == Alphabetically) $rowxxx['SORT'] = 'TITLE ASC'; if ($rowxxx['SORT'] == 'Date Added') $rowxxx['SORT'] = 'YA DESC, MA DESC, DA DESC, TITLE DESC'; if ($rowxxx['SORT'] == 'Date Updated') $rowxxx['SORT'] = 'YU DESC, MU DESC, DU DESC, TITLE ASC'; } if (empty($_GET[sortby])) $sort = $rowxxx['SORT']; $_GET[sortby] = "$sort"; $table = "LISTINGS"; $string = "WHERE STATUS = 'Active' AND CATEGORY LIKE '%-$_GET[sTATE]-%'"; if (empty($_GET[category])) $string = "WHERE STATUS = 'Active'"; if ($_GET[category] == '') $string = "WHERE ID != 'Queensland'"; $swap = "&page=$_GET &state=$_GET[state]"; //------------------------------------------------------------------------------------------- $query1 = @mysql_query ("SELECT * FROM $table INNER JOIN PACKAGES ON LISTINGS.PACKAGE = PACKAGES.ID $string $adv_search ORDER BY PACKAGES.RANK ASC, $_GET[sortby]"); //$query1 = @mysql_query ("SELECT * FROM $table $string $adv_search ORDER BY $_GET[sortby]"); $numrows= @mysql_num_rows ($query1); if (!isset ($_GET['show'])) { $display = 1; } else { $display = $_GET['show']; } $start = (($display * $_SESSION['limit']) - $_SESSION['limit']); $query2 = @mysql_query ("SELECT *, LISTINGS.ID AS LID FROM $table INNER JOIN PACKAGES ON LISTINGS.PACKAGE = PACKAGES.ID $string $adv_search ORDER BY PACKAGES.RANK ASC, $_GET[sortby] LIMIT $start,$_SESSION[limit]"); //$query2 = @mysql_query ("SELECT * FROM $table $string $adv_search ORDER BY $_GET[sortby] LIMIT $start,$_SESSION[limit]"); while ($row = @mysql_fetch_array ($query2)) { include "bwose_display.php"; } //------------------------------------------------------------------------------------------- ?> <?php if ($numrows == '0') { ?> <div class="tdbox" style="width: 100%;"></div> <?php if (empty($_GET[category])) include 'bit_centerbar.php'; ?> <? echo $browse_no; ?> <?PHP } else { ?> <form action="" method="post" name="form" id="form"> <div class="pagi" style="margin-top: 15px;"> <input type="submit" name="Submit" value="<? echo $browse_show; ?>" /> <select name="limit"> <option selected> <?php echo $_SESSION['limit']; ?> </option> <option>1</option> <option>5</option> <option>10</option> <option>20</option> <option>30</option> <option>50</option> <option>100</option> </select> <? echo $browse_lists; ?> <?php include "pagination_bot.php"; ?> </div> </form> <?PHP } ?>
  4. The "state" and "city" are in a LOCATION table where they have IDs, i.e. Victoria has the ID of 2, the records in the LISTINGS table have state defined by word, i.e. "Victoria".
  5. Thanks for the reply, they aren't getting back to me now (best customer support ever), so I'll guess I'll be looking into other options.
  6. Just an update, the software providers got back to me and said for this function to be available I'll need to pay an "additional feature" fee EDIT: Just got an e-mail back.. "If you want to do it yourself, I can tell you as much as, you would need to do a MySQL query which loops through the database and pulls out results based on the listing owner, then you would need to output those results into the HTML. Search for MySQL queries and how to get records out of a database with PHP.If you want to do it yourself, I can tell you as much as, you would need to do a MySQL query which loops through the database and pulls out results based on the listing owner, then you would need to output those results into the HTML. Search for MySQL queries and how to get records out of a database with PHP." So I guess I'll start there, so for wasting any readers time by not understanding the terminology enough to ask the right questions.
  7. Thank you for responding, my problem is I'm not sure how I would target the URL to filter (by location in this case). I can do www.site.com/index.php?page=home&category=1 And it will list all the results in category 1, i've tried location=victoria, location=2(the id of the state in the mysql database) I just don't know where to look to troubleshoot if this is possible(sorry I am very new to php so my terminology isn't the best). I can provide information from the mysql database if required, I just don't know what info is required.
  8. Hi, As title reads I am looking for a way to make the state field name searchable, even by way of a url example: www.site.com/index.php?page=home&state=victoria The directory script software I got has a home page with a seach box where you select your state from a drop down, hit search and then it narrows down the results and shows the number of the results next to the categories "dogs(2)", but I am trying to find a way that I can create a link directly to a page which displays the records from that state, the idea behind it is to create more links for SEO purposes. If anyone could shed light on how I could do this or how I could figure out how I'd be greatly appreciative.
  9. Jdog

    If /if Else

    Thanks for the replies guys, I have since found another problem, thought it would make more sense posting in there than making a new thread on it. Ok package 1 and 2 work fine, but when I try to apply the same code but to a package != 3, it's not working, on the page that has packages 1 and 2 listed it has the template for 3 listed below each result, when i remove the IF commands for package 3 it displays 1 and 2 perfectly, and the result as package 3 twice, using the templates from 1 and 2, is there a bug or something from preventing this IF command I posted before working for more than 2 commands? And to answer the other comment, I didn't write the code, I got the code when I got idev business listing 3.0, it was precoded, I am just making tweaks. The results page is currently, with the code like this the template set for package 3 shows below both 1 & 2 and for package 3 it only shows the result twice, as template 1 and 2 (hope this makes sense) <?php if ($_GET == searchr) $row[LID] = $row[iD]; ?> <?php $SQLbg = "SELECT * from PACKAGES WHERE ID = '$row[PACKAGE]'"; $resultbg = @mysql_query( $SQLbg ); $rowbg = @mysql_fetch_array( $resultbg ); if ($rowbg[HIGHLIGHT] != $nil) $bgcolor = $rowbg[HIGHLIGHT]; ?> <?php if ($_GET[mode] == 'search') $row[iD] = $row[iD]; ?> <?PHP $SQLview = "SELECT * from VIEW WHERE L_ID = '$row[iD]'"; $resultview = @mysql_query( $SQLview ); $rowview = @mysql_fetch_array( $resultview ); $SQLvisit = "SELECT * from VISIT WHERE L_ID = '$row[iD]'"; $resultvisit = @mysql_query( $SQLvisit ); $rowvisit = @mysql_fetch_array( $resultvisit ); ?> <?PHP $country = ereg_replace(' ','+',$row[COUNTRY]); $state = ereg_replace(' ','+',$row[sTATE]); $province = ereg_replace(' ','+',$row[PROVINCE]); $city = ereg_replace(' ','+',$row[CITY]); $zip = ereg_replace(' ','+',$row[ZIP]); $street = ereg_replace(' ','+',$row[sTREET]); $country = strtolower($country); $state = strtolower($state); $province = strtolower($province); $city = strtolower($city); $zip = strtolower($zip); $street = strtolower($street); ?> <?PHP $MyProductTitle=EdURL($row[TITLE]); $row[CATEGORY]=str_replace("-","","$row[CATEGORY]"); ?> <?php if ($row["PACKAGE"] != 1) { ?> <table class="listbox-red" width="100%" border="0" cellspacing="0" cellpadding="0" height="120px"> <tr> <?PHP //--------------------------------------------------------------------- $filename = "$svr_rootscript/product_images/thumb/$row[iMAGENAME].jpg"; if (file_exists($filename)) { //--------------------------- ?> <td rowspan="2" valign="top" ><div class="thumbimage"><img src="product_images/thumb/<?php echo "$row[iMAGENAME]"; ?>.jpg" border="0" height="100px"></div> <a href="<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><img src="images/more-info.gif"></a></td> <?PHP } ?> <td width="80%" valign="top"><h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><font color="#FF0000">**URGENT**</font> <?php echo "$row[TITLE]"; ?> - <?php echo $row[AGE]; ?></a></h3> <p><?php echo $row[CAPTION]; ?></p> <p></p></td> <td width="20%" valign="top"><B><?php echo $row[sTATE]; ?></b><br> <?php echo $row[CITY]; ?> <br> <br> </td> </tr> <tr> <td valign="bottom"><b><?php echo $row[GENDER]; ?> <?php echo $row[bREED]; ?></b></td> <td width="20%" valign="bottom"><?php echo "$row[DA]/$row[MA]/$row[YA]"; ?></td> </tr> </table> <?PHP } ?> <?php if ($row["PACKAGE"] != 2) { ?> <table class="listbox" width="100%" border="0" cellspacing="0" cellpadding="0" height="120px"> <tr> <?PHP //--------------------------------------------------------------------- $filename = "$svr_rootscript/product_images/thumb/$row[iMAGENAME].jpg"; if (file_exists($filename)) { //--------------------------- ?> <td rowspan="2" valign="top" ><div class="thumbimage"><img src="product_images/thumb/<?php echo "$row[iMAGENAME]"; ?>.jpg" border="0" height="100px" /></div> <a href="<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><img src="images/more-info.gif"></a></td> <?PHP } ?> <td width="80%" valign="top"> <h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?> - <?php echo $row[AGE]; ?></a></h3> <p><?php echo $row[CAPTION]; ?></p> </td> <td width="20%" valign="top"><B><?php echo $row[sTATE]; ?></b><br> <?php echo $row[CITY]; ?> </td> </tr> <tr> <td valign="bottom"><b><?php echo $row[GENDER]; ?> <?php echo $row[bREED]; ?></b></td> <td width="20%" valign="bottom"><?php echo "$row[DA]/$row[MA]/$row[YA]"; ?></td> </tr> </table> <?PHP } ?> <?php if ($row["PACKAGE"] != 3) { ?> <table class="listbox" width="100%" border="0" cellspacing="0" cellpadding="0" height="120px"> <tr> <?PHP //--------------------------------------------------------------------- $filename = "$svr_rootscript/product_images/thumb/$row[iMAGENAME].jpg"; if (file_exists($filename)) { //--------------------------- ?> <td rowspan="2" valign="top" ><div class="thumbimage"><img src="product_images/thumb/<?php echo "$row[iMAGENAME]"; ?>.jpg" border="0" height="100px" /></div> <a href="<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><img src="images/more-info.gif"></a></td> <?PHP } ?> <td width="80%" valign="top"> <h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?> - <?php echo $row[AGE]; ?></a></h3> <p><?php echo $row[CAPTION]; ?></p> </td> <td width="20%" valign="top"><B><?php echo $row[sTATE]; ?></b><br> <?php echo $row[CITY]; ?> </td> </tr> <tr> <td valign="bottom"><b><?php echo $row[GENDER]; ?> <?php echo $row[bREED]; ?></b></td> <td width="20%" valign="bottom"><?php echo "$row[DA]/$row[MA]/$row[YA]"; ?></td> </tr> </table> <?PHP } ?>
  10. Jdog

    If /if Else

    Nevermind, I worked it out. <?php if ($row[PACKAGE] != 3) { ?> <h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a></h3> <?PHP } ?> <?php if ($row[PACKAGE] != 1) { ?> <?php echo "$row[TITLE]"; ?> <?PHP } ?> <p><?php echo $row[CAPTION]; ?></p> If anyone can suggest a cleaner code go nuts.
  11. Hey, I am new to PHP and I'm having a problem with a listing script I recently installed. Long story short basically there are 3 listing types, the 3rd, or "3" is free listings, I am trying to use an IF or IF ELSE code so that if the [package] = 3, it shows the listing name without the link, here is the code for the listing. I have bolded the area that needs to have the command. <table class="listbox" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <?PHP //--------------------------------------------------------------------- $filename = "$svr_rootscript/product_images/thumb/$row[iMAGENAME].jpg"; if (file_exists($filename)) { //--------------------------- ?> <td valign="top" ><a class="thumbimage" href="<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><img src="product_images/thumb/<?php echo "$row[iMAGENAME]"; ?>.jpg" border="1" width="100px" /></a></td> <?PHP } ?> <td width="100%" valign="top"> <?php if ($row[package] != 3) { ?> <h3><a href = "<?PHP mrd("$MyProductTitle", "$row[LID]", "$_GET[category]", "$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a></h3> <?PHP } ?> <p><?php echo $row[CAPTION]; ?></p> </td> </tr> </table> The current IF command was told to me by a tech support from the place I got the software, but it doesn't work Any help would be much appreciated. Thank you.
×
×
  • 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.