SitePoint Sponsor

User Tag List

Page 4 of 4 FirstFirst 1234
Results 76 to 81 of 81
  1. #76
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    907
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah right, thank you cpradio...

    PHP Code:
    <? 
    $sql
    .="select * FROM tbl_hotels ".  ((!empty($sqlcategory)) ? $sqlcategory "") ." WHERE Act_Hot='1' "
    ?>
    Thats a lot different to mine isnt it, but thanks for the help again, always very appreciated.

  2. #77
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,122
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Well, I made a slight improvement of using the empty function instead of comparing to "". It adds the benefit that if $sqlcategory is ever null it will behave how you'd expect too.

  3. #78
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    907
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes as it would be, yours is a lot, lot neater than mine.

    I've sort of nearly got the thing working, but for showing the hotels when a user clicks one of the options in the categories.

    I've got the code showing and it seems right, but I'm missing something which i will find out im sure.

    http://devchecksafetyfirst.csf.dcman...5D=2&Country=7

  4. #79
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    907
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah there you go I got it, I noticed that I didnt call the table before one of the Id_Hot, the order by one in fact.

    PHP Code:
    <?
    $sql
    .= " ORDER by Id_Hot ASC"
    ?>
    needs to be

    PHP Code:
    <?
    $sql
    .= " ORDER by tbl_hotels.Id_Hot ASC"
    ?>

  5. #80
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    907
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?
    $order 
    " ORDER by Id_Hot ASC";
    $order2 " ORDER by tbl_hotels.Id_Hot ASC";

    $sql.= "". ((!empty($sqlcategory)) ? $order2 "") .""
    ?>
    This works fine as long as $sqlcategory is not empty, so how do I have it so that $order works instead of $order2 if $sqlcategory is empty

  6. #81
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    907
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry I got it i think.

    PHP Code:
    <?
    $sql
    .= "". ((!empty($sqlcategory)) ? $order2 $order) ."";
    ?>
    So it made sense at what you did


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
  •