The following code searches a database for a store location, then returns the IP info. How do I get the code to ask if I would like to enter a new location only if the search location is not in the database?
I have the form (addstor.php) that will allow me to add a new location.
<?php
if ($searchstring)
{
$sql="SELECT * FROM StorIPScheme WHERE $searchtype LIKE '%$searchstring%' ORDER BY StoreName ASC";
$db = mysql_connect("-------", "mforney", "-------"
mysql_select_db("CalicoStores",$db);
$result = mysql_query($sql,$db);
echo "<TABLE BORDER=2>";
echo"<TR><TD><B>Store Number</B><TD><B>Store Name</B><TD><B>Remote IP</B><TD><B>Remote WAN</B>
<TD><B>Default Gateway</B><TD><B>DLCI#</B></TR>";
while($myrow = mysql_fetch_array($result)) {
echo "<TR><TD>".$myrow["StoreNo"]."<TD>".$myrow["StoreName"]."<TD>".$myrow["RemoteIP"].
"<TD>".$myrow["RemoteWAN"]."<TD>".$myrow["Gateway"]."<TD>".$myrow["DLCI_No"];
echo "<TD><a href=\"view1.php?id=".$myrow["id"]."\">View</a>";
}
echo "</TABLE>";
}
?>
I have the form (addstor.php) that will allow me to add a new location.
<?php
if ($searchstring)
{
$sql="SELECT * FROM StorIPScheme WHERE $searchtype LIKE '%$searchstring%' ORDER BY StoreName ASC";
$db = mysql_connect("-------", "mforney", "-------"
mysql_select_db("CalicoStores",$db);
$result = mysql_query($sql,$db);
echo "<TABLE BORDER=2>";
echo"<TR><TD><B>Store Number</B><TD><B>Store Name</B><TD><B>Remote IP</B><TD><B>Remote WAN</B>
<TD><B>Default Gateway</B><TD><B>DLCI#</B></TR>";
while($myrow = mysql_fetch_array($result)) {
echo "<TR><TD>".$myrow["StoreNo"]."<TD>".$myrow["StoreName"]."<TD>".$myrow["RemoteIP"].
"<TD>".$myrow["RemoteWAN"]."<TD>".$myrow["Gateway"]."<TD>".$myrow["DLCI_No"];
echo "<TD><a href=\"view1.php?id=".$myrow["id"]."\">View</a>";
}
echo "</TABLE>";
}
?>