insert data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hey this is my function which should create an insert form in relation to the table I choose. I don't have the insert button working yet.
all i need is first of all keep the first 2 $id and $created of each table without text field(because they're auto).
then I need to make able to enter the data in the form and submit...a new record should appear in the table below.


http://www.qaip.com/~sub/week6_a.php

as soon as you load the page it won't work but if you choose the table it will.

thanks, sub


function insert_row($table,$data){ $query = "DESCRIBE $table"; $result = mysql_query($query);

        print "<DIV ALIGN=\"CENTER\">";
        print "<table border=1>\n";
        print "<FORM METHOD='POST' ACTION='$PHP_SELF'>";

        while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        print "\t<tr>\n";
        print "<td><b>$row[0]</b></td>";

print "<td><INPUT TYPE='text' NAME='data' VALUE='$data' SIZE=13 style=\"border-style:
solid\"></td>";
print "\t</tr>\n";
}


print "<INPUT TYPE='submit' name='submit2' value='Insert a new Row' style=\"border-style: solid\">";
print "</FORM>";


        print "</table>\n";
        print "</DIV>";

        #if($submit2){
       #print "$data";
       #}

}


?>



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux