p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   Problem with echo from query result (http://p2p.wrox.com/showthread.php?t=16878)

Steve Newbie August 15th, 2004 01:05 AM

Problem with echo from query result
 
What am I doing wrong?:

This is a query string in the code looking for the ID,Email, and NickName to whom a message wil be sent within the system/app :

            $tmp_arr = db_arr("SELECT ID, NickName, Email FROM Profiles WHERE ID=".(int)$_POST[caff_id_to]);

 A little later in the code I am trying to change an echo/print from ID to NickName:

 Using the following, the ID echos fine:
           <td width=15%> <?php echo"<b>TO:".$_GET[ID]."<b>"; ?>: </td><td width=85% align=left>

If I use the [NickName] instead, just a blank after TO:

            <td width=15%> <?php echo"<b>TO:".$_GET['NickName']."<b>"; ?>: </td><td width=85% align=left>


Tried to use <?php echo"<b>TO:".$tmp_arr['NickName']."<b>"; ?>
Also, does not work.

Help?





happygv August 15th, 2004 05:13 PM

Try this...
Code:

$result = mysql_query("SELECT ID, NickName, Email FROM Profiles WHERE ID=".(int)$_POST[caff_id_to]);

while($row = msql_fetch_array($result)) {
$NickName = $row["NickName"];
...
echo "<td width=15%> <b>TO:" . $NickName . "<b>: </td>"
...
}

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection

Steve Newbie August 16th, 2004 11:48 AM

That helps a lot. Thanks. It now outputs the echo....but I still have a problem with the code in that it outputs the echo later than it should....but that has to do with other code in the app. Thanks for your help. It helped a lot to get to the bottom of this. :D

Steve



All times are GMT -4. The time now is 04:26 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.