PDA

View Full Version : a little code help please


Jalrock
03-06-2003, 05:50 PM
What would I need to do here to only print the ip's that the first 5 numbers in the ip are the same?


<?php
require "./con.php";
include "./header.inc";
$result = mysql_query("SELECT * FROM employees",$db);

while ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>";
printf("<tr><td width=300><a href=\"%s?id=%s\">%s</a></td> \n", "index.php", $myrow["id"], $myrow["ip"]);

printf("<td width=45><a href=\"%s?id=%s&delete=yes\">(DELETE)</td></tr></a>", $PHP_SELF, $myrow["id"]);
echo "</table>";
}
include "./footer.inc";
?>


Any help appreciated.

Jalrock
03-06-2003, 10:53 PM
somthing like this but compare 1 to each NOT all

similar_text
(PHP 3>= 3.0.7, PHP 4 )

similar_text -- Calculate the similarity between two strings

mr e
03-07-2003, 01:08 AM
i think you could use substr(0,5) i think that takes the first 5 letters of a string