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!
I am trying to change the backgound color of the table cell where this info is stored, if the line returned from the DB is anything from Google. I was thinking using the wildcard (*) like in mySQL statements. The syntax is a problem though?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Now I want to use it in a mySQL statement
I want to count the records in this query. I tried this, but it doesn't work?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
<?php
mysql_select_db($database_sunrise, $sunrise);
$query_myStats = "SELECT * FROM myStats WHERE `no` > 1 AND `host` <> '$ip_skip' AND host LIKE '$ip_show' ORDER BY `no` DESC";
$myStats = mysql_query($query_myStats, $sunrise) or die(mysql_error());
$row_myStats = mysql_fetch_assoc($myStats);
$totalRows_myStats = mysql_num_rows($myStats);
$google = preg_match("#(.*?)Google(.*?)#i", $row_myStats['referer']); // To define what we discussed
mysql_select_db($database_sunrise, $sunrise);
$query_google = "SELECT referer FROM myStats WHERE referer LIKE '$google'";
$google = mysql_query($query_google, $sunrise) or die(mysql_error());
$row_google = mysql_fetch_assoc($google);
$totalRows_google = mysql_num_rows($google);
?>
Yes, but what would happen if the referrer was some how set to: "lafkjflkjf29083jr9w8j9wjgoogledf09s8ujsd09f8jdsa98djf" It should match, and that wouldnt be good...
Read up on preg_match and try doing a var_dump() or a print_r() on what it returns...