Oppure

Loading
Questo topic e' stato chiuso dal moderatore.
16/12/09 20:04
Salve, volevo sapere come si usa il not " ! "

Ho questo codice:

In poche parole vorrei aggiungere queste righe di codice:
if(!mysql_num_rows(mysql_query("SELECT email FROM plus_signup WHERE email = '$email'";))){
$msg=$msg."Email already exists. Please try another one<BR>";
$status= "NOTOK";}    

Ma non mi funziona il controllo quando uno prova ad modificare l'email
e il programma deve cercare nel db se esiste già o no.

Per la registrazione tutto ok.
Ma volevo solo aggiungere quel pezzettino di codice che mi fa il controllo quando uno modifica il profilo

ora ho solo due email una gmail.com e yahoo.it

se uno entra e mette una yahoo.it e il sistema riconosce che esiste già da il messaggio di errore, invece se non esiste cambia.

Mi sapete dire come fare?
grazie.
ecco il codice:

<?php
//***************************************
// This is downloaded from www.plus2net.com //
/// You can distribute this code with the link to www.plus2net.com ///
//  Please don't  remove the link to www.plus2net.com ///
// This is for your learning only not for commercial use. ///////
//The author is not responsible for any type of loss or problem or damage on using this script.//
/// You can use it at your own risk. /////
//*****************************************
include "include/session.php";

include "include/z_db.php";
//////////////////////////////


?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body >
<?
$todo=$_POST['todo'];
$name=$_POST['name'];
$email=$_POST['email'];
$sex=$_POST['sex'];
// check the login details of the user and stop execution if not logged in
require "check.php";

if(isset($todo) and $todo=="update-profile"){

// set the flags for validation and messages
$status = "OK";
$msg="";
if(!mysql_num_rows(mysql_query("SELECT email FROM plus_signup WHERE email = '$email'"))){
$msg=$msg."Email already exists. Please try another one<BR>";
$status= "NOTOK";}	
// if name is less than 5 char then status is not ok
if (strlen($name) < 5) {
$msg=$msg."Your name  must be more than 5 char length<BR>";
$status= "NOTOK";}	


// you can add email validation here if required. 
// The code for email validation is available at www.plus2net.com

if($status<>"OK"){ // if validation failed
echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
}else{ // if all validations are passed.
if(mysql_query("update plus_signup set email='$email',name='$name',sex='$sex' where userid='$_SESSION[userid]'")){
echo "<font face='Verdana' size='2' color=green>You have successfully updated your profile<br></font>";
}else{echo "<font face='Verdana' size='2' color=red>There is some problem in updating your profile. Please contact site admin<br></font>";}
}}

require "bottom.php";
?>
<center>
<br><br><a href='http://www.plus2net.com'>PHP SQL HTML free tutorials and scripts</a></center> 

</body>

</html>
Ultima modifica effettuata da 16/12/09 20:05
16/12/09 22:51
Thejuster
!=
mire.forumfree.it/ - Mire Engine
C# UI Designer
17/12/09 9:26
Postato originariamente da Thejuster:

!=


scusa, dove devo inserirlo?

grazie.
17/12/09 14:23
Thejuster
if($test != "blablabla";) {

echo "Contenuto $test non uguale a blablabla";

}


Ultima modifica effettuata da Thejuster 17/12/09 14:24
mire.forumfree.it/ - Mire Engine
C# UI Designer
03/05/10 19:32
Rowan
*** spam ***
Ultima modifica effettuata da Thejuster 03/05/10 23:03
aaa