dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: record not adding

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Posts
    63

    record not adding

    I am really stuck in this one, Ii just can't get it working.

    when i check my table after running this code, the record never gets added.

    If you happen to spot the problem ( i am sure most of you will) please drop me a quick post and guide me)

    // the table in which i am adding this record is called (BusFile) it is under a database called (Business)
    <html>
    <head>
    <title>Business PHP add</title>
    </head>
    <body bgcolor="white">
    <?php
    foreach($HTTP_POST_VARS as $varname => $value)
    $formVars[$varname]=$value;
    $db1=mysql_connect($dbhost, $dbuname, $dbpass);
    mysql_select_db("BusFile");
    echo "Record Added<br><a href=\"BusinessAdd.htm\">click here</a>
    to return to Business Information Control<br>";
    $query="INSERT INTO BusFile set ".
    "Status= \"".$formVars["Status"]."\",".
    "Fname= \"".$formVars["Fname"]."\",".
    "Lname= \"".$formVars["Lname"]."\",".
    "Email= \"".$formVars["Email"]."\",".
    mysql_query($query);
    mysql_close($db1);
    ?>
    </body>
    </html>

  2. #2
    Join Date
    Feb 2005
    Location
    BC, Canada
    Posts
    1,098
    Have you done any error checking to make sure the query worked?

  3. #3
    Join Date
    Jan 2006
    Posts
    63
    i am using phpmyadmin sir, i am not certain about the query check but when i open the table to see teh records, it still says zero records?

    thank you very much for reading my post and trying to help me.

  4. #4
    Join Date
    Dec 2005
    Location
    India
    Posts
    490
    what is this "set" doing in an INSERT Statement? I think it has to be "values".
    I dont have any idea of this "mysql" but am aware of simple PL/SQL. might be, this works out in mysql too...

  5. #5
    Join Date
    Jan 2006
    Posts
    63
    I have tried it every way i know how ( not many, but acouple lol)

    I am givng up, i hope a more experienced gemtlemen can help me.

  6. #6
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    your insert statement is not standard (and doesn't follow the other form)

    use
    INSERT into table(column_list..) VALUES(value_list...);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles