SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy It doesnt add any data in the table

    Is something wrong with this code? becaue it doesn't add any data to my database..

    PHP Code:
    if(isset($_POST['Input']))
    {
        
    $cl intval($_POST['clt']);
        
    $c intval($_POST['ct']);
        
    $cb intval($_POST['cbt']);
        
    $cc intval($_POST['cct']);
        
    $CheckIt mysql_query("SELECT * FROM f_beg WHERE cl='$cl'");
        if(!
    $cl OR !$c OR !$cb OR !$cc)
        {
            echo(
    "Please fill up the form");
        }
        else
        {
            
    $SQL "INSERT INTO f_beg (cl, c, cb, cc) 
            VALUES(    '
    $cl','$c','$cb','$cc')";
            echo(
    "Success");
            
    $result mysql_query($SQL);            
        }


  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Do you actually get any of the two echo messages in your script?

    Also you could change this line
    PHP Code:
            $result mysql_query($SQL); 
    in
    PHP Code:
            $result mysql_query($SQL) or die ('error ' mysql_error() . ' in query ' $SQL); 
    That will show you any errors in the execution of your query.

    And if no errors show up, and still nothing is inserted, try echoing $SQL anyway to see if it is what you expect it to be.

  3. #3
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tnx so much for the reply I figured out my problem.. I lack ' ' beside the value
    Last edited by cruzz56; Jan 17, 2013 at 02:26. Reason: done


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
  •