as title : php hang-up with my code
can please tell me why Or What is the problem
here is my code
<?php
$group = $_GET['group'] ;
$email = $_GET['email'] ;
include("../includes/config.php") ;
if($group != '')
{
$query = mysql_query(" SELECT email FROM users WHERE `group`='$group' ") ;
$emails = '' ;
while($res = mysql_num_rows($query))
{
$emails .= $res[0] ;
}
}
$emails .= $email ;
echo $emails ; die();
?>
Before While loop
i tried to check my query and its ok
after loop
There is no answer from the server
i’m using php 5.2.6
To avoid SQL injections you should replace
for
Then, you have to execute the query and then iterate over the resultset, not what you are doing which is iterate over the amount of rows in the result (which is constant for each resultset and always evaluates to true, creating an infinite loop)