Error is:
echo"<th>".{$data['engword']}."</td>";
and you don't need () around the stripslashes function.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
With so much html and so little php, perhaps you'd be better off 'reversing' the coding. Your code:
echo "<table border='1'>";
echo"<tr>";
echo"<th>".{$data['engword']}."</td>";
echo"<th align='left'> "<a href=\"http://www.domain.com/sound/En-us-{$data['engword']}.WAV \" title=\"open the audio file for the word {$data['engword']} \"rel='dbPopWin'><img src='audio.gif'></a>"."</td>";
echo"</tr>";
echo"<tr>";
echo"<td align='left'></td>";
echo"<td>".(stripslashes($data["mword"]))."</td>";
echo"</tr>";
echo"</table>";
You've gotta lot of xhtml errors above (e.g. content inside and ; single quotes around attribute values instead of doubles.)
Change this to:
<table border="1">
...include <thead> bits...
<tbody>
<?php
while($data = mysql_fetch_array('result'){
?>
<tr>
<td><?=$data['engword'];?></td>
<td align="left"><a href= "http://www.domain.com/sound/En-us-<?={$data['engword']};?>.wav" title="open the audio file for the word <?=$data['engword'];?>" rel="dbPopWin"><img src= "audio.gif"></a></td>
</tr>
<tr>
<td align="left"> </td>
<td><?=stripslashes($data["mword"]);?></td>
</tr>
<?php
}
?>
</tbody>
</table>
The '<?=' is shorthand for '<?php echo '. This may be frowned upon by some developers, but if your setup supports short tags (it should), then it's a time saver.
Again many developers would frown at mixing xhtml and raw php code like this, but what the hell? You're only creating a basic link list.
I think that keeping to 'normal' xhtml as much as possible and just inserting the odd bit of 'php echo code' can see you OK. Once you start with all those \" escaped quotes, things can become very messy.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
Where does it say that you have to use double quotes? I ran a check through w3.org validator and there were no xhtml errors concerning single quotes.
I am one of those developers who frowns upon mixing html and php (and using short tags). I suggest you use heredoc syntax.
echo <<
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
Damn! Meant to edit the last post.
@KK
Sorry KK, that sounded a bit rude. The heredoc syntax, I will concede is a better way if there's loads of text/html and the occasional php variable to insert. However, if you need to stripslash or whatever, it gets a bit messy, or you have to transform before the heredoc and then insert the vars.
@Say
Sorry fella, I'm a bit busy at the moment. I don't think you're far off with that code. Just play with it, try to isolate errors, change single lines at a time, etc.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
That's nice, especially for newbies. However, I think we're starting to wander off the point for Sayakyi. Any luck yet?
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080