Jump to content

Recommended Posts

K1=Familyno, K2=Familyrank, K3=Name, K4=Grandfamilyno, K5=Fathers rank i Grandfamily(10=First born child)

<?php

$db="kall300db";

$link = mysql_connect("localhost","root","");

if (! $link)

die("Couldn't connect to MySQL");

mysql_select_db($db , $link)

or die("Couldn't open $db: ".mysql_error());

 

// $search = 'Familjenr' skall kunna hämtas från indataformulär;28( Will later come from a form)

 

$result = mysql_query("SELECT * FROM kall WHERE Familjenr = '1883' AND Fställning = '0'");

 

// !! Skriv ut info för Fadern !! K1=Familjenr,K2=Fställning,K3=Helnamn,K4=Ufamiljenr,K5=Ufställning

// Fställning = '0' Is the father and here I echo his info

while($row = mysql_fetch_array($result))

 

  {

  echo $row['Familjenr'] . " " . $row['Fställning'] . " " . $row['Helnamn'] . " " . $row['Ufamiljenr'] .

" " . $row['Ufställning'];

  echo "<br />"; 

  }

 

 

// !! Spara Faderns  K4 värde (Ufamiljenr) (I save K4 for later use in the next SELECT)

$next=$row['Ufamiljenr'];

// !! Sen använder du Faderns K1 (1883) och skriver ut resten av hans familj om

// det finns fler !! 44 (I take the fathers familyno and echo his whole family)

 

$result = mysql_query("SELECT '$row[Familjenr]' FROM kall");

 

 

while($row = mysql_fetch_array($result))

  {

  echo $row['Familjenr'] . " " . $row['Fställning'] . " " . $row['Helnamn'] . " " . $row['Ufamiljenr'] .

" " . $row['Ufställning'];

  echo "<br />";

 

  }

// !! Sen kollar vi om det finns fler familjer relaterade till Fadern och skriver

// ut dessa!!( If there is a Ufamiljenr I do the next SELECT)

$result = mysql_query("SELECT $next FROM kall WHERE Familjenr = '$next' AND Fställning = '0'");

while($row = mysql_fetch_array($result))

  {

  echo $row['Familjenr'] . " " . $row['Fställning'] . " " . $row['Helnamn'] . " " . $row['Ufamiljenr'] .

" " . $row['Ufställning'];

  echo "<br />";

 

  }

?>

//Detta skall fortsätta så länge som Fadern har ett Ufamiljenr

//Must continue antill a Father dont have a Ufamiljenr!)

</body>

</html>

 

Hope you understand.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.