Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Bootstrap Studio[PASOK]

try mo to angtagal na, sigurado master mo na ngayon php pero eto padin since wala pa sumasagot haha.

if(isset($_POST['save'])){
$fn = real_escape_string($dbcon,$_POST['name']);
$ln = real_escape_string($dbcon,$_POST['position']);
$sn = real_escape_string($dbcon,$_POST['office']);


$counter="select Name from tbl_employee where Name='$fn'";
$con_counter=mysqli_query($dbcon,$counter);
$check=mysqli_num_rows($con);

if($check==1)
{
echo"Employee already exist!";
}

else{
$emp_table="INSERT INTO tbl_employee (Name,Position,Office) VALUES('$fn','$ln','$sn')";
mysqli_query($dbcon,$emp_table);
echo"successfully recorded!";
}

}

sir yung $con yata dapat $con_counter
 
try mo to angtagal na, sigurado master mo na ngayon php pero eto padin since wala pa sumasagot haha.

if(isset($_POST['save'])){
$fn = real_escape_string($dbcon,$_POST['name']);
$ln = real_escape_string($dbcon,$_POST['position']);
$sn = real_escape_string($dbcon,$_POST['office']);


$counter="select Name from tbl_employee where Name='$fn'";
$con_counter=mysqli_query($dbcon,$counter);
$check=mysqli_num_rows($con);

if($check==1)
{
echo"Employee already exist!";
}

else{
$emp_table="INSERT INTO tbl_employee (Name,Position,Office) VALUES('$fn','$ln','$sn')";
mysqli_query($dbcon,$emp_table);
echo"successfully recorded!";
}

}

you can use PRIMARY KEY/UNIQUE KEY then use "INSERT IGNORE" para di mag duplicate or you can use also "INSERT .. ON DUPLICATE KEY" if you want to update the record match with new record.

eto lang nman is kung gusto mo i optimize yung speed ng queries mo..pwedi rin nman yung counter checking if existing..
pero in the end kakailanganin mo pa rin mga unique keys for faster query..
 
hindi ba error yan? mag kaiba ung number ng arguments at params? +1 dun sa taas ko mas malinis mag query ka muna kung existing.

Sir Jays, Do you teach web programming? or can you recommend a school near quezon city?
 
Back
Top Bottom