Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_array_needed() {
- $servername = "localhost";
- $username = "algolhos_unisitc";
- $password = "Un1s1t_commerce";
- $dbname = "algolhos_unisitc";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT codice_target FROM customer";
- $result = $conn->query($sql);
- $rtoclass = array();
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "id: " . $row["id_customer"]. " - Codice target: " . $row["codice_target"]."<br>";
- $rtoclass[] = $row;
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- return $rtoclass;
- }
- $obj->set_arr_needed( get_array_needed() ); // change $obj with the instance name writeToFile() is using...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement