0

In codeIgniter I see that if query has error codeignter only show database error. but codeigniter doesn't say which file's line error. here a example

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 
      //some thing goes here
Filename: C:\xampp\htdocs\bata_shop\system\database\DB_driver.php

Line Number: 330

Sometimes it difficult to find which query is wrong. How do I get specific database error location in codeigniter?

1
  • 1
    It however tells you which queries went wrong, this can be leveraged. But to your point, codeigniter's limitation is there. Perhaps time to switch to more modern framework (if you are still early on in your development stage)? Commented Sep 12, 2013 at 3:35

2 Answers 2

3

A dirty Solution for CI 2 and it helped me:-

Go and edit system\database\DB_driver.php and add the following code on line 321:-

echo "<pre>";
debug_print_backtrace();
echo "</pre>";
Sign up to request clarification or add additional context in comments.

1 Comment

I knew this idea. but I'm little afraid for use this. Because If It is suitable, why CI could not use directly?
1

This is happening due the database.php file not set correctly please check your database file and all database related problem are in that file only

2 Comments

I am not understand your answer. If I was not set my database how was running correct query.
I was Trying to tell you that if there an database connection error they there is problem in that database.php file only this for the connection purpose

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.