Rare error

Gestart doorBartv7 reacties135 weergaven

8 berichten · pagina 1 van 1

Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat is hier de error?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near  at line 1


Ik snap het niet
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Geef de query eens
0
Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Deze?

$sql = mysql_query("SELECT * FROM leden WHERE id = ".$_SESSION[log_id]."") or die(mysql_error());
$fetch = mysql_fetch_assoc($sql);
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je sessie bestaat niet, daardoor vraagt hij eigenlijk dit:

"SELECT * FROM leden WHERE id = "

Dus weet mysql niet welke id hij moet hebben, en geeft hij een error wink
0
Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar ik snap het niet,
hoe kan ik het verhelpen zodat je niet ingelogd MOET zijn om de site te bekijken?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #FF8000]// dingen voor leden[/COLOR]
[COLOR= #007700]}[/COLOR]

[COLOR= #FF8000]// voor iedereen[/COLOR]

?>
0
Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt nog steeds niet
dit zijn de pagina:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]inc/header.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
?>
<!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" lang="nl" xml:lang="nl">

<head>
 <title>De Weg Is Weg</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <script type="text/javascript" src="js/UBB.js"></script>
</head>
 
<body>
<div id="houder">
    <div id="header"></div>
    </div>
    <div id="menubalk"></div>
<div id="houder">
    <div id="leftbar">
        <div id="menu"></div>
        <div class="under">[COLOR= #0000BB]<?php[/COLOR]
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]])){[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]~ [/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] ~[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<span style="color:#000;"><br />Geld:</span> <span style="color:gold;">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]galjoenen[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</span>,
  <span style="color:gray;">
  [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sikkels[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</span>,<span style="color:brown;">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]knoeten[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</span><br /> 
  <span style="color:#000;">
  Afdeling: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$site[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]/afdeling">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afdeling[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</span></a>[/COLOR][COLOR= #007700];
   }[/COLOR]
   [URL="http://www.php.net/else"]else[/URL]
   [COLOR= #007700]{[/COLOR]
  ?>
  <p>Welkom Dreuzel</p>
   <a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$site[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]];[/COLOR] ?>/aanmelden">Schrijf je in</a><br />
   <a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$site[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]];[/COLOR] ?>/inloggen">Login</a><br />
   <a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$site[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]];[/COLOR] ?>/wwvergeten">Toverwoord vergeten</a><br />
  [COLOR= #0000BB]<?[/COLOR]
  [COLOR= #007700]}[/COLOR]
  ?></div>
        <div id="linkpartners"></div>
        <div class="under"><a href="http://zairo.nl">Zairo - GPT site</a></div>
    </div>
    <div id="midbar">
        <div id="content"></div>
        <div class="under2">[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]inc/header.php[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]])){[/COLOR]
          [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700]){[/COLOR]   
          [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE gebruikersnaam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" AND wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
          [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
          [COLOR= #0000BB]$log[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR] 
          [COLOR= #0000BB]$act[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$log[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]act[/COLOR][COLOR= #007700]];[/COLOR]
          
          [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$act[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je kunt niet inloggen omdat je account niet geactiveerd is.[/COLOR][COLOR= #007700];
          }[/COLOR] 
          [URL="http://www.php.net/else"]else[/URL]
          [COLOR= #007700]{[/COLOR] 
          [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE gebruikersnaam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" AND wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
          [COLOR= #0000BB]$log[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR] 
          [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$log[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
          [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_id[/COLOR][COLOR= #007700]];[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `leden` SET online = NOW() WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je bent succesvol ingelogd, je wordt doorgestuurd.[/COLOR][COLOR= #007700];[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="2; URL=index">[/COLOR][COLOR= #007700];
          
            }         
         }[/COLOR]
         [URL="http://www.php.net/else"]else[/URL] 
         [COLOR= #007700]{[/COLOR]
       [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze account bestaat niet[/COLOR][COLOR= #007700];
   }
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
           [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]
           <form action="" method="post">
          <table border="0" cellpadding="0" cellspacing="3">
                        <tr>
           <td><font color="white">Inloggen:</font></td>
           </tr>
           <tr>
           <td><strong>Tovenaarsnaam:</strong></td>
           <td><img src="img/gebruiker.png" alt="" />
           <input type="text" name="gebruikersnaam" size="14"></td>
           </tr>
           <tr>
           <td><strong>Toverwoord:</strong></td>
           <td><img src="img/slot.png" alt="" />
           <input type="password" name="wachtwoord" size="14"></td>
           </tr>
           <tr>
        
        <td><input type="submit" name="submit" value="Inloggen" /></td>
           </tr>
           </table>
           </form>[/COLOR][COLOR= #007700];
            }        
           }[/COLOR]
           [URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
           [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je bent al ingelogd.[/COLOR][COLOR= #007700];
   }[/COLOR]
?></div>
    </div>
    <div id="rightbar">
        <div id="ledenmenu"></div>
        <div class="under3">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]inc/footer.php[/COLOR][COLOR= #007700])[/COLOR]?></div>
    </div>
</body>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Dan moet je dit wel in het ledenstuk plaatsen he:

sql = mysql_query("SELECT * FROM leden WHERE id = ".$_SESSION[log_id]."") or die(mysql_error());
$fetch = mysql_fetch_assoc($sql);
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren