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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.