Hi Everyone....
I am first in php... I come across with problem... I have install XAMPP and work with php.. I have table 1 in database prim
My table 1 have 3 field Ad (type varchar) daimi (type int) ish (type int)
the connection with table I already make so that I take the anwer to the following ...
$count = mysql_numrows(mysql_query("select * from `table 1` "));
PRINT "<CENTER>chislo zapisey $count <BR><BR>";
but when I add where to this string it make problems
$count = mysql_numrows(mysql_query("select * from `table 1` where `Ad`=`Qazax rayonu`"));
PRINT "<CENTER>chislo zapisey $count <BR><BR>";
in the screen it gives the following explanation....
Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\rrson.php on line 40
chislo zapisey
Pls. help me what I have to do where is my mistakes????
new PHP
Moderator: General Moderators
Re: new PHP
That error message means there was a problem with the query and it could not be executed. Specifically, you used the wrong quotes for the "Qazax rayonu": backticks `s are only for names in the database so you need to use single quotes 's or double quotes "s.
Also, your method of getting the row count is very inefficient. You can use MySQL's COUNT() function to tell you how many rows come back from a query and without having to actually get all the rows (rows that you don't need to read through).
Use
Also, your method of getting the row count is very inefficient. You can use MySQL's COUNT() function to tell you how many rows come back from a query and without having to actually get all the rows (rows that you don't need to read through).
Use
Code: Select all
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `table 1` WHERE `Ad` = 'Qazax rayonu'"), 0, 0);