Page 1 of 1

insert query problem

Posted: Tue Sep 13, 2011 5:56 am
by seeker
plz help me out in this query
Code: Select all
<?php 
    $a = $_POST['T1']; 
    $b = $_POST['T2']; 
    $c = $_POST['T3']; 
    $d = $_POST['T4']; 
    $e = $_POST['T5']; 
    $f = $_POST['T6']; 
     
    $con = mysql_connect("localhost", "root", ""); 
    if(!$con) 
    { 
    echo "error in connection".mysql_error(); 
    } 
    mysql_select_db("uc", $con); 
    $q = mysql_query("insert into members values('$a',$b','$c','$d','$e','$f'",$con); 
    if(!$q) 
    { 
    echo "error in query".mysql_error(); 
    } 
    
    
    session_start(); 
     
    $_SESSION['sname'] = $a; 
    header("location:confrmreg.php");     
    } 
    else 
    { 
    echo "invalid id or password try again"; 
    } 
?>

Re: insert query problem

Posted: Tue Sep 13, 2011 7:03 pm
by mandai
There appears to be a missing if statement on line 25.

Re: insert query problem

Posted: Wed Sep 14, 2011 2:41 pm
by seeker
the error is "DUPLICATE KEY 0 TO 1"

i made changes in query it was run only one time and redirect to other page successfully

but again i try . its gives the above error