Xtremer360 Posted September 27, 2010 Author Share Posted September 27, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1116191 Share on other sites More sharing options...
jcbones Posted September 27, 2010 Share Posted September 27, 2010 So does your competitors account id follow them through all of the tables? Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1116483 Share on other sites More sharing options...
Xtremer360 Posted September 27, 2010 Author Share Posted September 27, 2010 Yes. The id from efed_bio is the same int as all the other tables with bio_id. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1116500 Share on other sites More sharing options...
jcbones Posted September 28, 2010 Share Posted September 28, 2010 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> <? } Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1116530 Share on other sites More sharing options...
Xtremer360 Posted September 29, 2010 Author Share Posted September 29, 2010 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') { ?> <? } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117014 Share on other sites More sharing options...
yaMz Posted September 29, 2010 Share Posted September 29, 2010 Eh, nevermind. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117031 Share on other sites More sharing options...
Xtremer360 Posted September 29, 2010 Author Share Posted September 29, 2010 LOL I was about to say you should have been the end of the function besides you had reposted old code. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117032 Share on other sites More sharing options...
yaMz Posted September 29, 2010 Share Posted September 29, 2010 LOL I was about to say you should have been the end of the function besides you had reposted old code. I needed a cigarette. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117033 Share on other sites More sharing options...
Xtremer360 Posted September 29, 2010 Author Share Posted September 29, 2010 Does anyone know that can read a few previous posts? Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117036 Share on other sites More sharing options...
jcbones Posted September 29, 2010 Share Posted September 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117369 Share on other sites More sharing options...
Xtremer360 Posted September 29, 2010 Author Share Posted September 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1117379 Share on other sites More sharing options...
Xtremer360 Posted October 1, 2010 Author Share Posted October 1, 2010 Anyone have any other suggestions that I could plug in and try because I've about tried everything I can come up with. It just keeps saying its undefined. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1118105 Share on other sites More sharing options...
Xtremer360 Posted October 3, 2010 Author Share Posted October 3, 2010 Again I spent the better part of the day researching and trying different things and can't seem to come up with a solution. Anyone available to try it from a second brain instead of mine. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1118476 Share on other sites More sharing options...
Yesideez Posted October 3, 2010 Share Posted October 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1118515 Share on other sites More sharing options...
Yesideez Posted October 3, 2010 Share Posted October 3, 2010 Any chance you can post the structure of the tables you want to read and the contents of the function "cleanquerydata()" please? Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1118518 Share on other sites More sharing options...
Xtremer360 Posted October 3, 2010 Author Share Posted October 3, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1118582 Share on other sites More sharing options...
Xtremer360 Posted October 4, 2010 Author Share Posted October 4, 2010 Does that help anyone? Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1119037 Share on other sites More sharing options...
Xtremer360 Posted October 4, 2010 Author Share Posted October 4, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1119056 Share on other sites More sharing options...
Xtremer360 Posted October 4, 2010 Author Share Posted October 4, 2010 Finally solved it on my own. I thank everyone who contributed to the thread. Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1119059 Share on other sites More sharing options...
Xtremer360 Posted October 4, 2010 Author Share Posted October 4, 2010 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/214403-not-showing-anything/page/2/#findComment-1119060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.