- This topic is empty.
-
AuthorPosts
-
October 8, 2010 at 11:06 pm #30498CoolAsCarlitoParticipant
Okay so I echoed the query and it ran successfully showing up as:
SELECT ebw.manager_id AS managerid, ebw.finisher AS finisher, ebw.setup AS setup, ebw.music AS music FROM efed_bio_wrestling AS ebw LEFT JOIN efed_bio AS bio ON ( ebw.bio_id = bio.id) WHERE ebw.bio_id = 6
managerid:18
finisher: Joker’s Wild
setup: Joker’s Card
music: Still Frame by Trapt.Now since it has managerid which is a variable I’m sure I want it to go back into efed_bio and match it to the id field and when it does then get the charactername field value. I thought from the following query I did that.
if($managerid != ''){
$query = "SELECT * FROM `efed_bio` WHERE id = '$managerid'";
$result = mysql_query($query);
echo $query;
$row = mysql_fetch_assoc($result);
$manager = $row;
}
else{
$manager = 'None';
}
However it’s still saying that the variable managerid is undefined.
Here’s the entire function:
if ($style=='singles') {
$query = "SELECT ebw.manager_id AS managerid, ebw.finisher AS finisher, ebw.setup AS setup, ebw.music AS music FROM efed_bio_wrestling AS ebw LEFT JOIN efed_bio AS bio ON ( ebw.bio_id = bio.id) WHERE ebw.bio_id = $id";
$result = mysql_query($query) or die(mysql_error());
echo $query;
if($managerid != ''){
$query = "SELECT * FROM `efed_bio` WHERE id = '$managerid'";
$result = mysql_query($query);
echo $query;
$row = mysql_fetch_assoc($result);
$manager = $row;
}
else{
$manager = 'None';
}
while ($row = mysql_fetch_array($result))
{
?>
Wrestling
Manager/Valet:
Finisher:
Setup:
Entrance Music:
October 9, 2010 at 1:04 am #78421kylewiedmanMemberI don’t see where you ever set the variable $managerid… perhaps something like this is what you where going for????
$query = "SELECT ebw.manager_id AS managerid, ebw.finisher AS finisher, ebw.setup AS setup, ebw.music AS music FROM efed_bio_wrestling AS ebw LEFT JOIN efed_bio AS bio ON ( ebw.bio_id = bio.id) WHERE ebw.bio_id = $id";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$managerid = $row;
if($managerid != ''){
October 9, 2010 at 2:12 am #78422CoolAsCarlitoParticipantThat worked however I need to figure out with the managerid if its 0 then that’s when it puts None
October 13, 2010 at 5:03 am #78143armin.hackmannParticipantHi,
if you change your script to this, you should get what you want:
if ( $managerid > 0 ) {
Hope, this helps! :)
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.