Well believe it or not I got it right finally. Just used the example from the manual. Meanwhile, the funny thing is , I think the error translates back to my original error abut Resource ID#2 Because not I get : Check the manual that corresponds to your MySQL server version for the right syntax to use near 'id #2). I think this means the second ID column in the table? Stuart --- Graham Cossey <graham@xxxxxxxxxxxxxxx> wrote: > Stuart, you need to define $link if you're going to > use it ;) > > > > > Not much luck here on placing the > mysql_error($link); > > I know the server and database is reachable. So I > > imagine the error is happening in the query. I've > > moved the $link around with no luck. > > > > Stuart > > > > Revised code below: > [snip] > > mysql_connect("myserver","myusername", > "mypassword") or > die(mysql_error()); > > $link = mysql_connect(... > > > > > mysql_select_db("mydatabase") or > die(mysql_error()); > > mysql_select_db("mydatabase", $link)... > > > > > $query = "INSERT INTO MainTable > > (RecordID,UserID,.........) > > values > > > (null,null,$f1a,$f2a,$f2c,$f2d,$f2e,$f2g,$f5b,$f3m,$f3n,$f3e,$f3f, > > $f3g,$f3h,$f3i,$f3j, > > $f3k,$f3l)"; > > begin(); // transaction begins > > $result = @mysql_query($query, $link); > ^^^^^ see above > > > > > if(!$result) > > { > > rollback(); // transaction rolls back > > echo "You rolled back ".mysql_error($link); > ^^^^^ see > above > > exit; > > } > > else > > { > > commit(); // transaction is committed > > echo "your insertion was successful"; > > } > > ?> > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php