Lỗi mysql_num_rows expects parameter 1 to be resource

Công ty TNHH vận tải Cẩm Vân trân trọng cảm ơn quý khách hàng đã tin tưởng sử dụng dịch vụ của chúng tôi trong suốt thời gian qua.

Nhân dịp Tết Nguyên Đán sắp đến, chúng tôi trân trọng kính chúc Quý khách và gia quyến cùng toàn thể anh chị trong công ty “luôn tràn đầy sức khỏe, an vui, hòa hợp, hạnh phúc và phát triển thịnh vượng bền vững”.

Cũng nhân dịp này xe Cẩm Vân kính gửi đến quý khách chương trình ưu đãi như sau:

Lỗi mysql_num_rows expects parameter 1 to be resource

QUÍ KHÁCH MUỐN ĐẶT VÉ TẾT VUI LÒNG ĐẾN TRỰC TIẾP ĐẠI LÍ TẠI:

ĐÀ NẴNG: 246 Điện Biên Phủ, P. Chính Gián, Q. Thanh Khê, Tp. Đà Nẵng SÀI GÒN: 49 Tân Thành - Hòa Thạnh - Tân Phú, Tp. Hồ Chí Minh Điện thoại: 0905 673 673 / 0902 006 007

BẢNG GIÁ VẬN CHUYỂN NGÀY THƯỜNG

Loại Giá Ưu đãi Giường nằm 380.000 Bao ăn suốt tuyến Ghế ngồi 300.000

TT - Trên đoạn đường Hồng Lạc (Q.Tân Bình, TP.HCM) chỉ dài 200m nhưng có đến bốn hãng xe treo bảng “xe đò tết”đưa khách từ TP.HCM về các tỉnh thành miền Trung như Quảng Ngãi, Quảng Nam, Đà Nẵng, Huế...

Lỗi mysql_num_rows expects parameter 1 to be resource

Ford triệu hồi xe Fiesta vì lỗi túi khí

Theo Cơ quan an toàn giao thông quốc gia Mỹ (NHTSA), Ford sẽ triệu hồi hơn 154 ngàn xe Fiesta để sửa lỗi ở túi khí rèm.

Lỗi mysql_num_rows expects parameter 1 to be resource

Khám phá bộ ứng dụng ConnectedDrive mới của BMW

Hệ thống dẫn đường 3D, giao diện cảm ứng iDrive, hệ thống soạn thảo văn bản bằng giọng nói và truy cập Internet nền tảng 4G sẽ là tính năng nổi bật trên những chiếc xe sắp ra mắt của BMW.

Lỗi mysql_num_rows expects parameter 1 to be resource

Lexus LS 2013 chính thức có giá bán

Phiên bản tiêu chuẩn LS 460 2013 dẫn động cầu sau có giá bán thấp nhất, khởi điểm ở mức gần 72.000 USD.

Lỗi mysql_num_rows expects parameter 1 to be resource

Toyota Việt Nam triệu hồi hơn 5.000 xe

Toyota Việt Nam sẽ tiến hành triệu hồi hơn 1.400 xe Corolla và gần 4.000 xe Vios sản xuất trong các năm 2007, 2008 do lỗi công tắc cửa điện. Đây là một phần trong chiến dịch triều hồi lịch sử 7,4 triệu xe trên toàn cầu của tập đoàn Toyota.

Lỗi mysql_num_rows expects parameter 1 to be resource

Thuế với ôtô hạng sang tăng thêm hàng chục nghìn đôla

Giá tính thuế nhập khẩu ôtô mới và đã qua sử dụng sẽ tăng từ ngày mai (18/10), trong đó một số dòng cao hơn trước tới 22.000 USD.

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\www\recherche\function.php on line 20

si le code source }

