Jump to content

Help with pet breeding?


yuso6363

Recommended Posts

I am trying to make a page on my virtual pet site where you can breed your pets to get cute mini ones. At the moment I can't get it to get the stuff from the pet database and I have been doing it for three days... :facepalm:

<?php
$rank_check = 1;
$page_title = "Under Construction";
include "header.inc.php";

echo $openHTML;
ECHO <<<END


<?php
$query = "SELECT * FROM user_pets2 WHERE inrelationship = '0' AND gender = 'male' 
AND owner = '$userid'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
        echo "Pet Name:";
        echo $row[name]. " Level: ". $row[level];
echo "<br>";
<br>
}
?>



END;
echo $closeHTML;

?>

 

Link to comment
https://forums.phpfreaks.com/topic/215448-help-with-pet-breeding/
Share on other sites

I assume the header.inc.php file contains the database connection and data for $openHTML and $closeHTML?

 

Its hard to tell whats happening without knowing the openHTML and closeHTML output but try something like;

 

<?php

$rank_check = 1;

$page_title = "Under Construction";

include "header.inc.php";

 

$query = "SELECT * FROM user_pets2 WHERE inrelationship = '0' AND gender = 'male' AND owner = '$userid'";

$result = mysql_query($query) or die(mysql_error());

 

$rows= null;

while($a = mysql_fetch_array($result)){

$rows .= "Pet Name: $a[name] - Level: $a[level]<br />\n";

}

 

echo $openHTML;

echo $rows."<br />\n";

echo $closeHTML;

exit;

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.