MyBB Community Forums

Full Version: Querying the database elsewhere on the site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I can't seem to find a solution querying successful the phpmyadmin database from other pages on my site.


  $sql5 = "SELECT * FROM `mbb_users` WHERE `uid` = 1";
  $result5 = $conn_mbb->query($sql5);
  $row5 =  $result->fetch_assoc();
  var_dump($row5);

  echo 'Username: '. $row5['username'].'';

My var_dump returns NULL on every occasion.

I alse checked the $conn_mbb variable, nothings wrong there.. the connection to the database is sccessful

I found this article, on how to query the db:
https://docs.mybb.com/1.8/development/pl...e-methods/

But it doesn't states which files need to be included in order to get this methods working
The variable where you save the data is $result5, but you used $result when you execute the method fetch_assoc.
OMG, you are a legend!! Smile I must have been very tired :p thx dude!!