I'm writing sql code which gets the name of the columns its supposed to look up of a table from custom php code.
Part of this has to do with location i.e. country ,state, zip, etc. I have it so that on the php code, the user fills out the fields that correspond to these on their tables. However, it is possible that while these are all possibilities they may not have every piece, like the zip code.
If I the php doesn't get anything for the zip column name it throws off the entire code. Null columns are ok with me, but I'm struggling finding a way to make a placeholder for the column. Is there a sql placeholder I can tell the php variable to become if the user enters nothing and is therefore null?
$addressColumn = $_POST["address"];
$stateColumn = $_POST["state"];
$zipColumn = $_POST["zip"];
$cityColumn = $_POST["city"];
$countryColumn = $_POST["country"];
$database = $_POST["database"];
if one of these is not posted on the html page, then the code breaks. suggestions? I can change the value if null to something else if anyone knows of a placeholder value that sql will accept and then as I fetch rows will place null below it