Show Smilies...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Show Smilies...

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

huh?
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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'];?>">
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post 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.
Post Reply