OK the error that is showing up here is that there is something wrong with my SQL syntax Heres the script......
<?php
require'conn_func.php';
?>
<?php
$supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.';
function new_data() {
global $supersecret_hash_padding;
$conn = db_connect();
$loc = $_POST['loc'];
print_r($loc);
$mac1_1 = $_POST['mac1_1'];
$mac1_2 = $_POST['mac1_2'];
$mac1_3 = $_POST['mac1_3'];
$mac1_4 = $_POST['mac1_4'];
$mac1_5 = $_POST['mac1_5'];
$mac1_6 = $_POST['mac1_6'];
$mac2_1 = $_POST['mac2_1'];
$mac2_2 = $_POST['mac2_2'];
$mac2_3 = $_POST['mac2_3'];
$mac2_4 = $_POST['mac2_4'];
$mac2_5 = $_POST['mac2_5'];
$mac2_6 = $_POST['mac2_6'];
$mac1 = array($mac1_1, $mac1_2, $mac1_3, $mac1_4, $mac1_5, $mac1_6);
$mac2 = array($mac2_1, $mac2_2, $mac2_3, $mac2_4, $mac2_5, $mac2_6);
if ($mac1 == $mac2) {
$mac = "$mac1[0].$mac1[1].$mac1[2].$mac1[3].$mac1[4].$mac1[5]";
$query = "SELECT *
FROM '$loc'
WHERE mac = '$mac'";
$result = mysql_query($query) or die("query failed!!".mysql_error());
if ($result && mysql_num_rows($result) >= 1) {
$feedback = 'ERROR--Username or email address already exists';
return $feedback;
} else {
$user = $_POST['user'];
$man = $_POST['manufact'];
$device = $_POST['davice_name'];
$mac1_1 = $_POST['mac1_1'];
$mac1_2 = $_POST['mac1_2'];
$mac1_3 = $_POST['mac1_3'];
$mac1_4 = $_POST['mac1_4'];
$mac1_5 = $_POST['mac1_5'];
$mac1_6 = $_POST['mac1_6'];
$mac2_1 = $_POST['mac2_1'];
$mac2_2 = $_POST['mac2_2'];
$mac2_3 = $_POST['mac2_3'];
$mac2_4 = $_POST['mac2_4'];
$mac2_5 = $_POST['mac2_5'];
$mac2_6 = $_POST['mac2_6'];
$mac1 = array($mac1_1, $mac1_2, $mac1_3, $mac1_4, $mac1_5, $mac1_6);
$mac2 = array($mac2_1, $mac2_2, $mac2_3, $mac2_4, $mac2_5, $mac2_6);
$chelsea = $_POST['chelsea'];
$gp4 = $_POST['gp4'];
$ap1 = $_POST['ap1'];
$ap2 = $_POST['ap2'];
$ap3 = $_POST['ap3'];
$query = "INSERT INTO '$db' (user, manufact, device_name,
mac, chelsea, gp4, ap1_se, ap2_n, ap3_sw, date_created)
VALUES ('$user', '$man', '$device', '$mac1', '$chelsea',
'$gp4', '$ap1', '$ap2', '$ap3', NOW())";
$result = mysql_query($query) or die("query failed!!".mysql_error());
if (!$result) {
$feedback = 'ERROR--Database error';
return $feedback;
}
$feedback = 'ERROR--Please fill in all fields correctly';
return $feedback;
}
}
}
?>and the exact error message....
you've got more than one query in there, and I don't which one you're having problems with or whether it is the queries or something else...
help us to help yousorry it's the very first query!!!well, the query itself looks okay...
what is the error?query failed!!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 ''cust_prem' WHERE mac = '55\:55\:55\:55\:55\:55'' at lineFROM '$loc'
instead of that do this
FROM $locthat worked thanks!!!oh, i see - let me do all the work to get the information out of the guy, and then jump in with the answer Scoutt! Originally posted by Horus_Kol
oh, i see - let me do all the work to get the information out of the guy, and then jump in with the answer Scoutt!
the info was in the first post jsut had to see it. I didn't need anything other than that. but thanks
<?php
require'conn_func.php';
?>
<?php
$supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.';
function new_data() {
global $supersecret_hash_padding;
$conn = db_connect();
$loc = $_POST['loc'];
print_r($loc);
$mac1_1 = $_POST['mac1_1'];
$mac1_2 = $_POST['mac1_2'];
$mac1_3 = $_POST['mac1_3'];
$mac1_4 = $_POST['mac1_4'];
$mac1_5 = $_POST['mac1_5'];
$mac1_6 = $_POST['mac1_6'];
$mac2_1 = $_POST['mac2_1'];
$mac2_2 = $_POST['mac2_2'];
$mac2_3 = $_POST['mac2_3'];
$mac2_4 = $_POST['mac2_4'];
$mac2_5 = $_POST['mac2_5'];
$mac2_6 = $_POST['mac2_6'];
$mac1 = array($mac1_1, $mac1_2, $mac1_3, $mac1_4, $mac1_5, $mac1_6);
$mac2 = array($mac2_1, $mac2_2, $mac2_3, $mac2_4, $mac2_5, $mac2_6);
if ($mac1 == $mac2) {
$mac = "$mac1[0].$mac1[1].$mac1[2].$mac1[3].$mac1[4].$mac1[5]";
$query = "SELECT *
FROM '$loc'
WHERE mac = '$mac'";
$result = mysql_query($query) or die("query failed!!".mysql_error());
if ($result && mysql_num_rows($result) >= 1) {
$feedback = 'ERROR--Username or email address already exists';
return $feedback;
} else {
$user = $_POST['user'];
$man = $_POST['manufact'];
$device = $_POST['davice_name'];
$mac1_1 = $_POST['mac1_1'];
$mac1_2 = $_POST['mac1_2'];
$mac1_3 = $_POST['mac1_3'];
$mac1_4 = $_POST['mac1_4'];
$mac1_5 = $_POST['mac1_5'];
$mac1_6 = $_POST['mac1_6'];
$mac2_1 = $_POST['mac2_1'];
$mac2_2 = $_POST['mac2_2'];
$mac2_3 = $_POST['mac2_3'];
$mac2_4 = $_POST['mac2_4'];
$mac2_5 = $_POST['mac2_5'];
$mac2_6 = $_POST['mac2_6'];
$mac1 = array($mac1_1, $mac1_2, $mac1_3, $mac1_4, $mac1_5, $mac1_6);
$mac2 = array($mac2_1, $mac2_2, $mac2_3, $mac2_4, $mac2_5, $mac2_6);
$chelsea = $_POST['chelsea'];
$gp4 = $_POST['gp4'];
$ap1 = $_POST['ap1'];
$ap2 = $_POST['ap2'];
$ap3 = $_POST['ap3'];
$query = "INSERT INTO '$db' (user, manufact, device_name,
mac, chelsea, gp4, ap1_se, ap2_n, ap3_sw, date_created)
VALUES ('$user', '$man', '$device', '$mac1', '$chelsea',
'$gp4', '$ap1', '$ap2', '$ap3', NOW())";
$result = mysql_query($query) or die("query failed!!".mysql_error());
if (!$result) {
$feedback = 'ERROR--Database error';
return $feedback;
}
$feedback = 'ERROR--Please fill in all fields correctly';
return $feedback;
}
}
}
?>and the exact error message....
you've got more than one query in there, and I don't which one you're having problems with or whether it is the queries or something else...
help us to help yousorry it's the very first query!!!well, the query itself looks okay...
what is the error?query failed!!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 ''cust_prem' WHERE mac = '55\:55\:55\:55\:55\:55'' at lineFROM '$loc'
instead of that do this
FROM $locthat worked thanks!!!oh, i see - let me do all the work to get the information out of the guy, and then jump in with the answer Scoutt! Originally posted by Horus_Kol
oh, i see - let me do all the work to get the information out of the guy, and then jump in with the answer Scoutt!
the info was in the first post jsut had to see it. I didn't need anything other than that. but thanks