Jump to content

Recommended Posts

well this is where it gets confusing for most people. After it finds out if its a singles competitor then it goes into the efed_bio_singles table and matches the id of the competitor which was passed and connects it to the bio_id inside of efed_bio_singles. There will be use for the efed_bio_wrestling table as well.

 

efed_bio_singles Table - bio_id, hometown, height, weight

efed_bio_wrestling Table- bio_id, manager_id, nicknames, finisher, setup, music

Try this.

<?php
$page = (isset($_GET['page'])) ? strip_tags($_GET['page']) : NULL;

if(isset($_GET['username']) && $_GET['username'] != '')  {
$username = mysql_real_escape_string($_GET['username']);
$query = "SELECT bio.username AS username,  bio.posername AS posername, bio.charactername AS charactername, bio.id AS id, st.name AS style FROM `efed_bio` AS bio,efed_list_styles AS st WHERE bio.style_id = st.id AND bio.username = '$username'";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
$row = array_map('cleanquerydata',$row);
extract($row);
}
}
?>
<div id="bio">
        <h1><?php echo $charactername; ?>'s Biography</h1>
<?php echo getBioMenu($username);
if(file_exists('images/fullshots/' . $posername . '.png')){
echo '<img class="fullshot" src="images/fullshots/' . $posername . '.png" />';
}
else{
echo '<img class="fullshot" src="images/fullshots/default.png" />';
}
//Or if the GET page variable is gallery, display the gallery page
if ($page == 'gallery')
{
echo getGallery($style,$id);
}//If the GET page variable is news, display the news page
elseif ($page == 'news')
{
echo getNews($$id);
}
//If the GET page variable is segments, display the segments page
elseif ($page == 'segments')
{
echo getBioSegments($id,S);
}
//If the GET page variable is matches, display the matches page
elseif ($page == 'matches')
{
echo getBioSegments($id,M);
}
elseif ($page == 'chronology')
{
echo getChronology($id);
}
//Otherwise display the bio
else
{
echo getBio($style,$id);
}
?>

 

I only did the singles part.

<?php
function getBio($style, $uid) {
$id = mysql_real_escape_string($uid);
?>
<h2>Personal</h2>
<?php if ($style=='singles') { 
$sql = "SELECT
			a.*,b.manager_id, b.nicknames, b.finisher, b.setup, b.music 
		FROM 
			efed_bio_singles AS a 
		JOIN 
			efed_bio_wrestling AS b 
		ON 
			(a.bio_id = b.bio_id) 
		WHERE 
			a.bio_id = '$id' 
		LIMIT 1";
$re = mysql_query($sql);
$row = mysql_fetch_assoc($re);
extract($row);
?>
<table class="biotable" cellspacing="10px">
<tr class="biotablerowa">
<td class="biotableheadingb">Nicknames:</td>
<td class="biotabledatab"><?php echo (empty($nicknames)) ?  "N/A" : $nicknames; ?></td>
</tr>
<tr class="biotablerowa">
<td class="biotableheadingb">Height:</td>
<td class="biotabledatab"><?php echo $height; ?></td>
</tr>
<tr class="biotablerowb">
<td class="biotableheadingb">Weight:</td>
<td class="biotabledatab"><?php echo $weight; ?></td>
</tr>
<tr class="biotablerowa">
<td class="biotableheadingb">Hometown:</td>
<td class="biotabledatab"><?php echo $hometown; ?></td>
</tr>
</table>
<?php } ?>


<? if ($style=='tagteam') { ?>

<? } ?>

<? if ($style=='manager') { ?>

<? } ?>

<? if ($style=='referee') { ?>

<? } ?>

<? if ($style=='staff') { ?>

<? } ?>

<? if ($style=='stable') { ?>

<? } ?>

<h2>History</h2>
<?  echo getHistory($id); ?>

<h2>Quotes</h2>
<?  echo getQuotes($id); ?>

<h2>Wrestling</h2>
<?  echo getWrestling($id); ?>

</div>
<?
}

