List:General Discussion« Previous MessageNext Message »
From:David Blomstrom Date:March 18 2005 7:31pm
Subject:Ghost Table
View as plain text  
I've spent the last few days modifying my website, and
when I published my files online, one of my tables was
knocked out of commission. It was really bizarre -
everything between the <tbody></tbody> tags
disappeared online. In other words, I didn't just lose
everything related to PHP/MySQL, I couldn't even see
<tr> or <td> in the source code.

I thought it was a HTML validation error or a problem
with one of my PHP scripts, but I haven't found any
smoking gun. Then I pasted a database table from
another page onto the problem page, and it works just
fine.

So copied the good table, then replaced the table and
field names with names from the problem table - and it
doesn't work.

So I suspect there's either something really weird
going on with this particular table - "counties" - or
there's some sort of conflict between MySQL verions.
My host hasn't upgraded to the latest MySQL. However,
that hasn't been a problem for me before, except that
I have to create tables independently due to that
collation stuff.

I put both tables online at
http://www.geoworld.org/na/usa/az/counties2/

...and I appended the source code below. (Notice that
I included error_reporting(E_ALL);)

Again, both tables work fine locally, but I'm now
getting undefined index errors online and wonder if
the latest MySQL version requires a different syntax
in my script. Any tips?

Thanks.

<?php
$mycode = 'us-az';
$mytopic = 'cou';
[DATABASE CONNECTION]
echo '<head>';
error_reporting(E_ALL);
?>
</head>
<body>
<?php
$colors = array( '#eee', '', '#cfc', '' );
$n=0;
$size=count($colors);

$result = mysql_query('select count(*) from
weatherna');
if (($result) && (mysql_result ($result , 0) > 0)) {
// continue here with the code that starts
//$res = mysql_query ("SELECT * FROM type.....
} else {
die('Invalid query: ' . mysql_error());
}
{

$res = mysql_query ("SELECT * FROM weatherna WHERE
weatherna.IDArea = '$mycode'")
or die (mysql_error());

echo '<table class="tabweather" id="tabtemp"
style="float: left; margin-right: 25px;">
  <tr><td class="tdmonth" id="tdjan"
colspan="2">Jan</td><td class="tdmonth" id="tdfeb"
colspan="2">Feb</td><td class="tdmonth" id="tdmar"
colspan="2">Mar</td><td class="tdmonth" id="tdapr"
colspan="2">Apr</td></tr>';
//<!-- BeginDynamicTable -->
$rowcounter=0;
while ($row = mysql_fetch_array ($res)) {
     $c=$colors[$rowcounter++%$size];
     echo "<tr style=\"background-color:$c\"><".
$_SERVER['PHP_SELF'] .'?id='. $row['IDArea'] .">
<td>". $row['JanHot'] ."&deg;</td><td>".
$row['JanCold'] ."&deg;</td><td>". $row['FebHot']
."&deg;</td><td>". $row['FebCold'] ."&deg;</td><td>".
$row['MarHot'] ."&deg;</td><td>". $row['MarCold']
."&deg;</td><td>". $row['AprHot'] ."&deg;</td><td
class='tdcold'>". $row['AprCold']
."&deg;</td></tr>\n";
}
}
?>
    </table>


Cool Table

<?php
$colors = array( '#eee', '', '#cfc', '' );
$n=0;
$size=count($colors);

$result = mysql_query('select count(*) from
counties');
if (($result) && (mysql_result ($result , 0) > 0)) {
// continue here with the code that starts
//$res = mysql_query ("SELECT * FROM type.....
} else {
die('Invalid query: ' . mysql_error());
}
{

$res = mysql_query ("SELECT * FROM counties WHERE
counties.seat = 'Lafayette'")
or die (mysql_error());

echo '<table>
  <tr><td>Seat</td><td>Area</td></tr>';
//<!-- BeginDynamicTable -->
$rowcounter=0;
while ($row = mysql_fetch_array ($res)) {
     $c=$colors[$rowcounter++%$size];

echo 'XXX';
echo mysql_num_rows($res);


     echo "<tr style=\"background-color:$c\">
<td>". $row['seat'] ."</td><td>". $row['area']
."</td></tr>\n";
}
}
?>
    </table>
</body>
</html>



		
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs
Thread
Ghost TableDavid Blomstrom18 Mar
  • Re: Ghost TableDavid Blomstrom18 Mar