Bitcoin Forum
June 19, 2018, 07:29:06 AM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: PHP help?  (Read 225 times)
Robertt
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
January 20, 2016, 06:11:06 AM
 #1

I wasn't sure where to put this, I need some help.
bitcointap.xyz
I'm running my script on it, but it won't work for some reason. I sign up & try to login, it says the user does not exist.

Error at the top of the page:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/.... on line 8
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/..../login.php on line 23

line 8:
Code:
$result = mysqli_query($con, "SELECT * FROM `settings`");
$settings = mysqli_fetch_array($result);
$result = : Line 7
$settings = : Line 8

line 23:
Blank.
line 22 & 24 (line 23 in the middle):
Code:
$result = mysqli_query($con, $sql);

$num = mysqli_num_rows($result);

Any help is REALLY appreciated. Thank you
1529393346
Hero Member
*
Offline Offline

Posts: 1529393346

View Profile Personal Message (Offline)

Ignore
1529393346
Reply with quote  #2

1529393346
Report to moderator
1529393346
Hero Member
*
Offline Offline

Posts: 1529393346

View Profile Personal Message (Offline)

Ignore
1529393346
Reply with quote  #2

1529393346
Report to moderator
1529393346
Hero Member
*
Offline Offline

Posts: 1529393346

View Profile Personal Message (Offline)

Ignore
1529393346
Reply with quote  #2

1529393346
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1529393346
Hero Member
*
Offline Offline

Posts: 1529393346

View Profile Personal Message (Offline)

Ignore
1529393346
Reply with quote  #2

1529393346
Report to moderator
1529393346
Hero Member
*
Offline Offline

Posts: 1529393346

View Profile Personal Message (Offline)

Ignore
1529393346
Reply with quote  #2

1529393346
Report to moderator
tasoth
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
January 20, 2016, 04:10:50 PM
 #2

$result variable is not mysql resource, mean there is an error with the query or you are not connected to a database \ server.

did you use mysqli_connect() function bebore in your code?

to troubleshoot the error try

adding before your line 7 next code:
var_dump($con);
minifrij
Legendary
*
Offline Offline

Activity: 1694
Merit: 1057



View Profile
January 20, 2016, 10:00:59 PM
 #3

If it's returning as a boolean it probably means that it is returning false meaning that there is either an error in your database connection or the query you are trying to do. Try doing echo mysqli_error($conn); and see if it returns anything that may help you figure out the problem.
You should probably implement some sort of error reporting to your script next time, something as simple as this would probably suffice:
Code:
if(!$result){
     die(mysqli_error($conn));
}

You should also be using Prepared Statements to secure your app if you do any MySQLi queries with user input, but that is another matter for another time.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!