html - Php Static Page -


i try create user profile page. visitor can see page

www.sample.com/details.php?id=1

 <?php             foreach($db->query('select * uyeler') $row) {                     echo "<tr><td>" .$row['id'] . "</td>";                     echo "<td>" .$row['username'] . "</td>";                     echo "<td>" .$row['sex'] . "</td>";                     echo "<td>" .$row['country'] . "</td>";                     echo "<td>" .$row['age'] . "</td>";                     echo "<td>" .$row['twitter'] . "</td>";                     echo "<td>" .$row['instagram'] . "</td>";                     echo "<td>" .$row['snapchat'] . "</td>";                     echo ('<td><a href="details.php?id=' .$row['id'] . '" title="panel">details</a></td>');                     echo "</tr>";                 }             ?> 

when click link. detail page open.

i try create details.php these codes

<?php include('connect.php'); foreach($db->query("select country uyeler id =' .$row['id'] . '") $row)      echo $row['id'];  ?> 

how can fix this? thanks

you're presumably taking id query $_get variable, rather $row. should check it's right format (i.e. if(is_numeric($_get['id'])) condition before attempting database query prevent injection attacks.

you selecting 'country' column , looking 'id'. try this:

<?php include('connect.php'); if (is_numeric($_get['id'])) {     foreach($db->query("select country uyeler id =' .$_get['id'] . '") $row)        echo $row['country']; } ?> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -