Jump to content
php.lv forumi

atlasiit kkonkreetus datus no mysql tabulas


gkazhus

Recommended Posts

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

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 by gkazhus
Link to comment
Share on other sites

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 />";

}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...