homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Echo not working as expected.
Driving me crazy
gosman




msg:3597568
 4:29 pm on Mar 11, 2008 (gmt 0)

I have a script that is a mixture of php and html code. I have a variable that is pulled from a database using the following query

SELECT city FROM geo where id=1234

If I echo the result out in the php portion of the script using

echo $row['city'];

The result is echoed fine, however if I try to echo it out in the html part of the script using the following

<p><?php echo $row['city'];?></p>

No result is returned.

 

jatar_k




msg:3597601
 4:50 pm on Mar 11, 2008 (gmt 0)

I doubt echo is the problem, I would lean more towards whether the var is set or unset

how is the value of $row being set?
are you using both of those in the exact same spot in the code?
if not what is happening to $row between one and the other?

Duskrider




msg:3597605
 4:54 pm on Mar 11, 2008 (gmt 0)

If you just wanted to double check the echo, you could always make it <?php echo 'City: '.$row[city]; ?>. That way you'd know the echo is working but the variable is empty.

paulmadillo




msg:3597609
 4:58 pm on Mar 11, 2008 (gmt 0)

Are you using an include for the script generating the variable by any chance?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved