This question already has an answer here:
- Reference: What is variable scope, which variables are accessible from where and what are “undefined variable” errors? 3 answers
- Reference - What does this error mean in PHP? 35 answers
- mysqli_fetch_assoc() expects parameter / Call to a member function bind_param() errors. How to get the actual mysql error and fix it? 1 answer
I am trying to create a slug URL function, if condition not working inside the function
Mycode
function slug($text) {
$reslt = mysqli_query($connection, "SELECT slug FROM users WHERE slug='".$text."'");
$data = mysqli_fetch_array($reslt);
if (isset($text)) {
if (in_array($text, $data)) {
$count = 0;
while (in_array(($text . '-' . ++$count), $data));
$text = $text . '-' . $count;
}
}
}
Aucun commentaire:
Enregistrer un commentaire