I have problem with my php/sql
code because id (auto
inc ., primary)
row .
(
$sql = "INSERT INTO ".$_CONF['tprefix']."schedule_scores VALUES ";
$sql .= "('NULL','$newdate','$newtime','$newlocation','$team1_id',";
$sql .=
"'$team2_id','$team1_div','$team2_div','$newteam1_score','$newteam2_score',";
$sql .= "'$newseason','','','','','','1')";
)
this is code and I done this
(
$sql = "INSERT INTO ".$_CONF['tprefix']."schedule_scores (date, time,
location,
team1, team2, team1_div, team2_div, team1_score, team2_score, season,
summary,
pic_name, pic_caption, tourneyid, tourneygid, standings) VALUES ";
$sql .= "('$newdate','$newtime','$newlocation','$team1_id',";
$sql .=
"'$team2_id','$team1_div','$team2_div','$newteam1_score','$newteam2_score',";
$sql .= "'$newseason','','','','','','1')";
)
because I know that I have to avoid id row to get it work.
please help
Miso
wrote in message:
I have problem with my php/sql code because id (auto inc., primary) row.
(
$sql = "INSERT INTO ".$_CONF['tprefix']."schedule_scores VALUES ";
$sql .= "('NULL','$newdate','$newtime','$newlocation','$team1_id',";
$sql .=
"'$team2_id','$team1_div','$team2_div','$newteam1_score','$newteam2_score',";
$sql .= "'$newseason','','','','','','1')";
)
As you already figured out, this won't work, as all columns are assumed
to have an insert value, while an auto inc column won't be happy about
getting a value.> this is code and I done this
(
$sql = "INSERT INTO ".$_CONF['tprefix']."schedule_scores (date, time,
location,
team1, team2, team1_div, team2_div, team1_score, team2_score, season,
summary,
pic_name, pic_caption, tourneyid, tourneygid, standings) VALUES ";
$sql .= "('$newdate','$newtime','$newlocation','$team1_id',";
$sql .=
"'$team2_id','$team1_div','$team2_div','$newteam1_score','$newteam2_score',";
$sql .= "'$newseason','','','','','','1')";
)
because I know that I have to avoid id row to get it work.
Are you sure you get all the
data into the $sql? I'd suggest you add
the following to your code (while you debug)
echo $sql."
<br>\n";
//put your sql
query code here
echo mysql_
error ()."
<br>\n";This way you see the
SQL statement and can see what is missing it and
you'll get the error message.When you found the error and fix it,
comment out those two lines.
--
//Aho