$query=mysql_query("SELECT * FROM ouvrage WHERE $ou"); $rows=mysql_num_rows($query); if($rows) { while ($row=mysql_fetch_assoc($query)) { echo $row['titre']."
".$row['auteurID']."
"; } }else echo"Pas de résultat pou votre recherche".$searches; }

unexpected '/', unexpected '{', unexpected $end, Could not connect to SMTP host, mysql_num_rows() expects parameter 1 to be resource, unexpected T_STRING, unexpected T_ECHO, session had already been started, unexpected T_VARIABLE expecting '.' or ';', Use of undefined constant, Call to undefined function, headers already sent, Undefined variable, Undefined index /Undefined offset, unexpected T_IF, unexpected T_FOR, unexpected ')', Illegal offset type, unexpected '=' expecting ')', unexpected ... T_CONSTANT_ENCAPSED_STRING expecting ..., unexpected T_BOOLEAN_AND, unexpected '$variable' (T_VARIABLE) expecting function (T_FUNCTION), unexpected 'some_string' (T_STRING) expecting function (T_FUNCTION), unexpected '$var_name' (T_VARIABLE), unexpected '->' (T_OBJECT_OPERATOR), Missing argument ... for function_name(), zip_read() expects parameter 1 to be resource, syntax error unexpected 'unset' (T_UNSET) in ..., preg_match(): Compilation failed: nothing to repeat at offset, Cannot redeclare class, Call to undefined function curl_init(), Expects parameter 1 to be string; array given in, Expects parameter 1 to be array; string given in, domdocument.loadhtml Unexpected end tag, simplexml_load_string() / loadXML() Input is not proper UTF-8 indicate encoding, session_start() The session id is too long or contains illegal characters, preg_replace / preg_match Unknown modifier, Invalid argument supplied for foreach(), Call to undefined method stdClass, Call to a member function bind_param() on boolean, preg_replace Empty regular expression, Class finfo not found

- First, to be sure that PHP displays all errors and warning messages, add this code at the beginning of the PHP script.

ini_set('display_errors',1); error_reporting(E_ALL);

• Parse error: syntax error, unexpected '/' in ... Cause: - Posible forgot a slash "/" in the comment line.

Solution: - Add the second slash at the beginning of the comment line.

• Parse error: syntax error, unexpected '{' in ... Cause: - Posible to miss a closing ')' to a conditional instruction.

Solution: - Add the closing ')'.

• Parse error: syntax error, unexpected $end in Cause:

- The cause of this error can be the editor used to edit the PHP file. The complex editors, like DreamWaver, or the editor from CPanel can add invisible characters on the first line of the file (a UTF-8 byte order mark at the top of file), which causes the error. This can also be caused if a website is coded in ASCII and php files are being saved as UTF-8.

Solution:

- Try use a simple text editor, for example Notepad++, and set Encoding UTF-8 without BOM. If the website and database are both UTF-8, it should be ok to save php files as UTF-8.

• SMTP Error: Could not connect to SMTP host Cause:

- PHP cannot connect to the SMTP mail server. A cause can be incorrect name or passord for connecting to SMTP server. - If you use PHPMailer class, the cause of this error can be: The extension=php_openssl.dll inactivated in "php.ini", or, the file php_openssl.dll is missing from PHP.

Solution:

1. Add correct data for connecting to SMTP server. 2. Add this line in "php.ini": extension=php_openssl.dll - Or delete the " ; " character if this line exists, but with ; in front. 3. Use a PHP version that contains the "php_openssl.dll" file.

• Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ... Cause:

The cause can be incorrect SQL query that makes MySQL server to return False.

Solution: - Check the SQL query you send to MySQL (you can test it in PHPMyAdmin), this can help you to see and fix the problem in that query.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

• Parse error: syntax error, unexpected T_STRING in ... Cause: - Possible to miss the proper single, or double quote for starting /closing string. The cause for this error can be the incorrect spelling of the PHP instructions.

Solution: - Add the proper simple, or double quote to delimiter the string. Check and correct the spelling of PHP instructions at the line indicated in the error message.

• Parse error: syntax error, unexpected T_ECHO in Cause: - Missing the character ";" that ends a code instruction.

Solution: - Check the code and add the ";" character at the end of code line where it is missing.

• Notice: A session had already been started - ignoring session_start() in Cause: - This error appear when the session_start() it is used two times in same script. This thing can happen when you add session_start() in the code, and, in that php file it is included another php file which contains session_start().

// include a file which contains session_start() include('file.php');

Solution: - Add allways session_start() with a condition that checks if $_SESSION exists.

• Parse error: syntax error, unexpected T_VARIABLE, expecting '.' or ';' in ... on line ... Cause: - You can get this error if it is missing a ';' character (to finish a line of code, or in the code of a loop instruction). Or it is missing a concatenation operator '.' in a string.

Solution: - Check your code at the indicated line (or a little above), and add the missing ';', or concatenation '.' .

• Notice: Use of undefined constant name - assumed 'name' in ... on line ... Cause: - It is accessed a "name". constant that is not defined in the script till that line. Or it is used a variable without the $ character.

Solution: - If you use a constant, define that constant before access it. Or, if it is a variable, add the $ character to that variable name.

• Fatal error: Call to undefined function function_name() in ... on line ... Cause: - It is accessed a function that is not defined in the script till that line.

Solution: - Create that function before access it.

• Warning: Cannot modify header information - headers already sent by ... Cause: - The general cause is that the PHP script sends output data to browser, then it is ussed: session_start(), setcookie(), or header(). - If this error is not the first error message on the page, then it is most likely a 'avalanche effect' of previous error that was send to browser. - This can also be caused if a website is coded in ASCII and php files are being saved as UTF-8. - The problem can also be from an extra whitespace (or other text) before the beginning "" in the PHP files included in script.

Whitespace, or some HTML code

Solution: - Use a simple text editor, for example Notepad++. If the website and database are both UTF-8, it should be ok to save php files as UTF-8 without BOM. - Read the error message carefully. It says "output started at ..." followed by a file name and a line number. That is the file (and line) that you need to edit. - Add session_start() at the beginning of the php file. - Make sure you send all your headers before you start sending the content. - Remove extra whitespace before the beginning "" in the PHP files included in script. - When use header() function, check if Header already send.

0

• Notice: Undefined variable: var_name in ... Cause: - It is accessed a variable that is not defined in the script till that line.

1

Solution: - Create that variable before access it. Also, a good practice is to use isset() to check if that variable exists.

2

• Notice: Undefined index /Undefined offset: xy in ... Cause: - It is accessed an array index /key (array element) that not exists in that array, you're referring to an array key that doesn't exist. "Offset" refers to the integer key of a numeric array, and "index" refers to the string key of an associative array..

3

Solution: - Try to create the element with that index /key in array, to access only defined array elements. Also, use isset() to check if that element exists, useful when the array is defined and accesed dinamically.

4

• Parse error: syntax error, unexpected T_IF in ... on line ... Cause: - A syntax error before a "if()" condition. Usually, this error is caused by the missing of the ';' character before a line with a "if()" condition.

5

Solution: - Check the code immediately before the line indicated in the error message, and add the correct syntax.

6

• Parse error: syntax error, unexpected T_FOR in ... on line ... Cause: - A syntax error before a "for()" instruction. Usually, this error is caused by the missing of the ';' character before a line with a "for()" instruction.

7

Solution: - Check the code immediately before the line indicated in the error message, and add the correct syntax.

8

• Parse error: syntax error, unexpected ')' in ... on line ... Cause: - An extra ")".

9

Solution: - Check the code at the line indicated in the error message, and delete the extra ')'.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

0

• Warning: Illegal offset type in ... on line ... Cause: - This warning message can appear when you use a Function, an Array, an Object, or other incorrect value as the index /key of an Array element.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

1

Solution: - Check the code at the line indicated in the error message, and use a variable that contains a string, or numeric value for the index /key of the array element.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

2

• Parse error: syntax error, unexpected '=', expecting ')' in ... on line ... Cause: - This error can appear when it is missing the '>' character between the key and its value in array.

'abc', 1='xyz', 2=>789); // missing '>' at key 1

Solution: - Check the code (the array) at the line indicated in the error message, and add the missing '>'.

'abc', 1=>'xyz', 2=>789);

• Parse error: syntax error, unexpected ... T_CONSTANT_ENCAPSED_STRING, expecting ... Cause: - This error can appear when it is missing the '=>' between the key and its value in array, or the comma separator between array items, or when it is missed the dot character after a variable concatenated /joined to string.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

3

Solution: - Check the code (the array, or concatenated string) at the line indicated in the error message, and add the missing character.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

4

• Parse error: syntax error, unexpected T_BOOLEAN_AND in ... on line ... Cause: - This error can appear when you add a function as the argument of a PHP function.

Solution: - Store into a variable the result of the function, then use the variable for argument of the other function. In other words: Pass a real variable for argument and not a function returning an array because only actual variables may be passed by reference.

• Parse error: syntax error, unexpected '$variable' (T_VARIABLE), expecting function (T_FUNCTION) in ... on line ... Cause: - This error can appear when it is missing the access attribute (public, private, protected) from a property into a class.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

5

Solution: - Check the code in the file, at the line indicated in the error message, and add the access attribute correctly, before the variable name.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

6

• Parse error: syntax error, unexpected 'some_string' (T_STRING), expecting function (T_FUNCTION) in ... on line ... Cause: - This error can appear when the access attribute of a property into a class is spelled incorrectly, or it is added other thing than one of these words: public, private, protected.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

7

Solution: - Check the code in the file, at the line indicated in the error message, and write the access attribute correctly (public, private, protected), before the property name.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

8

• Parse error: syntax error, unexpected '$var_name' (T_VARIABLE) in ... on line ... Cause: - This error can appear when the property into a class is set using directly other variable to devine its value.

table_name WHERE $condition ..."; echo $sql; // outputs in browser the sql query that is send to MySQL

9

Solution: - Check the code in the file, at the line indicated in the error message, and define the property value directly with a sting, number, or array. Or create it with no value, then you can set the property value with other variable in _constructor().

0

• Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in ... on line ... Cause: - This error can appear when it is missing the '$' character before the special word "this", or before the object name, when it is accessed a property or method.

1

Solution: - Check the code in the file, at the line indicated in the error message, and add the missing '$'.

2

• Warning: Missing argument ... for function_name(), called in ... on line ... Cause: - This error can appear when it is called a function without passing all the rquired arguments. Then, might be fallowed by this error: • Notice: Undefined variable: variable_name in ... , because of the missing argument.

3

Solution: - Check the code in the file, at the line indicated in the error message, and add the required arguments in the call of the function.

4

• Warning: zip_read() expects parameter 1 to be resource, integer given in ... on line ... Cause: - It's because zip_open() failed to open the file and returned an error code instead of a resource. This error might be fallowed by this: • Warning: zip_close() expects parameter 1 to be resource, integer given in ... , because of the same cause.

5

Solution: - Check if the path and name of the ZIP file are correct. If they are correct, try to use the FULL path to the ZIP file.

6

• syntax error, unexpected 'unset' (T_UNSET) in ... Cause: - This error can appear when the unset() function is assigned to a variable, or it is used with another PHP function (for example with if() ).

7

Solution: - unset() returns No Value, so, it cannot be assigned, or compared. It removes an element from Array, just apply it as it is.

8

• preg_match(): Compilation failed: nothing to repeat at offset ... Cause: - This warning message appears when preg_match() is used with an incorrect RegExp pattern. So, the problem is in the RegExp pattern, usualy if the "*" is added wrong. Example:

9

Solution: - Check the RegExp pattern at the character number specified in the Warning message (after 'offset ...'), and correct the syntax.

CoursesWeb.net';

if(preg_match('/href="(.*?)"/i', $str, $mt)) print_r($mt[1]);

if(preg_match('/href="([^"]{8,28})/i', $str, $mt)) print_r($mt[1]);

• Cannot redeclare class ... Cause: - There is a class of the same name declared more than once. Maybe via multiple includes. Example:

0

Solution: - Instead of using include() (or require() ) use include_once() (or require_once() ) in all the php files in which that class is included, to prevent multiple inclusions.

// include other php file which includes in its code the 'file_with_class_Foo.php', but using include_once()