im having some trouble with a script im working on, the problem is that its choppin g off the first two 00's on the mac address, yet it prints it out fine. its only when its being passed to MySQL that it looses the first two 00's
this is the out put i get:
00:18:F8:BD:F0:E3
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':18:F8:BD:F0:E3' at line 1
Thanks for the help
-Phil
<?PHP
$source = "test.txt";
$return = file($source);
$conn = mysql_connect("host", "user", "password");
mysql_select_db("wifi",$conn);
foreach($return as $ret)
{
$wifi = explode ("|", $ret, 17);
$mac = $wifi[1];
echo $mac;
$sql = "SELECT*FROM`wifi`WHERE`mac`=$mac";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result))
{
$test=$newArray['mac'];
$id=$newArray['id'];
if ( $test == $mac )
{
$sqls ="UPDATE `wifi` SET `ssid` = '$wifi[0]' WHERE `id` = '$id' AND `ssid` = '$wifi[0]' AND `mac` = '$wifi[1]' AND `manuf` = '$wifi[2]' AND `auth` = '$wifi[4]' AND `encry` = '$wifi[5]' AND `radio` = '$wifi[6]' AND `chan` = '$wifi[7]' AND `lat` = '$wifi[8]' AND `long` = '$wifi[9]' AND `btx` = '$wifi[10]' AND `otx` = '$wifi[11]' AND `fa` = '$wifi[12]' AND `la` = '$wifi[13]' AND `nt` = '$wifi[14]' AND `label` = '$wifi[15]' AND `signal` = '$wifi[16]'";
}
}
}
?>