index.php
קוד: בחר הכל
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("Roi a") or die(mysql_error());
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM users")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>שם פרטי</th> <th>שם משפחה</th> <th>סיסמא</th> <th>כתובת אמייל</th> <th>תאריך הצטרפות</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['Name'];
echo "</td><td>";
echo $row['Last name'];
echo "</td><td>";
echo $row['Password'];
echo "</td><td>";
echo $row['Email'];
echo "</td><td>";
echo $row['Join date'];
echo "</td></td>";
echo "<a href='view.php?name={$row['Name']}'> צפה בפרופיל </a>";
echo "</td></tr>";
}
echo "</table>";
mysql_close();
?>
view.php
קוד: בחר הכל
<?php
mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("Roi a") or die(mysql_error());
$name = mysql_real_escape_string($_GET['name']);
$result = mysql_query("SELECT * FROM users WHERE Name={$name}'") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
// your code for viewing profile goes here.
mysql_close();
?>