gkazhus Posted August 13, 2010 Report Share Posted August 13, 2010 Kaa lai uztaisa nosaciijumu kas atlasa datus kas piemeeram satur role_id=4... un visi kam ir role_id=4 tiek atlasiiti. Quote Link to comment Share on other sites More sharing options...
101111 Posted August 13, 2010 Report Share Posted August 13, 2010 SELECT * FROM kautkaada_tabula WHERE role_id=4 Quote Link to comment Share on other sites More sharing options...
gkazhus Posted August 13, 2010 Author Report Share Posted August 13, 2010 <? $sql="SELECT * FROM $users_roles WHERE rid = 4 "; $result=mysql_query($sql); ?> Kas veel sheit pietruukst lai dabuutu aaraa rezultaatu? Quote Link to comment Share on other sites More sharing options...
Леший Posted August 13, 2010 Report Share Posted August 13, 2010 while ($row = mysql_fetch_assoc($result)){ print_r($row); } Quote Link to comment Share on other sites More sharing options...
gkazhus Posted August 13, 2010 Author Report Share Posted August 13, 2010 sanjemu shaadu zinjojumu: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Quote Link to comment Share on other sites More sharing options...
Леший Posted August 13, 2010 Report Share Posted August 13, 2010 kodu parādi. Quote Link to comment Share on other sites More sharing options...
gkazhus Posted August 13, 2010 Author Report Share Posted August 13, 2010 kodu parādi. <? $sql="SELECT * FROM $users_roles WHERE rid = 3 "; $result=mysql_query($sql); while ($row = mysql_fetch_assoc($result)){ print_r($row); } ?> Quote Link to comment Share on other sites More sharing options...
101111 Posted August 13, 2010 Report Share Posted August 13, 2010 Kāds ir tabulas nosaukums? Ja "users_roles", tad $sql="SELECT * FROM users_roles WHERE rid = 3"; Quote Link to comment Share on other sites More sharing options...
Леший Posted August 13, 2010 Report Share Posted August 13, 2010 Hmm, man te viens džeks izstāstīja baigo noslēpumu: mysql-am sākumā ir jāpieslēdzās. Otrkārt, kas tev iekš $users_roles? Quote Link to comment Share on other sites More sharing options...
gkazhus Posted August 13, 2010 Author Report Share Posted August 13, 2010 (edited) Hmm, man te viens džeks izstāstīja baigo noslēpumu: mysql-am sākumā ir jāpieslēdzās. Otrkārt, kas tev iekš $users_roles? <?php mysql_connect("localhost", "user" "pwd") or die("Connection Failed"); mysql_select_db("lpaiflv")or die("Connection Failed"); ?> tas jau man ir pashaa saakumaa. users_roles ir DB tabula kuraa ir 2 kolonnas uid(user id) un rid(role id) Pashi lietotaaji ir citaa tabulaa : users. Man vajag atlasiit userus kuriem rid=3 Edited August 13, 2010 by gkazhus Quote Link to comment Share on other sites More sharing options...
euphoric Posted August 13, 2010 Report Share Posted August 13, 2010 (edited) Tad, user_roles, vai users_roles ? Ja lietotāji ir citā tabulā tad, LEFT JOIN Edited August 13, 2010 by euphoric Quote Link to comment Share on other sites More sharing options...
Uldis Posted August 16, 2010 Report Share Posted August 16, 2010 kāpēc pirms tabulas nosaukuma ir $ ? Quote Link to comment Share on other sites More sharing options...
gkazhus Posted August 16, 2010 Author Report Share Posted August 16, 2010 Kas man sheit nestimee? <?php $query = "SELECT users, users_roles WHERE rid = 3". "FROM users LEFT JOIN users_roles ". "ON users = users_roles"; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['Lietotajs']; echo "<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
indoom Posted August 16, 2010 Report Share Posted August 16, 2010 sintakse neštimē. WHERE ir pēc from un joiniem Quote Link to comment Share on other sites More sharing options...
briedis Posted August 16, 2010 Report Share Posted August 16, 2010 paprovē uztaisīt echo $query; un paskaties, kāds tad izskatās gala kvērijs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.