Jump to content
php.lv forumi

Izvēlk tikai vienu


homers

Recommended Posts

Tatad gribu izvilkt lietotāja draugus.

Kods

$rez9 = mysql_fetch_row(mysql_query("SELECT dr_niks FROM draugi WHERE ka=$id ORDER BY id")) or die();
$dr = $rez9[0];
echo $dr;

Bet viņš man izvēlk tikai 1cilvēku, kura ID 1 bet ar ID 2,3,4... neizvēlk.

Kas par kļūdu?

Link to comment
Share on other sites

Kļūdas tā īsti nemaz nav... Tu vienkārši neesi licis PHP kaut ko vēl izvilkt. Tu esi pateicis "rādi man rindiņu" - tev arī rindiņu parāda. :)

Jāliek tam php "kamēr vēl ir kāda rindiņa, tikmēr rādīt rindiņu"

 

$rezultats = mysql_query("SELECT dr_niks FROM draugi WHERE ka=$id ORDER BY id") or die('Viss ir slikti, ' . mysql_error());
while($rez9 = mysql_fetch_row($rezultats)){
$dr = $rez9[0];
echo $dr; }

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...