Hello everybody,
How can i do this one??
If i press a button, i have to check if certain columns(fields) in a table are empty.If they are empty, i want to send an e-mail to the e-mail address which is already in this table.If there are no empty columns, then i want to do some calculation using another table.
Could somebody please tell me how should i do.
Many many thanks
How to check empty columns in a table
Moderator: General Moderators
-
minds_gifts
- Forum Commoner
- Posts: 63
- Joined: Mon Feb 10, 2003 4:23 am
EDIT: for the button part, i would make a link that would goto a page that did this in an if statement.
Now, all you need to modify is your connection username and password, where you're selecting from, and what field you want to check that is blank. i just tested this, and it works fine for me. Reply if you have troubles!
Code: Select all
<?php
$link = mysql_connect("localhost", "***", "***")
or die("Could not connect");
mysql_select_db("your_database", $link) or die("Could not select database");
$query = MYSQL_QUERY("SELECT * FROM table WHERE field=''");
while ($fetch=mysql_fetch_array($query)) {
mail($email, "Your Subjet Here", "This email was sent for a reason, but I don't know why!");
}
?>-
minds_gifts
- Forum Commoner
- Posts: 63
- Joined: Mon Feb 10, 2003 4:23 am
Code: Select all
<?php
WHERE zipcode='' AND city=''
?>Code: Select all
<?php
WHERE field=''
?>