473,626 Members | 3,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bizarre (to me) result: intermittent garbled output

I've been having some really weird problems with a very simple PHP
app. I'm wondering if anyone can help me sort this out.

I have a page that prints out the results of a MySQL query as an HTML
table using a for loop: nothing too exotic there.

However, sometimes one column shows the data it's supposed to contain,
and sometimes it doesn't. (The name of the field is "category". ) I
checked the actual DB data. The data is there.

That's not all. I just visited the page and got the result below. PHP
has inserted "(" characters between the table rows. I can see how
maybe a syntax error could cause that, but why would it only happen
sometimes?

Why does that column of data disappear and then reappear when I visit
the page later?

Php code and HTML output are given below.

Setup information:

FreeBSD 4.7
PHP 4.3.8
Zend Optimizer 2.5.1
MySQL 4.0.18

--------------------------------------------------------------------------
PHP CODE
--------------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AFWH Website Admin</title>
<? include("../include/headerItems.htm "); ?>
</head>

<body>
<?
$con = mysql_connect(" localhost", "MYUSERNAME ", "MYPASSWORD ");
if (!$con)
{
echo "Error connecting to DB";
}
mysql_select_db ("articles") ;
$statement = "SELECT * FROM articles";
$result = mysql_query($st atement);
?>

<h1 id="pageTitle"> <? echo mysql_num_rows( $result); ?>
articles</h1>
<p id="menu"><a href="articleFo rmIn.php">Add article</a> | <a
href="listArtic les.php">List all</a></p>
<table id="articleList ing">
<tr>
<td>Filename</td>
<td>Category</td>
<td>Title</td>
<td>Date</td>
<td>Publish</td>
<td>&nbsp;</td>
<td>Idx. pg. code</td>
</tr>
<?
$rowClass = "white";
for ($i = 0 ; $i < mysql_num_rows( $result) ; $i++)
{
if ($rowClass == "white")
{
$rowClass = "grey";
} else {
$rowClass = "white";
}
$row = mysql_fetch_arr ay($result);
?>

<tr class="<? echo $rowClass; ?>">
<td><? echo $row["filename"]; ?>
</td>

<td><? echo $row["category"]; ?>
</td>

<td><a href='editArtic le.php?id=<? echo $row["ID"]; ?>'>
<? echo $row["title"]; ?>: <? echo $row["subtitle"]; ?>
</a></td>

<td><? echo $row["date"]; ?>
</td>

<td>
Publish >
<a href="publish.p hp?id=<? echo $row["ID"] ?>&curr=1">Curr ent</a>
|
<a href="publish.p hp?id=<? echo $row["ID"] ?>&curr=0">Arch ive</a>
</td>

<td>
<a href="deleteCon firm.php?id=<? echo $row["ID"] ?>">DEL from
DB</a>
</td>

<td><a href='indexPgCo de.php?id=<? echo $row["ID"]; ?>'>Snippet</a>
</td>
</tr><?
}
?>
</table>
</body>
</html>
--------------------------------------------------------------------------
RESULTING HTML OUTPUT
--------------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AFWH Website Admin</title>
<meta http-equiv="Content-type"
content="text/html; charset=us-ascii" />
<meta http-equiv="Content-Language"
content="en-us" />
<meta name="ROBOTS"
content="NONE" />
<style type="text/css">
/*<![CDATA[*/
@import url(/admin/css/admin.css);
/*]]>*/
</style> </head>

<body>

<h1 id="pageTitle"> 12 articles</h1>

<p id="menu"><a href="articleFo rmIn.php">Add article</a> | <a
href="listArtic les.php">List all</a></p>
<table id="articleList ing">
<tr>
<td>Filename</td>
<td>Category</td>
<td>Title</td>

<td>Date</td>
<td>Publish</td>
<td>&nbsp;</td>
<td>Idx. pg. code</td>
</tr>

