Hello,

I am a php newb here and I am wondering what would be the best way to accomplish the following task.

I am writing a small set of scripts to log parking permissions.

Basically I have a form that has the following fields

Start Date
Number of nights (dynamic pull down )
Vehicle
Street Location
Telephone Number

Basically, I want to take the start date, add the number of nights requested and then insert the start date, number of nights, and result (end_date) into the database.

Any ideas?? Should I do it in PHP or in MYSQL..needless to say I am quite lost..

Thanks in advance for the help. BTW I have been working on this in DW8.

    You will most likely need to use PHP and mySQL.

    I would search for tutorials introducing the two and using them together.

    mySQL is the database and will hold all the data PHP does your processing communications with the Database.

      I figured I would need to use php and mysql, however, there are specific functions for both regarding dates, I was curious what the best practice would be.

        Ok, some progress made..

        However, I can not get this to function even though I think it should.

        $query = "INSERT INTO onp VALUES ('','$start_date','$num_nights','DATE_ADD('2007-03-27', INTERVAL 3 DAY)','$street','$vehicle','$telephone_num')";

        Please let me know if I am missing anything...

        Once I get this one working I want to replace the dated of '2007-03-27' with $start_date and the 3 after interval with $num_nights.

        Your input please.
        As it stands now, everything is getting in except the DATE_ADD functions.

          You don't want quotes around the entire DATE_ADD() call.

          $query = "INSERT INTO onp VALUES ('', '$start_date', '$num_nights', DATE_ADD('$start_date', INTERVAL $num_nights DAY), '$street', '$vehicle', '$telephone_num')";
          

            That worked great thanks..

            I have moved on and now have my information going in, and can perform the mysql queries I want to do..

            My next step is dropping everything into a table on a webpage. I am reading up on mysql_fetch_array and will posyt any other questions I may have later..

            Thanks for the help so far.

              Write a Reply...