הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 03-02-08, 15:47   # 11
pirsomet
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Jan 2008
הודעות: 104

pirsomet לא מחובר  

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>";
       }
הדרך שבה אתה בודק היתה יכולה להיות נכונה רק אם היית מגדיר את email_address כ UNIQUE KEY במוסד הנתונים

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..
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 23:47.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