Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

EDIT::

The current code being used is :

  //$username= 'lmfsthefounder';
  $type = "SELECT account_type from user_attribs WHERE username='lmfsthefounder';";
  $type_again = mysql_query($type);
  $row = mysql_fetch_row($type_again);
  $usertype = $row['account_type'];
  echo $usertype;

which returns like this: Home Login Register Usertype is

When I search this query in mysql query explorer, it shows me the value is 1. I need that 1 to echo in my page.

(This should display 'Usertype is 1' in my navigation bar)

share|improve this question
 
mysql_query is a dead function, soon to be removed from the language. Try PDO. –  meagar 16 hours ago
add comment

marked as duplicate by John Conde, OGHaza, RandolphCarter, Kami, quamrana 5 hours ago

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

The mysql function you are looking for is mysql_fetch_assoc (link) instead of mysql_fetch_row.

But please, PLEASE don't use mysql_ functions. The link to the PHP manual tells you the same.

I would recommend trying to teach yourself how to use the mySQL PDO. There are many great tutorials online.

share|improve this answer
 
I am going to work on that, but I am using an old version of php on my server, so at the moment its safe. I will be converting over to newer code very shortly. –  user3175451 16 hours ago
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.