Shout Box help

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

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

Post by Smackie »

hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

in the case of delete, your $row['URL'] is blank, check in your database if url contains anything at all.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

it has something in the data base which is

(id) (symbol) (Url) (Alt)
10 ;) wink.png wink.png
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

in the delete case:
could you echo "my image should be: ".$row['Url'];
see what you get.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

same thing there :S
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

<a href="admin.php?mode=posting&smilie='.$row['id'].'">

i bet this line will have smilie = (blank) as well
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

yea it is
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

in delete case:

could you change: while($row = mysql_fetch_array($query)){

to while($row = mysql_fetch_array($query,MYSQL_ASSOC)){

(MYSQL_ASSOC returns an associative array.)
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

yeah and still gives me the same thing
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

it looks to me it doesn't return any row? how many rows did you get? Is the number of rows showing up as same as that of the database?
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

yeah there only one in the data base and there is one in the delete place
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

var_export() or var_dump() or print_r() $row to see what is actually being returned.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

Alright i fixed it here is what was wrong


Old code

Code: Select all

case 'delete':

			$query = mysql_query("SELECT * FROM smilies") or die(mysql_error());
			while($row = mysql_fetch_array($query)){ 
			
				echo '<a href="admin.php?mode=posting&smilie='.$row['id'].'">
		
			  <img src="smilies/'.$row['URL'].'" border="0" width="30" height="30" alt="'.$row['Alt'].'">
					  </a><br><br>
					  ';
New Code

Code: Select all

case 'delete':

			$query = mysql_query("SELECT * FROM smilies") or die(mysql_error());
			while($row = mysql_fetch_array($query)){ 
			
				echo '<a href="admin.php?mode=posting&smilie='.$row['id'].'">
		
			  <img src="smilies/'.$row['Alt'].'" border="0" width="30" height="30" alt="'.$row['Url'].'">
					  </a><br><br>
					  ';
<img src="smilies/'.$row['Alt'].'" border="0" width="30" height="30" alt="'.$row['Url'].'">
the smilies/'.$row['URL'] should have been Alt and the Alt one should have been URL........... :)

Thank you for helping me out
Smackie
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sounds like your insert is goofy then..
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

At least it works right? lol.... is there a way to make it refresh without flickering and messing up when you try typing?
Post Reply