Having some problems with a query
Posted: Wed Aug 02, 2006 5:14 pm
feyd | Please use
This is the query that don't work (gives NO problem at screen and the output is NULL).
Result has to come here
ps
If the query is like this it works fine but it is not what i want:
Hope you understand
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hope my english is good enough:
These are only parts of the script as i still working at the script
url contains number pedigree?Id=7036&Gen=4Code: Select all
$Id = (isset($_GET['Id'])) ? intval($_GET['Id']) : 0 ;
$where = ($Id != 0) ? " WHERE Id=".$Id : " ";Code: Select all
$Parentquery =
"SELECT FatherId, MotherId, DOB FROM $table WHERE Id='".$_GET['Id']."'";
$result_Parentquery = mysql_query($Parentquery)or die(mysql_error());
if ($result_Parentquery) {
$row = mysql_fetch_assoc($result_Parentquery);
$FatherId = $row['FatherId'];
$MotherId = $row['MotherId'];
$DOB = $row['DOB'];
}
else {
$Parentquery;
}Code: Select all
$query_Littermates =
"SELECT * FROM $table WHERE FatherId = $FatherId and MotherId = $MotherId and DOB = $DOB and Id !=$Id ORDER BY DogName ASC";Code: Select all
print "<td colspan=\"2\" align=\"left\">";
while($row = mysql_fetch_array($NameResultSetLittermates,MYSQL_BOTH)){
$field=$row['DogName'];
$id=$row['Id'];
print "<a href=./pedigree.php?Id=$id"."&"."Gen=4>$field</a><br>";
}
mysql_free_result($NameResultSetLittermates);
print "</tr>";If the query is like this it works fine but it is not what i want:
Code: Select all
$query_Littermates =
"SELECT * FROM $table WHERE FatherId = $FatherId and MotherId = $MotherId and Id !=$Id ORDER BY DogName ASC";feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]