Title: mysql Query executed ?
Last modified: August 18, 2016

---

# mysql Query executed ?

 *  Resolved [chaaban](https://wordpress.org/support/users/chaaban/)
 * (@chaaban)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/mysql-query-executed/)
 * How can i know if a query was executed correctly …
 * i did this :
 * $sql = ” the sql query ” ;
 * $sql_query = $wpdb->query($sql);
 * then tested both :
 * if (! $sql_query) { the query dident work } else …
 * and
 * if ($sql_query != 1) { the query dident work }else …
 * but both dident work in term of showing that the query were executed (i know 
   it did because i can see some results in my phpMyAdmin)
 * also another weird thing is that i use the same command
 * ” if ($sql_query != 1) ” in another php file and it work !
 * any idea ?
 * also the $sql_query return 0 if it was executed and nothing if it dident (weird?)

Viewing 1 replies (of 1 total)

 *  Thread Starter [chaaban](https://wordpress.org/support/users/chaaban/)
 * (@chaaban)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/mysql-query-executed/#post-289215)
 * fixed it using : if($sql_query === 0) { query executed } else { problem occured};
 * it seem 2 be working in this way
 * Thank’s alot for the Help :p

Viewing 1 replies (of 1 total)

The topic ‘mysql Query executed ?’ is closed to new replies.

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 1 reply
 * 1 participant
 * Last reply from: [chaaban](https://wordpress.org/support/users/chaaban/)
 * Last activity: [20 years, 5 months ago](https://wordpress.org/support/topic/mysql-query-executed/#post-289215)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
