Professional Web Applications Themes

Please help me with some SQL - MySQL

Hi there folks.. :) I've got some troubles here, The man that can, dont give a S..., with others problems.. I tried to ask for a solution but nothing helped.. Here is what he said i should do : Simply put the SQL-Statement and take out all the filter-stuff. That should do it. And how do i do that..lol I hope some of you guys or Girls can help me with this... The code is : function addUnCategorized($categories) { $weapons = array(); $res = SQL_query("select distinct weapon from selectbf_kills_weapon order by weapon ASC"); while($cols = SQL_fetchArray($res)) { array_push($weapons,$cols); } for($i ...

  1. #1

    Default Please help me with some SQL

    Hi there folks.. :)
    I've got some troubles here, The man that can, dont give a S..., with others
    problems.. I tried to ask for a solution but nothing helped..

    Here is what he said i should do :

    Simply put the SQL-Statement and take out all the filter-stuff. That should
    do it.

    And how do i do that..lol
    I hope some of you guys or Girls can help me with this...
    The code is :

    function addUnCategorized($categories)
    {
    $weapons = array();
    $res = SQL_query("select distinct weapon from selectbf_kills_weapon order
    by weapon ASC");
    while($cols = SQL_fetchArray($res))
    {
    array_push($weapons,$cols);
    }

    for($i = 0; $i<count($categories); $i++)
    {
    $members = $categories[$i]["members"];

    $uncategorized = array();

    for($j = 0; $j<count($weapons); $j++)
    {
    $found = false;
    for($k = 0; $k<count($members) && $found==false; $k++)
    {
    if($weapons[$j]["weapon"]==$members[$k]["member"])
    {
    $found = true;
    }
    }
    if($found == false)
    {
    array_push($uncategorized,array("weapon"=>$weapons[$j]["weapon"]));
    }
    }

    $categories[$i]["uncategorized"] = $uncategorized;
    }

    return $categories;
    }

    Best Regards
    Ulle


    Ulle Guest

  2. #2

    Default Re: Please help me with some SQL

    Ulle wrote:
    > Here is what he said i should do :
    >
    > Simply put the SQL-Statement and take out all the filter-stuff. That should
    > do it.
    >
    > And how do i do that..lol
    > $res = SQL_query("select distinct weapon from selectbf_kills_weapon order
    > by weapon ASC");
    What that does is return a list of each "weapon" from your
    "selectbf_kills_weapon" table that is sorted alphabetically.

    That looks like exactly what you would want in a application. If you want a list
    of all the weapons, you would remove the keyword "DISCTINCT" from the query.

    Since you posted from a return address/subject line that is different than your
    original post, we have no idea what the original question/answers were.

    --
    Walter

    Walter Vaughan Guest

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139