Its working great, however, I'm trying to also get the manager of someone if one exist by taking the id of the competitor's biography that you are looking at and putting that in the efed_bio_wrestling table that is being used inside the getWrestling function part. The table all that info is taken from is efed_bio_wrestling which has a field called manager_id. If there is a value there I want it to take it to the efed_bio table and match that value to the id inside that table and when it finds a match then grab the field from efed_bio table called charactername and then take that charactername back to the Wrestling area of the bio and insert it for Manager/Valet since right now it says that the variable manager is undefined.

 

Here's the query from the first try at the bio I once had that worked before trying to redo it all to make it more efficient:

 

$sql = "SELECT ebw.manager_id AS managerid, ebw.finisher AS finisher, ebw.setup AS setup, ebw.music AS music, ebw.nicknames AS nicknames, bio.id AS id, bio.posername AS posername, bio.charactername AS charname, bio.style_id AS style, bio.status_id AS status FROM `efed_bio` AS bio LEFT JOIN `efed_bio_wrestling` AS ebw ON bio.id = ebw.bio_id WHERE bio.username = '$username'";

 

One more thing, I have that function for that biomenu that was made however I took it out as a div and gave it the same tagging as with a few other uses like it called with a class of minilinks and for some reason its adding a line break after each one and not sure why?

 

 

http://kansasoutlawwrestling.com/bio?username=satoshi

 

function getBioMenu($username) {
?>
<p><span class="minilinks">
<a href="/bio?username=<? echo $username; ?>" class="mwtabslink">Biography</a>
<a href="/bio?page=gallery&username=<? echo $username; ?>" class="mwtabslink">Gallery</a>
<a href="/bio?page=news&username=<? echo $username; ?>" class="mwtabslink">News</a>
<a href="/bio?page=segments&username=<? echo $username; ?>" class="mwtabslink">Segments</a>
<a href="/bio?page=matches&username=<? echo $username; ?>" class="mwtabslink">Matches</a>
<a href="/bio?page=chronology&username=<? echo $username; ?>" class="mwtabslink">Chronology</a>
</span>
</p>
<?
}

function getBio($style, $id) {
$id = mysql_real_escape_string($id);
?>
<h2>Personal</h2>
<?php if ($style=='singles') { 
$sql = "SELECT a.*,b.manager_id, b.nicknames, b.finisher, b.setup, b.music 
FROM efed_bio_singles AS a JOIN efed_bio_wrestling AS b ON (a.bio_id = b.bio_id)  WHERE a.bio_id = '$id' LIMIT 1";
$re = mysql_query($sql);
$row = mysql_fetch_assoc($re);
extract($row);
?>
<table class="biotable" cellspacing="5px">
<tr class="biotablerowa">
<td class="biotableheadingb">Nicknames:</td>
<td class="biotabledatab"><?php echo (empty($nicknames)) ?  "N/A" : $nicknames; ?></td>
</tr>
<tr class="biotablerowa">
<td class="biotableheadingb">Height:</td>
<td class="biotabledatab"><?php echo $height; ?></td>
</tr>
<tr class="biotablerowb">
<td class="biotableheadingb">Weight:</td>
<td class="biotabledatab"><?php echo $weight; ?></td>
</tr>
<tr class="biotablerowa">
<td class="biotableheadingb">Hometown:</td>
<td class="biotabledatab"><?php echo $hometown; ?></td>
</tr>
</table>
<?php } ?>


<? if ($style=='tagteam') { ?>

<? } ?>

<? if ($style=='manager') { ?>

<? } ?>

<? if ($style=='referee') { ?>

<? } ?>

<? if ($style=='staff') { ?>

<? } ?>

<? if ($style=='stable') { ?>

<? } ?>

<h2>History</h2>
<?  echo getHistory($style, $id); ?>

<h2>Quotes</h2>
<?  echo getQuotes($id); ?>

<h2>Wrestling</h2>
<?  echo getWrestling($style, $id); ?>

</div>
<?
}

