Jump to content

[SOLVED] Something wrong


jkkenzie

Recommended Posts

<?php 
if ((isset($_POST["list"])) && ($_POST["list"] == "form1")) {
$textAreaValue=$_POST['IDs'];
$numbers = explode("\n",$textAreaValue);
foreach($numbers as $number) {


mysql_select_db($database_app_conn, $app_conn);
$getresults = mysql_query("SELECT DISTINCT `Cell Phone`, Telephone, `First Name`, `Middle Name`, `Last Name` FROM members WHERE `ID Number`='$number'");


        while($rows = mysql_fetch_array($getresults))
	{
	?>
<tr height="2px"><td height="2px"><?php echo $rows['Cell Phone']; ?></td><td height="2px"><?php echo $rows['Telephone']?></td><td height="2px"><?php echo $rows['First Name']?></td><td height="2px"><?php echo $rows['Middle Name']?></td><td height="2px"><?php echo $rows['Last Name']?></td></tr>
<?php		
	 }	      
          
}
}

?>Paste Id Numbers Each on its own ROW without mark separting them.. 
<form method="post" name="form1" action="numbers.php">
<textarea name="IDs" cols="110" rows="10"></textarea>
<input type="hidden" name="list" value="form1"><br />
<input type="submit" value="Show the List">      <a href="./numbers.php">REFRESH</a>
</form>
</table>

 

the above code gives me one result, while its supposed to echo several results under:

<tr height="2px"><td height="2px"><?php echo $rows['Cell Phone']; ?></td><td height="2px"><?php echo $rows['Telephone']?></td><td height="2px"><?php echo $rows['First Name']?></td><td height="2px"><?php echo $rows['Middle Name']?></td><td height="2px"><?php echo $rows['Last Name']?></td></tr>

 

I have tried:

<?php 
if ((isset($_POST["list"])) && ($_POST["list"] == "form1")) {
$textAreaValue=$_POST['IDs'];
$numbers = explode('\n',$textAreaValue);
mysql_select_db($database_app_conn, $app_conn);
$count=0;
foreach($numbers as $number) {
$recs[$count]=$number;
echo $recs[$count];
$count++;
}
$count2=0;
while ($count2<$count){
If (!empty($recs[$count2])){


$getresults = mysql_query("SELECT DISTINCT `Cell Phone`, Telephone, `First Name`, `Middle Name`, `Last Name` FROM members WHERE `ID Number`='$recs[$count2]'");

       $rows = mysql_fetch_assoc($getresults);
echo '<tr height="2px"><td height="2px">'.$rows['Cell Phone'].'</td><td height="2px">'. $rows['Telephone'].'</td><td height="2px">'.$rows['First Name'].'</td><td height="2px">'.$rows['Middle Name'].'</td><td height="2px">'.$rows['Last Name'].'</td></tr>';
	      
   $count2++;       
}
}
}
?>

Help

Link to comment
https://forums.phpfreaks.com/topic/138122-solved-something-wrong/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.