sort of an SQL question

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

Post Reply
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

sort of an SQL question

Post by Illusionist »

ok, i've got a database and table setup... the table has columns, when i try to get the result fromt he columns i try and use $myrow['name']; but it never works, i always have to use $myrow[1]; does anyone know why i can't use the column name?

Code: Select all

while ($myrow = mysql_fetch_row($result)) {
	echo "<tr><td>";
	echo $myrow[1];
	echo "</td><td>";
	echo $myrow[2];
	echo "</td>";
}
echo "</table>\n";
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Check these out:

[php_man]mysal_fetch_assoc[/php_man]

[php_man]mysql_fetch_array[/php_man]
Last edited by McGruff on Tue Aug 09, 2005 8:46 pm, edited 1 time in total.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

ahha! Thanks! Got it to work with mysql_fetch_array!
Post Reply