Why does it not echo out http://pastebin.com/SggLrTPu
@ganeshie8
@iambatman
Did you try just setting the variable to test to make sure PHP and echo were working? If they are, then the problem is probably in reading from the database.
yes i did...
I get this out put: string(0) ""
when i use var_dump($displayname)
K. So if PHP is working, then as I said, it is not reading from the SQL database OR when it does so it is not assigning it to the variable.
How do I assign it a variable... didn't I already assign it in the first line?
AH HA! That got me enough to find the issue... (I don't program PHP) http://stackoverflow.com/questions/22521048/assign-mysql-database-value-to-php-variable
So that gets you a handle, not a result. You need to follow with a fetch s a two step process.
I think part of it is your fetch. You are re-using the same variable. Try it with a different variable.
okay.;)
That is the only real difference I see between what you did and what I found on Stack. Hopefully it is that simple.
THis is what I have: $displayname = mysql_query("SELECT displayname FROM company WHERE username = '$username'", $connection); $display = mysql_fetch_array($displayname);
No doesn't work... returns NULL
=( OK... hmmm... then I am not sure where it is breaking down. But I would look at the querry part. Also, some of that post was talking about devalued code, so I am not sure if there is simply a newer, better way to query the database.
Join our real-time social learning platform and learn together with your friends!