coder9 Posted July 19, 2008 Share Posted July 19, 2008 ok i have this simple grid table below http://czone01.com/zodesk/paradiseclicks/tablegrid.php when you click each cell number for instance. it will store the number into variable --> $link now i'm trying to create a function that will insert it into the table which has the same column number name of the table from 1 to 100. table |cid|user_box1|user_box2|user_box3|user_box4|user_box5|user_box6|user_box7|user_box8|user_box9| and soon... -------------------------------------------- |1 | | | | | | | | | | so when i click number 9 cell on the table grid for instance it should store the number 9 (which is stored in $link) and insert the value of $link (which value 9) into column user_box9 of the table (jtablegrid). (this is the tricky part, because $link is dynamic and it should find the right column number in the table itself) here is my not finish prototype function, function store_cell_number(){ //get value of variable link. //determine what number. //find the right cell number. //assign it and insert it into the table $link = $link; $query = "INSERT INTO jtablegrid (_no) VALUES ('$game_no')"; mysql_query($query); } Please show me how to insert the dynamic value $link into its right column number that has the same number of $link. THANK YOU!!! very much in advance. Quote Link to comment Share on other sites More sharing options...
arifsor Posted July 19, 2008 Share Posted July 19, 2008 $query = "INSERT INTO jtablegrid (_no,user_box".$link.") VALUES ('$game_no',$link)"; mysql_query($query); Quote Link to comment Share on other sites More sharing options...
coder9 Posted July 19, 2008 Author Share Posted July 19, 2008 Sorry i can't edit my own thread. this is suppose to be my right function prototype. function store_cell_number($link){ $query = "INSERT INTO jtablegrid ($link) VALUES ('$link')"; mysql_query($query); } 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.