barefootsanders Posted April 5, 2007 Share Posted April 5, 2007 Hey all. I'm having problems with my site. I'm trying to return information on a certain "family" or clan and the string my query returns is empty. Below is the familyinfo.php page which calls the function and below that is the function from database.php. If anyone has any suggestions it would be much appreciated. Thanks! <?php //familyinfo.php //Inform user of successfull faimly creation only on first time if($_SESSION['newfamily'] == true) { $_SESSION['newfamily'] = false; echo "Congratulations! You created a new family. Click here to continue to your families info page.<br>"; echo "<a href\"index.php?page=familyinfo\">Family Home Page</a>"; } else { //Get family ID your are viewing and family info array $req_famID = 14; $req_family = $database->getFamilyInfo($req_famID); //User is in family if(strcmp($session->family_id,$req_famID)) { echo "<h2 id=\"topper\">Your Family</h2><br>"; echo $req_family_info['family_name']; } //User is not in family else { echo "<h2 id=\"topper\">"; echo $req_family_info['family_name']; echo "</h2><br>"; } echo $req_family_info['family_desc']; } ?> //database.php function getFamilyInfo($id) { $q = "SELECT * FROM ".TBL_FAMILIES." WHERE faimly_id = '$id'"; $result = mysql_query($q, $this->connection); //Error occurred, return given name by default if(!$result || (mysql_numrows($result) < 1)) { return NULL; } /* Return result array */ $dbarray = mysql_fetch_array($result); return $dbarray; } Link to comment https://forums.phpfreaks.com/topic/45808-query-not-returning-data/ Share on other sites More sharing options...
per1os Posted April 5, 2007 Share Posted April 5, 2007 I bet your query is throwing an error due to this column: "SELECT * FROM ".TBL_FAMILIES." WHERE faimly_id You spelt family wrong. You can add this $result = mysql_query($q, $this->connection) or die(mysql_error()); To see if I am right. Link to comment https://forums.phpfreaks.com/topic/45808-query-not-returning-data/#findComment-222551 Share on other sites More sharing options...
barefootsanders Posted April 5, 2007 Author Share Posted April 5, 2007 WOW, i cant believe i did that. Thanks for catching my silly spelling error. Works like a charm now:) Link to comment https://forums.phpfreaks.com/topic/45808-query-not-returning-data/#findComment-222569 Share on other sites More sharing options...
MadTechie Posted April 5, 2007 Share Posted April 5, 2007 You spelt family wrong. you spelt 'spelt' wrong click Solved please Link to comment https://forums.phpfreaks.com/topic/45808-query-not-returning-data/#findComment-222570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.