Result pagina door link met gebruiker.php?= id hoe nu verder

Status
Niet open voor verdere reacties.
Aan de hand van het ID (5 dus) kanje met een SELECT-query de data ophalen, daarna even met mysqli_fetch_assoc() de data ophalen.
 
heb een table met de naam users als ik al username, first_name, last_name er uit krijg zou ik al blij zijn maar krijg niks voor elkaar via youtube krijg ik ook niet echt de indruk dat daar iets vind
 
heb de post op andere form gegooid eerste wat ik daar krijg om me oren te gegooit krijg hoop commentaar met dit is niet goed en dat niet exclusief goed door dachte oplossing
 
Waar loop je op vast? Wat heb je al aan code?

Als anderen iets niet goed vinden, dan lijkt me dat opbouwende kritiek? of ik zie het verkeerd?
Ik heb geen idee wat voor kritiek er meespeelt?
 
Laatst bewerkt:
nog niks

nog niks om dat ik hoop commentaar kreeg heb ik lopen zoeken naar
wat oude scripts wat ik nu gaat aan passen
PHP:
<div id="main">

<?php
if (isset($_GET['werknemer'])) {
					$naam = $_GET['werknemer'];

      $result = mysql_query("SELECT id, Naam, Adres, Postcode, Woonplaats, Telefoon, Nood, Email, BSN, Herkomst, Contact, contacttel, contactemail, contracturen, functie, vrijeuren FROM WERKNEMERS WHERE NAAM='".$naam."'");	
       
        while($row = mysql_fetch_array($result)) {
                if (!empty($row['Naam'])) {
	
	
						echo "<table class = 'pinfo'>";
						
						echo '<div id="naam">'.$row['Naam'].'</div>';
				
						//Naam
				
                        echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Naam</td>";
							echo "<td class = 'row'>".$row['Naam']."</td>";
						echo "</tr>";
						
						
						
						//Adres
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Adres</td>";
							echo "<td class = 'row'>".$row['Adres']."</td>";
						echo "</tr>";
						
						
						
						//Postcode
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Postcode</td>";
							echo "<td class = 'row'>".$row['Postcode']."</td>";
						echo "</tr>";
						
						
						
						//Woonplaats
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Woonplaats</td>";
							echo "<td class = 'row'>".$row['Woonplaats']."</td>";
						echo "</tr>";
						
						
						
						//Telefoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Telefoon</td>";
							echo "<td class = 'row'>".$row['Telefoon']."</td>";
						echo "</tr>";
						
						
						
						//Telefoon Nood
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Telefoon nood</td>";
							echo "<td class = 'row'>".$row['Nood']."</td>";
						echo "</tr>";
						
						
						
						//Email
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Email</td>";
							echo "<td class = 'row'>".$row['Email']."</td>";
						echo "</tr>";
						
						
						
						//BSN
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>BSN</td>";
							echo "<td class = 'row'>".$row['BSN']."</td>";
						echo "</tr>";
						
						
						
						//Herkomst
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Herkomst</td>";
							echo "<td class = 'row'>".$row['Herkomst']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon</td>";
							echo "<td class = 'row'>".$row['Contact']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon telefoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon telefoon</td>";
							echo "<td class = 'row'>".$row['contacttel']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon email
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon email</td>";
							echo "<td class = 'row'>".$row['contactemail']."</td>";
						echo "</tr>";
						
						
						
						//Contracturen
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contacturen</td>";
							echo "<td class = 'row'>".$row['contracturen']."</td>";
						echo "</tr>";
						
						
						
						//Functie
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Functie</td>";
							echo "<td class = 'row'>".$row['functie']."</td>";
						echo "</tr>";
						
						
						//Vrije uren
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Uren</td>";
							echo "<td class = 'row'>".$row['vrijeuren']."</td>";
						echo "</tr>";
						
						
						echo "</table>";
dit wel iets anders
 
Het is zo lek als een zeef, kan ik je vertellen. Je mist een beveiliging met mysql_real_escape_string(). Ook kijk je niet of je $result false is.
Als je query onverhoopt niet zou werken, gebeurt er niks. Aan jouw om een foutmelding in te bakken.

Misschien is Naam gewoon leeg, en dan zie je niks.
 
Laatst bewerkt:
dit is een oud script je mag van mijn weten ik weet erweinig van van beveiligen en lezen is nie mijn sterkte vak moet hebben wat me ogen zien maken me handen maar hooft niet
 
en ik heb niet hele script gepost er zittten nog 100 regels bij dit script
 
En waarom niet als ik vragen mag? Ik vind het maar vreemd al mag ik het eerlijk zeggen.
En je zegt dat leze neit je sterkste vak is, maar dat is niet het enige wat bij programmeren hoort..... je moet het ook doen.
Als je dat niet lukt, heb ik twijfels of dit de juiste hobby is. Klinkt rot, maar je moet er wel feeling voor hebben. Voel je niet gedwongen.....
 
maakt oo kniet uit

PHP:
<!DOCTYPE html>
<html>
<head>
	<title> Combigoods - Werknemerslijst</title>
<?php require_once('private/connection.inc.php');?>
<?php
session_start();
     if(isset($_SESSION['CPANEL_ID'])){
        $usr_id = $_SESSION['CPANEL_ID'];
       
        $qy_rs_login = mysql_query("SELECT name FROM tbl_users WHERE id='".mysql_real_escape_string($usr_id)."'", $conn_db_flash) or die(mysql_error());
        $row_rs_login = mysql_fetch_assoc($qy_rs_login);
       
        if($row_rs_login == NULL){
                header("Location: /");
                exit();
        }
        mysql_free_result($qy_rs_login);
}else{
        header("Location: /");
        exit();
}


define('DEBUG_MODE',true);  // true == aan, false == uit
 
   function showSQLError($sql,$error,$text='Error')
    {
        if (DEBUG_MODE)
        {
            return  '<pre>Error: ' . $error . '<br />' . $sql . '</pre>';
        }
        else
        {
            return $text;
        }
    }  
?>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script src="lib/jquery/jquery-1.8.3.min.js"></script>
	<link href="css/werk.css" rel="stylesheet" type="text/css">

	
</head>
<body>
<?php
 include ('header.php');
 include ('private/connect.php');
 ?>

<div id="main">

<?php
if (isset($_GET['werknemer'])) {
					$naam = $_GET['werknemer'];

      $result = mysql_query("SELECT id, Naam, Adres, Postcode, Woonplaats, Telefoon, Nood, Email, BSN, Herkomst, Contact, contacttel, contactemail, contracturen, functie, vrijeuren FROM WERKNEMERS WHERE NAAM='".$naam."'");	
       
        while($row = mysql_fetch_array($result)) {
                if (!empty($row['Naam'])) {
	
	
						echo "<table class = 'pinfo'>";
						
						echo '<div id="naam">'.$row['Naam'].'</div>';
				
						//Naam
				
                        echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Naam</td>";
							echo "<td class = 'row'>".$row['Naam']."</td>";
						echo "</tr>";
						
						
						
						//Adres
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Adres</td>";
							echo "<td class = 'row'>".$row['Adres']."</td>";
						echo "</tr>";
						
						
						
						//Postcode
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Postcode</td>";
							echo "<td class = 'row'>".$row['Postcode']."</td>";
						echo "</tr>";
						
						
						
						//Woonplaats
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Woonplaats</td>";
							echo "<td class = 'row'>".$row['Woonplaats']."</td>";
						echo "</tr>";
						
						
						
						//Telefoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Telefoon</td>";
							echo "<td class = 'row'>".$row['Telefoon']."</td>";
						echo "</tr>";
						
						
						
						//Telefoon Nood
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Telefoon nood</td>";
							echo "<td class = 'row'>".$row['Nood']."</td>";
						echo "</tr>";
						
						
						
						//Email
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Email</td>";
							echo "<td class = 'row'>".$row['Email']."</td>";
						echo "</tr>";
						
						
						
						//BSN
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>BSN</td>";
							echo "<td class = 'row'>".$row['BSN']."</td>";
						echo "</tr>";
						
						
						
						//Herkomst
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Herkomst</td>";
							echo "<td class = 'row'>".$row['Herkomst']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon</td>";
							echo "<td class = 'row'>".$row['Contact']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon telefoon
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon telefoon</td>";
							echo "<td class = 'row'>".$row['contacttel']."</td>";
						echo "</tr>";
						
						
						
						//Contactpersoon email
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contactpersoon email</td>";
							echo "<td class = 'row'>".$row['contactemail']."</td>";
						echo "</tr>";
						
						
						
						//Contracturen
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Contacturen</td>";
							echo "<td class = 'row'>".$row['contracturen']."</td>";
						echo "</tr>";
						
						
						
						//Functie
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Functie</td>";
							echo "<td class = 'row'>".$row['functie']."</td>";
						echo "</tr>";
						
						
						//Vrije uren
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Uren</td>";
							echo "<td class = 'row'>".$row['vrijeuren']."</td>";
						echo "</tr>";
						
						
						echo "</table>";
						
						echo "<div class = 'box-right'>";
						
						echo "<div class = 'box-right-b1'>";
						
						echo "<ul class = 'box-right'>";
							echo "<li class = 'box-right'><a href = '#'>Dossier</a></li>";
							echo "<li class = 'box-right'><a href='#wijzig_rooster' id='join_pop'>Werktijden</a></li>";
							echo "<li class = 'box-right'><a href = '#'>Dossier</a></li>";
						echo "</ul>";
						
						echo "</div>";
						
						echo "</div>";
						
						}
						
					}
					
					echo '<div id="geschiedins">Geschiedenis</div>';
					
					echo '<div class = "geschiedenis">';
					
					echo "<table class = 'geschiedenis'>";
					 
					 //Telaat geschiedenis 
		$result = mysql_query("SELECT * FROM archief WHERE Status='Telaat' AND Naam='".$naam."'");
					
					$count = 0;
					
		while ($row = mysql_fetch_array($result)) {
						$count++;
					}
				
			if ($count > 0) {
						echo '<tr>';
							echo '<td class = "ul"><a href = "#telaat" class = "al">Te laat</a></td>';
							echo '<td class = "li">'.$count.'</td>';
						echo '</tr>';
					}
					
					//Ziek geschiedenis
					
		$result = mysql_query("SELECT * FROM archief WHERE Status='Ziek' AND Naam='".$naam."'");
					
					$count = 0;
					
		while ($row = mysql_fetch_array($result)) {
						$count++;
					}
				
					if ($count > 0) {
					
					echo '<tr>';
						echo '<td class = "ul"><a href = "#ziek" class = "al">Ziek</td>';
						echo '<td class = "li">'.$count.'</td>';
					echo '</tr>';
					}
										
					//Vakantie geschiedenis
					
		$result = mysql_query("SELECT * FROM archief WHERE Status='Vakantie' AND Naam='".$naam."'");
					
					$count = 0;
					
		while ($row = mysql_fetch_array($result)) {
						$count++;	
					}

			if ($count > 0) {
					
					echo '<tr>';
						echo '<td class = "ul">Vakantie</td>';
						echo '<td class = "li">'.$count.'</td>';
						
						echo '<td class = "ul">Vakantie</td>';
						
					echo '</tr>';
					}

					echo '</table>';
				echo '</div>';
				

                           echo '  <a href="#x" class="overlay" id="join_form"></a>';
                           echo '  <div class="popup">';
                           echo '    <h2>Werktijden</h2>';

                           echo '  <a class="close" href="#close"></a>';
                           echo ' </div>';
        
        
                           echo '  <a href="#x" class="overlay" id="wijzig_rooster"></a>';
                           echo '  <div class="popup">';
                           echo '   <h2>Werktijden</h2>';

			
			 $result = mysql_query("SELECT id, Naam, fromma, endma, fromdi, enddi, fromwo, endwo, fromdo, enddo, fromvr, endvr, fromza, endza, fromzo, endzo FROM werktijden WHERE NAAM='".$naam."'");
				           echo '<table id="table-6">';
                           echo '<tr>';
                           echo '<td id = "wd">Maandag</td>';
                           echo '<td id = "wd">Dinsdag</td>';
				           echo '<td id = "wd">Woensdag</td>';
				           echo '<td id = "wd">Donderdag</td>';
                           echo '<td id = "wd">Vrijdag</td>';
                           echo '<td id = "wd">Zaterdag</td>';
				           echo '<td id = "wd">Zondag</td>';
						   echo '</tr>';
            
          while ($row = mysql_fetch_array($result)) {
                	
                           echo '<tr>';
                            echo '<td>'.$row['fromma'].' - '.$row['endma'].'</td>';
				            echo '<td>'.$row['fromdi'].' - '.$row['enddi'].'</td>';
                            echo '<td>'.$row['fromwo'].' - '.$row['endwo'].'</td>';
				            echo '<td>'.$row['fromdo'].' - '.$row['enddo'].'</td>';
                            echo '<td>'.$row['fromvr'].' - '.$row['endvr'].'</td>';
				            echo '<td>'.$row['fromza'].' - '.$row['endza'].'</td>';
							echo '<td>'.$row['fromzo'].' - '.$row['endzo'].'</td>';

					   echo '</tr>';
                       }
			           echo '</table>';
							 
							 

                       echo '  <a class="close" href="#close"></a>';
                       echo '</div>';
	                   	
		$result = mysql_query("SELECT * FROM archief2 WHERE Naam='".$naam."'");
					   echo '<br><br><div id="telaat">Afspraken</div>';
		               echo '<table class = "table">';
                       echo '<tr>';
                       echo '<th class = "head">Wie</th>';
                       echo '<th class = "head">Naam</th>';
                       echo '<th class = "head">Datum</th>';
				       echo '<th class = "head">Tijd</th>';
				       echo '<th class = "head">Afspraak</th>';
					   echo '</tr>';
            
         while ($row = mysql_fetch_array($result)){
                       echo '<tr>';
                       echo '    <th class = "column">'.$row['wie'].'</th>';
                       echo '    <th class = "column">'.$row['Naam'].'</th>';
                       echo '    <th class = "column">'.$row['Datum'].'</th>';
				       echo '    <th class = "column">'.$row['tijd'].'</th>';
                       echo '    <th class = "column">'.$row['Afspraak'].'</th></tr>';
                            }
					 echo '</table>';
					
						
		$result = mysql_query("SELECT id, Datum, aankomst, Rede	FROM archief WHERE Status='Telaat' AND Naam='".$naam."'");
					echo '<br><br><div id="telaat">Te laat</div>';
 					echo '<table class = "table">';
                    echo '<tr>';
                    echo '<th class = "head">Datum</th>';
                    echo '<th class = "head">Aankomst</th>';
                    echo '<th class = "head">Reden</th>';
					echo '</tr>';
            
        while ($row = mysql_fetch_array($result)){
                    echo '<tr>';
                    echo '<th class = "column">'.$row['Datum'].'</th>';
                    echo '<th class = "column">'.$row['aankomst'].'</th>';
                    echo '<th class = "column">'.$row['Rede'].'</th>';
                            }
					echo '</table><br />';
				    echo '<br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
					 
//Vakantie
					
		$result = mysql_query("SELECT id, Datum, Rede FROM archief WHERE Status='Ziek' AND Naam='".$naam."'");
 					echo '<div id="ziek">Ziek</div>';
 					echo '<table class = "table">';
                    echo'<tr>';
                    echo'<th class = "head">Datum</th>';
                    echo'<th class = "head">Reden</th>';
					echo'</tr>';
            
        while ($row = mysql_fetch_array($result)){
                    echo '<tr>';
                    echo '<th class = "column">'.$row['Datum'].'</th>';
                    echo '<th class = "column">'.$row['Rede'].'</th>';
                            }
				    echo '</table><br />';
					echo '<br />';
				    echo '<br />';
				    echo '<br />';
				    echo '<br />';
					echo '<br />';
					echo '<br />';
        $result = mysql_query("SELECT id, Rede, vakantieduur, Datum FROM archief WHERE Status='Vakantie' AND Naam='".$naam."'");
 					echo '<div id="vakantie">Vakantie</div>';
 					echo '<table class = "table">';
                    echo'<tr>';
                    echo '<th class = "head">Reden</th>';
                    echo '<th class = "head">Datum</th>';
                    echo '<th class = "head">Vakantie tot</th>';
					echo ' </tr>';
            
        while ($row = mysql_fetch_array($result)){
                    echo '<tr>';
                    echo '   <th class = "column">'.$row['Rede'].'</th>';
                    echo '   <th class = "column">'.$row['Datum'].'</th>';
                    echo '   <th class = "column">'.$row['vakantieduur'].'</th>';
                            }
				    echo '</table><br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
					echo '<br />';
				    echo '<br />';
					


		$result = mysql_query("SELECT * FROM WERKNEMERS WHERE NAAM='".$naam."'");
				

         while ($row = mysql_fetch_array($result)) {
                    	
                    echo '<div id="foto">';
						echo '<img src="/images/foto/' . $row['mrl'] . '.png" width="150" height="150" alt="' . $row['mrl'] . '" />';		
                    echo '</div>';
						
					}

			    }else {
					echo "<p style='color:red;'>Geen werknemer geselecteerd!</p>";
				}
				
				
			
     
	 ?>

<br>
<br>
<br>
</div>
<?php include ('footer.php'); ?>
</body>
</html>
 
Laatst bewerkt:
Ik vind je best gemakzuchtig, vind ik. Niet echt netjes.

maar vooruit:Doe wat met mijn tips, zou ik zeggen.
Ik doe het even voor in een korte schets....

<?php
if(query hier) {
echo 'het is gelukt, yes we dit it.';
// plaats hier je while-loopje!
} else {
echo mysql_error().". Er is een fout!.";
}
?>

Dat was lesje 1, foutafhandeling.
Nu lesje 2: Dan is het even een kwestie van mysql_real_escape_string() gebruiken waar je $_GET['username'] in verpakt.
mysql_real_escape_string($_GET['username'])

Vanaf nu even leren en goed weten wat je programmeert, en maak vooral oefeningen, dan kan er niks misgaan.
 
Laatst bewerkt:
bbeste php4u hoe ziet dat er uit want je kunt me alles wijst maken met strinnetje hier en daar dan weet nog niet exact wat je bedoelt
 
Je vraagt alleen, maar ik heb nog niks van je gezien?
Ik heb vroeger geleerd: Proberen = Leren!
En zorg dat je weet wat je doet, en dat je elke zinnetje in PHP kan beschrijven.
 
boven genoemde reactie oke die fout melding wat moet er in qeury staan if(???????)
 
Je mysql_query natuurlijk met je je SQL-opdracht erin ( zoiets: SELECT a,b,c,d FROM tabelnaam WHERE voorwaarde='waarde')
 
if

zo iets ()
PHP:
if(isset($_GET['id'])){
            $id=$_GET['username'];
      $result = mysql_query("SELECT id, username,  FROM users WHERE username='".$username."'");
 
Ja, en daarna een if om je $result te controleren.
En vergeet de mysql_real_escape_string() NIET!!!!!!
 
nog niet alle info verwerkt

PHP:
<?php
if (isset($_GET['id'])) {
					$naam = $_GET['username'];

      $result = mysql_query("SELECT id, username, first_name FROM USERS WHERE username='".$username."'",
	   mysql_real_escape_string($id),
            mysql_real_escape_string($username));
       
        while($row = mysql_fetch_array($result)) {
                if (!empty($row['username'])) {
	
	
						echo "<table class = 'pinfo'>";
						
						echo '<div id="username">'.$row['username'].'</div>';
				
						//Naam
				
                        echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>Gebruikersnaam</td>";
							echo "<td class = 'row'>".$row['username']."</td>";
						echo "</tr>";
						
						
						
						//Adres
						
						echo "<tr class = 'head'>";
							echo "<td class = 'tdhead'>voornaam</td>";
							echo "<td class = 'row'>".$row['first_name']."</td>";
						echo "</tr>";
						
						
						
							echo "</table>";
						
					
						
						}
						
					}
						
						
						echo "</table>";
						
}

     
	 ?>
 
Nou nee, dat klopt niet zo.
Zie lijn 3, pad die mysql_real_escape_string() daar op toe. Die is bedoeld voor INVOER!
Ook kan je geen komma's gebruiken in een WHERE. Als je meerdere dingen wilt controleeren moet je WHERE IN() gebruiken, maar dat lijkt mij niet de bedoeling in dit geval.

Verder moet je nog ene if() plaatsen waarin je controleert of je query gelukt is, of juist niet.
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan