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? Quote Link to comment Share on other sites More sharing options...
koen Posted November 11, 2007 Share Posted November 11, 2007 It's because you use ' instead of ". Quote Link to comment 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"; Quote Link to comment 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"; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.