Page 1 of 1

Show Smilies...

Posted: Mon May 23, 2005 5:25 pm
by Smackie
Im adding a smiliey page to display all my smilies for my shout box.. and well on the ("URL") part i want it to show like the picture so i need the full url on that part but here is the script for it..

Code: Select all

<html> 
<table border="0" CELLSPACING="0" CELLPADDING="10" align="center">

<?php 



$result = mysql_query ("select * from smilies"); 


$count = 1; 
$column = 1; 
//loop statement 
while ($myrow = mysql_fetch_array ($result)) 
{ 
// first column display
if ($column == 1) 
{ 

//field is the column in your table
printf("<tr><td>%s</td>",$myrow["URL"]);

else{ 
//second column display 
printf("<td>%s</td></tr>",$myrow["Symbol"]); 
} 


$count += 1; 

$column = $count % 2;

} 
?> 

</table> 
</html>
Thanx
Smackie

Posted: Mon May 23, 2005 6:44 pm
by Burrito
huh?

Posted: Mon May 23, 2005 7:03 pm
by Smackie
i need it to show the picture of a smilie instead of the url so the $myrow['URL'] needs to be something like
<img src="../Smilies/images/$myrow["URL"]">
but everytime i do i get an error
Parse error: parse error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/haunted/public_html/shout/popup_test_a.php on line 22

Posted: Mon May 23, 2005 8:12 pm
by Burrito
are you echoing the whole thing or interspersing php and html?

if the former try this:

Code: Select all

echo "<img src=\"folder/folder/".$row['url']."\">";
if the latter try this:

Code: Select all

<img src="folder/folder/<?=$row['url'];?>">

Posted: Mon May 23, 2005 8:56 pm
by Skara
Or, going with what he posted, I tend to put my variables in the string:

Code: Select all

echo "<img src='folder/folder/{$row['url']}' />";
*shrugs* just me.