Mutley Posted November 27, 2006 Share Posted November 27, 2006 I did an update form, to update some data.It says:Unknown column 'p2' in 'field list'But I can't see how it's "Unknown", everything is there correct as the fields in the database.Here's my update file, not sure if it goes back to the actual form the problem:[code]$team = $_GET['team'];//ob_start();//include("config.php");//if($logged['username'])//{echo $team;if(isset($team)){$p1 = $_POST['p1'];$p2 = $_POST['p2'];$p3 = $_POST['p3'];$p4 = $_POST['p4'];$p5 = $_POST['p5'];$p6 = $_POST['p6'];$p7 = $_POST['p7'];$p8 = $_POST['p8'];$p9 = $_POST['p9'];$p10 = $_POST['p10'];$p11 = $_POST['p11'];$p12 = $_POST['p12'];$p13 = $_POST['p13'];$p14 = $_POST['p14'];$p15 = $_POST['p15'];$p16 = $_POST['p16'];$p17 = $_POST['p17'];$p18 = $_POST['p18'];$p19 = $_POST['p19'];$p20 = $_POST['p20'];mysql_select_db("rufc");$sql = "UPDATE scores SET `1` ='$p1', `p2` ='$p2', `p3` ='$p3', `p4` ='$p4', `p5` ='$p5', `p6` ='$p6', `p7` ='$p7', `p8` ='$p8', `p9` ='$p9', `p10` ='$p10', `p11` ='$p11', `p12` ='$p12', `p13` ='$p13', `p14` ='$p14', `p15` ='$p15', `p16` ='$p16', `p17` ='$p17', `p18` ='$p18', `p19` ='$p19', `p20` ='$p20' WHERE score_id = '".$id."'";mysql_query($sql) or die('Unable to perform query<br />' . mysql_error());[/code] Quote Link to comment Share on other sites More sharing options...
marcus Posted November 27, 2006 Share Posted November 27, 2006 Where are you defining $id? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 27, 2006 Share Posted November 27, 2006 What are the field names in the database table "scores"?Also, there may be an easier way to write your code. What does your form look like? It might be possible to use arrays here.Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.