1$mysqli = new mysqli(SERVER, DBUSER, DBPASS, DATABASE);
2$result = $mysqli->query("SELECT id FROM mytable WHERE city = 'c7'");
3if($result->num_rows == 0) {
4 // row not found, do stuff...
5} else {
6 // do other stuff...
7}
8$mysqli->close();
1INSERT INTO table_name (firstname, lastname)
2SELECT 'NEW FIRSTNAME', 'NEW LASTNAME'
3FROM DUAL
4WHERE NOT EXISTS(
5 SELECT 1
6 FROM table_name
7 WHERE firstname = 'NEW FIRSTNAME' AND lastname = 'NEW LASTNAME'
8)
9LIMIT 1;
1INSERT IGNORE INTO `transcripts`
2SET `ensembl_transcript_id` = 'ENSORGT00000000001',
3`transcript_chrom_start` = 12345,
4`transcript_chrom_end` = 12678;