Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: How do you pass a value through the address URL?

  1. #11
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    629
    Thanks
    277
    Thanked 15 Times in 15 Posts

    Default

    Dear Nile: Thanks for that suggestion. It did change the numbers for the links but they are all wrong. It could not possibly work in this case because the events are not in consecutive order by id number. When I moved the foreach loop inside the while loop it did fix the links, so it was really close, but not quite right.

    Do you happen to know the command to set the time format to lowercase am/pm?

    $event['starttime'] = $row2['time'];

    I want to do something like this: $event['starttime'] = time_format (hh:mm a, $row2['time'] Thanks very much for helping.

  2. #12
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So, all you want is a lowercase PM and AM? Just use strtoupper. Search google for it.
    Jeremy | jfein.net

  3. #13
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    629
    Thanks
    277
    Thanked 15 Times in 15 Posts

    Default

    I thought that was for string data types. I desperately need to get the links fixed properly. The am/pm is merely aesthetic.

    Codeexploiter, where art thou?
    Last edited by kuau; 07-18-2008 at 01:19 PM. Reason: added

  4. #14
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try it.
    Jeremy | jfein.net

  5. #15
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Untested, but a lot cleaner than what you had
    PHP Code:
    <?php 
    putenv
    ("TZ=Pacific/Honolulu");
    include(
    'cal-connectdb.php'); 
    $today date ('Y-m-d');
    $query " SELECT `event_id`,`event_title`, date_format(`startdate`, '%M %D, %Y') startdate, time_format(`starttime`, '%h:%i %p') starttime
               FROM `event`
                     WHERE `featured` = '1' AND `startdate` >= '"
    .$today."'                          
               ORDER BY `startdate`, `event_title` LIMIT 200 "
    ;    
    $result = @mysql_query($query,$connection) or die("Couldn't execute $query query.");
    while(
    $event mysql_fetch_assoc($result)){
        echo 
    "<div class='event'>
                <a herf='/php/event-detail.php?event_id="
    .$event['event_id']."'>".$event['event_title.'"</a><br>".$event['startdate']." at ".$event['starttime']."
            </div>"
    ;
    }
    ?>
    You seemed to have a lot of uneeded code in there.

  6. The Following User Says Thank You to blm126 For This Useful Post:

    kuau (07-18-2008)

  7. #16
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    629
    Thanks
    277
    Thanked 15 Times in 15 Posts

    Default

    Thanks very much. I'll try it out and let you know.

  8. #17
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    629
    Thanks
    277
    Thanked 15 Times in 15 Posts

    Default

    Dear Brady:

    That was brilliant!! TheTestingSite fixed a couple of typos in it, but your code accomplished in a few lines what mine took a page to do. I know in my head the logic of what I want to accomplish, but don't know the language (php) well enough to express it. I *really* appreciate all the assistance. Was able to make the page live before everyone woke up.

    Niles: what got the proper id numbers showing up for each event was changing the $event_id to $event['id']. TheTestingSite figured it out.

    Thanks a million to all of you. e

  9. #18
    Join Date
    Jul 2008
    Location
    Johannesburg, South Africa
    Posts
    31
    Thanks
    1
    Thanked 10 Times in 10 Posts

    Default

    Just thought I would mention something. The use of the short form <?=$variable ?> is considered bad practice these days and in fact short tags <? and ?> instead of <?php and ?> are seriously discouraged due to conflicts with XML. I would recommend that you use <?php echo $variable ?> rather than that short form. Its only a few extra characters and makes your code conform to best practices.

  10. The Following User Says Thank You to GarethMc For This Useful Post:

    kuau (07-21-2008)

  11. #19
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Quote Originally Posted by GarethMc View Post
    Just thought I would mention something. The use of the short form <?=$variable ?> is considered bad practice these days and in fact short tags <? and ?> instead of <?php and ?> are seriously discouraged due to conflicts with XML. I would recommend that you use <?php echo $variable ?> rather than that short form. Its only a few extra characters and makes your code conform to best practices.
    I agree with this. As the short form will work only if it is allowed in the server otherwise it'll fail. So it is always better to code based on the standards even if the length of the code is bit more.

  12. The Following User Says Thank You to codeexploiter For This Useful Post:

    kuau (07-21-2008)

  13. #20
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    629
    Thanks
    277
    Thanked 15 Times in 15 Posts

    Default

    Now how did you guys know that I was just today deliberating about that very question? I find the long tags very distracting when I am trying to follow the code, so I took them all out of this one file this afternoon just so I could think. But I'll put them all back again, I promise. Thanks! e

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •