blogit Posted May 23, 2008 Share Posted May 23, 2008 I'm having trouble with a script that is pretty basic but my coding is that great so far i have it getting the current domain and putting it into a variable which is simple enough, I then want it to run a search on a table in a database and if the current domain is there to echo it out. The mysql query im using is below if anyone can help with the rest i'd really appreciate it. <?php include 'config.php'; include 'opendb.php'; $pageUR1 = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); $curdomain = str_replace("www.", "", $pageUR1); $query = "SELECT page_url FROM page LIKE '%$curdomain%'"; Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 23, 2008 Share Posted May 23, 2008 Try <?php include 'config.php'; include 'opendb.php'; $pageUR1 = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); $curdomain = str_replace("www.", "", $pageUR1); $query = "SELECT COUNT(*) FROM page WHERE page_url='$curdomain'"; $result = mysql_query($query)or die(mysql_error()); $count = mysql_result($result, 0); if ($count > 0) echo $curdomain; else echo "Domain not in database"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.