Re: [PHP] Re: Why Can't I get this to work
On Jun 28, 2003, Ron Clark claimed that: |OK, normally I do not respond to my own posts, but I have been shown that I |did not get the whole script. So here it is: | |for ($i=0; $i$number_of_alerts; $i++) { | |// Split each line | |$line = explode( , $ipfwlog[$i]); | |$line[1] = intval($line[1]); | |$IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, |fw_engine, rule_number, action, protocol, src_ip_port, dst_ip_port, |direction, via, interface) VALUES ('$line[0]', '$line[1]', '$line[2]', |'$line[3]', '$line[4]', '$line[5]', '$line[6]','$line[7]', '$line[8]', |'$line[9]', '$line[10]', '$line[11]', '$line[12]'); | |$results = mysql_query($IPFWsql) or die (Could not execute query); | |} |Again, any help with this issue is appreciated. |Thanks, | |Ron Clark | Could it be the fact that 1) `date` and `time` are reserved mysql keywords and should be enclosed in back ticks, and 2) you're listing 14 columns and adding 13 values? -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Why Can't I get this to work
OK, normally I do not respond to my own posts, but I have been shown that I did not get the whole script. So here it is: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src_ip_port, dst_ip_port, direction, via, interface) VALUES ('$line[0]', '$line[1]', '$line[2]', '$line[3]', '$line[4]', '$line[5]', '$line[6]','$line[7]', '$line[8]', '$line[9]', '$line[10]', '$line[11]', '$line[12]'); $results = mysql_query($IPFWsql) or die (Could not execute query); } Again, any help with this issue is appreciated. Thanks, Ron Clark Ron Clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I have a php script that reads a flat text file with fields seperated by a space. I explode them into an array just fine, but when I try then to load that array into a mysql database, it doesn't work. Here is my script: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src $results = mysql_query($IPFWsql) or die (Could not execute query); } Any ideas why this does not work? I am completely stuck. Thanks in advance, RonC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Why Can't I get this to work
It depends on what data types are your fields in the database. U are quoting each value which might not be the case. You should check the mysql_error function to see what error the database is giving back to you.. -- BigDog On Sat, 2003-06-28 at 12:42, Ron Clark wrote: OK, normally I do not respond to my own posts, but I have been shown that I did not get the whole script. So here it is: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src_ip_port, dst_ip_port, direction, via, interface) VALUES ('$line[0]', '$line[1]', '$line[2]', '$line[3]', '$line[4]', '$line[5]', '$line[6]','$line[7]', '$line[8]', '$line[9]', '$line[10]', '$line[11]', '$line[12]'); $results = mysql_query($IPFWsql) or die (Could not execute query); } Again, any help with this issue is appreciated. Thanks, Ron Clark Ron Clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I have a php script that reads a flat text file with fields seperated by a space. I explode them into an array just fine, but when I try then to load that array into a mysql database, it doesn't work. Here is my script: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src $results = mysql_query($IPFWsql) or die (Could not execute query); } Any ideas why this does not work? I am completely stuck. Thanks in advance, RonC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php