Title: sql error
Last modified: August 19, 2016

---

# sql error

 *  [shadd](https://wordpress.org/support/users/shadd/)
 * (@shadd)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/sql-error-8/)
 * Hi Guys
 * I keep getting errors when executing the following query:
 * $wpdb->get_row(“SELECT * FROM alb_teachers WHERE teacher_name = $teacher_name”);
 * WordPress database error: [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‘
   Abaa Alay’ at line 1]
    SELECT * FROM alb_teachers WHERE teacher_name = Abaa Alay
 * Here is the DB table:
 * CREATE TABLE alb_teachers (
    teacher_id integer auto_increment NOT NULL, teacher_name
   varchar(120) NOT NULL, teacher_description text NULL, PRIMARY KEY(teacher_id));

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [kymac](https://wordpress.org/support/users/kymac/)
 * (@kymac)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/sql-error-8/#post-1287279)
 * Your teacher_name needs to be in quotes. I believe this will work:
 * `$wpdb->get_row("SELECT * FROM alb_teachers WHERE teacher_name = '$teacher_name'");`
 *  Thread Starter [shadd](https://wordpress.org/support/users/shadd/)
 * (@shadd)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/sql-error-8/#post-1287326)
 * Thanks. BTW, does WP offer transaction committ and rollback ?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘sql error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [shadd](https://wordpress.org/support/users/shadd/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/sql-error-8/#post-1287326)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
