OrganizedChaos
MIS
Hi there, I have a piece of code that searches for a name in all the fields of a table, if it finds that name, I then display some of the contents of that row that it found it in.
Now with the loop, the code reads each row of the db and displays the data if the if statement is true. What is happening is, when viewing in IE, it looks like I would expect it to, but when viewing in Firefox, there is a small space that is put on the page for each time the if statement returns false.. I want to remove this space..
Here is a snippit of the code
Now, Im sure there is a better way to make this work, I just havent figured it out, if you have any suggestions on how to improve my code, that would be appriciated also.
I tried to set up something like a fuction to do all the if statements but within the loop it gave me troubles so I just types them out as you see.
Thanks..
Mike
Now with the loop, the code reads each row of the db and displays the data if the if statement is true. What is happening is, when viewing in IE, it looks like I would expect it to, but when viewing in Firefox, there is a small space that is put on the page for each time the if statement returns false.. I want to remove this space..
Here is a snippit of the code
Code:
// Start to process game data
mysql_connect('localhost',$username,$password);
mysql_select_db($database) or die("Unable to select database");
$query=("SELECT * FROM games");
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$one=mysql_result($result,$i,"1st");
$two=mysql_result($result,$i,"2nd");
$three=mysql_result($result,$i,"3rd");
$four=mysql_result($result,$i,"4th");
$five=mysql_result($result,$i,"5th");
if ($one == $name) {
print"all items in row if the name is in the one field";
}
if ($two == $name) {
print"all items in row if the name is in the two field";
}
if ($three == $name) {
print"all items in row if the name is in the three field";
}
if ($four == $name) {
print"all items in row if the name is in the four field";
}
if ($five == $name) {
print"all items in row if the name is in the five field";
}
$i++;
}
Now, Im sure there is a better way to make this work, I just havent figured it out, if you have any suggestions on how to improve my code, that would be appriciated also.
I tried to set up something like a fuction to do all the if statements but within the loop it gave me troubles so I just types them out as you see.
Thanks..
Mike