Advanced Search

Results 1 to 2 of 2

Thread: first attempt at a join function is only returning one row result..

  1. #1
    Join Date
    Aug 2011
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default first attempt at a join function is only returning one row result..

    Hi
    Im new to "join" function this is my first attempt.. My example below only outputs the first tab/row. I need all the data output.. the "rel" below seems correct to the one tab loaded..
    PHP Code:
    // here is the join attempt:
    if(isset($_GET['loadLists']))
    {
    if(
    $needAuth == && !is_logged()) return 'you must be logged in to view this list.';
    $current_user_id = (__isset('multiuser') == 1)?intval($_SESSION['userid']):0;

    $q $db->dq("SELECT * FROM todo_lists INNER JOIN todo_lists_setting
    ON todo_lists.id=todo_lists_setting.list_id WHERE todo_lists_setting.user_id = '
    $current_user_id'");

    while(
    $row $q->fetch_assoc($q)) // same as mysql_fetch_assoc
    {
    echo 
    '<li id="list_'.$row['id'].'" rel="'.$row['notify'].'_'.$row['showcompl'].'_'.$row['sorting'].'_'.$row['shownotes'].'_'.$row['showdates'].'" class="ytt-tabi"><a href="#list/'.$row['id'].'" rel="'.$row['id'].'" title="'.htmlarray($row['name']).'"><span>'.htmlarray($row['name']).'</span></a></li>';
    }


    here is the normal method i attempted without join.. The result i got here was: i got all the tabs but only the first tab had its "rel" settings.
    PHP Code:
    if(isset($_GET['loadLists']))
    {
        if(
    $needAuth == && !is_logged()) return 'you must be logged in to view this list.';
        else 
    $sqlWhere '';
        
    $current_user_id = (__isset('multiuser') == 1)?intval($_SESSION['userid']):0;    
        
    $q $db->dq("SELECT * FROM todo_lists $sqlWhere ORDER BY ow ASC, id ASC");
        while(
    $row mysql_fetch_assoc($q))
        {
        
    $ncurconfig $db->dq("SELECT * FROM todo_lists_setting WHERE list_id =? AND user_id=?", array($row['id'], $current_user_id));
        
    $sett $mysql_fetch_assoc($ncurconfig);  
        echo 
    '<li id="list_'.$row['id'].'" rel="'.$sett['notify'].'_'.$sett['showcompl'].'_'.$sett['sorting'].'_'.$sett['shownotes'].'_'.$sett['showdates'].'" class="tab"><a href="#list/'.$row['id'].'" rel="'.$row['id'].'" title="'.htmlarray($row['name']).'"><span>'.htmlarray($row['name']).'</span></a></li>';  
        
    }


    if i can get either method to work would be great..
    Last edited by traq; 05-08-2013 at 03:22 PM. Reason: please use code tags

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,623
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Can you show us your DB schema?
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

Similar Threads

  1. new to ajax. this attempt to post is not working.
    By antonyf in forum JavaScript
    Replies: 0
    Last Post: 12-08-2011, 07:49 PM
  2. Resolved Joining result of multiple selects to get final result?
    By gwmbox in forum JavaScript
    Replies: 2
    Last Post: 01-04-2011, 12:18 PM
  3. Replies: 0
    Last Post: 01-04-2011, 12:17 PM
  4. Fedora Installation Attempt #2
    By tech_support in forum The lounge
    Replies: 5
    Last Post: 08-28-2007, 02:18 PM
  5. Function(&Sub) no result passes first run
    By mototrance in forum ASP
    Replies: 0
    Last Post: 06-15-2007, 08:54 PM

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
  •