Jump to content


Photo

[solved thank you all]match making help cheers.


  • Please log in to reply
3 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 October 2006 - 12:52 PM

can you help cheers.

what i am trying to do is match information from the current user using the id='$id' form a session then do a while loop and select the same database field and show all those user that match.
<?php sesion_start();

//database information.

$query1="SELECT * FROM members_profile WHERE id='$id'";

$result1=mysql_query($query1);

while($record=mysql_fetch_assoc($result1)){

$query2="SELECT * FROM members_profile WHERE
 '".$record['age']."'='$age' AND '".$record['hair_color']."'='$hair_color' AND
 '".$record['weight']."'='$weight'";

$result2=mysql_query($query2);

while($row=mysql_fetch_assoc($result2)){

echo" Your match is <br> Users Name: <br> '".$row['name']."' 
<br> Users age: '".$row['age']."' <br> Users weight: <br> '".$row['weight']."' <br>";
}
 }

?>


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 13 October 2006 - 12:58 PM

Don't put your first query in a while statement. Really no need to since you a only looking for one record anyway. Also why are you using variables for field names in your where clause. You won't get anything back looking for an age field named 34.

I do not know your field names but you should be looking for something like this
$query2="SELECT * FROM members_profile WHERE
 age = '".$record['age']."' AND hair_color = '".$record['hair_color']."' AND
 weight = '".$record['weight']."'";

Ray

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 October 2006 - 01:09 PM

craygo i woke up and wanted to no how to do this match making thing it was on my mind so the whole code is for pratice only.

remember i dont no mysql relly well but i am getting there with the help of you guys/ladies cheers mate.

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 October 2006 - 01:13 PM

is this correct then as the final code cheers.

<?php sesion_start();

//database information.

$query1="SELECT * FROM members_profile WHERE id='$id'";

$result1=mysql_query($query1);

$record=mysql_fetch_assoc($result1);

$query2="SELECT * FROM members_profile WHERE
age= '".$record['age']."' AND hair_color='".$record['hair_color']."' AND
weight='".$record['weight']."' ";

$result2=mysql_query($query2);

while($row=mysql_fetch_assoc($result2)){

echo" Your match is <br> Users Name: <br> '".$row['name']."' 
<br> Users age: '".$row['age']."' <br> Users weight: <br> '".$row['weight']."' <br>";
}
 

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users