?
Solved

php/mysql code segment quite working

Posted on 2011-04-23
3
Medium Priority
?
494 Views
Last Modified: 2013-12-12
I must be tired, I have been working on this code segment for some time.  It was working, and I was cleaning it up (the output) when it just quit working.  Now I just cannot seem to see where I screwed it up.

Any assistance would be appriciated.

The code segment is below:

<?php
include("prosVars.inc");

$con = mysql_connect($host, $user,$passwd);
mysql_select_db($database, $con) or die ("Couldn't select database.");



$result = mysql_query("SELECT * FROM prospects ORDER BY dis ASC LIMIT 1,85");



echo "<table border='1'>"
<tr>
<th>ID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>District</th>
<th>Unit</th>
<th>Home Phone</th>
<th>Cell Phone</th>
<th>email</th>
<th>Notes</th>
</tr>;

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['fn'] . "</td>";
  echo "<td>" . $row['ln'] . "</td>";
  echo "<td>" . $row['dis'] . "</td>";  
  echo "<td>" . $row['u'] . "</td>";
  echo "<td>" . $row['hp'] . "</td>";
  echo "<td>" . $row['cp'] . "</td>";
  echo "<td>" . $row['email'] . "</td>";
  echo "<td>" . $row['Notes'] . "</td>";  
  echo "</tr>";
  }
echo "</table>";


mysql_close($con);
?>
0
Comment
Question by:dibrandt
3 Comments
 
LVL 4

Accepted Solution

by:
4e4en earned 2000 total points
ID: 35454417
<?php
include("prosVars.inc");

$con = mysql_connect($host, $user,$passwd);
mysql_select_db($database, $con) or die ("Couldn't select database.");



$result = mysql_query("SELECT * FROM prospects ORDER BY dis ASC LIMIT 1,85");



echo "<table border='1'>
<tr>
<th>ID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>District</th>
<th>Unit</th>
<th>Home Phone</th>
<th>Cell Phone</th>
<th>email</th>
<th>Notes</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['fn'] . "</td>";
  echo "<td>" . $row['ln'] . "</td>";
  echo "<td>" . $row['dis'] . "</td>";  
  echo "<td>" . $row['u'] . "</td>";
  echo "<td>" . $row['hp'] . "</td>";
  echo "<td>" . $row['cp'] . "</td>";
  echo "<td>" . $row['email'] . "</td>";
  echo "<td>" . $row['Notes'] . "</td>";  
  echo "</tr>";
  }
echo "</table>";


mysql_close($con);

Open in new window

0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 35454475
@4e4en is right, you had the ending double quote after the first 'echo' in the wrong place.
0
 

Author Closing Comment

by:dibrandt
ID: 35454495
That's what a fress set of eyes can do!!

Thanks all.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question