Trouble with tables
-
I’m also having trouble with tables. I have two php sections on my page each displaying a table using SQL rows. The first section, I was able to get to work once I figured out to replace all <> with []:
[php]
…
if (!$query) die(‘Query failed: ‘. mysql_error());
echo “[table]”;
echo “[tr][td]Date[/td]”;
echo “[td]Time[/td]”;
echo “[td]Description[/td]”;
echo “[td]Location[/td]”;
echo “[td]Notes[/td][/tr]”;
while (list($Date, $DateEnd, $Time, $Description, $Location, $Notes) = mysql_fetch_row($query)){
if (is_null($DateEnd))
$hyphen = ‘ ‘;
else
$hyphen = ‘-‘;
if (is_null($Time))
$Time = ‘TBA ‘;
if($Time==’12:00AM’)
$Time=’TBA’;
echo “[tr]”;
echo “[td]$Date$hyphen[br]$DateEnd[/td]”;
echo “[td]$Time[/td]”;
echo “[td]$Description[/td]”;
echo “[td]$Location[/td]”;
echo “[td]$Notes[/td]”;
echo “[/tr]”;
}
echo “[/tbody][/table]”;This seems to run fine.
However in the second section/table, I cannot get it to function. For some reason the table definition just disappears. Getting down to one test line:
…
if (!$query) die(‘Query failed: ‘. mysql_error());
echo “x[table]y”;
[/php]leaves me with this display on the page:
xy
Inspect is showing me:
<p>
“
x”
</p>
“y”The characters “[table]” have disappeared from the string “x[table]y”. (I added the x and y to illustrate. Naturally the original echo was the table code using []s as used in my first section.
https://www.ads-software.com/plugins/allow-php-in-posts-and-pages/
- The topic ‘Trouble with tables’ is closed to new replies.