Hey HxF users!
I have this code, and it seems to be giving me an error.
Here's the full code (it isn't mine, its off techtuts).
I'm getting the error on this line:PHP Code:<?php
$base_host = "localhost"; # your sql host (usualy 'localhost')
$base_name = "your_database_name"; # your database name
$base_user = "your_database_user"; # your database username
$base_pass = "your_database_password"; # your database password
$base_table= "banners"; # the table your going to use?
# Connect to the database
$db = mysql_connect($base_host,$base_user,$base_pass); # connect to the database
mysql_select_db ($base_name) or die ("Cannot connect to database"); # or die (if theres a problem it will echo, cannot connect to the database.
$query = mysql_query("select * from ".$base_table.""); # SQL query
$total = mysql_num_rows($query); # count up all the rows in the table
$query = mysql_query("select * from ".$base_table.""); # SQL query
$total = mysql_num_rows($query); # count up all the rows in the table
$random = (rand()%$total); # Create a random number
$query = mysql_query("SELECT * FROM ".$db_table." LIMIT $random, 1"); # Retrieve the random banner from the database.
{ # echo the query
echo"<a href="$row->addr" target="_blank" title="$row->text"><img src="$row->ban_image" alt="$row->text" width="468" height="60"></a>";
$view = $row->views + 1; # update the times viewed
mysql_query("update ".$base_table." set views = $view where id = $row->"id"); # another query
} # close while()
?>
Any help would be appreciated, thanks.PHP Code:echo"<a href="$row->addr" target="_blank" title="$row->text"><img src="$row->ban_image" alt="$row->text" width="468" height="60"></a>";









Reply With Quote




