ERROR: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\...\....php on line 19
Probably mysql_query()
failed. In this case it returns false
. Use mysql_error() to find out, what happens.
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /var/customers/webs/ni272979_1/Loader/login.php on line 17
You have an error in your query. It should be something like this.
$sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword';";
And then you can do something like this.
$result=mysql_query($sql) or die(mysql_error());
Also try using MySQLi or PDO function for CRUD operations.
mysql_num_rows causes an error message
Does this work?
<?php
$con = mysql_connect("aaa", "bbb", "ccc", "ddd");
mysql_select_db("database", $con);
$sql = "SELECT * FROM list";
$result = mysql_query($sql,$con);
echo mysql_num_rows($result);
?>
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...' but my query is correct
$query = "SELECT * FROM newuser WHERE token='$token'";
$result = mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
do stuff...
}
If the die
statement is not executed, $result
is OK when you enter the while loop. The problem then is probably that you use $result
for a query inside the loop as well, eventually leading to it being set to false.
Related Topics
Get Entire Url, Including Query String and Anchor
"Slash Before Every Quote" Problem
Converting HTML to Pdf Using PHP
Delete Multiple Rows by Selecting Checkboxes Using PHP
Laravel Migration: Unique Key Is Too Long, Even If Specified
Intl Extension: Installing PHP_Intl.Dll
Yii2 Htaccess - How to Hide Frontend/Web and Backend/Web Completely
How to Execute PHP That Is Stored in a MySQL Database
Laravel Certificate Verification Errors When Sending Tls Email
How to Remove Extension from String (Only Real Extension!)
Converting a Simplexml Object to an Array
Session Data Lost in Chrome Only
Page Redirect After Certain Time PHP
PHP: Check If an Array Contains All Array Values from Another Array