I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
I have problem cant exist catogaries :
I want chek if the catogary is add before or not
please i need help
<?php
require '0.php';
if (isset($_POST['login'])){
$catogary_name = $_POST['catogary-name'];
$catogary_much = $_POST['catogary-much'];
if (empty($catogary_name) == true || empty($catogary_much) == true){
}else{
$sql = "insert into catograyies (CATOGRARY,howMush) VALUES (' $catogary_name','$catogary_much')";
if ($sq->query($sql) === TRUE) {
} else {
}
}
header("location:");
exit;
}
?>
2
Answers
I would do a select first. Here is an example below, this won’t work out the box but will give you an idea what todo.
Use a
SELECT
query first to check if the category already exists.I’ve also shown how to use prepared statements instead of substituting variables into the SQL, to protect against SQL-injection.