case and image help please

Reply

Join Date: Jun 2004
Posts: 11
Reputation: charter is an unknown quantity at this point 
Solved Threads: 0
charter charter is offline Offline
Newbie Poster

case and image help please

 
0
  #1
Jun 18th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 5
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor

Re: case and image help please

 
0
  #2
Jun 18th, 2004
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]
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.
Check out my blog at http://www.shinylight.com for more stuff about web dev.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 11
Reputation: charter is an unknown quantity at this point 
Solved Threads: 0
charter charter is offline Offline
Newbie Poster

Re: case and image help please

 
0
  #3
Jun 19th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 5
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor

Re: case and image help please

 
0
  #4
Jun 19th, 2004
You can try: http://hotwired.lycos.com/webmonkey/...tutorial4.html

Other ways is just to go to google.com and type "php tutorial"
Check out my blog at http://www.shinylight.com for more stuff about web dev.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 3120 | Replies: 3
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC