I want to check if somethign exist in the database before I update/insert. This is a two question in one but similar.
This is how I do it.
$p->main .= '<td><input type="text" name="value" id="value" size="12" maxlength="50" />';
$statement = $conn->prepare("SELECT year, month, name table_test WHERE MLOV_year= :Year
AND month= month AND name= :name");
$bind = array(
'year' => $year,
'month' = > $month,
'name' = > $name
);
$statement->tyu_exec_sql_bind($conn,$statement, $bind );
if ( false === $statement->fetch()) {
// I will run an insert statement here.
}
$p->main .= '</td>';
$p->main .= '</tr>';
Question This is my first time trying it this way and I was wondering if that is right? also if that is security?