I am now obsessed with MySQL and want to make a script that uses a loop to print all the Names in a table called 'clans'.
The script is:
<?php
/* Connecting, selecting database */
$link = mysql_connect("localhost", "zingbats", "password")
or die("Could not connect");
mysql_select_db("tycooneden_com") or die("Could not select database");
$query = "SELECT * FROM clans LIMIT 0,30";
$result = mysql_query($query) or die("Query failed");
$foo=mysql_fetch_array($result);
/* Start the clan defining */
$clan_url=$foo['clan_url'];
$clan_logo=$foo['clan_logo'];
$clan_admin=$foo['clan_admin'];
$clan_admin_email=$foo['clan_admin_email'];
$clan_forum=$foo['clan_forum'];
$clan_name=$foo['clan_name'];
$clan_logo_height=$foo['clan_logo_height'];
$clan_logo_width=$foo['clan_logo_width'];
mysql_close($link);
?>
THIS IS A COMPLETE TEST: <br><br>
<?php echo ("$clan_name");?>
I have gone wrong somewhere as it only prints the first clan.
Anyhelp would be greatly recieved 😃
Alex.