2820

Mysql error handling/Try catch

Question:

If table column does not exist mysql shows error .How to fix it using try catch or error handling method

Thanks

Answer1:

you can handle the mysql error in this way

if ( ! $this->db->query('SELECT `name`,`age` FROM `example`')) { $error = $this->db->error(); // Has keys 'code' and 'message' }

Recommend

  • Handling exceptions in a class library enveloping a device driver
  • Is MVC2 ASP.Net URLDecoding automatically?
  • back button function for phonegap windows phone 7
  • Merge Module leaving files during uninstall
  • Add the parent product name to each cart item names in WooCommerce
  • PDO error when wrong host name
  • Magento get URL before current
  • Bigquery event streaming and table creation
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Groovy: Unexpected token “:”
  • Xcode 4 NSLog Macro link in Xcode 3
  • Converting a WriteableBitmap image ToArray in UWP
  • Moving mysql files across servers
  • Replace value with Factor in r data.table
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • How to access EntityManager inside Entity class in EJB3
  • Control modification in presentation layer
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Why value captured by reference in lambda is broken? [duplicate]
  • Bug in WPF DataGrid
  • TFS: Get latest causes slow project reloading
  • Controls, properties, events and timers running in design time
  • javascript inside java/jsp code
  • Javascript Callbacks with Object constructor
  • How to check if every primary key value is being referenced as foreign key in another table
  • Updated Ionic CLI but shows previous version (Windows)
  • How to make Safari send if-modified-since header?
  • Delete MySQLi record without showing the id in the URL
  • Unanticipated behavior
  • Comma separated Values
  • Hits per day in Google Big Query
  • Trying to get generic when generic is not available
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • File not found error Google Drive API
  • Qt: Run a script BEFORE make
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass