Jump to content

PHP echo Question


vund0

Recommended Posts

lol ^ same thing

try this

[code=php:0]
echo '<tr>
           <td><font color="#000000">' . $rows['lastname'] . ' ' . $rows['firstname'] . '</font</td>
           <td><font color="#000000">' . $rows['company'] . '</font></td>
           <td><font color="#000000">' . $rows['email'] .  '</font></td>
           <td>' . $rows['homephone'] . '</td>
      </tr>';[/code]

Try using single quotes instead of double

Hope this helps,
Tom
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-64465
Share on other sites

Just style the row tag!:
[code=php:0]echo '<tr style="color:#000000; font-size:10px;">
            <td>' . $rows['lastname'] . ' ' . $rows['firstname'] . '</td>
            <td>' . $rows['company'] . '</td>
            <td>' . $rows['email'] .  '</td>
            <td>' . $rows['homephone'] . '</td>
      </tr>';[/code]

That'll now affect all the text within that row. It'll change the text to black and resixe the font to 10px.
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-64566
Share on other sites

Thanks, that helped a lot.  But now I have another question.  When the users website is displayed I want to know how to make it a link.  I tried messing around with it and heres what I got so far:

echo "<tr><td><font color='white' size='2'>" . $rows['coname'] . "</font></td><td><font color='white' size='2'>" . $rows['buisnessphone'] . "</font></td><td><font color='white' size='2'>" . $rows['coemail'] . "</font></td><td><font color='white' size='2'>". "<a href=['website']>" . $rows['website'] . "</font></td></tr>";

Thanks for your help
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-64871
Share on other sites

do this

[code=php:0]
'<a href="' . $rows['website'] . '">' . $rows['website'] . '</a>'
[/code]

The reason that I said to use the single quotes [code=php:0]'[/code] instead of double quotes [code=php:0]"[/code] is that it would make it easier for useing things that require double quotes. Also I would recommend cleaning up your code a bit. Something more like what wildteen or myself posted would make it easier to add new fields or for debugging.

Good luck,
Tom
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-64874
Share on other sites

Ok, I now have another problem.... The website link comes up fine, but for some reason its using the root with the website.  For example instead of being qnpi.com its http://npia.us/www.qnpi.com and I just need it to be qnpi.com you can see it at

http://npia.us/cmemberlist.php

Here's my code:

echo '<tr style="color:#ffffff; font-size:12px;">
            <td>' . $rows['coname'] . '</td>
            <td>' . $rows['buisnessphone'] . '</td>
            <td>' . $rows['coemail'] .  '</td>
            <td>' . '<a href="' . $rows['website'] . '">' . $rows['website'] . '</a>' . '</td>
       </tr>';

Also I would like to change the color of the link to make it more visible

Thanks for your help
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-66481
Share on other sites

That's happening because you didn't specify the "http://" in the generated URL.

Try this:
[code]<?php
echo '<tr style="color:#ffffff; font-size:12px;">
            <td>' . $rows['coname'] . '</td>
            <td>' . $rows['buisnessphone'] . '</td>
            <td>' . $rows['coemail'] .  '</td>
            <td>' . '<a href="http://' . $rows['website'] . '">' . $rows['website'] . '[/url]' . '</td>
      </tr>';
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/15766-php-echo-question/#findComment-66498
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.