A
A
Alexis_D2018-04-09 07:27:51
PHP
Alexis_D, 2018-04-09 07:27:51

PHP not seeing function?

Good day! There is such a code, when I put it in a function (function), then this code, when the function is declared, stops working. Maybe someone knows what the problem is. Thank you.

<?php
                $result_set = mysqli_query($connect, "SELECT * FROM `newCity`");

                while ($row = $result_set->fetch_assoc()) {
                $result_set = mysqli_query($connect, "SELECT * FROM `new_test_table` WHERE `newCity` = '".$row["city"]."'");

                while ($row_1 = $result_set->fetch_assoc()) {
                  echo "<option>".$row_1["newDistrict"]."</option>";
                  }
                }
               ?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-04-09
@Alexis_D

The internal vanga says that the problem is in the visibility of variables in general and $connect in particular.
error output? no, have not heard.

L
l1l1l1, 2018-04-09
@l1l1l1

The variable
in the function is probably not declared.
And yes, I advise you to use ReadBeanPHP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question