SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Arrow How to do this function?

    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,
    Code:
    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.

  2. #2
    SitePoint Addict silentcollision's Avatar
    Join Date
    Jun 2006
    Location
    New Zealand
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've only had a quick look, is this what you mean?

    PHP Code:
    $query "INSERT INTO jtablegrid (user_box" $link ") VALUES ('" $link "')"

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    thanks man, i will try that.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •