yea what i did was i added another line that gets the number of rows. 0 if table is empty, and 1 if its not, then use an if statement so that if its 0 then the query is an INSERT INTO and if its 1 its the update one.. which works i might add, just trying to get the delete thingy to work now... this is the code i got:
$exist = mysql_query("SELECT * FROM $tablename");
$exist = mysql_fetch_array($exist);
$existingemail = $exist['email'];
$checkio = strpos($existingemail,$_POST['email'].' ,');
if($checkio === false) {
$newemail = str_replace(', '.$_POST['email'],"",$existingemail);
} elseif ($checkio === true) {
$newemail = str_replace($_POST['email'].' ,',"",$existingemail);
}
$update = mysql_query("UPDATE $tablename SET email='$newemail' ");
i think it works. not fully sure, cos ive got a check running that sees if the email exists in the database, if so it deletes it, if not returns the error...
heres the code for the email check:
function EmailCheck() {
global $tablename;
$checkthis = mysql_query("SELECT * FROM $tablename");
$checkthis = mysql_fetch_array($checkthis);
$checkthis = strpos($checkthis['email'], $_POST['email']);
if ($checkthis === true) {
$emailvalidate=1;// email exists in the database
} elseif ($checkthis === false) {
$emailvalidate=0;// email does not exist in the database
}
}
but the email check doesnt seem to work 🙁 i might adding a default value of: $emailvalidate = 0; somewhere to see or somthing