homepage Welcome to WebmasterWorld Guest from 107.22.45.61
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Best way to handle this data set
wheelie34




msg:3987899
 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]
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




msg:3987997
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved