![]() |
| Home Community Mys-Script Creative Off-Topic |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
This snippet of code is suppose to get the names of the parents and show them. As it is now... it shows nothing. I can get it to show the id of the parents, but I'd like it to show their names.
Code:
$result = $adopts->select("owned_adoptables", array(), "aid='{$id}'");
while ($row = $result->fetchObject()) {
$father=$row->father;
$mother=$row->mother;
$getFather = $adopts->select("owned_adoptables", array(), "aid='{$father}'");
$getMother = $adopts->select("owned_adoptables", array(), "aid='{$mother}'");
$nFather = $row->getFather;
$nFather = $nFather['name'];
$nMother = $row->getMother;
$nMother = $nMother['name'];
if(empty($row->father)) {
$article_content .= '<b>Caught On:';
} else {
$article_content .= '<b>Laid On:';
}
$article_content .= "{$row->date}<br>";
if($father == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: ' . $nFather . '<br>
Mother: ' . $nMother . '<br>';
}
}
|
|
#2
|
|||
|
|||
|
First, grab the object instance of the result.
PHP Code:
PHP Code:
|
|
#3
|
||||
|
||||
|
Code:
$result = $adopts->select("owned_adoptables", array(), "aid='{$id}'");
while ($row = $result->fetchObject()) {
$father=$row->father;
$mother=$row->mother;
$getFather = $adopts->select("owned_adoptables", array(), "aid='{$father}'")->fetchObject();
$getFather->name;
$getMother = $adopts->select("owned_adoptables", array("name"), "aid='{$mother}'");
$nFather = $nFather['name'];
$nMother = $row->getMother;
$nMother = $nMother['name'];
if($father == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: <a href="levelup.php?id='.$father.'">' . $getfather . '</a><br>
Mother: ' . $nMother . '<br>';
|
|
#4
|
|||
|
|||
|
It's like this
PHP Code:
|
|
#5
|
||||
|
||||
|
You the MAN!!! Thank you :D
|
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shop Tables | SilverDragonTears | Questions and Supports | 1 | 02-02-2013 03:26 PM |
| Tables | StarGirl | Questions and Supports | 3 | 04-26-2012 02:57 PM |
| Joining Tables | SilverDragonTears | Questions and Supports | 24 | 04-10-2012 01:54 AM |
| No tables in database? | Fangs | Questions and Supports | 1 | 02-28-2012 11:26 AM |
| Tables in myadoptables.php | rosepose | Questions and Supports | 7 | 03-12-2009 06:29 PM |
What's New? |
What's Hot? |
What's Popular? |