I am new to PHP and MySQL so am in need of some help please.
I am using MySQL through PHP MyAdmin.

I have a results page to a MySQL search and formatted it so that they come up as an HTML table.
This is it's code:

<table border="0" align="center">
<tr><!--Change colspan number as appropriate -->
<td colspan="7">Number of records found: <?php echo mysql_num_rows($result); ?></td>
</tr>
<tr>

<th>TW</th>
<th>LW</th>
<th>Wks</th>
<th>Title</th>
<th>Artist</th>

</tr>
<?php $i = 1; while($row = mysql_fetch_array($result)){ ?>
<tr>

<td><?php echo stripslashes($row); ?></td>
<td><?php echo stripslashes($row); ?></td> //image or formatted RE
<td><?php echo stripslashes($row); ?></td>
<td><?php echo stripslashes($row); ?></td> //upper case
<td><?php echo stripslashes($row); ?></td>

</tr>
<?php $i++; } ?>
</table>

Could some guru please amend the code for me where the comment Upper Case so that it will appear all in upper case. I know it uses the function strtoupper() but I don't know how to put the code into this table row.

The field where the comment for Image is, what I want is that if this field has new entered it will automatically insert a certain graphic. Also if this field of the MySQL database has a zero (0) entered, I wish it to automatically insert the letters RE in Yellow and bold.

How could I do these using if statements such as: if TW == new <img src = "new.gif">
Same type of thing here: if LW == 0 <b><font color>RE</font></b>

If someone would be so kind as to amend this code for me it would be greatly appreciated.

Recommended Answers

All 3 Replies

I am new to PHP and MySQL so am in need of some help please.
I am using MySQL through PHP MyAdmin.

I have a results page to a MySQL search and formatted it so that they come up as an HTML table.
This is it's code:

<table border="0" align="center">
<tr><!--Change colspan number as appropriate -->
<td colspan="7">Number of records found: <?php echo mysql_num_rows($result); ?></td>
</tr>
<tr>

<th>TW</th>
<th>LW</th>
<th>Wks</th>
<th>Title</th>
<th>Artist</th>

</tr>
<?php $i = 1; while($row = mysql_fetch_array($result)){ ?>
<tr>

<td><?php echo stripslashes($row); ?></td>
<td><?php echo stripslashes($row); ?></td> //image or formatted RE
<td><?php echo stripslashes($row); ?></td>
<td><?php echo stripslashes($row); ?></td> //upper case
<td><?php echo stripslashes($row); ?></td>

</tr>
<?php $i++; } ?>
</table>

Could some guru please amend the code for me where the comment Upper Case so that it will appear all in upper case. I know it uses the function strtoupper() but I don't know how to put the code into this table row.

<td><?php echo strtoupper(ststripslashes($row['Title'])); //upper case ?></td>

The field where the comment for Image is, what I want is that if this field has new entered it will automatically insert a certain graphic. Also if this field of the MySQL database has a zero (0) entered, I wish it to automatically insert the letters RE in Yellow and bold.

<td>
<? 
if($row['LW']=='new') {
   echo "<img src=\"new.gif\">";
}
elseif($row['LW']==0) {
   echo "<font color="yellow"><strong>RE</strong></font>
}
?></td> //image or formatted RE

If you need anything else, let me know.

Many thanks inscissor.
I'll give it a try and let you know how I get on.

I am a newbie to PHP & MySQL.
I'm running the Database through PHP MyAdmin.

Do you know of any sites with tutorials for using PHP MyAdmin?
Again thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.