Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
I'm using the following structure, but it takes up two lines which basically DOUBLES the size and bulk of my code. I also imagine it might not be the fastest way to do it.
$clicks_in_30_min=mysql_fetch_array(mysql_query("SELECT SUM(clicked) FROM links WHERE ip='$ip'"));
#don't forget to escape your query variables!
$query = "SELECT SUM(clicked) FROM links WHERE ip='".[url=http://www.php.net/mysql-real-escape-string]mysql_real_escape_string[/url]($ip)."'";
$result = mysql_query($query) or die('Query Failed');
Obviously this is a personal choice, but even though it is more lines, it is much neater, at least for me :)
$clicks_in_30_min=mysql_get_number("SELECT SUM(clicked) FROM links WHERE ip='$ip'");