Help - Once again soz

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Help - Once again soz

Post 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
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post by NeoPuma »

Bump
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post by NeoPuma »

bump again soz... any one please? :(

-Neo
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

You give an answer, but what is the question to the answer?

Very much a 42 situation ;)
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post 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
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Apart from [php_man]while[/php_man] browsing the relevant forum is a good idea.
NeoPuma
Forum Commoner
Posts: 26
Joined: Sat Mar 06, 2004 12:18 pm
Location: South Wales, UK
Contact:

Post 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
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

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