View Single Post
Old 12-27-2012, 07:43 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Actually, the reason is obvious:
Code:
SELECT * from members-profile-info where username = '$uname'"
MySQL will read that supposed table name as
Quote:
members MINUS profile MINUS info
Just as PHP would. Just as JavaScript would. Etc.

YOU CAN NOT USE A MINUS SIGN IN THE MIDDLE OF A NAME!

Well, fortunately, with MySQL, you can.

But if you do so, you *MUST* then tell MySQL that you are using a non-standard name by enclosing the entire name in back ticks (the ` character...shares a key with ~ normally).

So:
Code:
$getuprofile = 
    mysql_query("SELECT * from `members-profile-info` where username = '$uname'")
    or die( mysql_error() );
Incidentally, you don't show the rest of your PHP page, but almost surely you have goofed by making two separate queries in the code you showed us, insted of using a single query that JOINs the two tables.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
KazeFlame (12-28-2012)