Bitcoin Forum
December 13, 2017, 10:33:03 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: PHP help?  (Read 225 times)
Robertt
Member
**
Offline Offline

Activity: 112


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
1513161183
Hero Member
*
Offline Offline

Posts: 1513161183

View Profile Personal Message (Offline)

Ignore
1513161183
Reply with quote  #2

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

Posts: 1513161183

View Profile Personal Message (Offline)

Ignore
1513161183
Reply with quote  #2

1513161183
Report to moderator
1513161183
Hero Member
*
Offline Offline

Posts: 1513161183

View Profile Personal Message (Offline)

Ignore
1513161183
Reply with quote  #2

1513161183
Report to moderator
tasoth
Newbie
*
Offline Offline

Activity: 16


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: 1526


Bored.


View Profile WWW
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.


▄▄▄████████▄▄▄
▄██████████████████▄
▄██████████████████████▄
██████████████████████████
████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
████████████████████████████
██████████████████████████
▀██████████████████████▀
▀██████████████████▀
▀▀▀████████▀▀▀
   ███████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
███████
BTC  ◉PLAY  ◉XMR  ◉DOGE  ◉STRAT  ◉ETH  ◉GRC  ◉LTC  ◉DASH  ◉PPC
     ▄▄██████████████▄▄
  ▄██████████████████████▄        █████
▄██████████████████████████▄      █████
████ ▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄ ████     ▄██▀
████ █████ ██████ █████ ████    ▄██▀
████ █████ ██████ █████ ████    ██▀
████ █████ ██████ █████ ████    ██
████ ▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀▀ ████ ▄██████▄
████████████████████████████ ████████
███████▀            ▀███████ ▀██████▀
█████▀                ▀█████
▀██████████████████████████▀
  ▀▀████████████████████▀▀ 
DICE           
BLACKJACK
PLINKO       
VIDEO POKER
ROULETTE     
LOTTO            
Report to moderator 

▄▄▄████████▄▄▄
▄██████████████████▄
▄██████████████████████▄
██████████████████████████
████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
████████████████████████████
██████████████████████████
▀██████████████████████▀
▀██████████████████▀
▀▀▀████████▀▀▀
CryptoGames
Catch the winning spirit
   ███████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
███████      
BEST PROVABLY FAIR CRYPTOCURRENCY GAMBLING SITE
◉BTC  ◉PLAY  ◉XMR  ◉DOGE  ◉STRAT 
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!