This happens when your result is not a result (but a “false” instead). You should change this line
$sql = 'SELECT * FROM $usertable WHERE PartNumber = $partid';
to this:
$sql = "SELECT * FROM $usertable WHERE PartNumber = $partid";
because the ” can interprete $variables while ‘ cannot.
Works fine with integers (numbers), for strings you need to put the $variable in single quotes, like
$sql = "SELECT * FROM $usertable WHERE PartNumber = '$partid' ";
If you want / have to work with single quotes, then php CAN NOT interprete the variables, you will have to do it like this:
$sql = 'SELECT * FROM '.$usertable.' WHERE string_column = "'.$string.'" AND in
Related Posts:
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
- mysqli_real_connect(): (HY000/2002): No such file or directory
- Fatal error: Call to undefined function mysqli_connect()
- mysqli_real_connect(): (HY000/2002): No such file or directory
- Fatal error: Call to undefined function mysqli_connect()
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- MySqli Commands out of sync; you can’t run this command now
- Commands out of sync; you can’t run this command now
- Call to undefined method mysqli_stmt::get_result
- Call to undefined method mysqli_stmt::get_result
- Fatal error: Cannot use object of type mysqli_result
- How to solve “Fatal error: Class ‘MySQLi’ not found”?
- mysql_field_name to the new mysqli
- mysqli_select_db() expects parameter 1 to be mysqli, string given
- mysqli::query(): Couldn’t fetch mysqli
- phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user ‘pma’@’localhost’ (using password: NO)
- Warning: mysqli_query() expects at least 2 parameters, 1 given. What? [duplicate]
- Deprecated: mysql_query() [duplicate]
- Object of class mysqli_result could not be converted to string
- Fatal error: Call to a member function fetch_assoc() on a non-object
- Having a problem getting mysqli_query to execute
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given… what I do wrong?
- Call to a member function fetch_assoc() on boolean in
[duplicate] - Visual list of all installed fonts with respective pangram phrase?
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- count() parameter must be an array or an object that implements countable in laravel
- Fatal error: Call to undefined function mysql_connect()
- Mysql query- How to use contains?
- what does PHP die() return
- Invalid column count in CSV input on line 1 Error
- how to replace quotation marks with \”
- mcrypt is deprecated, what is the alternative?
- How to echo or print an array in PHP?
- How to replace “if” statement with a ternary operator ( ? : )?
- why use 0xffff over 65535
- .rar, .zip files MIME Type
- PDO bindParam() with prepared statement isn’t working
- HTML Element Array, name=”something[]” or name=”something”?
- Why use $_SERVER[‘PHP_SELF’] instead of “”
- Setting up a PHP interpreter in PhpStorm
- PHP: $_SERVER variables: $_SERVER[‘HTTP_HOST’] vs $_SERVER[‘SERVER_NAME’]
- Illegal string offset Warning PHP
- Could not open input file: artisan
- Why php tag is not working in html file?
- What’s the use of ob_start() in php?
- PHP: variables in strings without concatenation
- PHP mail not working for some reason
- Get Root Directory Path of a PHP project
- Returning JSON from PHP to JavaScript?
- How to create cron job using PHP?
- Imploding an associative array in PHP
- curl POST format for CURLOPT_POSTFIELDS
- Can’t use method return value in write context
- PHP get domain name
- Running a Python script from PHP
- Object of class DateTime could not be converted to string
- HTTP Error 411, The request must be chunked or have a content length
- Fatal error: Call to undefined function sqlsrv_connect()
- NotFoundHttpException in RouteCollection.php line 161: in laravel 5
- Html encode in PHP
- file_put_contents: Failed to open stream, no such file or directory
- PHP $_POST not working?
- PHP cURL HTTP PUT
- Convert timestamp to readable date/time PHP
- PHP sessions that have already been started
- Contact Form 7 – Custom Validation
- How to output JavaScript with PHP
- WRONGTYPE Operation against a key holding the wrong kind of value php
- What is the advantage of using try {} catch {} versus if {} else {}
- Subtracting days, months or years from date using php
- Laravel – Model Class not found
- Strict Standards: Only variables should be assigned by reference PHP 5.4
- mysqlworkbench giving version error on exporting database
- Steam Market API?
- PHP array delete by value (not key)
- PHP mail: Multiple recipients?
- PHP Multiple Checkbox Array
- Session variables not working php
- Get JSON object from URL
- How to push both value and key into PHP array
- Find the last element of an array while using a foreach loop in PHP
- Popup window in PHP?
- How can you use php in a javascript function
- How to bypass (deprecated) reCAPTCHA V1?
- Adding days to $Date in PHP
- Genesis – Customize search form
- Count the number of times the search form template gets included on a page
- esc_url returns incorrect URL
- Customising the search function?
- edit search.php to include subdomain posts
- how can i include post meta in search result
- How to search order using database frontend short code WordPress
- Limit Search to Product Pages only unless I’m on Blogpage or Blogposts
- How can I remove this sidebar from my Search Results page?
- Select All not working in a WordPress search filter
- How can i retrive the movies, trailers, news in a single page using search
- Search custom post type posts only by meta fields?