Page 1 of 1

Help - Once again soz

Posted: Sun Mar 14, 2004 9:56 am
by NeoPuma
Hi again,
I got a connection to a mysql, and now i want to do the query:

Code: Select all

SELECT game FROM tbl_cheats_$con WHERE letter = '$letter' ORDER BY game ASC
After doing so, echo, ONE result from the game field, then

Code: Select all

echo"<br></td>";
After doing so,

Code: Select all

echo '<td width="23%"><font color="#FFFFFF" face="OCR A Extended">';
and count the ammount of rows where game = The result echoed (being a game name). After that,

Code: Select all

echo '</td>';
and close the connection (which i can do :P).

Thats all i need for now, and i made it as simple as i could sorry.

-Neo

Posted: Mon Mar 15, 2004 9:41 am
by NeoPuma
Bump

Posted: Thu Mar 18, 2004 1:32 pm
by NeoPuma
bump again soz... any one please? :(

-Neo

Posted: Thu Mar 18, 2004 2:33 pm
by patrikG
You give an answer, but what is the question to the answer?

Very much a 42 situation ;)

Posted: Thu Mar 18, 2004 4:25 pm
by NeoPuma
I dont no how to loop, well I do, but the last attempt i made, crashed mine and my m8s pc, so i think it wern't good lol. Would you start me off?

-Neo

Posted: Thu Mar 18, 2004 5:07 pm
by patrikG
Apart from [php_man]while[/php_man] browsing the relevant forum is a good idea.

Posted: Fri Mar 19, 2004 12:37 pm
by NeoPuma
thats good ty, but how can I say, for every row of data, echo the value in field ID and echo the value in field Name?

-Neo

Posted: Fri Mar 19, 2004 12:40 pm
by Draco_03
this is an exemple

Code: Select all

<?php
//getting all the name of the field in my table
for ($i = 0; $num_fields = mysql_fetch_field($result); $i++)
	{
	print "<br /><b>Fetching field #$i from the query.</b><br />";
	print "Value stored at the first index position of \$num_fields: '$num_fields->name'<br />";
	}
	
//getting all the rows (with the value of each field) of my table
for ($i = 1; $row = mysql_fetch_row($result); $i++)
	{
	print "<br /><b>Fetching row #$i from the query.</b><br />";
	print "Value stored at the first index position of \$row: '$row[0]'<br />";
	print "Value stored at the first index position of \$row: '$row[1]'<br />";
	print "Value stored at the first index position of \$row: '$row[2]'<br />";
 	print "Value stored at the first index position of \$row: '$row[3]'<br />";
	}
?>
hope it helps
PS note that in my exemple i had 4 field for my rows...