homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Best way to handle this data set

WebmasterWorld Senior Member 5+ Year Member

Msg#: 3987897 posted 11:42 am on Sep 11, 2009 (gmt 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?



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

Msg#: 3987897 posted 3:34 pm on Sep 11, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved