Hello all
Its been a few months since I first asked you guys where I could get assistance writing a PHP script for my client (search for dealers by state and zip on web site). DevShed was great and helped me get started, but still could not figure out why this script skips through the code and displays the "We apologize, at this present time we do not have a dealer in your area but are expanding very quickly. Please . . ." that appears in the else {} at the very end.
I looked through php.net and mysql.com and double-checked the functions I used and could not find the problem. My intention is not for the Asylumites to hold my hand . . but rather point me in the correct direction. I have no idea why this is not working. Maybe I need to incorporate or die(); so at least I know either I have an error with mysql_connect or mysql_select_db or mysql_query functions. Or maybe it has something to do with my database? I built it with phpmyadmin.
What do you think?
Thanks.
CRO8
---------------------------------------------------------------------------------------------------------------
<!-- begin form--> <?php
mysql_connect ("66.84.26.254","planters","xxxxxx");
mysql_select_db ("/usr/local/apache/htdocs/Dealers");
$result = mysql_query ("SELECT Company_Name,Address,City,State,Zip,Contact_Name,Phone,Fax,email,Web_Site,Map
FROM Contact_Info
WHERE state LIKE '".$State."'");
$count = mysql_query ("SELECT COUNT(*)
FROM Contact_Info
WHERE state LIKE '".$State."'");
$countresult = mysql_fetch_array($count);
print "<font color=red><strong>".$countresult[0]."</strong></font> results found:<br><br>";
if ($row = mysql_fetch_array($result)) {
do {
print "<hr noshade width=300 align=left>";
print "<strong>".$row["Company_Name"]."</strong><br>\r";
print $row["Address"]."<br>\r";
print $row["City"].", ".$row["State"]." ".$row["Zip"]."<br>\r";
print $row["Contact_Name"]."<br>\r";
print $row["Phone"]."<br>\r";
print $row["Fax"]."<br>\r";
print $row["Email"]."<br>\r";
print $row["Web_Site"]."<br>\r";
print $row["Map"]."<br>";
} while($row = mysql_fetch_array($result));
} else {print "We apologize, at this present time we do not have a dealer in your area but are expanding very quickly. Please check back in a few weeks or call 914-939-8500 to speak to a representative at Madison Fielding Inc, the manufacturer of PlanterSpeakers.";}
echo "<hr noshade width=300 align=left>";
?> <!-- end form-->
---------------------------------------------------------------------------------------------------------------
[This message has been edited by CRO8 (edited 11-27-2002).]