View Single Post
Old 2003-09-11, 02:19 PM   #4
iSC_Luke
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
 
Join Date: Aug 2003
Location: T.O.
Posts: 23
Send a message via ICQ to iSC_Luke
This code won't execute the script if there is an error with the SQL Query:
PHP Code:
<? 
if ( mysql_pconnect("mysql.4ph.com","jonhill","changeme") === FALSE)
    echo 
"ERROR: Could Not Successfully Connect to DB Server<br>\nSQL ERROR:".mysql_error()."<br>\n";
if ( 
mysql_select_db("counter") === FALSE)
    echo 
"ERROR: Could Not Select Database<br>\nSQL ERROR:".mysql_error()."<br>\n";

if ( (
$result mysql_query("select * from counter WHERE url='$url'")) === FALSE)
    echo 
"ERROR: Error executing query:<br>\nSQL ERROR:".mysql_error()."<br>\n";
else {
    while(
$r=mysql_fetch_array($result)) { 
        
$id=$r["id"]; 
        
$count=$r["count"]; 
        
$url=$r["url"]; 
        
$count++; 
        
        
$update "UPDATE counter SET count='$count' WHERE id=$id"
        
$updatesql mysql_query($update); 
?> 
    <script language="JavaScript"> 
    document.location.href="<?php echo $url;?>
    </script> 
<?
    
}
}
?>
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts &nbsp;&copy;&nbsp; Top-Converting Niche Sites.</font>
iSC_Luke is offline   Reply With Quote