SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: mySQL question

  1. #1
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mySQL question

    Does there somethink exist like this:
    PHP Code:
    $query my_sql_query("select ID from $links where PID is not 43"); 
    So, a valid string for "is not"...

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $query = mysql_query("select ID from $links where PID!='43'");

    That should work perfectly for you

  3. #3
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't know it was as simple

    Thanks anyway!

  4. #4
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, another problem, where do I put "where Category != 45" in this query:
    PHP Code:
    $sql "select $tb_links.ID as site_id, $tb_links.SiteName as site_name, $tb_links.SiteURL as site_url, $tb_categories.Category as category_name, $tb_categories.ID as cat_id, $tb_links.Added as added, $tb_links.LastUpdate as last_update, $tb_links.Description as site_description, $tb_links.HitsIn as hits_in, $tb_links.HitsOut as hits_out, count($tb_reviews.ID) as total_reviews from $tb_links left join $tb_categories on $tb_links.Category=$tb_categories.ID left join $tb_reviews on $tb_links.ID=$tb_reviews.SiteID group by site_id order by "
    if(
    $show == "new"){$sql .= "last_update "$msg "Bekijk ook de meest populaire links <a href=\"links.php?show=pop\">>></a>";} 
    if(
    $show == "cool"){$sql .= "hits_in ";} 
    if(
    $show == "pop"){$sql .= "hits_out "$msg "Bekijk ook de nieuwe links <a href=\"links.php?show=new\">>></a>";} 
    $sql .= "desc limit $sr$pp"

  5. #5
    SitePoint Zealot oodie's Avatar
    Join Date
    Jul 2000
    Location
    Misty Mountain
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be like this:
    PHP Code:
    ... left join $tb_reviews on $tb_links.ID=$tb_reviews.SiteID 
    WHERE $tb_categories
    .Category != '45' group by site_id order by ... 


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
  •