7536

PHP & MySQL Error - An error occurred on line 176: Object of class mysqli_result could not be co

Question:

I was wondering what is causing this error and how can I correct this problem?

Line 176 is below.

$q = "INSERT INTO users (first_name, middle_name, ". "last_name, rn, username, month, day, year, se, pic, ". "salt, password, rb, aa, ul, rd, ll, ui) ". "VALUES ('" . $fn . "', NULL, '" . $ln . "', NULL, '" . $u . "', NULL, NULL, NULL, NULL, NULL, '" . $salt . "', '" . $p . "', '" . $r . "', '" . $ag . "', 0, NOW(), NULL, '" . $unique_id . "')"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));

Answer1:

One of the variables you are injecting into that query string must be a result from an earlier query.

It's probably the $r.

Answer2:

Does the code following line 176 resemble this posters code? If so, try changing it to resemble more of what comes beneath it.

<a href="http://www.phpfreaks.com/forums/php-coding-help/(solved)-catchable-fatal-error-object-of-class-mysqli_result-could-not-be-conver/" rel="nofollow">http://www.phpfreaks.com/forums/php-coding-help/(solved)-catchable-fatal-error-object-of-class-mysqli_result-could-not-be-conver/</a>

Answer3:

I suspect you're trying to concatenate an object-variable. This is not possible with objects of the class "mysqli_result".

Do a var_dump() on each variable you concatenate to make $q and you'll find out which one it is.

Recommend

  • INSERT multiple records in MySQL with one PHP form
  • Mysqli INSERT not working unless all columns are present
  • Can https fallback to http and security level of https
  • Ruby on Rails filtering attributes on returning model object
  • XCode, Authentication and NSUserDefaults
  • Retrieve id of each INSERT statement in multi query
  • Securely storing (encrypting) data in an ASP.Net application
  • How to emulate integrated numeric keypad cursor keys in linux
  • Regexp, capture between parentheses, javascript
  • jQuery file download plugin
  • Rails 3.2 from SQLite locally to Postgres on Heroku
  • Log4j cannot find properties file in a simple application
  • python - calculate orthographic similarity between words of a list
  • Express displaying mongodb documents in Jade
  • Ruby and class variables in inherit class
  • if some function is not optimized does it mean that all functions where it is declared are not optim
  • Why doesn't a local variable live long enough for thread::scoped?
  • MongoError: Incorrect arguments
  • Could not find rake using whenever rails
  • Django rest serializer Breaks when data exists
  • Using jQuery closest() method with class selector
  • Change JButton Shape while respecting Look And Feel
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Convert array of 8 bytes to signed long in C++
  • jQuery tmpl and DataLink beta
  • Jquery - Jquery Wysiwyg return html as a string
  • Linker errors when using intrinsic function via function pointer
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Understanding cpu registers
  • LevelDB C iterator
  • Authorize attributes not working in MVC 4
  • Recursive/Hierarchical Query Using Postgres
  • Running Map reduces the dimensions of the matrices
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app