function getGallery($id) {
$id=mysql_real_escape_string($id);
?>
<table class="biotable" cellspacing="0px">
		<tr class="biotablerowa">
			<td class="biotableheadingb">Headshot Image</td>
			<td class="biotabledatab"><?php if(file_exists('images/headshots/' . $posername . '.jpg')){ echo '<img src="/backstage/images/headshots/' . $posername . '.jpg" alt="" />'; } else { echo 'No Image Uploaded'; } ?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Roleplay Image</td>
			<td class="biotabledatab"><?php if(file_exists('images/lp/' . $posername . '.jpg')){ echo '<img src="/backstage/images/lp/' . $posername . '.jpg" alt="" />'; } else { echo 'No Image Uploaded'; } ?></td>
		</tr>

		<tr class="biotablerowa">
			<td class="biotableheadingb">Titantron Image</td>
			<td class="biotabledatab"><?php if(file_exists('images/titantron/' . $posername . '.jpg')){ echo '<img src="/backstage/images/titantron/' . $posername . '.jpg" alt="" />'; } else { echo 'No Image Uploaded'; } ?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Champion Image</td>
			<td class="biotabledatab"><?php if(file_exists('images/champions/' . $posername . '.jpg')){ echo '<img src="/backstage/images/champions/' . $posername . '.jpg" alt="" />'; } else { echo 'No Image Uploaded'; } ?></td>
		</tr>
	</table>

<?php
}

function getHistory($style, $id) {
$id=mysql_real_escape_string($id);

if ($style=='singles') { 
$sql = "SELECT * FROM `efed_bio_history` WHERE bio_id = '$id'";
$re = mysql_query($sql);
$row = mysql_fetch_assoc($re);
extract($row);
?>
<table class="biotable" cellspacing="10px">
		<tr class="biotablerowb">
			<td class="biotableheadingb">KOW Titles:</td>
			<td class="biotabledatab"><?php if (strlen ($kowtitles) < 1) { 	print "N/A"; } else { print "$kowtitles";}?></td>
		</tr>

		<tr class="biotablerowa">
			<td class="biotableheadingb">KOW Awards:</td>
			<td class="biotabledatab"><?php if (strlen ($kowawards) < 1) { 	print "N/A"; } else { print "$kowawards";}?></td>
		</tr>
	</table>
<?php
}
?>

<? if ($style=='tagteam') { ?>

<? } ?>

<? if ($style=='manager') { ?>

<? } ?>

<? if ($style=='referee') { ?>

<? } ?>

<? if ($style=='staff') { ?>

<? } ?>

<? if ($style=='stable') { ?>

<? } 

}


function getQuotes($id) {
$id=mysql_real_escape_string($id);
?>
<ul id="quotes">
		<?php
			if(count($quotes) > 0){
				for($i = 0; $i < count($quotes); $i++){
					echo "<li>".$quotes[$i]."</li>";
				}
			}
			else{
				echo '<li>This wrestler has no quotes.</li>';
			}
		?>
	</ul>	
<?php
}

