Advertisement

10.09.2008 at 07:41AM PDT, ID: 23801014
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

mySQL table row count not working when joining tables

Asked by cataleptic_state in PHP and Databases, WebApplications

Tags: , ,

Hi,
Using Dreamweaver Developer Toolbox, I added a Horizontal recordset to get two columns across for the city. Next to this is a number value of how many records are in the particular city.

But I have gone wrong somewhere, as I get the same value for all my 102 cities.

I have two records in the 'jobs' table and it shows '2' in the repeat region for all 102 cities.

Can anyone point me in the right direction?

Thank you.

Attach Code

Query for cities ------
mysql_select_db($database_db, $db);
$query_jobs_locations = "SELECT * FROM city";
$jobs_locations = mysql_query($query_jobs_locations, $db) or die(mysql_error());
$row_jobs_locations = mysql_fetch_assoc($jobs_locations);
$totalRows_jobs_locations = mysql_num_rows($jobs_locations);

Query for counts ------

mysql_select_db($database_db, $db);
$query_job_counts = "SELECT * FROM jobs, restaurants, city WHERE jobs.rest_id = restaurants.rest_id AND restaurants.rest_city = city_name AND job_status = 'ON'";
$job_counts = mysql_query($query_job_counts, $db) or die(mysql_error());

-----

Loop -----
<?php
  do { // horizontal looper version 3
?>
          <td><table border="0" class="smallText">
                <tr>
                  <td><a href="search_by_location.php?=<?php echo $row_jobs_locations['city_name']; ?>" onMouseOver="mouseOver()" onMouseOut="mouseOut()"><?php echo $row_jobs_locations['city_name']; ?></a></td>
                  <td>&nbsp;<?php echo $totalRows_job_counts ?> </td>
                </tr>
            </table></td>
          <?php
    $row_jobs_locations = mysql_fetch_assoc($jobs_locations);
    if (!isset($nested_jobs_locations)) {
      $nested_jobs_locations= 1;
    }
    if (isset($row_jobs_locations) && is_array($row_jobs_locations) && $nested_jobs_locations++ % 2==0) {
      echo "</tr><tr>";
    }
  } while ($row_jobs_locations); //end horizontal looper version 3
?>

----

How can I load the values for the specific city?

Also when I hover over the city name, I want to be able to show the point on a map of the UK.

I have figured out a way of creating the map effect but not as nice as the site above.

Using Javascript I am loading the image on rollover state:

Heres my code:
<script type="text/javascript">
function mouseOver()
{
document.map.src ="images/map7.jpg";
}
function mouseOut()
{
document.map.src ="images/map.jpg";
}
</script>

<td><a href="search_by_location.php" onMouseOver="mouseOver()" onMouseOut="mouseOut()">mouse</a> </td>
<td><div align="right"><img src="images/map.jpg" border="0" usemap="#Map" id="map" name="map"/></div></td>

But the problem I have is how do I add the correct map when the user clicks on the town/city name?

The town/city name will be taken from the database and setup as a link to go to search_by_location.php which will have SQL to show all for specific location(town/city)

Im sure someone once told me you cant add php to javascript :-s is this correct? Start Free Trial
[+][-]10.09.2008 at 08:08AM PDT, ID: 22679168

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 03:48AM PDT, ID: 22685661

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 06:27AM PDT, ID: 22686622

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 07:28AM PDT, ID: 22687201

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 08:27AM PDT, ID: 22687682

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 09:01AM PDT, ID: 22688020

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, WebApplications
Tags: PHP/MySQL, FF IE, Using Dreamweaver and Dreamweaver Development Tookit
Sign Up Now!
Solution Provided By: cxr
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628