954,591 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

case and image help please

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:

Number of records found: <?php echo mysql_num_rows($result); ?>
TW
LW
Wks
Title
Artist


<?php $i = 1; while($row = mysql_fetch_array($result)){ ?>
<?php echo stripslashes($row['TW']); ?>
<?php echo stripslashes($row['LW']); ?> //image or formatted RE
<?php echo stripslashes($row['Wks']); ?>
<?php echo stripslashes($row['Title']); ?> //upper case
<?php echo stripslashes($row['Artist']); ?>


<?php $i++; } ?>

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 new.gif Same type of thing here: if LW == 0 RE

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

charter
Newbie Poster
11 posts since Jun 2004
Reputation Points: 10
Solved Threads: 0
 
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: Number of records found: <?php echo mysql_num_rows($result); ?> TW LW Wks Title Artist <?php $i = 1; while($row = mysql_fetch_array($result)){ ?> <?php echo stripslashes($row['TW']); ?> <?php echo stripslashes($row['LW']); ?> //image or formatted RE <?php echo stripslashes($row['Wks']); ?> <?php echo stripslashes($row['Title']); ?> //upper case <?php echo stripslashes($row['Artist']); ?> <?php $i++; } ?> 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] <?php echo strtoupper(ststripslashes($row['Title'])); //upper case ?> [/php]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] <? if($row['LW']=='new') { echo "\"new.gif\""; } elseif($row['LW']==0) { echo "RE } ?> //image or formatted RE[/php] If you need anything else, let me know.

samaru
a.k.a inscissor
Team Colleague
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18
 

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.

charter
Newbie Poster
11 posts since Jun 2004
Reputation Points: 10
Solved Threads: 0
 

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

Other ways is just to go to google.com and type "php tutorial"

samaru
a.k.a inscissor
Team Colleague
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You