i'm new to php and this is what i want to do if you can help me , i have a DB on my web server and there are two column one for the name of the product and the other for the id of the product , i added text box but i want to know how can i take the text written there and use it to create new column every time i click a button e.x when i write 1/1/2010 in the text box and click the button new column well be created in the DB also i wish that all the records of the products become 0 under that column so finally this what the DB will look like
proudcts ID "the new column i added"
milk 12 0
sugar 13 0
raise 11 0
i' already connected to DB and i made the text box and the button this is what i make so far
<form id="form1" name="form1" method="post" action=""> <p> <label>date <input type="text" name="date" id="date" /> </label> </p> <p> <label>add new date <input type="submit" name="add" id="add" value="Submit" /> </label> </p> </form> <p> </p> <?php $db_host = "localhost"; $db_username = "root"; $db_pass = ""; $db_name = "le"; @mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect"); @mysql_select_db("$db_name") or die ("No database found"); echo"you are connected to the DB"; ?>
i wish someone help me , thank you "hint i'm going to add only dates like 1/1/2011 & 2/1/2011....