herghost Posted May 10, 2009 Share Posted May 10, 2009 Hi All, I have the below page which is basically shows a bands profile page. What I want to do is only have this display if all the required information is updated. What I plan to do is have a button in the members control panel which allows the user to confirm there profile as complete, this will then inturn check that all the required fields in the database are complete and update a database table called `useractive` to 1. How would I get the page below to display if user is active, if not active then to display another page? Thanks <?php session_start(); include('include/database.php'); $userid = $_GET['userid']; $_SESSION['bandid'] = $userid; ?> <head> <script type="text/javascript" src="include/prototype.js"></script> <script type="text/javascript" src="include/scriptaculous.js? ¬ load=effects"></script> <script type="text/javascript" src="include/modalbox.js"></script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>FanJunky.com! - <?php $sql = "SELECT * FROM user WHERE userid = '$userid'";$result = mysql_query($sql) or die(mysql_error());while($row = mysql_fetch_array($result)){ { echo $row['bandname']; }} ?></title> <meta name="keywords" content="Fanjunky.com, Fan Junky, <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['bandname']; } } ?> information, <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['bandname']; } } ?> tickets, <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['bandname']; } } ?> mp3's, <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['bandname']; } } ?>" /> <meta name="description" content="www.fanjunky.com - your number 1 for all things music! Gig dates, tickets, information, discography, fans, concerts" /> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <?php include('include/header.php') ?> <!-- start page --> <div id="page"> <!-- start content --> <div id="content"> <div class="post greenbox"> <div class="title"> <h1> <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['bandname']; } } ?> ----------- Band Status = <?php $sql = "SELECT * FROM bandmaininfo WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ { echo $row['status']; } } ?> </h1> </div> <div class="entry"> <p><a href="portfolioview.php?userid=<?php $sql = "SELECT * FROM user WHERE userid = '$userid'";$result = mysql_query($sql) or die(mysql_error());while($row = mysql_fetch_array($result)){echo $row['userid'];}?>"target="blank"><h2>View Bands Discography</h2></a></p> <table width="100%" border="0"> <tr> <td width="25%"><span class="norm"><img src="users/<?php $sql = "SELECT * FROM user WHERE userid = '$userid'";$result = mysql_query($sql) or die(mysql_error());while($row = mysql_fetch_array($result)){ { echo $row['userid'];}}?>/mainpic.jpg " alt="bandimage" /></span></td> <td width="75%"><?php $sql = "SELECT * FROM banddata WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($r = mysql_fetch_array($result)){ { $position0 = $r["position0"]; $position1 = $r["position1"]; $position2 = $r["position2"]; $position3 = $r["position3"]; $position4 = $r["position4"]; $position5 = $r["position5"]; $member0 = $r["member0"]; $member1 = $r["member1"]; $member2 = $r["member2"]; $member3 = $r["member3"]; $member4 = $r["member4"]; $member5 = $r["member5"]; echo "<table width ='80%'>"; echo "<tr>"; echo "<td>$position0</td>"; echo "<td>$member0</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$position1</td>"; echo "<td>$member1</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$position2</td>"; echo "<td>$member2</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$position3</td>"; echo "<td>$member3</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$position4</td>"; echo "<td>$member4</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$position5</td>"; echo "<td>$member5</td>"; echo "</tr>"; echo "</table>"; } }?></td> </tr> </table> <br /> <p><?php $sql = "SELECT * FROM banddata WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($r = mysql_fetch_array($result)){ { $genre = $r["genre"]; //$genre = echo "Genre = "; echo $genre; } }?> </p> <p> <?php $sql = "SELECT * FROM bandmaininfo WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); if ($result) { while ($r = mysql_fetch_array($result)) { $summary = $r["summary"]; $howformed = $r["howformed"]; $history = $r["history"]; $ach = $r["ach"]; $inf = $r["inf"]; echo "<p>"; echo $summary; echo "</p>"; echo "<p>"; echo $howformed; echo "</p>"; echo "<p>"; echo $history; echo "</p>"; echo "<p>"; echo $ach; echo "</p>"; echo "<p>" ; echo $inf; echo "</p>"; } } else { echo "No data."; } ?> </p> </div> <div class="btm"> <div class="l"> <div class="r"> <p class="meta"></p> </div> </div> </div> </div><br /> <div class="two-columns"> <div class="columnA"> <div class="title red"> <h2>sponsers</h2> </div> <div class="content"> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 300x250, created 4/13/09 */ google_ad_slot = "3081294343"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> </div> </div> <div class="columnB"> <div class="title blue"> <h2>sponsers</h2> </div> <div class="content"> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 250x250, created 4/14/09 */ google_ad_slot = "6665679490"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> </div> </div> <div class="btm"> </div> </div> </div> <!-- end content --> <!-- start sidebar --> <div id="sidebar"> <ul> <li> <h2>band links</h2> <ul><li> <?php $sql = "SELECT * FROM bandlinks WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); echo "<table>"; if ($result) { while ($r = mysql_fetch_array($result)) { $homepage = $r["homepage"]; $myspace = $r["myspace"]; $facebook = $r["facebook"]; $userid = $r["userid"]; echo "<tr>"; echo "<td>Home Page</td>"; echo "<td width='25'></td>"; echo "<td><a href='$homepage' target='blank'>Go!</a></td></tr>"; echo "<tr>"; echo "<td>Myspace</td>"; echo "<td width='25'></td>"; echo "<td><a href='$myspace' target='blank'>Go!</a></td></tr>"; echo "<tr>"; echo "<td>Facebook</td>"; echo "<td width='25'></td>"; echo "<td><a href='$facebook' target='blank'>Go!</a></td></tr>"; echo "</table>"; } } else { echo "No data."; } ?> <tr> <td>Tour Dates & Tickets (US)</td> <td><a href="http://www.ticketmaster.com/search?q= <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { { echo $row['bandname']; } }?>" target="blank">Go!</a></td> </tr> <tr> <td>Tour Dates & Tickets (UK)</td> <td><a href="http://www.ticketmaster.co.uk/search?q= <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { { echo $row['bandname']; } }?>" target="blank">Go!</a></td> </tr> <tr> <td>Discography</td> <td><a href="portfolioview.php?userid=<?php $sql = "SELECT * FROM user WHERE userid = '$userid'";$result = mysql_query($sql) or die(mysql_error());while($row = mysql_fetch_array($result)){echo $row['userid'];}?>"target="blank">Go!</a></td> </tr> </table> </li> </ul> <h2>buy music</h2> <iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=fanjun-21&o=2&p=12&l=st1&mode=mp3-uk&search=<?php $sql = "SELECT * FROM user WHERE userid = '$userid'";$result = mysql_query($sql) or die(mysql_error());while($row = mysql_fetch_array($result)){ { echo $row['bandname']; }} ?>&fc1=000000<1=_blank&lc1=FF3333&bg1=FFFFFF&f=ifr" marginwidth="0" marginheight="0" width="300" height="250" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe> </ul> </li> </ul> </div> <!-- end sidebar --> <div id="sidebar"> <ul> <li> <h2>Listen</h2> <ul> <table align="center" border="0" cellspacing="0"cellpadding="0"><tbody><tr><td> </td></tr><div align="center"> <script language='JavaScript' src='include/musicplayer.js' type='text/javascript'></script></div> <tr><td><div align="center"><font face="Arial" font size="1"></font></div> </td></tr></tbody></table> </ul> </li> </ul> </div> <div id="sidebar"> <ul> <li> <h2>Bands Like This</h2> <ul> <?php $sql = "SELECT * FROM user,banddata WHERE genre = '$genre' ORDER BY RAND() LIMIT 3"; $result = mysql_query($sql ,$con); while($myrow = mysql_fetch_array($result)) { echo "<table width ='90%'>"; echo "<tr>"; echo "<td>"; echo $myrow['bandname']; echo "</td>"; echo "<td>"; echo "<a href='newprofile.php?userid="; echo $myrow['userid']; echo "'><img src='users/"; echo $myrow['userid']; echo "/mainpic.jpg' width='80' height='80' alt='bandimage' /></a>"; echo "</table>"; } ?> </ul> </li> </ul> </div> <!-- end sidebar --> <!-- end page --> <div style="clear: both;"> </div> <?php include('include/footer.php') ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/157576-hopefully-simple-display-question/ Share on other sites More sharing options...
gevans Posted May 10, 2009 Share Posted May 10, 2009 After the mysql query check the `useractive` field. if($row['useractive']) { //show the page } else { //show a different page } Link to comment https://forums.phpfreaks.com/topic/157576-hopefully-simple-display-question/#findComment-830965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.