Jump to content

Dicko_md

Members
  • Content count

    44
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dicko_md

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. Dicko_md

    issue showing results - 1 row keeps alternating

    Hi Sorry I wasnt trying to get the code for free without trying. I was genuinely not sure how to incorporate this into your code you shared. I have probably gone about it the wrong or should I say long way round but it works below after playing with my code. $result = mysql_query("Select DISTINCT phone.model, phone.model_no, phone.icon, phone.year, phone.capacity From phonerepairs INNER JOIN phone ON phonerepairs.phone=phone.phone WHERE phone.model_no='".$_POST['model']."'"); $result2 = mysql_query("Select * From phonerepairs INNER JOIN phone ON phonerepairs.phone=phone.phone WHERE phone.model_no='".$_POST['model']."'"); while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['model_no'].'</td>'; echo '<td width="130" align="center">'.$row['model'].'</td>'; echo '<td width="50" align="center">'.$row['year'].'</td>'; echo '<td width="150" align="center">'.$row['capacity'].'</td>'; echo '</tr>'; } echo '</table><br></p>'; while($row = mysql_fetch_array($result2)) { echo '<p>'; echo '<div id="pageheading"><h3><div id="title">Repairs we carry out for '.$row['model'].'</div></h3></div>'; echo '<table width="99%" cellpadding="5" cellspacing="0" border="1">'; echo '</p>'; echo '<p>'; echo '<tr>'; echo '<td align="center"><strong>Image</strong></td>'; echo '<td align="center"><strong>Fault</strong></td>'; echo '<td align="center"><strong>Repair</strong></td>'; echo '<td align="center"><strong>Cost</strong></td>'; echo '</tr>'; echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['fault'].'</td>'; echo '<td width="130" align="center">'.$row['description'].'</td>'; echo '<td width="50" align="center">&pound'.$row['cost'].'</td>'; echo '</tr>'; echo '</table><br>'; } mysql_close($con); ?> </p> The only nicety thing I would like if possible is to alternate the table heading on each fix available if its a quick fix. Thanks Martyn
  2. Dicko_md

    issue showing results - 1 row keeps alternating

    Any one able help to show me how to use the above code with my code ? Thanks Martyn
  3. Dicko_md

    issue showing results - 1 row keeps alternating

    Hi Thanks for your reply. Would I be best keeping the 2 tables separate and use your code above ? I have one column in each table that is the same ie phone so this could be the stored variable. How would I get my code into your suggestion to output the available repairs for a particular phone. ? Thanks again Martyn
  4. Hi I have 2 tables that I am searching infor for. One holds the phone info and the other the repairs that are available. I have the code below and it displays on the webpage in a table for the phone information and then another table the repairs but they seem to be separate tables and headers. inbetween them is the phone and the details which separates the repairs but its not in a table. Hopefully the code below will explain better. What I would like it the phone details in one table and then a table full of all the repairs (I am not bothered about a new heading for each repair). $result = mysql_query("SELECT * FROM phone, phonerepairs WHERE phone.model_no='".$_POST['model']."' AND phone.phone = phonerepairs.phone"); while($row = mysql_fetch_array($result)) { echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['model_no'].'</td>'; echo '<td width="130" align="center">'.$row['model'].'</td>'; echo '<td width="50" align="center">'.$row['year'].'</td>'; echo '<td width="150" align="center">'.$row['capacity'].'</td>'; echo '</tr>'; echo '</table><br>'; echo '</p>'; echo '<p>'; echo '<div id="pageheading"><h3><div id="title">Repairs we carry out for '.$row['model'].'</div></h3></div>'; echo '<table width="99%" cellpadding="5" cellspacing="0" border="1">'; echo '</p>'; echo '<p>'; echo '<tr>'; echo '<td align="center"><strong>Image</strong></td>'; echo '<td align="center"><strong>Fault</strong></td>'; echo '<td align="center"><strong>Repair</strong></td>'; echo '<td align="center"><strong>Cost</strong></td>'; echo '</tr>'; echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['fault'].'</td>'; echo '<td width="130" align="center">'.$row['description'].'</td>'; echo '<td width="50" align="center">&pound'.$row['cost'].'</td>'; echo '</tr>'; echo '</table><br>'; Thanks in advance Martyn
×

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.