K
K
kuzyairon2020-05-14 21:48:56
PHP
kuzyairon, 2020-05-14 21:48:56

How to upload string from mysql database to url?

Here is the code

$bd = mysqli_connect('localhost', 'root', 'root', 'key'); // делаем коннект к базе данных

$sql = mysqli_query($bd, "SELECT number FROM `number`"); // $sql - переменная и делаем запрос ВЫБРАТЬ колонку(number) из Таблицы(number)
$row = mysqli_fetch_array($sql);  
//echo $row ['number']; // возвращаем строку
if (!$row) { // выполняем условие, если не срабатывает предыдущее.
  exit("Не возможно отобразить файл");

}


$path = substr ($_SERVER['PHP_SELF'],0,STRRPOS($_server['PHP_SELF'],"/"));

echo "<a href='http://localhost/".$_SERVER[''].$path."datatime.php?hash=".$row."'>http://localhost/".$_SERVER['HOST_HTTP'].$path."datatime.php?hash=".$row."</a>";


When I make a request, it displays
localhost/datatime.php?hash=Array
But I need to display the line itself from the database, how can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
topalek, 2020-05-14
@topalek

mysqli_fetch_array Function Fetches a single row from the result set and places it in an associative array, regular array, or both. Accordingly, you need to access the desired element of the array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question