function getWrestling($style, $id) {
$id=mysql_real_escape_string($id);
if ($style=='singles') { 
$sql = "SELECT * FROM `efed_bio_wrestling` WHERE bio_id = '$id'";
$re = mysql_query($sql);
$row = mysql_fetch_assoc($re);
extract($row);
?>
<table class="biotable" cellspacing="10px">
		<tr class="biotablerowb">
			<td class="biotableheadingb">Manager/Valet:</td>
			<td class="biotabledatab"><?php if (strlen ($manager) < 1) { 	print "N/A"; } else { print "$manager";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Finisher:</td>
			<td class="biotabledatab"><?php if (strlen ($finisher) < 1) { 	print "N/A"; } else { print "$finisher";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Setup:</td>
			<td class="biotabledatab"><?php if (strlen ($setup) < 1) { 	print "N/A"; } else { print "$setup";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Entrance Music:</td>
			<td class="biotabledatab"><?php if (strlen ($music) < 1) { 	print "N/A"; } else { print "$music";}?></td>
		</tr>
	</table>	
<?php
if ($style=='tagteam') { ?>

<? } ?>

<? if ($style=='manager') { ?>

<? } ?>

<? if ($style=='referee') { ?>

<? } ?>

<? if ($style=='staff') { ?>

<? } ?>

<? if ($style=='stable') { ?>

<? }
}
}
?>

You are wanting the manager_id from the wrestling table, to match up to the bio table?

 

$sql = "SELECT wr.*,bio.* FROM `efed_bio_wrestling` AS wr JOIN `efed_bio` AS bio ON (wr.manager_id = bio.id) WHERE wr.id = '$id'";

 

This should work, it is un-tested though.

That didn't work it made all the variables in that area undefined.

 

Not saying you don't understand what I'm trying to attempt here but that way you can get a better understanding. Okay so say i have wrestler 1 that inside the efed_bio_wrestling table has a value of 2 in the manager_id field. I want it to take that value to the efed_bio table and look in the id field with that integer. Then when it finds a match then grab the value inside the charactername field.

I tried reading through that but got lost but can add one bit.

 

You've got a large chunk of links being thrown out and you can tidy that up a bit.

 

<a href="<? echo $siteurl; ?>/bio.php?username=<? echo $username; ?>" class="mwtabslink">Biography</a>

 

Can be cut down to:

makeURL($siteurl,$username,'Biography');

 

Then you have a function to make the link:

function makeURL($url,$uname,$str) {
  echo '<a href="'.$url.'/bio.php?username='.$uname.'" class="mwtabslink">'.$str.'</a>'."\n";
}

The "\n" on the end isn't needed, it just helps reading the source easier if you "View Source" in your browser.

These are just the parts that don't work. I already have it getting the rest of the information so it has the bio_id of the character and what it's supposed to do when it's inside of the efed_bio_wrestling table is get the manager_id and then take it to the efed_bio table and match that to the same integer and when it finds a match record then get that person's charactername and if there is a 0 for the value inside of manager_id then it says "N/A"

 

efed_bio

id

charactername

 

efed_bio_wrestling

bio_id

manager_id

 

 

Okay so I got something to work. I have it to display the value of the manager_id field. However my coding says that if its value is less than 1 then print N/A but it's not then it needs to take it back to efed_bio and match it up with the id value and then grab that charactername.

 

<td class="biotableheadingb">Manager/Valet:</td>
                <td class="biotabledatab"><?php if (strlen ($manager) < 1) {     print "N/A"; } else { print "$manager";}?></td>

I take that back. The only way the info displays is if the person has a manager and if it doesn't then it says all the variables are undefined.

 

function getWrestling($style, $id) {
$id=mysql_real_escape_string($id);
if ($style=='singles') { 
$sql = "SELECT bio.charactername AS manager, ebw.finisher AS finisher, ebw.setup AS setup, ebw.music AS music FROM efed_bio_wrestling AS ebw JOIN efed_bio AS bio ON ( ebw.manager_id = bio.id) WHERE ebw.bio_id = '$id'";
$re = mysql_query($sql);
$row = mysql_fetch_assoc($re);
extract($row);
?>
<h2>Wrestling</h2>
<table class="biotable" cellspacing="10px">
		<tr class="biotablerowb">
			<td class="biotableheadingb">Manager/Valet:</td>
			<td class="biotabledatab"><?php if (strlen ($manager) < 1) { 	print "N/A"; } else { print "$manager";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Finisher:</td>
			<td class="biotabledatab"><?php if (strlen ($finisher) < 1) { 	print "N/A"; } else { print "$finisher";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Setup:</td>
			<td class="biotabledatab"><?php if (strlen ($setup) < 1) { 	print "N/A"; } else { print "$setup";}?></td>
		</tr>

		<tr class="biotablerowb">
			<td class="biotableheadingb">Entrance Music:</td>
			<td class="biotabledatab"><?php if (strlen ($music) < 1) { 	print "N/A"; } else { print "$music";}?></td>
		</tr>
	</table>	
<?php } ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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