|
![]() |
# 1 |
חבר בקהילה
|
0xfo7d
קוד:
mysql_query("INSERT INTO `emails` SET `email_address`='".$_POST["email_address"]."' "); echo mysql_error(); if(mysql_affected_rows() > 0) { echo "<font color='red'>האימייל נוסף בהצלחה</font>"; echo "<META HTTP-EQUIV=Refresh CONTENT='1; URL=?action=mail_manager&sa=edit'>"; } else { echo "<font color='red'>שגיאה בעת תהליך הוספת האימייל</font>"; } ou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 תבדוק עכשיו קוד:
$email = $_POST['email_address']; $result = mysql_query("SELECT * FROM `emails` WHERE `email_address`= '$email' ") or die(mysql_error()); $search = mysql_num_rows($result); if ($search == 0) { mysql_query("INSERT INTO `emails` (`email_address`) VALUES ('$email')") or die(mysql_error()); echo("<font color=\"red\">האימייל נוסף בהצלחה</font>"); } else { echo("<font color=\"red\">אנא בחר אימייל אחר</font>"); } Last edited by pirsomet; 03-02-08 at 15:53.. |
![]() |
![]() |
# 2 | |
חבר בקהילה
|
ציטוט:
![]()
__________________
אחסון אתרים, עבודות גבס בירושלים ,אינדקס אתרים ,lc980 brother ,הבלוג הקשיח ,מתקנים מתנפחים, קפה לאירועים |
|
![]() |
![]() |
# 3 |
חבר וותיק
|
טיפ קטן:
mysql_num_rows פחות בריא... הוא מיועד ל"אם כבר בדקת"... יותר נכון לעשות: PHP קוד:
|
![]() |
![]() |
# 4 | |
חבר מתקדם
|
ציטוט:
אפשר דוגמא קטנה? כי הרי לפי מה שהבנתי הוא רק סופר כמה אימליים יש נגיד "נרשמו" 10 אימיילים אז הוא התוצאה של השאילתא שהראית תיהיה 10. |
|
![]() |
![]() |
# 5 | |
חבר בקהילה
|
ציטוט:
קוד:
$sql="SELECT count(*) as `num_rows` FROM `ALMOG_BAKU` WHERE `email`='aa@aa.cc' "; $result=mysql_query($sql); $count=mysql_result($result,0,0); if($coumt==0) { echo "everything ok"; } else { echo "there such email"; } |
|
![]() |
![]() |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
כלים לאשכול | |
תצורת הצגה | |
|
|