Jump to content

This is making no sense


dzhax

Recommended Posts

So I am making a chat program for a friend and when i run a query to load all existing chat into the div i am only getting the most recent result and not all results in the databaseCode:

			$query = 'SELECT * FROM chatLog';			$result = mysql_query($query,$chatWindow) or die(mysql_error());			while($row = mysql_fetch_array($result)){				echo "<span class='alias' style='color:red; font-weight:bold; font-size:13px;>".$row['user'].": </span>".$row['message']."<br>";			}

if i run mysql_num_rows($result) it returns 4 so 4 results should print out correct?

Link to comment
Share on other sites

So I am making a chat program for a friend and when i run a query to load all existing chat into the div i am only getting the most recent result and not all results in the databaseCode:
			$query = 'SELECT * FROM chatLog';			$result = mysql_query($query,$chatWindow) or die(mysql_error());			while($row = mysql_fetch_array($result)){				echo "<span class='alias' style='color:red; font-weight:bold; font-size:13px;>".$row['user'].": </span>".$row['message']."<br>";			}

if i run mysql_num_rows($result) it returns 4 so 4 results should print out correct?

you have an error in your HTML output
style='color:red; font-weight:bold; font-size:13px;>"

you are missing the closing ' for the style attribute. may or may not be relevant.

Link to comment
Share on other sites

wow its amazing what a single quote can do ... lol thanks you rock!
I would also urge you to give your span a class and do your CSS either in the head section of the page, or in an external sheet and link it in. Inline styles are technically correct, but look messy. CSS was meant to clean up mark-up.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...