Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
| Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 15th, 2004, 01:05 AM
Registered User
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


  #2 (permalink)  
Old August 15th, 2004, 05:13 PM
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Try this...
$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.

- Vijay G
Strive for Perfection
  #3 (permalink)  
Old August 16th, 2004, 11:48 AM
Registered User
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
query for identical field and echo... flyguylol Beginning PHP 2 January 15th, 2006 05:48 PM
echo "\n" problem jun99 PHP How-To 4 November 29th, 2005 01:01 PM
echo "\n" problem jun99 Beginning PHP 0 November 27th, 2005 05:12 PM
Show result from query akibaMaila VB.NET 2002/2003 Basics 2 January 18th, 2005 12:43 PM
Query Result mateenmohd SQL Server 2000 0 November 1st, 2003 03:53 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.