This is a discussion on Help with delete query please within the MySQL forums, part of the Database Server Software category; --> Hi Having problem with delete query. Below is query: $unconfirmedstatus = 'Unconfirmed'; $firstquery = "DELETE FROM Pendingsales WHERE time ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi Having problem with delete query. Below is query: $unconfirmedstatus = 'Unconfirmed'; $firstquery = "DELETE FROM Pendingsales WHERE time < NOW() - INTERVAL 60 MINUTE AND status = $unconfirmedstatus"; $result = mysql_query($firstquery) or die ("Failed query of" . $firstquery . mysql_error()); Error message is as follows: Failed query of DELETE FROM Pendingtransactions WHERE time < NOW() - INTERVAL 2 MINUTE AND status = Unconfirmed Unknown column 'Unconfirmed' in 'where clause' Cant see where I'm going wrong. Unconfirmed is not the column - status is the column. Any help greatly appreciated. Donna |
| |||
| Donna Elles wrote: > Hi > Having problem with delete query. Below is query: > > $unconfirmedstatus = 'Unconfirmed'; > $firstquery = "DELETE FROM Pendingsales WHERE time < NOW() - INTERVAL > 60 MINUTE AND status = $unconfirmedstatus"; > $result = mysql_query($firstquery) or die ("Failed query of" . > $firstquery . mysql_error()); > > Error message is as follows: > > Failed query of DELETE FROM Pendingtransactions WHERE time < NOW() - > INTERVAL 2 MINUTE AND status = Unconfirmed Unknown column > 'Unconfirmed' in 'where clause' > > Cant see where I'm going wrong. Unconfirmed is not the column - > status is the column. > > Any help greatly appreciated. > Donna You missed the quotes to change Unconfirmed into a constant. Try: $firstquery = "DELETE FROM Pendingsales WHERE time < NOW() - INTERVAL 60 MINUTE AND status = '$unconfirmedstatus'"; |
| |||
| >$unconfirmedstatus = 'Unconfirmed'; >$firstquery = "DELETE FROM Pendingsales WHERE time < NOW() - INTERVAL 60 MINUTE >AND status = $unconfirmedstatus"; >$result = mysql_query($firstquery) or die ("Failed query of" . $firstquery . >mysql_error()); > >Error message is as follows: > >Failed query of DELETE FROM Pendingtransactions WHERE time < NOW() - INTERVAL 2 >MINUTE AND status = Unconfirmed Unknown column 'Unconfirmed' in 'where clause' > >Cant see where I'm going wrong. Unconfirmed is not the column - status is the >column. No, as written, Unconfirmed is a (nonexistent) column. Perhaps you meant: where status = 'Unconfirmed' Gordon L. Burditt |
| ||||
| Donna Elles wrote: > Failed query of DELETE FROM Pendingtransactions WHERE time < NOW() - INTERVAL 2 > MINUTE AND status = Unconfirmed Unknown column 'Unconfirmed' in 'where clause' Unconfirmed with no quotes around it is interpreted as a column name. 'Unconfirmed' with quotes around it is interpreted as a string literal. Regards, Bill K. |