login  Naam:   Wachtwoord: 
Registreer je!
 Forum

[Php] Unknown column 'Admin' in 'where clause'

Offline Simax - 04/09/2007 17:27 (laatste wijziging 04/09/2007 17:28)
Avatar van SimaxOnbekend Fout: Unknown column 'Admin' in 'where clause'

  1. $standard = array("home","crew","news","services","incidents","contact");
  2. $admin = array("add_news","change_news","delete_news","view_news");
  3. $member = array("view_news");
  4.  
  5. $query = mysql_query("SELECT us_rank FROM users WHERE us_username = ".$_SESSION['username']) or die(mysql_error());
  6. $result = mysql_fetch_assoc($query);
  7. $rank = $result['us_rank'];
  8.  
  9. if(isset($_GET['page']))
  10. {
  11. $pages = $standard;
  12.  
  13. if(isset($rank))
  14. {
  15. $rank = strtolower($rank);
  16.  
  17. if(isset($$rank))
  18. {
  19. $pages = array_merge($standard, $$rank);
  20. }
  21. }
  22. if(in_array($_GET['page'], $pages))
  23. {
  24. if(file_exists($_GET['page'].'.php'))
  25. {
  26. include $_GET['page'].'.php';
  27. }
  28. else
  29. {
  30. echo('<p class="error">Ongeldige pagina opgegeven.</p>');
  31. }
  32. }
  33. else
  34. {
  35. echo('<p class="error">Ongeldige pagina opgegeven.</p>');
  36. }
  37. }

2 antwoorden

Gesponsorde links
Offline Rik - 04/09/2007 17:30
Avatar van Rik Gouden medailleGouden medaille

Crew algemeen
  1. mysql_query("SELECT us_rank FROM users WHERE us_username = ".$_SESSION['username'])

$_SESSION['username'], de waarde daarvan moet in de query tussen quotes komen, dus:
  1. mysql_query("SELECT us_rank FROM users WHERE us_username = '".$_SESSION['username'] . "'")
Offline Cosca - 04/09/2007 17:34 (laatste wijziging 04/09/2007 17:44)
Avatar van Cosca HTML beginner
  1. <?php
  2. $query = mysql_query("SELECT us_rank FROM users WHERE us_username = ".$_SESSION['username']) or die(mysql_error());
  3. ?>


=>

  1. <?php
  2. $query = mysql_query("SELECT us_rank FROM users WHERE us_username = '".$_SESSION['username']."'") or die(mysql_error());
  3. ?>


je mist quotes in je query.

bijna op tijd 
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.236s