|
Posted by J.O. Aho on 09/15/07 08:47
miso wrote:
> 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 would 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 will get the error message.
When you found the error and fix it, comment out those two lines.
--
//Aho
Navigation:
[Reply to this message]
|