I am running a community site and I experience a lot of fake registrations and every day i have to clean up and delete a lot of
incomplete user id's from the database. I can tell which users are fake by looking at the country value, because thats the first input box on registration page number 2 , which the spam bot or user never completed. So if the "f4_country" is "0" then I know that this profile registration was never completed and thus can be deleted.
So I have made a SQL command that I run from phpmyadmin that deletes the incomplete userid's from two tables... but instead I would like to make a php script that I can run from the admin website or put inside a cron job.
Here is the sql command that will be executed :
DELETE `dsb_user_accounts`, `dsb_user_profiles` FROM `dsb_user_accounts` INNER JOIN `dsb_user_profiles` ON `dsb_user_accounts`.`user_id` = `dsb_user_profiles`.`fk_user_id` WHERE
`dsb_user_profiles`.`f4_country` = 0
Unfortunately I dont know much about php but so far I have figured out that the php file may start like this:
<?php
session_start();
$host="localhost";
$db_username="etano";
$db_password="Jgc534S";
$db_name="etano";
mysql_connect($host,$db_username,$db_password);
mysql_select_db($db_name);
$query=("DELETE.................
but then I am stuck ....can I use exact the same sql statements that I used in phpmyadmin or is the syntax in php different ?
it would be nice to get some output from the script too, for example.....n number of rows deleted or something...
Thanks for any help
-Utah