Philip J. Newman wrote:


<?php ## ASSUME DATABASE IS CONNECTED AND THESE 2 ITEMS ARE NOT IN THE DATABASE ## THIS RETURNS 1,0 all the time.

$websiteUrl="http://www.philipnz.com/";;
$websiteEmail="[EMAIL PROTECTED]";

// CHECK TO SEE IF DATA MATCHS WHATS IN THE DATABASE.
$sql = "SELECT hUrl,hContactEmail FROM hyperlinks_data";
$sql_result = mysql_query($sql, $connection) or die ("Could not get Query");


$exists_hUrl = "0";
$exists_hContactEmail = "0";
while ($row = mysql_fetch_array($sql_result)) {


if ($websiteUrl==$row["hUrl"]) { $exists_hUrl = "1"; break; }
if ($websiteEmail==$row["hContactEmail"]) { $exists_hContactEmail = "1"; break; }
}


Echo" $exists_hUrl, $exists_hContactEmail";

?>

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

The "break;" breaks out of the while loop, causing it to skip the second check and all remaining records. You should be doing this in the SQL:


SELECT hUrl,hContactEmail FROM hyperlinks_data WHERE hUrl = "$websiteUrl" and hContactEmail = "$websiteEmail";

--
paperCrane <Justin Patrin>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to