MySQL or CI issue. Not sure. |
I'm using CI 2.2.0. I have my database set up correctly and configured in CI correctly. I have a form that validates the user input (in this case a client number - 1-5 digits all numeric, padding trimmed, etc).
in my controller, I make the following call to my model, Code: $data['clients_related'] = $this->willkomen_model->getRelatedClients($data['clientnum']); The code for getRelatedClients is below: PHP Code: public function getRelatedClients($clnum = FALSE) { Code: A Database Error Occurred According to mysql documentation, this error occurs when a query is run out of order. Code: If you get Commands out of sync; you can't run this command now in your client code, you are calling client functions in the wrong order. This is a very simple query. Nothing APPEARS out of order. Anyone have any ideas?
OM...
------------------------- And on the pedestal these words appear: 'My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!' Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and level sands stretch far away.
You're right, everything looks fine. Which database driver are you using? And in the database.php file in your config directory, what is the setting for autoinit? Try reversing it and see if it makes a difference.
Also, this StackOverflow question may be helpful. Note there's a reply from a Codeigniter user. http://stackoverflow.com/questions/61467...ommand-now
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Thanks for the reply.
I'm using the MySqli database driver. I read the article you mentioned and spent some time yesterday reading through other articles. I came across one article, http://stackoverflow.com/questions/16777...sion-class, that seems to have done the trick. And while my query isn't a sql call to a stored procedure, once I changed the _execute function in mysqli_driver.php (which I didn't really want to do), the error disappeared. the code is posted below. I would recommend if you decide to change the driver file, make a backup first. PHP Code: public function _execute($sql)
OM...
------------------------- And on the pedestal these words appear: 'My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!' Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and level sands stretch far away.
I'm glad you solved your problem. One of the answers to that question you reference suggested extending the library and creating your own MY_DB_mysqli_driver. You didn't want to go that route? Just curious.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
(03-15-2015, 04:09 PM)RobertSF Wrote: I'm glad you solved your problem. One of the answers to that question you reference suggested extending the library and creating your own MY_DB_mysqli_driver. You didn't want to go that route? Just curious. I tried what was suggested. I had a time trying to figure out how to actually use that driver. I must have missed that part of the discussion. I'm just hoping that the modification doesn't affect other things. being new to codeigniter, I jumped in head first working on developing a site, and praying that the codebase was stable enough to where I wouldn't worry about it. maybe i'll learn the code in this version sooner or later. I'm just trying to learn a bit more than the basics. thanks again!
OM...
------------------------- And on the pedestal these words appear: 'My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!' Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and level sands stretch far away. |
Welcome Guest, Not a member yet? Register Sign In |