WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('in-progress') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('pending') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

Debugging prepared statements in php | Loop and Break

Debugging prepared statements in php

Prepared statements in PHP sometimes reports a block error which is hard to debug. So for debugging prepared statements we use MYSQLI_REPORT_ALL in conjunction with MySql drivers to get a full detailed message. For using this we have to put our php/mysql code into try block and then the catch exception block will display related error.

Example

// YOUR MYSQL CONNECTION DETAILS HERE

/* activate reporting */
$driver = new mysqli_driver();
$driver->report_mode = MYSQLI_REPORT_ALL;

try { // START TRY BLOCK

	$theQuery = "insert into order (TimeAndDate, Type, Amount, Address, status) values (?,?,?,?,?)";
	$stmt = $mysqli->prepare ( $theQuery );

	$stmt->bind_param ( 'ssdsd', $DateTime, $Type, $finalPrice, $Address, $Status );

	$stmt->execute ();
	printf ( "%d Row inserted.\n", $stmt->affected_rows ); 

	// END TRY BLOCK

} 
catch (mysqli_sql_exception $e) { // START CATCH BLOCK

	echo $e->__toString(); // ERROR PRINTING

}
Share

You may also like...