Re: Re: Why Can't I get this to work
| From: | Ray Hunter | Date: | Sat, 28 Jun 2003 18:52:08 +0000 |
| Subject: | Re: Re: Why Can't I get this to work | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153278@lists.php.net to get a copy of this message | ||
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" <ronnie@txnetsecurity.com> wrote in message
> news:20030626032010.15227.qmail@pb1.pair.com...
> > 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
> >
> >
>
>