Hello. The idea is: there is a MySQL table, say, with 2 columns:
- The id column, which is Primary Key Not NULL AUTO INKREMENT
- A column with a numeric value (price or number, whatever).
How to unload all the values understood, and how to unload the values of the second column depending on id, yet. Everything is invoked through PHP .
I added the question to what I managed to do on my own. PHP knowledge is not enough.
<?php ini_set('display_errors','On'); error_reporting(E_ALL);//показ всех ошибок $host = 'localhost'; // имя хоста $database = 'test_sql'; // имя базы данных $user = 'root'; // имя пользователя $pswd = ''; // пароль $dbh = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL.");//соединение с бд mysql_select_db($database) or die("Не могу подключиться к базе."); $query = "SELECT * FROM `oc_product`";//выгрузка из таблицы $res = mysql_query($query); $row = mysql_fetch_array($res);//вызов массива while($row = mysql_fetch_array($res)){ echo "ID: ".$row['product_id']."<br>";//вывод всех id echo "Цена: ".$row['price']."<br>";//вывод всех цен } ?>
select поле from table where id=X- Mike