MySQL Forums
Forum List  »  Docs

Select default
Posted by: Patrick Zahra
Date: March 22, 2007 05:59AM

Is there a way to get mysql to return an empty row (populated by default values) if the WHERE clause finds nothing? Currently I have to set up an array manually, which can be a lot of code for a big table. I'm looking for something like this:

SELECT [fields] [OR DEFAULT] FROM [tablenames] WHERE primary_key=$_GET[id]

That way if id=0, it knows to set up an empty form ready to create a new item. I couldn't find anything in the manual about this.

Options: ReplyQuote


Subject
Views
Written By
Posted
Select default
6242
March 22, 2007 05:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.