Ok, im trying to make my footer use a mysql database instead of a text file…
but im having some problems…
I am using the code to get the mysql data:
$dbhost = 'localhost';
$dbuser = 'designs1';
$dbpass = '*****';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'designs1_footer';
mysql_select_db($dbname);
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
$query = "SELECT * FROM footer ORDER BY RAND() LIMIT 1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$row['comment'];
}
mysql_close($conn);
That works fine. but i cannot put that into to footer code, it doesnt work if I try:
$string = while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$row['comment'];
}
it works if I use
$string = $array[0];
but it only shows ONE letter from the whole word…
So does anyone know how to do this?