insert 1 field instead of 10??
can i insert only one field in a table which consists of 10 fields??
wat i am trying to do here is to see whether table have this record ornot??
<?php
$sql = \"select * from biocontact where uname = '$uname'\";
$result = mysql_query($sql);
?>
if no record, insert uname to the table:
<?php
if ($result == 0)
{
$sql_contact = \"insert into biocontact (uname) values ('$uname')\";
$result_contact = mysql_query($sql_contact);
}
?>
the problem is, i can't seem to insert the record. wat is wrong here??
Mark Hensler posted this at 07:26 — 11th January 2002.
He has: 4,048 posts
Joined: Aug 2000
I don't see anything wrong...
<?php
if ($result == 0) {
$sql_contact = \"INSERT INTO biocontact (uname) VALUES ('$uname')\";
$result_contact = mysql_query($sql_contact);
if (!$result_contact) {
echo \"\n\n<!--\n\";
echo \"File: \" . __FILE__ . \"\n\";
echo \"Line: \" . __LINE__ . \"\n\n\";
echo \"QUERY ERROR:\n\" . query_error() . \"\n\n\";
echo \"QUERY:\n$sql_contact\n\";
echo \"-->\n\n\";
}
}
?>
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.