mybluehair Posted November 11, 2007 Share Posted November 11, 2007 take a look at this: <? $database = "*******"; $username = "**********"; $password = "**********"; $one = "one and all"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die ( "unable to connect"); $query="SELECT * FROM settings"; $result=mysql_query($query); mysql_close(); $name=mysql_result($result, "password", "chatname"); echo 'welcome $one to here'; dont pay attention to all the mysql crap, but pay attention to the echo code. $one = "one and all" as you can see up on the top, but when i veiw this page here is EXACTLY what i see: welcome $one to here what did i do wrong? Link to comment https://forums.phpfreaks.com/topic/76896-solved-how-is-this-not-working-simple/ Share on other sites More sharing options...
koen Posted November 11, 2007 Share Posted November 11, 2007 It's because you use ' instead of ". Link to comment https://forums.phpfreaks.com/topic/76896-solved-how-is-this-not-working-simple/#findComment-389320 Share on other sites More sharing options...
pocobueno1388 Posted November 11, 2007 Share Posted November 11, 2007 Just to elaborate on the last post You need to change this echo 'welcome $one to here'; To echo "welcome $one to here"; Link to comment https://forums.phpfreaks.com/topic/76896-solved-how-is-this-not-working-simple/#findComment-389322 Share on other sites More sharing options...
murali Posted November 12, 2007 Share Posted November 12, 2007 Hi.. Just you need to give like this... echo "welcome ".$one." to here"; Link to comment https://forums.phpfreaks.com/topic/76896-solved-how-is-this-not-working-simple/#findComment-389721 Share on other sites More sharing options...
aschk Posted November 12, 2007 Share Posted November 12, 2007 There are plenty of ways of achieving what you need : 1) Using double quotes (") - echo "welcome ".$one." to here"; 2) Using double quotes (") - echo "welcome {$one} to here"; 3) Using double quotes (") - echo "welcome $one to here"; 4) Using single quotes (') - echo 'welcome '.$one.' to here'; 5) Using sprintf replacement - echo sprintf("welcome %s to here",$one); 6) Using printf replacement - printf("welcome %s to here",$one); 7) Using print - print "welcome $one to here"; Hope those help identify your options. Link to comment https://forums.phpfreaks.com/topic/76896-solved-how-is-this-not-working-simple/#findComment-389726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.