Jump to content

help


Lucky2710

Recommended Posts

Heres wat i got...

 

<?php
ini_set('display_errors',1);
error_reporting(E_ALL);

include '../myconfiginfo/datab.php';
?>
<?
$result = mysql_query("SELECT * FROM NascarPicks WHERE User_ID='61'"); 
$affected = mysql_num_rows($result);

$i=0;
while($i<$affected)
{
$i++;
$pick = mysql_fetch_assoc($result);
?>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr>
    <td colspan="2">CARFAX 400 at Michigan - Michigan International Speedway</td>
  </tr>
  <tr>
    <td width="8%">1st</td>
    <td width="92%">
<? 
if(in_array('81510', $pick)){
echo $pick['p1'];
}
?>
</td>
  </tr>
  <tr>
    <td>2nd</td>
    <td>
<? 
if(in_array('81510', $pick)){
echo $pick['p2'];
}
?>
</td>
  </tr>
  <tr>
    <td>3rd</td>
    <td>
<? 
if(in_array('81510', $pick)){
echo $pick['p3'];
}
?>
</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2">NASCAR Sprint Cup Series at Bristol Bristol Motor Speedway</td>
  </tr>
  <tr>
    <td>1st</td>
    <td>
<? 
if(in_array('82110', $pick)){
echo $pick['p1'];
}
?>
</td>
  </tr>
  <tr>
    <td>2nd</td>
    <td>
<? 
if(in_array('82110', $pick)){
echo $pick['p2'];
}
?>
</td>
  </tr>
  <tr>
    <td>3rd</td>
    <td>
<? 
if(in_array('82110', $pick)){
echo $pick['p3'];
}
?>
</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2">NASCAR Sprint Cup Series at Atlanta Atlanta Motor Speedway</td>
  </tr>
  <tr>
    <td>1st</td>
    <td>
<? 
if(in_array('90510', $pick)){
echo $pick['p1'];
}
?>
</td>
  </tr>
  <tr>
    <td>2nd</td>
    <td>
<? 
if(in_array('90510', $pick)){
echo $pick['p2'];
}
?>
</td>
  </tr>
  <tr>
    <td>3rd</td>
    <td>
<? 
if(in_array('90510', $pick)){
echo $pick['p3'];
}
?>
</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="3">
  <tr>
    <td colspan="2">NASCAR Sprint Cup Series at Richmond Richmond International Raceway</td>
  </tr>
  <tr>
    <td>1st</td>
    <td> </td>
  </tr>
  <tr>
    <td>2nd</td>
    <td> </td>
  </tr>
  <tr>
    <td>3rd</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>
<? } ?>

 

Goal of the script is to show users current an previous picks. All the data is stored in NascarPicks table.  Table has  fields id, User_ID, Race, p1,p2,p3.  Race is the trace date. (i.e 81510 for August 15, 2010)

 

With the current script it pulls all the info but it shows the< table> once for each piece of info pulled and then it displays all the info from the mysql table but only 1 per time that the <table> shows up.

 

How do i make the table only show up once and all my info display properly. (the order of the info will not always be the same. And not all users pick all the races so its got to be able to sjip those if there not there)

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/210710-help/
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.