943,621 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3425
  • PHP RSS
Jun 18th, 2004
0

case and image help please

Expand Post »
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['TW']); ?></td>
<td><?php echo stripslashes($row['LW']); ?></td> //image or formatted RE
<td><?php echo stripslashes($row['Wks']); ?></td>
<td><?php echo stripslashes($row['Title']); ?></td> //upper case
<td><?php echo stripslashes($row['Artist']); ?></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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
charter is offline Offline
11 posts
since Jun 2004
Jun 18th, 2004
0

Re: case and image help please

Quote originally posted by charter ...
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['TW']); ?></td>
<td><?php echo stripslashes($row['LW']); ?></td> //image or formatted RE
<td><?php echo stripslashes($row['Wks']); ?></td>
<td><?php echo stripslashes($row['Title']); ?></td> //upper case
<td><?php echo stripslashes($row['Artist']); ?></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.
[php]
<td><?php echo strtoupper(ststripslashes($row['Title'])); //upper case ?></td>
[/php]
Quote originally posted by charter ...
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.
[php]
<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[/php]

If you need anything else, let me know.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
Jun 19th, 2004
0

Re: case and image help please

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
charter is offline Offline
11 posts
since Jun 2004
Jun 19th, 2004
0

Re: case and image help please

You can try: http://hotwired.lycos.com/webmonkey/...tutorial4.html

Other ways is just to go to google.com and type "php tutorial"
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: limiting account names
Next Thread in PHP Forum Timeline: searching multiple fields





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC