Jump to content

[SOLVED] show everything in one box


timmah1

Recommended Posts

I have this form that a user submits and it shows them everything that is in the database for that particular week

I would like all the results to show in a textarea, so that they can copy and paste it.

 

But, this only puts one of the results, the last one, in the text box.

 

can anybody tell me what I'm doing wrong or show me how I can get all the results to show in the textarea?

 

<?php
		 $query = "SELECT * FROM picks WHERE week = '$week' AND YEAR(posted) = '".date("Y")."'";
				$picks = mysql_query($query);
				$numrows = mysql_num_rows($picks);
					if($numrows == 0){
						echo "No picks for $week1!<br /><a href='export_picks.php'>Go Back!</a>";
					}
					else {
						while($a = mysql_fetch_array($picks)){

								$sport = $a['sport'];
								$game = date("F j, Y", strtotime($a['game']));
								$game_time = $a['game_time'];
								$description = nl2br($a['description']);
								$away = $a['away'];
								$home = $a['home'];
								$prediction = $a['prediction'];

										$sql = "SELECT * FROM $sport WHERE id = '$home'";
										$q= mysql_query($sql); 
										while($a= mysql_fetch_assoc($q)){	

											$home_team = $a['team'];
											$home_image = "<img src='http://www.10freefootballpicks.com/sports/$a[image]' alt='$a[team]' width='100' />";

										}
										$sql = "SELECT * FROM $sport WHERE id = '$away'";
										$q= mysql_query($sql); 
										while($a= mysql_fetch_assoc($q)){	

											$away_team = $a['team'];
											$away_image = "<img src='http://www.10freefootballpicks.com/sports/$a[image]' alt='$a[team]' width='100' />";

										}

$string = "
<table width='100%' border='0' align='center' cellpadding='2' cellspacing='0' class='side'>
<tr>
                 <td align='center' colspan='3'><h1><em>$away_team at $home_team</em></h1>
                     <h2><em>Game Time: $game, $game_time</em></h2></td>
               </tr>
               <tr>
                 <td align='right'>$away_image</td>
                 <td align='center' valign='middle'><h1> vs </h1></td>
                 <td align='left'>$home_image</td>
               </tr>
               <tr>
                 <td colspan='3' align='left' valign='top'>$description</td>
               </tr>
               <tr>
                 <td colspan='3' align='center' valign='top'><font color='#ff0000'><strong>$prediction</strong></font></td>
               </tr>
		    </table>";	
			echo $string;



}
echo "<br /><textarea name='' cols='75' rows='5'>$string</textarea><br /><br />";	

}
}

?>

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/172302-solved-show-everything-in-one-box/
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.