if i am on the right track or if perhaps the previous paragraph just doesn’t make any sense, how would i query the database to find out if the name of a record entered already exists in the db? i’m working on a simple test script with only three fields, my most recent attempt is below but never matches up with the name already in the db.
Code: Select all
$name = $_POST["name"];
$len = strlen($name);
if ($len > 0)
{
$query = "SELECT name FROM picsTBL";
$response = "mysql_query($query, $connection) or die(mysql_error())";
if ($name != $response){
echo "NEW RECORD!";
}else{
echo "ALREADY IN DATABASE!";
}
$jpg = $_POST["jpg"];
$query = "INSERT INTO pics (autoID, name, jpg) VALUES (NULL, '$name', '$jpg')";
mysql_query($query, $connection) or die(mysql_error());
}any thoghts are appreciated