( <tr class="grey">
<td>/articles/free/newmodelofarous al.htm </td>
<td> </td>

<td><a href='editArtic le.php?id=8'>
A New Model of Arousal: At mid-life, desire may need a
jump start </a></td>

<td>April, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=8&curr=1" >Current</a> |
<a href="publish.p hp?id=8&curr=0" >Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=8"> DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=8'>Sn ippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/free/combattingdepre ssion.htm
</td>

<td> </td>

<td><a href='editArtic le.php?id=9'>
Combatting Depression with a Better Diet: What omega-3
fatty acids can do for you </a></td>

<td>April, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=9&curr=1" >Current</a> |
<a href="publish.p hp?id=9&curr=0" >Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=9"> DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=9'>Sn ippet</a>
</td>
</tr>
( <tr class="grey">

<td>/articles/paid/october_04/troublesleeping .htm
</td>

<td>SLEEP </td>

<td><a href='editArtic le.php?id=27'>
More Trouble Sleeping than Your Spouse?: Anxiety or
Depression May Be the Problem </a></td>

<td>October, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=27&curr=1 ">Current</a> |
<a href="publish.p hp?id=27&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=27" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=27'>S nippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/paid/october_04/beyondcholester ol.htm
</td>

<td>SELFCARE </td>

<td><a href='editArtic le.php?id=28'>
Predicting Heart Disease: Beyond Cholesterol
</a></td>

<td>October, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=28&curr=1 ">Current</a> |
<a href="publish.p hp?id=28&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=28" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=28'>S nippet</a>
</td>
</tr>
( <tr class="grey">

<td>/articles/free/controversyover kegels.htm
</td>

<td> </td>

<td><a href='editArtic le.php?id=11'>
The Controversy over Kegels: Are women doing them
correctly? </a></td>

<td>June, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=11&curr=1 ">Current</a> |
<a href="publish.p hp?id=11&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=11" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=11'>S nippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/free/recurringnightm ares.htm
</td>

<td> </td>

<td><a href='editArtic le.php?id=12'>
Recurring Nightmares and Post-traumatic Stress: Twice as
many women suffer as men </a></td>

<td>April, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=12&curr=1 ">Current</a> |
<a href="publish.p hp?id=12&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=12" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=12'>S nippet</a>
</td>
</tr>
( <tr class="grey">

<td>/articles/paid/october_04/testosterone.ht m
</td>

<td>INTERVIEW </td>

<td><a href='editArtic le.php?id=29'>
Is Testosterone the Answer to Low Libido?: Researcher
Susan Davis tells when and how it works </a></td>

<td> </td>

<td>
Publish >
<a href="publish.p hp?id=29&curr=1 ">Current</a> |
<a href="publish.p hp?id=29&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=29" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=29'>S nippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/free/sexafterprostat e.htm </td>

<td> </td>

<td><a href='editArtic le.php?id=14'>
Sex after Prostate Surgery: What every couple needs to
know </a></td>

<td>April, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=14&curr=1 ">Current</a> |
<a href="publish.p hp?id=14&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=14" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=14'>S nippet</a>
</td>
</tr>
( <tr class="grey">

<td>/articles/free/copingwithpms.h tm </td>

<td> </td>

<td><a href='editArtic le.php?id=15'>
Coping with PMS: Can low-dose antidepressants help?
</a></td>

<td>April, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=15&curr=1 ">Current</a> |
<a href="publish.p hp?id=15&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=15" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=15'>S nippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/free/destress.htm </td>

<td> </td>

<td><a href='editArtic le.php?id=17'>
How to De-Stress: A Brief Guide to Relaxation Tools
</a></td>

<td>June, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=17&curr=1 ">Current</a> |
<a href="publish.p hp?id=17&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=17" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=17'>S nippet</a>
</td>
</tr>
( <tr class="grey">

<td>/articles/free/erectiledysfunc tion.htm
</td>

<td>ABOUT MEN </td>

<td><a href='editArtic le.php?id=19'>
Straight Talk About Erectile Dysfunction: When the Body
Won\'t Respond </a></td>

<td>February, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=19&curr=1 ">Current</a> |
<a href="publish.p hp?id=19&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=19" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=19'>S nippet</a>
</td>
</tr>
( <tr class="white">

<td>/articles/free/fightingfatigue .htm </td>

<td> </td>

<td><a href='editArtic le.php?id=21'>
Fighting Fatigue: How to get a more satisfying sleep
</a></td>

<td>February, 2004 </td>

<td>
Publish >
<a href="publish.p hp?id=21&curr=1 ">Current</a> |
<a href="publish.p hp?id=21&curr=0 ">Archive</a>

</td>

<td>
<a href="deleteCon firm.php?id=21" >DEL from DB</a>
</td>

<td><a href='indexPgCo de.php?id=21'>S nippet</a>
</td>
</tr> </table>

</body>
</html>
Jul 17 '05 #1
0 1548

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3354
by: Tony Marston | last post by:
I have just moved my website to a new hosting provider as the previous one went belly-up. Everything is now fine except for one thing - my counter script which generates a PNG image is sending out garbled text instead of an image. This script has been working for months on my desktop and my laptop, and worked at my previous web host, but is failing with my new hosting company. PHP version 4.3.3 GD library is reported as 2.0.15 in...
1
2067
by: supercow | last post by:
Hello, Can anyone give me some pointers for solving my php serving problem? I'm relatively new to this. The problem is: all php output appears client side as garbled text (in firefox, and IE wants to download the page, but gives an error that downloading isn't possible). I had a working system (suse 9.0 / apache2 /php4/mysql) and upgraded to suse 9.1 (i know, "if it aint broke, dont fix it", but i did it
4
2159
by: Alan Little | last post by:
This is very bizarre. Could someone else have a look at this? Maybe you can see something I'm overlooking. Go here: http://www.newsletters.forbes.com/enews/admin/deliver.php4 U: bugtest P: test Enter 1 for "How many files in this delivery?" and select a file to upload, in one of the listed formats. Scroll down and click "Test Email".
4
2146
by: Tom Chadwin | last post by:
Hello all Using PHP 4.1.2, I am seeing intermittent visible escaping backslashes in my HTML output. Try refreshing the following page a few times to see what I mean: http://www.actorscentrene.co.uk/thread.php?messageThread=25 It seems totally random. Any ideas? The extra escaping backslashes are not present in the underlying MySQL records. magic_quotes_gpc is on.
1
2137
by: steve | last post by:
Hi, My Windows machine running PHP Version 4.3.4, Apache, mysql, Zend IDE has developed a strange problem whereas the html code coming out of php sometimes gets garbled in unpredicatable ways, i.e. my html page shows gibberish or I get a server error altogether, which is traced from log file to garbled html code. Has anyone seen this? I wanted to fix this, before I do a complete reinstall of php.
14
2066
by: Michael Carr | last post by:
I have an intermittent problem that occurs on a very small number of browsers that access my website. The strange thing is this: my site works perfectly for 99.9% of browsers. The behavior described below occurs for 0.1% of users, and so far I've only seen it on IE 6.0. My ASP.NET website is set up like this: 1. Logon page - Collect username / password and verify against the DB. If OK, store the UserID in Session and redirect to Main...
3
1472
by: jethro_uk | last post by:
Hi all, I'm having a hard time with the Day() function. Basically, it appears to be picking and choosing which part of a date string it uses to return the result ... heres some code : <HTML> <HEAD>
9
1464
by: pengypenguin | last post by:
I've made this little example script for a project I'm working on, and the text that gets output seems to be chewed up in IE for Windows. Every other (major) browser has no problem rendering the text, but in IE it seems garbled, or aliased perhaps. Can anyone confirm this, and maybe help me diagnose it? I would very much appriciate it. Here is the example: http://www.whit.info/dev/sf_toy.html Thanks in advance!
2
1860
by: peridian | last post by:
I've gotten a really weird result crop up on my site, and I can't find any information on the web that it has been seen elsewhere. Given how weird this is, I guess it's probably a symptom of either a server-side setting, or something very subtle. I have some code that builds a MySQL statement to retrieve some records. The subsequent HTML displays the results. No problem. I then changed the statement to have a WHERE clause that reads: ...
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.