Insert Data Problem[Please Help]
Posted: Thu Jun 05, 2008 12:00 am
Hi, I have problem..umm..perhaps a little bit problem that I can`t figured it out...below is my half script. I think the problem is in this part: (This script is part of a register form)
$day= $_POST['day'];
$sql = "INSERT INTO `rute` (`rute_id`, `from_id`, `to_id`, `flight_no`, `flight_time`, `flight_time2`, `via`, `type`, `day`)
VALUES ('$id', '$from', '$to, '$no', '$tm1', '$tm2', '$via', '$type' ' ";
for($i=0;$i<count($day);$i++){
$sql .= " ".$day[$i].", " ;
}
$sql .= "".$day[$i]." ')";
mysql_query($sql);
The colored text related to this select tags :
<select name="from" class="textField" id="from">
<option>--Arrival City--</option>
<?php
include "mainFunction.php";
$sql="SELECT * FROM `from_city` ORDER BY `from_id` ASC";
if (! $res=mysql_query($sql, $dbh)) {
echo mysql_error();
return 0;
}
$num=mysql_numrows($res);
$i=0;
while ($i < $num)
{
$row=mysql_fetch_row($res);
$id=mysql_result($res,$i,"from_id");
$city=mysql_result($res,$i,"city");
++$i;
print "<option value=$id>$city</option>";
}
?>
</select>
This Check box get the data from database. And then whe visitor checked this option the database will insert the data to Mysql. The Error message was :
error in executing query INSERT INTO `rute` (`rute_id`, `from_id`, `to_id`, `flight_no`, `tm1`, `tm2`, `via`, `type`, `day`) VALUES ('1', '1', '1', '24234', '11:02', '23:09', 'Idaho', 'B21-3423' ' 2, 3, ')
please click here to go back
Thanks a lot for any help...
$day= $_POST['day'];
$sql = "INSERT INTO `rute` (`rute_id`, `from_id`, `to_id`, `flight_no`, `flight_time`, `flight_time2`, `via`, `type`, `day`)
VALUES ('$id', '$from', '$to, '$no', '$tm1', '$tm2', '$via', '$type' ' ";
for($i=0;$i<count($day);$i++){
$sql .= " ".$day[$i].", " ;
}
$sql .= "".$day[$i]." ')";
mysql_query($sql);
The colored text related to this select tags :
<select name="from" class="textField" id="from">
<option>--Arrival City--</option>
<?php
include "mainFunction.php";
$sql="SELECT * FROM `from_city` ORDER BY `from_id` ASC";
if (! $res=mysql_query($sql, $dbh)) {
echo mysql_error();
return 0;
}
$num=mysql_numrows($res);
$i=0;
while ($i < $num)
{
$row=mysql_fetch_row($res);
$id=mysql_result($res,$i,"from_id");
$city=mysql_result($res,$i,"city");
++$i;
print "<option value=$id>$city</option>";
}
?>
</select>
This Check box get the data from database. And then whe visitor checked this option the database will insert the data to Mysql. The Error message was :
error in executing query INSERT INTO `rute` (`rute_id`, `from_id`, `to_id`, `flight_no`, `tm1`, `tm2`, `via`, `type`, `day`) VALUES ('1', '1', '1', '24234', '11:02', '23:09', 'Idaho', 'B21-3423' ' 2, 3, ')
please click here to go back
Thanks a lot for any help...