| | |
case and image help please
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2004
Posts: 11
Reputation:
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:
<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.
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.
•
•
•
•
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.
<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.
<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.
You can try: http://hotwired.lycos.com/webmonkey/...tutorial4.html
Other ways is just to go to google.com and type "php tutorial"
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.
![]() |
Similar Threads
- retrieve MySQL longblob image data using PHP becomes gibberish text (PHP)
- Showing image (PHP)
- Image Resize (JavaScript / DHTML / AJAX)
- image resize script errors (PHP)
- how to dislay alternate image (Visual Basic 4 / 5 / 6)
- uploading image folder (Graphics and Multimedia)
- preloader for database content possible?? (Graphics and Multimedia)
Other Threads in the PHP Forum
- Previous Thread: updating 2 HTML tables on one PHP page
- Next Thread: searching multiple fields
Views: 3120 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






