|
Posted by chadlupkes on 03/28/07 06:09
Sorry! king_precinct is the same as the precinct table. Forgot to
adjust it in both locations.
And since this is a PHP forum, which Jerry reminded me of, here is the
code I'm trying to get to work:
echo('<html>
<head>
<title>Precincts in King County</title>
</head>
<body>
<table border="1">
<tr>
<th>Precinct Number</th>
<th>Precinct Name</th>
<th>County Council District</th>
<th>Congressional District</th>
<th>Legislative District</th>
<th>PCO Name</th>
<th>PCO Type</th>
</tr>
');
$link_id = db_connect('wa46dems_data');
$result = mysql_query("SELECT king_precinct.precinct_number AS
precinct_number, king_precinct.precinct_name AS precinct_name,
king_precinct.legdist AS legdist, king_precinct.countydist AS
countydist, king_precinct.congdist AS congdist, pcolist.name AS name,
pcolist.type AS type
FROM king_precinct LEFT JOIN pcolist
ON king_precinct.precinct_number = pcolist.precinct
ORDER BY precinct_name", $link_id);
while($pct_data = mysql_fetch_array($result)) {
$precinct_number = $pct_data["precinct_number"];
$precinct_name = $pct_data["precinct_name"];
$precinct_cc = $pct_data["countydist"];
$precinct_cd = $pct_data["congdist"];
$precinct_ld = $pct_data["legdist"];
$precinct_pco_name = $query_data["name"];
$precinct_pco_email = $query_data["email"];
$precinct_pco_private = $query_data["private"];
$precinct_pco_type = $query_data["type"];
echo('
<tr>
<td>'.$precinct_number.'</td>
<td><a href="precinctmap.php?pct='.$precinct_number.'">'.
$precinct_name.'</a></td>
<td>'.$precinct_cc.'</td>
<td>'.$precinct_cd.'</td>
<td>'.$precinct_ld.'</td>
<td>'.$precinct_pco_name.'</td>
<td>'.$precinct_pco_type.'</td>
</tr>');
}
echo('</table>');
On Mar 27, 8:24 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
> chadlupkes wrote:
> > I'm getting NULLs where there shouldn't be.
>
> To determine that, we'd need to see some of the data.
>
> > king_precinct
>
> You've not given us a schema for this table.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~http://tobyinkster.co.uk/contact
> Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
>
> * = I'm getting there!
[Back to original message]
|