Hi guys,

Me again, I have just noticed something which i cant figure out whats going on. Below the query pulls back and account type from my db however the result which is coming back does have the account type but has a number 1 after it

eg: Current Account Type: Premium1

I just want Premium to come back which is what is in the DB.

Does any one know what is happening. Im sure its going to be my code.

$sql = "SELECT account FROM accounts WHERE ID='". $_SESSION['member_ID'] ."'";

$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();

if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to print so am exiting";

while ($row = mysql_fetch_assoc($result))

     echo $row["account"];

8 Years
Discussion Span
Last Post by nav33n

Your code looks absolutely fine to me.
P.S Check your table. Maybe it is stored that way (premium1 that is) ;)


mysql> select account from accounts where id = '14';
| account |
| Premium |
1 row in set (0.00 sec)

Above is what i get direct from mysql on my server. I just thought i most have something wrong as i am not sure why that 1 is being displayed.


Hmm.. Well, then the only thing that can be wrong is the value of $_SESSION. Print the query and check what's in $_SESSION. I still don't see anything wrong with your code.


Hi nav33n,

ive fixed this issue. I was pulling the page as an include file and that was causing the number 1 to appear, no idea how or where from. I have just put the code straight in the file and it just displays the correct value now.

Cheers for all your help today



This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.