Jump to content

Smee

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by Smee

  1. Thanks for the info again... Can't belive it was just not closing a href!
  2. Adding anything after this removes the link from the table and does not show what you have tried to add to the page. <td><a target="_blank" href="http://news.bbc.co.uk/sport1/hi/football/teams/b/birmingham_city/fixtures/default.stm> Fixtures</a></td> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="icon" type="image/png" href="../images/favicon.png"/> <title>Team Fixture Lists</title> <style type="text/css" mdeia="screen"> @import "./includes/layout.css"; </style> </head> <body background="../images/background.png"> <div id="container"> <div id="slimtop"> </div> <div id="small_login"> <form action="login.php" method="post"> <p class="email"> <label> E-Mail: </label> <input type="text" name="email" id="email" value=""/> </label> <p class="password"><label> Password: </label> <input type="password" name="pass" maxlength="20" /> <p class="submit"> <input type="submit" name="submit" value="Login" /> </form> </div> <div id="ft_logo"> </div> <div id="middle_container"> <div id="navigation_container"> <div id="navigation_header"> </div> <p><img src="/images/home.png" width="20" height="20" alt="home" title="home" align="baseline" border="0" hspace="10" /><a href="index.php">Home<br /></a></p> <p><img src="/images/register.png" width="20" height="20" alt="Register" title="Register" align="baseline" border="0" hspace="10" /><a href="register.php">Register<br /></a></p> <p><img src="/images/navbarlogin.png" width="20" height="20" alt="Login" title="Login" align="baseline" border="0" hspace="10" /><a href="login.php">Login<br /></a></p> <p><img src="/images/forgotpassword.png" width="20" height="20" alt="Forgot Password" title="Forgot Password" align="baseline" border="0" hspace="10" /><a href="forgot_password.php">Forgot Password<br /></a></p> <p><img src="/images/aboutus.png" width="20" height="20" alt="About Us" title="About Us" align="baseline" border="0" hspace="10" /><a href="aboutus.html">About Us<br /></a></p> <p><img src="/images/fixtures.png" width="20" height="20" alt="Fixtures" title="Fixtures" align="baseline" border="0" hspace="10" /><a href="fixtures.php">Team Fixtures<br /></a></p> <img src="/images/forums.png" width="20" height="20" alt="Football Trip.net Forums" title="Football Trip.net Forums" align="baseline" border="0" hspace="10" /><a href="forums" target="_blank">Forums</a> <div id="third_party_links"> <img src="../images/facebook_32.png" width="32" height="32" alt="Football Trip.net Facebook" title="Football Trip.net Facebook" align="baseline" border="0" hspace="9" /><a href="" target="_blank"></a> <img src="../images/twitter_32.png" width="32" height="32" alt="Football Trip.net Twitter" title="Football Trip.net Twitter" align="baseline" border="0" hspace="9" /><a href="" target="_blank"></a> <img src="../images/email_32.png" width="32" height="32" alt="E-Mail Football Trip.net" title="E-Mail Football Trip.net" align="baseline" border="0" hspace="9" /><a href="" target="_blank"></a> </div> </div> <!-- End of Header !--> <div id="fixture_content_container"> <div id="content_header"> </div> <h1> Search Team Fixture Lists <br /> <br /> <p>To view your teams fixture list please use the search function below. </p> <p> ** For legal reasons Football Trip.net are not allowed to list fixtures on the site.**</p></h1> <div id="fixture_search"> <form action="fixtures.php" method="post" /> <p class="team_name"><label> Football Team Supported: </label> <select name="team_name"> <option>Accrington Stanley</option> <option>Aldershot</option> <option>Arsenal</option> <option>Aston Villa</option> <option>Barnet</option> <option>Barnsley</option> <option>Birmingham City</option> <option>Blackburn Rovers</option> <option>Blackpool</option> <option>Bolton</option> <option>Bournemouth</option> <option>Bradford City</option> <option>Brentford</option> <option>Brighton</option> <option>Bristol City</option> <option>Bristol Rovers</option> <option>Burton Albion</option> <option>Bury</option> <option>Cardiff City</option> <option>Carlisle</option> <option>Charlton Athletic</option> <option>Chelsea</option> <option>Cheltenham Town</option> <option>Chesterfield</option> <option>Colchester United</option> <option>Coventry City</option> <option>Crewe Alexandra</option> <option>Crystal Palace</option> <option>Dagenham and Redbridge</option> <option>Darlington</option> <option>Derby County</option> <option>Doncaster Rovers</option> <option>Everton</option> <option>Exeter City</option> <option>Fulham</option> <option>Gillingham</option> <option>Grimsby Town</option> <option>Hartlepool United</option> <option>Hereford United</option> <option>Huddersfield Town</option> <option>Hull City</option> <option>Ipswich Town</option> <option>Leeds United</option> <option>Leicester City</option> <option>Leyton Orient</option> <option>Lincoln City</option> <option>Liverpool</option> <option>Macclesfield Town</option> <option>Manchester City</option> <option>Manchester United</option> <option>Middlesbrough</option> <option>Millwall</option> <option>Milton Keynes Dons</option> <option>Morecambe</option> <option>Newcastle United</option> <option>Northampton Town</option> <option>Norwich</option> <option>Nottingham Forest</option> <option>Notts County</option> <option>Oldham Athletic</option> <option>Peterborough United</option> <option>Plymouth Argyle</option> <option>Port Vale</option> <option>Portsmouth</option> <option>Preston North End</option> <option>Queens Park Rangers</option> <option>Reading</option> <option>Rochdale</option> <option>Rotherham United</option> <option>Scunthorpe United</option> <option>Sheffield United</option> <option>Sheffield Wednesday</option> <option>Shrewsbury Town</option> <option>Southampton</option> <option>Southend United</option> <option>Stockport</option> <option>Stoke City</option> <option>Sunderland</option> <option>Swansea City</option> <option>Swindon Town</option> <option>Torquay United</option> <option>Tottenham Hotspur</option> <option>Tranmere Rovers</option> <option>Wallsall</option> <option>Watford</option> <option>West Bromwich Albion</option> <option>West Ham United</option> <option>Wigan Athletic</option> <option>Wolverhampton Wanderers</option> <option>Wycombe Wanderers</option> <option>Yeovil Town</option> </select> <p class="submit"> <input type="submit" name="submit" value="Search" /> </form> </div> <div id="fixtures_confirmation"> <table width="600" height="100" border="0" /> <thead> <tr> <th scope="col">Team Name</th> <th scope="col">Fixture List URL</th> </tr> </thead> <tbody> <tr> <td>Birmingham City</td> <td><a target="_blank" href="http://news.bbc.co.uk/sport1/hi/football/teams/b/birmingham_city/fixtures/default.stm> Fixtures</a></td> </tr> </tbody> </table> </div> <!-- End of Content --!> </div> </body> </html>
  3. I will try and make it a bit clearer. The form is showing the right results as the page is. The only problem is when i try to add anything whether it is an image, divs or even text the team name shows but the fixture link is removed and nothing is being shown. So anything added after this means that the fixture link is removed and whatever you have tried to add does not show up either. <td><a target="_blank" href="'.$_SESSION['indexsearch_result']['url'].'> Fixtures</a></td> <?php # register.php // This is the registration script for the site require_once ('./includes/config.inc.php'); // Set the page title and header $page_title = 'Team Fixture Lists'; include ('./includes/header.html'); ?> <div id="fixture_content_container"> <div id="content_header"> </div> <h1> Search Team Fixture Lists <br /> <br /> <p>To view your teams fixture list please use the search function below. </p> <p> ** For legal reasons Football Trip.net are not allowed to list fixtures on the site.**</p></h1> <div id="fixture_search"> <form action="fixtures.php" method="post" /> <p class="team_name"><label> Football Team Supported: </label> <select name="team_name"> <option>Accrington Stanley</option> <option>Aldershot</option> <option>Arsenal</option> <option>Aston Villa</option> <option>Barnet</option> <option>Barnsley</option> <option>Birmingham City</option> <option>Blackburn Rovers</option> <option>Blackpool</option> <option>Bolton</option> <option>Bournemouth</option> <option>Bradford City</option> <option>Brentford</option> <option>Brighton</option> <option>Bristol City</option> <option>Bristol Rovers</option> <option>Burton Albion</option> <option>Bury</option> <option>Cardiff City</option> <option>Carlisle</option> <option>Charlton Athletic</option> <option>Chelsea</option> <option>Cheltenham Town</option> <option>Chesterfield</option> <option>Colchester United</option> <option>Coventry City</option> <option>Crewe Alexandra</option> <option>Crystal Palace</option> <option>Dagenham and Redbridge</option> <option>Darlington</option> <option>Derby County</option> <option>Doncaster Rovers</option> <option>Everton</option> <option>Exeter City</option> <option>Fulham</option> <option>Gillingham</option> <option>Grimsby Town</option> <option>Hartlepool United</option> <option>Hereford United</option> <option>Huddersfield Town</option> <option>Hull City</option> <option>Ipswich Town</option> <option>Leeds United</option> <option>Leicester City</option> <option>Leyton Orient</option> <option>Lincoln City</option> <option>Liverpool</option> <option>Macclesfield Town</option> <option>Manchester City</option> <option>Manchester United</option> <option>Middlesbrough</option> <option>Millwall</option> <option>Milton Keynes Dons</option> <option>Morecambe</option> <option>Newcastle United</option> <option>Northampton Town</option> <option>Norwich</option> <option>Nottingham Forest</option> <option>Notts County</option> <option>Oldham Athletic</option> <option>Peterborough United</option> <option>Plymouth Argyle</option> <option>Port Vale</option> <option>Portsmouth</option> <option>Preston North End</option> <option>Queens Park Rangers</option> <option>Reading</option> <option>Rochdale</option> <option>Rotherham United</option> <option>Scunthorpe United</option> <option>Sheffield United</option> <option>Sheffield Wednesday</option> <option>Shrewsbury Town</option> <option>Southampton</option> <option>Southend United</option> <option>Stockport</option> <option>Stoke City</option> <option>Sunderland</option> <option>Swansea City</option> <option>Swindon Town</option> <option>Torquay United</option> <option>Tottenham Hotspur</option> <option>Tranmere Rovers</option> <option>Wallsall</option> <option>Watford</option> <option>West Bromwich Albion</option> <option>West Ham United</option> <option>Wigan Athletic</option> <option>Wolverhampton Wanderers</option> <option>Wycombe Wanderers</option> <option>Yeovil Town</option> </select> <p class="submit"> <input type="submit" name="submit" value="Search" /> </form> </div> <div id="fixtures_confirmation"> <?php $error = null; if(isset($_POST['submit'])){ // Search form // Do the search query here first: require_once ('../mysql_connect.php'); // Santize Post code and team supported. (Santitize both, never use trim or other similar functions when santizing input.) if ( mysql_real_escape_string( $_POST['team_name']) ) { // Select every column from the table where conditions match: $query = "SELECT * FROM teams WHERE team_name LIKE '%" . $_POST['team_name'] . "%'"; $result = mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: ".mysql_error()); $_SESSION['indexsearch_result'] = array(); while($row = mysql_fetch_array($result)){ $_SESSION['indexsearch_result'] = $row; } } else { // Save error as string, so we can use it how we wish later. $error = '<center><p><font color ="red">Team Name contains either; one or more invalid characters, or too many/too little characters.</font></p></center>'; } } if(!isset($_SESSION['indexsearch_result']) || $error != null){ // No Search or errors echo(($error != null)? $error : ""); }else{ echo(' <table width="600" height="100" border="0" /> <thead> <tr> <th scope="col">Team Name</th> <th scope="col">Fixture List URL</th> </tr> </thead>'); echo(' <tbody> <tr> <td>'.$_SESSION['indexsearch_result']['team_name'].'</td> <td><a target="_blank" href="'.$_SESSION['indexsearch_result']['url'].'> Fixtures</a></td> </tr> </tbody> </table>'); // End echoing result. } ?> </div> <?php // Include the HTML footer. include ('./includes/footer.html'); ?>
  4. Oh sure, sorry its late and im not with it. It has shown the same errors and its still very long so i wouldn't know where to start looking. Anyway i have added it here for you to see. (just a small portion because apparently max characters is 40000) <td><a target="_blank" href="http://news.bbc.co.uk/sport1/hi/football/teams/a/accrington_stanley/fixtures/default.stm>Fixtures</a></td> </tr> </tbody> </table>array(24) { ["GLOBALS"]=> &array(24) { ["GLOBALS"]=> &array(24) { ["GLOBALS"]=> *RECURSION* ["_ENV"]=> array(32) { ["CONTENT_LENGTH"]=> string(2) "42" ["CONTENT_TYPE"]=> string(33) "application/x-www-form-urlencoded" ["DOCUMENT_ROOT"]=> string(26) "/home/footba33/public_html" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_CHARSET"]=> string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7" ["HTTP_ACCEPT_ENCODING"]=> string(12) "gzip,deflate" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-gb,en;q=0.5" ["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_COOKIE"]=> string(233) "phpbb3_nfhiu_u=1; phpbb3_nfhiu_k=; phpbb3_nfhiu_sid=dc050c7e193dc87bb89825ee898f9781; style_cookie=null; phpbb3_7rsoy_k=; phpbb3_7rsoy_u=2; phpbb3_7rsoy_sid=2fe48d284c54fe446ebe9c196824625c; PHPSESSID=8e49aa1d1cbc3bb131689acd465d7a3f" ["HTTP_HOST"]=> string(20) "www.footballtrip.net" ["HTTP_KEEP_ALIVE"]=> string(3) "115" ["HTTP_REFERER"]=> string(40) "http://www.footballtrip.net/fixtures.php" ["HTTP_USER_AGENT"]=> string(88) "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" ["PATH"]=> string(13) "/bin:/usr/bin" ["QUERY_STRING"]=> string(0) "" ["REDIRECT_STATUS"]=> string(3) "200" ["REMOTE_ADDR"]=> string(14) "90.212.231.148" ["REMOTE_PORT"]=> string(5) "52045" ["REQUEST_METHOD"]=> string(4) "POST" ["REQUEST_URI"]=> string(13) "/fixtures.php" ["SCRIPT_FILENAME"]=> string(39) "/home/footba33/public_html/fixtures.php" ["SCRIPT_NAME"]=> string(13) "/fixtures.php" ["SERVER_ADDR"]=> string(12) "69.175.67.90" ["SERVER_ADMIN"]=> string(26) "webmaster@footballtrip.net" ["SERVER_NAME"]=> string(20) "www.footballtrip.net" ["SERVER_PORT"]=> string(2) "80" ["SERVER_PROTOCOL"]=> string( "HTTP/1.1" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["UNIQUE_ID"]=> string(24) "TA2o2UWvQ1oAACsUeKkAAAAH" } ["HTTP_ENV_VARS"]=> array(32) { ["CONTENT_LENGTH"]=> string(2) "42" ["CONTENT_TYPE"]=> string(33) "application/x-www-form-urlencoded" ["DOCUMENT_ROOT"]=> string(26) "/home/footba33/public_html" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_CHARSET"]=> string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7" ["HTTP_ACCEPT_ENCODING"]=> string(12) "gzip,deflate" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-gb,en;q=0.5" ["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_COOKIE"]=> string(233) "phpbb3_nfhiu_u=1; phpbb3_nfhiu_k=; phpbb3_nfhiu_sid=dc050c7e193dc87bb89825ee898f9781; style_cookie=null; phpbb3_7rsoy_k=; phpbb3_7rsoy_u=2; phpbb3_7rsoy_sid=2fe48d284c54fe446ebe9c196824625c; PHPSESSID=8e49aa1d1cbc3bb131689acd465d7a3f" ["HTTP_HOST"]=> string(20) "www.footballtrip.net" ["HTTP_KEEP_ALIVE"]=> string(3) "115" ["HTTP_REFERER"]=> string(40) "http://www.footballtrip.net/fixtures.php" ["HTTP_USER_AGENT"]=> string(88) "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" ["PATH"]=> string(13) "/bin:/usr/bin" ["QUERY_STRING"]=> string(0) "" ["REDIRECT_STATUS"]=> string(3) "200" ["REMOTE_ADDR"]=> string(14) "90.212.231.148" ["REMOTE_PORT"]=> string(5) "52045" ["REQUEST_METHOD"]=> string(4) "POST" ["REQUEST_URI"]=> string(13) "/fixtures.php" ["SCRIPT_FILENAME"]=> string(39) "/home/footba33/public_html/fixtures.php" ["SCRIPT_NAME"]=> string(13) "/fixtures.php" ["SERVER_ADDR"]=> string(12) "69.175.67.90"
  5. Ok i added that at the bottom and have been returned 9 pages of HTML with no spaces so its kind of hard to read or understand. It seems to be giving a response for all the information stored in MySQL database. None of my other pages are doing this so i have no idea why this is acting the way it is.
  6. Yes it does mate! Where do i go from here?
  7. Hi, I have a working table that produces the info that i require however after adding it to the page what ever i try and add after it seems to make the PHP result vanish aswell as not showing the div i had tried adding. I have got a feeling it is something to do with the PHP i added and not set up properly because when this table is removed i can add divs and information like normal. Any help would be much appreciated. Thanks <?php $error = null; if(isset($_POST['submit'])){ // Search form // Do the search query here first: require_once ('../mysql_connect.php'); // Santize Post code and team supported. (Santitize both, never use trim or other similar functions when santizing input.) if ( mysql_real_escape_string( $_POST['team_name']) ) { // Select every column from the table where conditions match: $query = "SELECT * FROM teams WHERE team_name LIKE '%" . $_POST['team_name'] . "%'"; $result = mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: ".mysql_error()); $_SESSION['indexsearch_result'] = array(); while($row = mysql_fetch_array($result)){ $_SESSION['indexsearch_result'] = $row; } } else { // Save error as string, so we can use it how we wish later. $error = '<center><p><font color ="red">Team Name contains either; one or more invalid characters, or too many/too little characters.</font></p></center>'; } } if(!isset($_SESSION['indexsearch_result']) || $error != null){ // No Search or errors echo(($error != null)? $error : ""); }else{ echo(' <table width="600" height="100" border="0" /> <thead> <tr> <th scope="col">Team Name</th> <th scope="col">Fixture List URL</th> </tr> </thead>'); echo(' <tbody> <tr> <td>'.$_SESSION['indexsearch_result']['team_name'].'</td> <td><a target="_blank" href="'.$_SESSION['indexsearch_result']['url'].'>Fixtures</a></td> </tr> </tbody> </table>'); // End echoing result. } ?>
  8. Thanks again Ignace works a treat!
  9. Hey, I have been playing around with a count function and have it nearly working how i want it to but cant figure out what is going wrong. The code is returning these results: There are 11 11 supporters. There are 9 9 supporters. There are 2 2 supporters. There are 2 2 supporters. There are 1 1 supporters. There are 1 1 supporters. The second number(s) should be the names of teams but i can't seem to get the names to show. The reason for this is because of the duplication of . $row['team_supported'] ." but if i have it like . $row['COUNT(team_supported)'] ." i get an error of undefined variable. Anyway here is what i have done so far. <?php $query = "SELECT team_supported, COUNT(team_supported) AS team_supported FROM users GROUP BY team_supported ORDER BY team_supported DESC LIMIT 6"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "There are ". $row['team_supported'] ." ". $row['team_supported'] ." supporters."; echo "<br />"; } ?>
  10. Hi, I'm not sure if this can be done but can you use php to search your MySQL database and read entries to count and display the most popular of a certain item. For example.. when you register you have a mutliple choice of post codes. Can you then read the database to find the five most popular post codes and display them in a table. Thanks for any advice.
  11. Thanks for all the info! It's all working fine, its good to see the different ways you could have done this. Smee
  12. Ok, Ignace i changed the section u mentioned but got the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ***/index.php on line 88 line 88 is: <td>' . $row['first_name'] . '</td> I then changed both " to ' like it was before but kept your \'s on $row_color and no errors but no alternate colors. There was me thinking this would be an easy job. <?php require_once ('../mysql_connect.php'); echo ('<table width="294" height="150" border="0" /> <thead> <tr> <th scope="col">First Name</th> <th scope="col">Post Code</th> <th scope="col">Team Supported</th> </tr> </thead> '); $color0 = "#FFF"; $color1 = "#CCC"; $row_count = 0; $result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id DESC LIMIT 5") or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { if ($row_count == 1) { $row_color = $color1; $row_count = 0; } else { $row_color = $color0; $row_count++; } echo ('<tbody> <tr bgcolor=\"$row_color\"> <td>' . $row['first_name'] . '</td> <td>' . $row['post_code'] . '</td> <td>' . $row['team_supported'] . '</td> </tr> </tbody>'); } echo "</table>"; ?>
  13. Thanks your method seems like it should work perfectly. I implemented it to my script and still do no get alternate colors, It still gives the right MySQL results just no color. It wouldn't be anything to do with CSS that needs adding as well, i mean i tried earlier with the CSS method and that didn't work either. Well anyway here is the new code thanks to JD307. <?php require_once ('../mysql_connect.php'); echo ('<table width="294" height="150" border="0" /> <thead> <tr> <th scope="col">First Name</th> <th scope="col">Post Code</th> <th scope="col">Team Supported</th> </tr> </thead> '); $result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id DESC LIMIT 5") or die (mysql_error()); $color0 = '#FFF'; $color1 = '#CCC'; $row_count = 0; while($row = mysql_fetch_assoc($result)) { if ($row_count == 1) { $row_color = $color1; $row_count = 0; } else { $row_color = $color0; $row_count++; } echo ('<tbody> <tr bgcolor="$row_color"> <td>' . $row['first_name'] . '</td> <td>' . $row['post_code'] . '</td> <td>' . $row['team_supported'] . '</td> </tr> </tbody>'); } echo "</table>"; ?>
  14. Thanks for the help mate, What i thought should be happening is by using this code: $row_color = ($row_count % 2) ? $color1 : $color2; And having specified the colors in previous varials (color1 and color2) it will take what color is needed a placed in the bgcolor ="$row_color" section like below? <td bgcolor="$row_color">' . $row['first_name'] . '</td> I could be so far of the right method of doing this so my bad if its all a bit messed up heh Smee
  15. Hi, I posted an earlier article on the CSS forum section but have come to realise the problem is not CSS related and the solution was through PHP so i have given it a go and still seem to have no alternate colors. Can anyone see where i am going wrong with the following code: <?php require_once ('../mysql_connect.php'); echo ('<table width="294" height="150" border="0" /> <thead> <tr> <th scope="col">First Name</th> <th scope="col">Post Code</th> <th scope="col">Team Supported</th> </tr> </thead> '); $color1 = "#FFF"; $color2 = "#CCC"; $row_count = 0; $result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id DESC LIMIT 5") or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { $row_color = ($row_count % 2) ? $color1 : $color2; echo (' <tbody> <tr> <td bgcolor="$row_color">' . $row['first_name'] . '</td> <td bgcolor="$row_color">' . $row['post_code'] . '</td> <td bgcolor="$row_color">' . $row['team_supported'] . '</td> </tr> </tbody> '); $row_count++; } echo "</table>"; ?>
  16. Hi, I am having some serious issues with my table. I can't for the life of me get it to color alternate rows, i have tried several tutorials and methods found on the Internet but none seem to resolve the issue of just a plain white background. Can someone tell me what i am doing wrong because i have spent far to much time on this it's driving me crazy. Below i have shown the CSS and HTML i am using. Thanks for the help #index_newest_members table { font-family:Tahoma, Geneva, sans-serif; font-size: 12px; font-weight: lighter; padding: 0; border-collapse: collapse; text-align: center; color: #000000; line-height: 10px; } #index_newest_members td { margin-left: 0; padding: 12px 5px; } #index_newest_members th { margin-left: 0; } #index_newest_members thead tr th { font-family: Trebuchet MS; font-weight: 600; font-size: 12px; font-style: normal; padding: 12px 5px; text-align:center; } #index_newest_members tfoot tr th, tfoot tr td { background-color: transparent; color: #ccc; border-top: 1px solid #ccc; padding: 20px 10px; } #index_newest_members tbody tr th td { text-align: center; } #index_newest_members tbody tr td { background: #FFF; } #index_newest_members tbody tr td.odd { background: #CCC; } #index_newest_members tr:hover { } #index_newest_members tr:hover td, tr:hover td a, tr:hover th a { color: #a10000; } #index_newest_members td:hover { } #index_newest_members table a { color: #608117; background-image: none; text-decoration: none; border-bottom: 1px dotted #8A8F95; } #index_newest_members table a:hover { color: #BBC4CD; background-image: none; text-decoration: none; border-bottom: 2px solid #333; } #index_newest_members table a:visited { text-decoration: none; border-bottom: 1px dotted #333; text-decoration: none; } #index_newest_members table a:visited:hover { background-image: none; text-decoration: none; border-bottom: 3px solid #333; } echo ('<table width="294" height="150" border="0" /> <thead> <tr> <th scope="col">First Name</th> <th scope="col">Post Code</th> <th scope="col">Team Supported</th> </thead> </tr>'); while($row = mysql_fetch_assoc($result)) { echo (' <tbody> <tr> <td>' . $row['first_name'] . '</td> <td>' . $row['post_code'] . '</td> <td>' . $row['team_supported'] . '</td> </tr> </tbody> '); } echo "</table>";
  17. Think i have got it. I added a DESC after user_id. Thanks for your help. $result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id DESC LIMIT 5");
  18. Of course it is i was thinking of something else at the time. It works fine but what i was trying to do by using a 3 would be only to show three results and for it to list these by highest user_id first. I was thinking something like this but it shows the lowest user_id first rather than last. $result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id LIMIT 3"); Thanks again.
  19. Hi, I am trying to create a short list of new members that have registered to a site in PHP. This is what i have so far and i am getting an 'Undefined index: first_name' error. If i am right in thinking i need an (isset($_POST['??']) command somewhere in my code. If someone can point me in the right direction i'd be much appreciated. Cheers <?php require_once ('../mysql_connect.php'); $result = mysql_query("SELECT 3 FROM users ORDER BY user_id"); echo "<table border='0'> <tr> <th>First Name</th> <th>Post Code</th> <th>Team Supported</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['first_name'] . "</td>"; echo "<td>" . $row['post_code'] . "</td>"; echo "<td>" . $row['team_supported'] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  20. Awesome thanks for the help. It's working but is this what you meant by the exit(); command? if (!isset($_SESSION['user_id'])){ header("location:login.php"); exit(); }
  21. Hey, I have a working site but realise i have not added enough security because users who are not logged in, if they know that /attending.php is a page to the site then they can access it even though they cannot use the functions of the page. I cant find a lot on redirecting for non logged in users on the net so thought i would try here, has anyone got a tutorial or suggestions on how this can be implemented where if they try access these restricted pages they get taken to the /login.php. Thanks in advance!
  22. No i didn't i will give it a go, Thanks for your help.
  23. Hey, I am trying to apply a simple redirect script like to a logout page but i understand the redirect needs to be placed in the header before any other php for it to work. Below is the script i am trying to apply. sleep(3);//seconds to wait.. header("Location:http://www.footballtrip.net"); The script below is my logout.php with the header and footer of my site added via include scripts, this is where i am finding the problem. After the message you are logged out is it possible to have the script redirect to another by using php? <?php // This is the logout for the site require_once ('./includes/config.inc.php'); $page_title = 'Logout Football Trip'; include ('./includes/header.html'); $_SESSION = array(); // Destroy variables session_destroy(); // Destroy the session its self setcookie (session_name(), '', time()-300, '/', '', 0); // Destroy the cookie ?> <div id="content_container"> <div id="content_header"> </div> <?php echo "<h1>You are now logged out</h1>"; ?> </div> <?php include ('./includes/footer.html'); ?>
  24. Yes thats whats happening. Obviously i just want it to appear when there is a problem with the registration but can't get my head round it.
  25. I am having a problem with my registration script that i can't get my head around. Basically whats happening is if there is an error in the script, the PHP shows an image and the words 'problems with registration' as shown below. $error = true; echo '<h2><p><img src="/images/registrationproblem.png" width="16" height="16" alt="Forgot Password" title="Forgot Password" align="baseline" border="0" hspace="10" />Problems with Registration:</p></h2>'; after it will <li> list of the problems that occured. When you first load register.php it does not show up, this is correct however when a successfull registration has been made it still shows the image with the words 'registration problems'. (hope that made sense) Anyway here is the entire script and thanks for any help! <?php # register.php // This is the registration script for the site require_once ('./includes/config.inc.php'); // Set the page title and header $page_title = 'Register for Football Trip'; include ('./includes/header.html'); ?> <div id="registration_content_container"> <div id="content_header"> </div> <h1> Register for Football Trip <br /> <br /> <p>To access Football Trip.net please complete this short registration form. </p></h1> <div id="registration"> <form action="register.php" method="post"> <p class="first_name"><label> First Name: </label> <input type="text" name="first_name" maxlength="15" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /> <p class="last_name"><label> Last Name: </label> <input type="text" name="last_name" maxlength="30" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /> <p class="email"><label> E-Mail Address: </label> <input type="text" name="email" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> <label><small>** Please enter your email address carefully, it will be used to<br /> retrieve a forgotten password and contact you in the future.**</small></label> <p class="password1"><label> Password: </label> <input type="password" name="password1" maxlength="20" /> <label><small> **Use only letters and numbers. Must be between 4 and 20 Characters long.** </small></label> <p class="password2"><label> Confirm Password: </label> <input type="password" name="password2" maxlength="20" /> <p class="post_code"><label> Post Code: </label> <select name="post_code"> <option>AB Aberdeen</option> <option>AL St Albans</option> <option>B Birmingham</option> <option>BA Bath</option> <option>BB Blackburn</option> <option>BD Bradford</option> <option>BH Bournemouth</option> <option>BL Bolton</option> <option>BN Brighton</option> <option>BR Bromley</option> <option>BS Bristol</option> <option>BT Belfast</option> <option>CA Carlisle</option> <option>CB Cambridge</option> <option>CF Cardiff</option> <option>CH Chester</option> <option>CM Chelmsford</option> <option>CO Colchester</option> <option>CR Croydon</option> <option>CT Canterbury</option> <option>CV Coventry</option> <option>CW Crewe</option> <option>DA Dartford</option> <option>DD Dundee</option> <option>DE Derby</option> <option>DG Dumfries</option> <option>DH Durham</option> <option>DL Darlington</option> <option>DN Doncaster</option> <option>DT Dorchester</option> <option>DY Dudley</option> <option>E London E</option> <option>EC London EC</option> <option>EH Edinburgh</option> <option>EN Enfield</option> <option>EX Exeter</option> <option>FK Falkirk and Stirling</option> <option>FY Blackpool</option> <option>G Glasgow</option> <option>GL Gloucester</option> <option>GU Guildford</option> <option>HA Harrow</option> <option>HD Huddersfield</option> <option>HG Harrogate</option> <option>HP Hemel Hempstead</option> <option>HR Hereford</option> <option>HS Outer Hebrides</option> <option>HU Hull</option> <option>HX Halifax</option> <option>IG Ilford</option> <option>IP Ipswich</option> <option>IV Inverness</option> <option>KA Kilmarnock</option> <option>KT Kingston upon Thames</option> <option>KW Kirkwall</option> <option>KY Kirkcaldy</option> <option>L Liverpool</option> <option>LA Lancaster</option> <option>LD Llandrindod Wells</option> <option>LE Leicester</option> <option>LL Llandudno</option> <option>LN Lincoln</option> <option>LS Leeds</option> <option>LU Luton</option> <option>M Manchester</option> <option>ME Rochester</option> <option>MK Milton Keynes</option> <option>ML Motherwell</option> <option>N London N</option> <option>NE Newcastle upon Tyne</option> <option>NG Nottingham</option> <option>NN Northampton</option> <option>NP Newport</option> <option>NR Norwich</option> <option>NW London NW</option> <option>OL Oldham</option> <option>OX Oxford</option> <option>PA Paisley</option> <option>PE Peterborough</option> <option>PH Perth</option> <option>PL Plymouth</option> <option>PO Portsmouth</option> <option>PR Preston</option> <option>RG Reading</option> <option>RH Redhill</option> <option>RM Romford</option> <option>S Sheffield</option> <option>SA Swansea</option> <option>SE London SE</option> <option>SG Stevenage</option> <option>SK Stockport</option> <option>SL Slough</option> <option>SM Sutton</option> <option>SN Swindon</option> <option>SO Southampton</option> <option>SP Salisbury</option> <option>SR Sunderland</option> <option>SS Southend-on-Sea</option> <option>ST Stoke-on-Trent</option> <option>SW London SW</option> <option>SY Shrewsbury</option> <option>TA Taunton</option> <option>TD Galashiels</option> <option>TF Telford</option> <option>TN Tonbridge</option> <option>TQ Torquay</option> <option>TR Truro</option> <option>TS Cleveland</option> <option>TW Twickenham</option> <option>UB Southall</option> <option>W London W</option> <option>WA Warrington</option> <option>WC London WC</option> <option>WD Watford</option> <option>WF Wakefield</option> <option>WN Wigan</option> <option>WR Worcester</option> <option>WS Walsall</option> <option>WV Wolverhampton</option> <option>YO York</option> <option>ZE Lerwick</option> </select> <p class="team_supported"><label> Football Team Supported: </label> <select name="team_supported"> <option>Accrington Stanley</option> <option>Aldershot</option> <option>Arsenal</option> <option>Aston Villa</option> <option>Barnet</option> <option>Barnsley</option> <option>Birmingham City</option> <option>Blackburn Rovers</option> <option>Blackpool</option> <option>Bolton</option> <option>Bournemouth</option> <option>Bradford City</option> <option>Brentford</option> <option>Brighton</option> <option>Bristol City</option> <option>Bristol Rovers</option> <option>Burton Albion</option> <option>Bury</option> <option>Cardiff City</option> <option>Carlisle</option> <option>Charlton Athletic</option> <option>Chelsea</option> <option>Cheltenham Town</option> <option>Chesterfield</option> <option>Colchester United</option> <option>Coventry City</option> <option>Crewe Alexandra</option> <option>Crystal Palace</option> <option>Dagenham and Redbridge</option> <option>Darlington</option> <option>Derby County</option> <option>Doncaster Rovers</option> <option>Everton</option> <option>Exeter City</option> <option>Fulham</option> <option>Gillingham</option> <option>Grimsby Town</option> <option>Hartlepool United</option> <option>Hereford United</option> <option>Huddersfield Town</option> <option>Hull City</option> <option>Ipswich Town</option> <option>Leeds United</option> <option>Leicester City</option> <option>Leyton Orient</option> <option>Lincoln City</option> <option>Liverpool</option> <option>Macclesfield Town</option> <option>Manchester City</option> <option>Manchester United</option> <option>Middlesbrough</option> <option>Millwall</option> <option>Milton Keynes Dons</option> <option>Morecambe</option> <option>Newcastle United</option> <option>Northampton Town</option> <option>Norwich</option> <option>Nottingham Forest</option> <option>Notts County</option> <option>Oldham Athletic</option> <option>Peterborough United</option> <option>Plymouth Argyle</option> <option>Port Vale</option> <option>Portsmouth</option> <option>Preston North End</option> <option>Queens Park Rangers</option> <option>Reading</option> <option>Rochdale</option> <option>Rotherham United</option> <option>Scunthorpe United</option> <option>Sheffield United</option> <option>Sheffield Wednesday</option> <option>Shrewsbury Town</option> <option>Southampton</option> <option>Southend United</option> <option>Stockport</option> <option>Stoke City</option> <option>Sunderland</option> <option>Swansea City</option> <option>Swindon Town</option> <option>Torquay United</option> <option>Tottenham Hotspur</option> <option>Trenmere Rovers</option> <option>Wallsall</option> <option>Watford</option> <option>West Bromwich Albion</option> <option>West Ham United</option> <option>Wigan Athletic</option> <option>Wolverhampton Wanderers</option> <option>Wycombe Wanderers</option> <option>Yeovil Town</option> </select> <p class="submit"> <input type="submit" name="submit" value="Register" /> </form> </div> <div id="registration_error"> <?php if (isset($_POST['submit'])) { require_once ('../mysql_connect.php'); $error = true; echo '<h2><p><img src="/images/registrationproblem.png" width="16" height="16" alt="Forgot Password" title="Forgot Password" align="baseline" border="0" hspace="10" />Problems with Registration:</p></h2>'; $error = false; if (preg_match ('/^[[:alpha:]\.\'\-]{2,30}$/i', stripslashes(trim($_POST['first_name'])))) { $fn = mysql_real_escape_string($_POST['first_name']); }else { $error = true; echo '<h2><li><font color ="red"> Please enter your first name!</font></li></h2>'; } if (preg_match ('/^[[:alpha:]\.\'\-]{2,30}$/i', stripslashes(trim($_POST['last_name'])))) { $ln = mysql_real_escape_string($_POST['last_name']); }else { $error = true; echo '<h2><li><font color ="red"> Please enter your last name!</font></li></h2>'; } if (preg_match ('/^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$/i', stripslashes(trim($_POST['email'])))) { $e = mysql_real_escape_string($_POST['email']); }else { $error = true; echo '<h2><li><font color ="red"> Please enter a correct e-mail address</font></li></h2>'; } if (preg_match ('/^[[:alnum:]]{4,20}$/i', stripslashes(trim($_POST['password1'])))) { if ($_POST['password1'] == $_POST['password2']) { $p = mysql_real_escape_string($_POST['password1']); }else { $error = true; echo '<h2><li><font color="red">Your password did not match the confirmed password!</font></li><h2>'; } }else { $error = true; echo '<h2><li><font color="red">Please enter a valid password</font></li></h2>'; } ?> </div> <?php $pc = mysql_real_escape_string($_POST['post_code']); $ts = mysql_real_escape_string($_POST['team_supported']); if (!$error) { $query ="SELECT user_id FROM users WHERE email='$e'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: ".mysql_error()); if (mysql_num_rows($result) == 0) { $a = md5(uniqid(rand(), true)); $query = "INSERT INTO users (email, pass, first_name, last_name, post_code, team_supported, active, registration_date) VALUES ('$e', '$p', '$fn', '$ln', '$pc', '$ts', '$a', NOW() )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error:" .mysql_error()); if (mysql_affected_rows() == 1) { $body = "Thank you for registering with Football Trip. Please use the link below to activate your account:\n\n"; $body .= "http://www.footballtrip.net/activate.php?x=" . mysql_insert_id() . "&y=$a"; mail($_POST['email'],'Registration Comfirmation',$body); echo '<center><h1><p><img src="/images/registrationconfirmation.png" width="16" height="16" align="baseline" border="0" hspace="10" />Thank You for Registering! <br /><br /> A confirmation E-Mail has been sent to the address given, You must use the <br /> link provided in order to activate your account.</p></h1></center>'; }else { echo '<center><h1><p><font color="red"> You could not be registered due to a system error. We apologize for any inconvenience. </font></p></h1></center>'; } }else { echo '<center><h1><p><font color="red"> That E-Mail address has already been registered.<br /> Forgotten your password?, Click <a href="/forgot_password.php /> here </a>.</font></p></h1></center>'; } } else { echo '<center><h1><p><font color="red"> There Were Problems With the Registration. Please Try Again.</font></p></h1></center>'; } mysql_close(); } ?> </div> <?php // Include the HTML footer. include ('./includes/footer.html'); ?>
×
×
  • 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.