0

Hello everyone. I have setup a website and the common.php is configured but the site seems to not be linking to the database. For example, if I mouse over a link mydomain.com/details.php?id=1 and click the link it takes me to mydomain.com/details.php and says no results found. In the database it shows a value 1 in that spot but does not populate.

4
Contributors
6
Replies
32
Views
2 Years
Discussion Span
Last Post by Sutarusu
0

Any error logging available? With not much to go it it would appear that the code that reads the parameter and does the SQL query is failing or can't connect.
Either thing should be putting out a log hopefully. What platform are you using?

0

It does not give a database error it just says Sorry! No Listings Found!
my site is the9thgreen dot com if you want to take a look. When you click a search result you notice the mouseover link is not the link you go to.

I did find an error log

[Tue Feb 24 22:11:47 2015] [error] [client 108.xxx.xxx.xx] File does not exist: /home2/xxxxxxx/public_html/the9thgreen. com/style1.css, referer:the9thgreen. com/details.php?id=1

I have a style.css but no style1.css

Edited by Sutarusu: misspelling

0
<?php
include("common.php");
include("header.php");

$var = @$_GET['q'];

mysql_connect("localhost","$dbuser","$dbpass");
mysql_select_db("$dbname") or die("Unable to select database");
$query = "SELECT * FROM `$table` WHERE `id` = '$id'";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);

if ($numrows == 0)
    {
        echo "Sorry! No Listings Found!";
        include("footer.php");
        exit;
    }

$result = mysql_query($query) or die("Couldn't execute query");

while($row = mysql_fetch_array($result, MYSQL_BOTH))
    {
        $id = $row['id'];   if($id) { $id = $id; } else { $id = "-?-"; }
        $cityid = $row['city_id'];  if($cityid) { $cityid = $cityid; } else { $cityid = "-?-"; }
        $name = $row['name'];   if($name) { $name = $name; } else { $name = "-?-"; }
        //if(!$name) { $name2 = ""; } else { $name2 = $name; }
        $address = $row['address']; if($address) { $address = $address; } else { $address = "-?-"; }
        $phone = $row['phone']; if($phone) { $phone = $phone; } else { $phone = "-?-"; }
        $type = $row['type'];   if($type) { $type = $type; } else { $type = "-?-"; }
        $holes = $row['holes']; if($holes) { $holes = $holes; } else { $holes = "-?-"; }
        $bookings = $row['bookings'];   if($bookings) { $bookings = $bookings; } else { $bookings = "-?-"; }
        $fees = $row['fees'];   if($fees) { $fees = $fees; } else { $fees = "-?-"; }
        echo"<div align=\"center\">
<center>
<table bgcolor=\"#ffffff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"748\">
<tr width=\"100%\">
<!---  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>ID</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$id</td>
</tr> --->
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Name</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>$name</b></td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Address</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$address</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Phone</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$phone</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Type</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$type</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Holes</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$holes</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Bookings</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$bookings</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"><b>Fees</b></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\">$fees</td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"></td>
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\"></td>
</tr>
<tr width=\"100%\">
  <td width\"50%\" style=\"padding-left: 10; padding-right: 10; padding-top: 5; padding-bottom: 5\" colspan=\"2\"><a href=\"javascript:history.go(-1)\">Go Back</a></td>
</tr>
</table>
</center>
</div>";
    }?>

<!--API Code --->
<style type="text/css">
<!--
.style1 {
    color: #CC0000;
    font-weight: bold;
}
-->
</style>

<table width="748" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr align="center">
    <td bgcolor="#FFFFFF"><p>&nbsp;</p>
    <div align="center">

<center>
<p><span class="style1">Enter  the Course's address from ABOVE into the MapFinder BELOW and get directions and other Info</span></p>
<p>Default is where the PGA of America is located until you enter the address from above. 
      <!-- ++Begin Map Search Control Wizard Generated Code++ -->
    <!--
  // Created with a Google AJAX Search Wizard
  // http://code.google.com/apis/ajaxsearch/wizards.html
  -->

    <!--
  // The Following div element will end up holding the map search control.
  // You can place this anywhere on your page
  -->
</p>
<div id="mapsearch">
    <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span>  </div>

  <!-- Maps Api, Ajax Search Api and Stylesheet
  // Note: If you are already using the Maps API then do not include it again
  //       If you are already using the AJAX Search API, then do not include it
  //       or its stylesheet again
  //
  // The Key Embedded in the following script tags is designed to work with
  // the following site:
  // http://demo-demo-demo.com
  -->
  <script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $api ?>"
    type="text/javascript"></script>
  <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-msw&key=<?php echo $api ?>"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/css/gsearch.css");
  </style>

  <!-- Map Search Control and Stylesheet -->
  <script type="text/javascript">
    window._uds_msw_donotrepair = true;
  </script>
  <script src="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js?mode=new"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css");
  </style>

  <style type="text/css">
    .gsmsc-mapDiv {
      height : 300px;
    }

    .gsmsc-idleMapDiv {
      height : 300px;
    }

    #mapsearch {
      width : 735px;
      margin: 0px;
      padding: 4px;
    }
  </style>
  <script type="text/javascript">
    function LoadMapSearchControl() {

      var options = {
            zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL,
            title : "PGA of America",
            url : "http://www.pga.com/home/pgaofamerica/",
            idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM,
            activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM
            }

      new GSmapSearchControl(
            document.getElementById("mapsearch"),
            "100 Avenue of the Champions FL 33418",
            options
            );

    }
    // arrange for this function to be called during body.onload
    // event processing
    GSearch.setOnLoadCallback(LoadMapSearchControl);
  </script>
<!-- ++End Map Search Control Wizard Generated Code++ -->


 </div></td>
  </tr>
</table>



<?

include("footer.php");
?>
0

in line 9 you are displaying $id. GET value of id is missing.

**ie **

$id = $_GET['id'];

Edited by rpv_sen: alter

0

Thanks rpv sen, I tried that before posting here. Good catch though.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.