Can anyone recommend any good PHP/SQL Forums, or help with my problem? Page 2

    Next Last
  • pjmaybe 18 Mar 2005 14:25:29 70,666 posts
    Seen 12 years ago
    Registered 20 years ago
    HairyArse wrote:
    What I meant about dates, is that the user has to enter them in reverse order, i.e 2005-03-17 and I just know that my boss is gonna complain about having to do it that way.

    I assume the only way to fix this is to use the strrev (reverse string) function to reverse a normally entered date (17-03-2003) to make it SQL friendly?

    What are you using dates for? Is it something customers type in to do searches against?

    I usually use the old trusted php date(d:m:y) thing on a hidden form input field when a new record is started...never let the customers enter dates themselves cos they always fuck it up!

    Peej
  • Captain-Fetid 18 Mar 2005 14:26:54 659 posts
    Registered 17 years ago
    pjmaybe wrote:
    HairyArse wrote:
    What I meant about dates, is that the user has to enter them in reverse order, i.e 2005-03-17 and I just know that my boss is gonna complain about having to do it that way.

    I assume the only way to fix this is to use the strrev (reverse string) function to reverse a normally entered date (17-03-2003) to make it SQL friendly?

    What are you using dates for? Is it something customers type in to do searches against?

    I usually use the old trusted php date(d:m:y) thing on a hidden form input field when a new record is started...never let the customers enter dates themselves cos they always fuck it up!

    Peej

    Indeed. Another idea is to have three dropdown boxes, one for each part of a date.
  • pjmaybe 18 Mar 2005 14:31:11 70,666 posts
    Seen 12 years ago
    Registered 20 years ago
    Aye tis a goodun...

    I think STRREV is a bit unreliable as it can fuck up non-conformative date formats...

    Better to extract each part of the string separately then swap it around...

    Peej
  • eviltobz  18 Mar 2005 14:37:05 2,609 posts
    Registered 18 years ago
    and whilst we're on the subject of dates, wherever possible i'd strongly advise using a format where the month is text based such as dd mmm yyyy, both at the front end and when passing dates around as strings. otherwise someone always has their date set in american format and things get screwed up. if you have the month in text there can be no doubt about which is month and which is day. cause untold problems do date formats. bloody yanks.
  • Captain-Fetid 18 Mar 2005 14:37:54 659 posts
    Registered 17 years ago
    Post deleted
  • Shivoa 18 Mar 2005 14:47:37 6,314 posts
    Seen 2 years ago
    Registered 20 years ago
    [code]date("Y-m-d",strtotime($searchdate));[/code] is my current way of dealing with user input for the date. That said I've put a text entry on the back burner as I've got a callendar function that really works well modified from active calendar (GNU LGPL)

    Managed to craft it into a school year view which colourises each day depending on timetable info from a My SQL database and each day on the calendar links back to the detailed day timetable view.
  • Captain-Fetid 18 Mar 2005 14:47:43 659 posts
    Registered 17 years ago
    Captain Fetid wrote:
    Bloody hell. I typed a whole document on this, and I can't paste because > and < apparently don't translate well between code tags.

    Gah! And how, dear EG Overlords, does one get lowerthan and biggerthan tags on this here screen?!
  • Deleted user 18 March 2005 14:48:03
    Captain - My email address is richard[at]wyedean.com

    I really appreciate all help on this as it's driving me crazy and is quite a tricky job to say I'm only just delving under the bonnet of PHP and SQL.

    The most annoying bit is that my boss expects this in no time.

    Also, yes I do need to use dates and often too. The whole point of this project is that we have all the items on a tender in one table, and we record all receipts of patterns and sample approvals, as well as deliveries and delivery dates. So date very much does need to be used.
  • Captain-Fetid 18 Mar 2005 14:54:15 659 posts
    Registered 17 years ago
    Mail sent.

    I hope it'll help you get your head around arrays. They're mightily important and handy.
  • Shivoa 18 Mar 2005 15:11:04 6,314 posts
    Seen 2 years ago
    Registered 20 years ago
    >The most annoying bit is that my boss expects this in no time.

    This is obviously a management test. If no one can do it they'll have to train one of you but if they can force one of you to get it done without training then they can save the cash and add that responsibility to your job without renaming you to a database administrator.


    Personally, I get free reign over creating the system here and also have an excuse for why I did no real work in a day. 'I was working on the booking system' 'lots of bug fixes, not many features added' 'now running faster and stable'

    There's nothign quite like the fun od creating a 5 dimensional array and then trying to describe it to the boss visually :)
  • LaundroMat 18 Mar 2005 15:16:25 1,443 posts
    Seen 10 months ago
    Registered 20 years ago
    Captain Fetid wrote:
    Mail sent.

    I hope it'll help you get your head around arrays. They're mightily important and handy.

    Oh yes they are :)
  • Jos 18 Mar 2005 15:29:51 712 posts
    Seen 5 hours ago
    Registered 20 years ago
    Date fields in databases can be a bit confusing. The way it is stored in the database is irrelevant to the format of the data string you get in and out.

    What I mean by this is that if you are dealing with a date field (as defined in the database - not a text field used to store date info) you can put any format in and out so long as you tell the database what the format is that you are putting in/getting out. It'll do all the conversions for you. It gets confusing because there is a default format that is usually set up in the config of a database which is what you get without explicitly defining the date format. I'm more an oracle man now but here are a couple of pointers for mysql formating...

    See this .
    And this for date format command (find on DATE_FORMAT)
  • Deleted user 21 March 2005 14:43:28
    Can anyone tell me how I get the results of a query to open in a new web page?

    It's probably really simple but I've been doing PHP all day and my brain has turned to mush.
  • pjmaybe 21 Mar 2005 14:45:59 70,666 posts
    Seen 12 years ago
    Registered 20 years ago
    Set the link (or whatever it is) to open up with a TARGET=BLANK bit...

    So for instance, say I was linking a link from here...

    it'd be (a href="http://www.bollocks.com" target="_blank")

    (substituting my brackets for the proper greater than/less than things)

    Peej
  • Deleted user 21 March 2005 14:52:44
    Peej - that would be the simple way: BUT:

    The link the user will press to open the query in a new window is a java button in the middle of an if else statement. I'm not entirely sure how to get the 'open new window' code into the middle of all that.

    [code]if ($field==Nsn)
    {
    echo ("");
    }
    [/code]
  • Deleted user 21 March 2005 14:52:55
    Bollocks, the code won't display.
  • Shivoa 21 Mar 2005 15:05:36 6,314 posts
    Seen 2 years ago
    Registered 20 years ago
    [code]if ($field==Nsn)
    {
    echo ("thing");
    }
    [/code]
    Quote to view edit.
  • Next Last
Sign in or register to reply

Sometimes posts may contain links to online retail stores. If you click on one and make a purchase we may receive a small commission. For more information, go here.