sorry...I'm very tired 🙂...try this:
<?php
// Include config file
include('common.php');
// Connect to database
$link = dbConnect();
//Build query to select client_grpid
$query = "SELECT client_grpid FROM clients_grp WHERE client_type='$client_type'";
//Execute query
$result = @($query);
//Fetch the result in array and assign to $row
$row = @mysql_fetch_array($result);
//Get the content and assign to $client_type
$client_grpid = stripslashes($row['client_grpid']);
//Check method if client name to be inserted exist
//Build query to select client name
$query = "SELECT * FROM client WHERE client_name = '$client_name'";
//Execute query
mysql_query($query);
//If match is found
if (mysql_num_rows($result)!=0){
//Inform user
$msg = "$client_name already exist";
} else {
// Build query to insert new client name
$query = "INSERT INTO client(client_grpid, client_name)
VALUES('$client_grpid', '$client_name')";
// Execute query
$result = @($query);
}
mysql_close($link);
?>