Professional Web Applications Themes

Only 1 record - MySQL

Hello, I want a MySQL to be filled with a form (in PHP). It works, only for one single record. When I fill in the form again, the table only exists with 1 record (The original one) when I delete the record and fill in the form, the new record is added to the database. ===PHP ==== mysql_connect('localhost',$username,$password); mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO `donations` ( `Email` , 'Name` , `Amount` ) VALUES ('$Email', '$Form_Name', '$Form_Amount')"; mysql_query($query); mysql_close(); ====phpMyAdmin 2.8 ===== Field=Email Type=varchar(40) Collation=utf8_general_ci Null=No Field=Name Type=varchar(30) Collation=utf8_general_ci Null=No Field=Amount Type=varchar(6) Collation=utf8_general_ci Null=No...

  1. #1

    Default Only 1 record

    Hello,

    I want a MySQL to be filled with a form (in PHP). It works, only for one
    single record. When I fill in the form again, the table only exists with 1
    record (The original one)
    when I delete the record and fill in the form, the new record is added to
    the database.


    ===PHP ====
    mysql_connect('localhost',$username,$password);
    mysql_select_db($database) or die( "Unable to select database");

    $query = "INSERT INTO `donations` ( `Email` , 'Name` , `Amount` ) VALUES
    ('$Email', '$Form_Name', '$Form_Amount')";

    mysql_query($query);

    mysql_close();

    ====phpMyAdmin 2.8 =====
    Field=Email Type=varchar(40) Collation=utf8_general_ci Null=No
    Field=Name Type=varchar(30) Collation=utf8_general_ci Null=No
    Field=Amount Type=varchar(6) Collation=utf8_general_ci Null=No



    Marco Guest

  2. #2

    Default Re: Only 1 record

    On Apr 7, 10:33 pm, "Marco J.L." <com.news> wrote: 

    maybe this will help...

    mysql_query($query) or die(mysql_error());

    strawberry Guest

  3. #3

    Default Re: Only 1 record

    Marco J.L. wrote: 

    sounds like you fetch only one row, try

    One row:
    $res=mysql_query("SELECT * FROM donations");
    row=mysql_fetch_array($res);
    echo $row['Name']." ".$row['Email']." ".$row['Amount']."<br>";

    All rows:
    $res=mysql_query("SELECT * FROM donations");
    while($row=mysql_fetch_array($res)) {
    echo $row['Name']." ".$row['Email']." ".$row['Amount']."<br>";
    }

    --

    //Aho
    J.O. Guest

Similar Threads

  1. How can i retrieve record ONLY From 300 - 400 in amillion Record Table?
    By keonglah in forum Coldfusion Database Access
    Replies: 6
    Last Post: June 13th, 02:53 AM
  2. Find record w/ conditions met in the same child record
    By Thomas Berg in forum FileMaker
    Replies: 2
    Last Post: October 21st, 05:01 AM
  3. Stop adding record in subform after record count = 1
    By Charlie in forum Microsoft Access
    Replies: 0
    Last Post: July 31st, 10:42 AM
  4. Adding a new record when the record source is a query.
    By Andy in forum Microsoft Access
    Replies: 0
    Last Post: July 29th, 01:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139