Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Best way to handle this data set

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts: 863
votes: 0

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]

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?

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

Moderator from US 

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

joined:Dec 10, 2005
votes: 87

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.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members