Welcome to WebmasterWorld Guest from 54.226.246.160

Forum Moderators: open

Message Too Old, No Replies

Best way to handle this data set

     

wheelie34

11:42 am on Sep 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi everyone

I have a list of 13 dates in a mysql db stored as varchar like this

Jan 3 - Mar 19

The dates get used by numerous products, each date has 2 possible prices so on the prices page to add prices I call ALL dates in a while loop and end up with 3 (input type = text) boxes so I can type in the prices like so

[Jan 03 - Mar 19][pricea][priceb]
[Feb 07 - Mar 09][pricea][priceb]
[Apr 05 - Jun 16][pricea][priceb]
etc
etc

At the moment I am using print_r( $_POST ); to see what's coming through on submit but am not getting the first text box? heres what I get

[pricea1] => 100
[priceb1] => 110
[pricea2] => 110
[priceb2] => 120

No dates? I am using a counter increment each row of data

while ($newArray = mysql_fetch_array($result)){
$date = $newArray['date'];
print "<input type=\"text\" name=\"date$number\" value=\"$date\" disabled><input type=\"text\" name=\"pricea$number\"><input type=\"text\" name=\"priceb$number\"><br>";
$number = $number +1;
}

What is the best way to take this data and add it to a mysql database?

LifeinAsia

3:34 pm on Sep 11, 2009 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



TI would say the best way would be to change the dates into actual DATETIME fields instead of VARCHAR. Make 2 fields: StartDate and EndDate. It will make your life so much simpler.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month