hi im soosai ..very new to this PHP WORLD..have created database with the field tc...and i have 10 fields in it but only would like to insert those datas in the coding .... but the coding shows some error...pls help me .. Thank you

<?
@mysql_connect("localhost","root","") or die (mysql_error());
    mysql_select_db("upit");

    $sql="INSERT INTO tc ('$nama','$ic','$fakulti','$emel')values('$nama', '$ic', '$fakulti', '$emel')");
     $result=mysql_query($sql);
     if ($result){
    echo "<html><body>Registration Completed";
    echo "<p><font color='blue'>User Account Details<br>";
    echo "Username: '$ic'<br>";
    echo "Password: '$ic'</font><p>";
    echo "<a href='javascript:history.go(-2)'>Go back</a></body></html>";
    }
     else
    echo "Problem inserting data";      
  ?>

Recommended Answers

All 3 Replies

you need to have the column names in the insert:

$sql=mysql_query("Insert into tc (col1, col2, col3, col4) Values (`$nama`, `$ic`, `$fakulti`, `emel`)") or die(mysql_error());

give that a try

hi the coding seems to give error... but it helps a lot.... my another problem is to capture data ...The following is for my authentication page...

echo "Username: '$ic'<br>";

why is it that the value of ic cannot be captured?

hi the coding seems to give error... but it helps a lot.... my another problem is to capture data ...The following is for my authentication page...

echo "Username: '$ic'<br>";

why is it that the value of ic cannot be captured?

hi,you have to do like this

echo "Username: ".$ic."<br>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.