Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

No database selected

Asked Modified Viewed 2,434 times
U
UndeadlyDragon
U
  • Newbie, joined since
  • Contributed 8 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
asked
Newbie

Hey, i created a custom page that retrieves data from a data base but now everything else on the page gets 'no database selected' The code that I created is working fine though
Here is a screen: http://prntscr.com/2vrjjd

Here is the code:
<html>
<body>
<?php
$host="localhost"; // Host name
$username="site"; // Mysql username
$password=""; // Mysql password
$db_name="stats"; // Database name
$tbl_name="stats_move"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
while($rows = mysql_fetch_array($result)){
  echo $rows['player'];
  echo $rows['distance'];
  echo $row['distance'];
}
mysql_close();
?>
</body>
</html>
0 replies

3 posts

F
Falk
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

0 replies
U
UndeadlyDragon
U
  • Newbie, joined since
  • Contributed 8 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

How am I gonna reconnect to the site database?
Edited by Falk on 09-01-2021 13:16,
0 replies
F
Falk
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

with this line,

// Reconnect to Fusion database:

dbconnect($db_host, $db_user, $db_pass, $db_name);


You might need to re define the $ variables but they are suposed to be fetched from your current config.php.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

F
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
U
U
  • Newbie, joined since
  • Contributed 8 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet