PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи

Страниц (2): [1] 2 »

> Найдено сообщений: 27
sochirf Отправлено: 14 Ноября, 2015 - 11:11:25 • Тема: Помогите заменить mysql код на mysqli • Форум: Вопросы новичков

Ответов: 0
Просмотров: 161
CODE (htmlphp):
скопировать код в буфер обмена
  1. <?
  2. $hostname = "localhost";
  3. $username = "c10646_tyuiop";
  4. $password = "qwertyuio";
  5. $dbName = "c10691_php";
  6.  
  7. $table = "zapros";
  8. mysql_connect($hostname, $username, $password) or die ("Не могу создать соединение");
  9.  
  10. $query = "SELECT id, rayban FROM $table";
  11. $res = mysql_query($query) or die(mysql_error());
  12. echo $res;
  13. ?>

(Добавление)
Спасибо решил
sochirf Отправлено: 04 Ноября, 2015 - 13:43:22 • Тема: Где ошибка в кавычках не могу найти • Форум: Вопросы новичков

Ответов: 5
Просмотров: 256
SAD пишет:
title="' . $content->ad_headline . '"


Спасибо!!!
sochirf Отправлено: 04 Ноября, 2015 - 09:42:13 • Тема: Где ошибка в кавычках не могу найти • Форум: Вопросы новичков

Ответов: 5
Просмотров: 256
SAD пишет:
Даю намёк, title


Не доходит)))
sochirf Отправлено: 04 Ноября, 2015 - 08:31:37 • Тема: Где ошибка в кавычках не могу найти • Форум: Вопросы новичков

Ответов: 5
Просмотров: 256
Не могу сообразить где что лишнее поставил...

echo '<img src="'.$this->baseurl.'images/com_adsmanager/photo/'.$foto.'" title="$content->ad_headline" />';
sochirf Отправлено: 18 Октября, 2015 - 13:58:27 • Тема: Как сделать переменную глобальной? • Форум: Вопросы новичков

Ответов: 5
Просмотров: 222
Да ваш код работает. Но в модуле сайта на joomla невыводит Огорчение
sochirf Отправлено: 18 Октября, 2015 - 12:37:20 • Тема: Как сделать переменную глобальной? • Форум: Вопросы новичков

Ответов: 5
Просмотров: 222
Не работает. В чем может быть причина?
sochirf Отправлено: 18 Октября, 2015 - 10:22:27 • Тема: Как сделать переменную глобальной? • Форум: Вопросы новичков

Ответов: 5
Просмотров: 222
CODE (htmlphp):
скопировать код в буфер обмена
  1. $a_city = $city['city']['name_ru'];
  2. echo $a_city;
  3.  
  4.  
  5. $var = $a_city;
  6. test ($var);
  7. function test($var) {
  8.  global $my_var;
  9. }
  10.  
  11. //Где то ошибка?
sochirf Отправлено: 14 Октября, 2015 - 13:48:06 • Тема: Выбор из массива MIN • Форум: Вопросы новичков

Ответов: 7
Просмотров: 294
Это я понял мне нужно выбрать одно минимальное значение кроме 0
sochirf Отправлено: 14 Октября, 2015 - 13:32:05 • Тема: Выбор из массива MIN • Форум: Вопросы новичков

Ответов: 7
Просмотров: 294
Что то не очень понял)))
sochirf Отправлено: 14 Октября, 2015 - 13:23:52 • Тема: Выбор из массива MIN • Форум: Вопросы новичков

Ответов: 7
Просмотров: 294
Подскажите пожалуйста!

есть 4 переменные в массиве $a=0, $b=2, $c=16, $d=64
Необходимо получить одно Минимальное значение кроме нуля.

Т.е вывести 2.
sochirf Отправлено: 05 Октября, 2015 - 13:12:30 • Тема: Какой функцией можно получить к примеру 5 строку из массива • Форум: Вопросы новичков

Ответов: 2
Просмотров: 161
array (
'city' =>
array (
'id' => 491422,
'lat' => 43.5991700000000008685674401931464672088623046875,
'lon' => 39.7256900000000001682565198279917240142822265625,
'name_ru' => 'Москва',
'name_en' => 'Moscow',
),
sochirf Отправлено: 03 Октября, 2015 - 11:20:20 • Тема: sypexgeo Вывести город из бинарной базы .dat по ip • Форум: SQL и Архитектура БД

Ответов: 0
Просмотров: 5357
Доброе утро. Как получить переменную о Городе?

Скрипт SypexGeo выводит много лишней инфо:

CODE (htmlphp):
скопировать код в буфер обмена
  1. <?php
  2. define ('SXGEO_FILE', 0);
  3. define ('SXGEO_MEMORY', 1);
  4. define ('SXGEO_BATCH',  2);
  5. class SxGeo {
  6.         protected $fh;
  7.         protected $ip1c;
  8.         protected $info;
  9.         protected $range;
  10.         protected $db_begin;
  11.         protected $b_idx_str;
  12.         protected $m_idx_str;
  13.         protected $b_idx_arr;
  14.         protected $m_idx_arr;
  15.         protected $m_idx_len;
  16.         protected $db_items;
  17.         protected $country_size;
  18.         protected $db;
  19.         protected $regions_db;
  20.         protected $cities_db;
  21.  
  22.         public $id2iso = array(
  23.                 '', 'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'CW', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU',
  24.                 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS',
  25.                 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN',
  26.                 'CO', 'CR', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG',
  27.                 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'SX', 'GA', 'GB', 'GD', 'GE', 'GF',
  28.                 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN',
  29.                 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE',
  30.                 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR',
  31.                 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP',
  32.                 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI',
  33.                 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN',
  34.                 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG',
  35.                 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY', 'SZ', 'TC', 'TD', 'TF',
  36.                 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TL', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM',
  37.                 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'RS', 'ZA',
  38.                 'ZM', 'ME', 'ZW', 'A1', 'XK', 'O1', 'AX', 'GG', 'IM', 'JE', 'BL', 'MF', 'BQ', 'SS'
  39.         );
  40.  
  41.         public $batch_mode  = false;
  42.         public $memory_mode = false;
  43.  
  44.         public function __construct($db_file = 'SxGeo.dat', $type = SXGEO_FILE){
  45.                 $this->fh = fopen($db_file, 'rb');
  46.                 // Сначала убеждаемся, что есть файл базы данных
  47.                 $header = fread($this->fh, 40); // В версии 2.2 заголовок увеличился на 8 байт
  48.                 if(substr($header, 0, 3) != 'SxG') die("Can't open {$db_file}\n");
  49.                 $info = unpack('Cver/Ntime/Ctype/Ccharset/Cb_idx_len/nm_idx_len/nrange/Ndb_items/Cid_len/nmax_region/nmax_city/Nregion_size/Ncity_size/nmax_country/Ncountry_size/npack_size', substr($header, 3));
  50.                 if($info['b_idx_len'] * $info['m_idx_len'] * $info['range'] * $info['db_items'] * $info['time'] * $info['id_len'] == 0) die("Wrong file format {$db_file}\n");
  51.                 $this->range       = $info['range'];
  52.                 $this->b_idx_len   = $info['b_idx_len'];
  53.                 $this->m_idx_len   = $info['m_idx_len'];
  54.                 $this->db_items    = $info['db_items'];
  55.                 $this->id_len      = $info['id_len'];
  56.                 $this->block_len   = 3 + $this->id_len;
  57.                 $this->max_region  = $info['max_region'];
  58.                 $this->max_city    = $info['max_city'];
  59.                 $this->max_country = $info['max_country'];
  60.                 $this->country_size= $info['country_size'];
  61.                 $this->batch_mode  = $type & SXGEO_BATCH;
  62.                 $this->memory_mode = $type & SXGEO_MEMORY;
  63.                 $this->pack        = $info['pack_size'] ? explode("\0", fread($this->fh, $info['pack_size'])) : '';
  64.                 $this->b_idx_str   = fread($this->fh, $info['b_idx_len'] * 4);
  65.                 $this->m_idx_str   = fread($this->fh, $info['m_idx_len'] * 4);
  66.  
  67.                 $this->db_begin = ftell($this->fh);
  68.                 if ($this->batch_mode) {
  69.                         $this->b_idx_arr = array_values(unpack("N*", $this->b_idx_str)); // Быстрее в 5 раз, чем с циклом
  70.                         unset ($this->b_idx_str);
  71.                         $this->m_idx_arr = str_split($this->m_idx_str, 4); // Быстрее в 5 раз чем с циклом
  72.                         unset ($this->m_idx_str);
  73.                 }
  74.                 if ($this->memory_mode) {
  75.                         $this->db  = fread($this->fh, $this->db_items * $this->block_len);
  76.                         $this->regions_db = $info['region_size'] > 0 ? fread($this->fh, $info['region_size']) : '';
  77.                         $this->cities_db  = $info['city_size'] > 0 ? fread($this->fh, $info['city_size']) : '';
  78.                 }
  79.                 $this->info = $info;
  80.                 $this->info['regions_begin'] = $this->db_begin + $this->db_items * $this->block_len;
  81.                 $this->info['cities_begin']  = $this->info['regions_begin'] + $info['region_size'];
  82.         }
  83.  
  84.         protected function search_idx($ipn, $min, $max){
  85.                 if($this->batch_mode){
  86.                         while($max - $min > 8){
  87.                                 $offset = ($min + $max) >> 1;
  88.                                 if ($ipn > $this->m_idx_arr[$offset]) $min = $offset;
  89.                                 else $max = $offset;
  90.                         }
  91.                         while ($ipn > $this->m_idx_arr[$min] && $min++ < $max){};
  92.                 }
  93.                 else {
  94.                         while($max - $min > 8){
  95.                                 $offset = ($min + $max) >> 1;
  96.                                 if ($ipn > substr($this->m_idx_str, $offset*4, 4)) $min = $offset;
  97.                                 else $max = $offset;
  98.                         }
  99.                         while ($ipn > substr($this->m_idx_str, $min*4, 4) && $min++ < $max){};
  100.                 }
  101.                 return  $min;
  102.         }
  103.  
  104.         protected function search_db($str, $ipn, $min, $max){
  105.                 if($max - $min > 1) {
  106.                         $ipn = substr($ipn, 1);
  107.                         while($max - $min > 8){
  108.                                 $offset = ($min + $max) >> 1;
  109.                                 if ($ipn > substr($str, $offset * $this->block_len, 3)) $min = $offset;
  110.                                 else $max = $offset;
  111.                         }
  112.                         while ($ipn >= substr($str, $min * $this->block_len, 3) && ++$min < $max){};
  113.                 }
  114.                 else {
  115.                         $min++;
  116.                 }
  117.                 return hexdec(bin2hex(substr($str, $min * $this->block_len - $this->id_len, $this->id_len)));
  118.         }
  119.  
  120.         public function get_num($ip){
  121.                 $ip1n = (int)$ip; // Первый байт
  122.                 if($ip1n == 0 || $ip1n == 10 || $ip1n == 127 || $ip1n >= $this->b_idx_len || false === ($ipn = ip2long($ip))) return false;
  123.                 $ipn = pack('N', $ipn);
  124.                 $this->ip1c = chr($ip1n);
  125.                 // Находим блок данных в индексе первых байт
  126.                 if ($this->batch_mode){
  127.                         $blocks = array('min' => $this->b_idx_arr[$ip1n-1], 'max' => $this->b_idx_arr[$ip1n]);
  128.                 }
  129.                 else {
  130.                         $blocks = unpack("Nmin/Nmax", substr($this->b_idx_str, ($ip1n - 1) * 4, 8));
  131.                 }
  132.                 if ($blocks['max'] - $blocks['min'] > $this->range){
  133.                         // Ищем блок в основном индексе
  134.                         $part = $this->search_idx($ipn, floor($blocks['min'] / $this->range), floor($blocks['max'] / $this->range)-1);
  135.                         // Нашли номер блока в котором нужно искать IP, теперь находим нужный блок в БД
  136.                         $min = $part > 0 ? $part * $this->range : 0;
  137.                         $max = $part > $this->m_idx_len ? $this->db_items : ($part+1) * $this->range;
  138.                         // Нужно проверить чтобы блок не выходил за пределы блока первого байта
  139.                         if($min < $blocks['min']) $min = $blocks['min'];
  140.                         if($max > $blocks['max']) $max = $blocks['max'];
  141.                 }
  142.                 else {
  143.                         $min = $blocks['min'];
  144.                         $max = $blocks['max'];
  145.                 }
  146.                 $len = $max - $min;
  147.                 // Находим нужный диапазон в БД
  148.                 if ($this->memory_mode) {
  149.                         return $this->search_db($this->db, $ipn, $min, $max);
  150.                 }
  151.                 else {
  152.                         fseek($this->fh, $this->db_begin + $min * $this->block_len);
  153.                         return $this->search_db(fread($this->fh, $len * $this->block_len), $ipn, 0, $len);
  154.                 }
  155.         }
  156.  
  157.         protected function readData($seek, $max, $type){
  158.                 $raw = '';
  159.                 if($seek && $max) {
  160.                         if ($this->memory_mode) {
  161.                                 $raw = substr($type == 1 ? $this->regions_db : $this->cities_db, $seek, $max);
  162.                         } else {
  163.                                 fseek($this->fh, $this->info[$type == 1 ? 'regions_begin' : 'cities_begin'] + $seek);
  164.                                 $raw = fread($this->fh, $max);
  165.                         }
  166.                 }
  167.                 return $this->unpack($this->pack[$type], $raw);
  168.         }
  169.  
  170.         protected function parseCity($seek, $full = false){
  171.                 if(!$this->pack) return false;
  172.                 $only_country = false;
  173.                 if($seek < $this->country_size){
  174.                         $country = $this->readData($seek, $this->max_country, 0);
  175.                         $city = $this->unpack($this->pack[2]);
  176.                         $city['lat'] = $country['lat'];
  177.                         $city['lon'] = $country['lon'];
  178.                         $only_country = true;
  179.                 }
  180.                 else {
  181.                         $city = $this->readData($seek, $this->max_city, 2);
  182.                         $country = array('id' => $city['country_id'], 'iso' => $this->id2iso[$city['country_id']]);
  183.                         unset($city['country_id']);
  184.                 }
  185.                 if($full) {
  186.                         $region = $this->readData($city['region_seek'], $this->max_region, 1);
  187.                         if(!$only_country) $country = $this->readData($region['country_seek'], $this->max_country, 0);
  188.                         unset($city['region_seek']);
  189.                         unset($region['country_seek']);
  190.                         return array('city' => $city, 'region' => $region, 'country' => $country);
  191.                 }
  192.                 else {
  193.                         unset($city['region_seek']);
  194.                         return array('city' => $city, 'country' => array('id' => $country['id'], 'iso' => $country['iso']));
  195.                 }
  196.         }
  197.  
  198.         protected function unpack($pack, $item = ''){
  199.                 $unpacked = array();
  200.                 $empty = empty($item);
  201.                 $pack = explode('/', $pack);
  202.                 $pos = 0;
  203.                 foreach($pack AS $p){
  204.                         list($type, $name) = explode(':', $p);
  205.                         $type0 = $type{0};
  206.                         if($empty) {
  207.                                 $unpacked[$name] = $type0 == 'b' || $type0 == 'c' ? '' : 0;
  208.                                 continue;
  209.                         }
  210.                         switch($type0){
  211.                                 case 't':
  212.                                 case 'T': $l = 1; break;
  213.                                 case 's':
  214.                                 case 'n':
  215.                                 case 'S': $l = 2; break;
  216.                                 case 'm':
  217.                                 case 'M': $l = 3; break;
  218.                                 case 'd': $l = 8; break;
  219.                                 case 'c': $l = (int)substr($type, 1); break;
  220.                                 case 'b': $l = strpos($item, "\0", $pos)-$pos; break;
  221.                                 default: $l = 4;
  222.                         }
  223.                         $val = substr($item, $pos, $l);
  224.                         switch($type0){
  225.                                 case 't': $v = unpack('c', $val); break;
  226.                                 case 'T': $v = unpack('C', $val); break;
  227.                                 case 's': $v = unpack('s', $val); break;
  228.                                 case 'S': $v = unpack('S', $val); break;
  229.                                 case 'm': $v = unpack('l', $val . (ord($val{2}) >> 7 ? "\xff" : "\0")); break;
  230.                                 case 'M': $v = unpack('L', $val . "\0"); break;
  231.                                 case 'i': $v = unpack('l', $val); break;
  232.                                 case 'I': $v = unpack('L', $val); break;
  233.                                 case 'f': $v = unpack('f', $val); break;
  234.                                 case 'd': $v = unpack('d', $val); break;
  235.  
  236.                                 case 'n': $v = current(unpack('s', $val)) / pow(10, $type{1}); break;
  237.                                 case 'N': $v = current(unpack('l', $val)) / pow(10, $type{1}); break;
  238.  
  239.                                 case 'c': $v = rtrim($val, ' '); break;
  240.                                 case 'b': $v = $val; $l++; break;
  241.                         }
  242.                         $pos += $l;
  243.                         $unpacked[$name] = is_array($v) ? current($v) : $v;
  244.                 }
  245.                 return $unpacked;
  246.         }
  247.  
  248.         public function get($ip){
  249.                 return $this->max_city ? $this->getCity($ip) : $this->getCountry($ip);
  250.         }
  251.         public function getCountry($ip){
  252.                 if($this->max_city) {
  253.                         $tmp = $this->parseCity($this->get_num($ip));
  254.                         return $tmp['country']['iso'];
  255.                 }
  256.                 else return $this->id2iso[$this->get_num($ip)];
  257.         }
  258.         public function getCountryId($ip){
  259.                 if($this->max_city) {
  260.                         $tmp = $this->parseCity($this->get_num($ip));
  261.                         return $tmp['country']['id'];
  262.                 }
  263.                 else return $this->get_num($ip);
  264.         }
  265.         public function getCity($ip){
  266.                 $seek = $this->get_num($ip);
  267.                 return $seek ? $this->parseCity($seek) : false;
  268.         }
  269.         public function getCityFull($ip){
  270.                 $seek = $this->get_num($ip);
  271.                 return $seek ? $this->parseCity($seek, 1) : false;
  272.         }
  273.         public function about(){
  274.                 $charset = array('utf-8', 'latin1', 'cp1251');
  275.                 $types   = array('n/a', 'SxGeo Country', 'SxGeo City RU', 'SxGeo City EN', 'SxGeo City', 'SxGeo City Max RU', 'SxGeo City Max EN', 'SxGeo City Max');
  276.                 return array(
  277.                         'Created' => date('Y.m.d', $this->info['time']),
  278.                         'Timestamp' => $this->info['time'],
  279.                         'Charset' => $charset[$this->info['charset']],
  280.                         'Type' => $types[$this->info['type']],
  281.                         'Byte Index' => $this->b_idx_len,
  282.                         'Main Index' => $this->m_idx_len,
  283.                         'Blocks In Index Item' => $this->range,
  284.                         'IP Blocks' => $this->db_items,
  285.                         'Block Size' => $this->block_len,
  286.                         'City' => array(
  287.                                 'Max Length' => $this->max_city,
  288.                                 'Total Size' => $this->info['city_size'],
  289.                         ),
  290.                         'Region' => array(
  291.                                 'Max Length' => $this->max_region,
  292.                                 'Total Size' => $this->info['region_size'],
  293.                         ),
  294.                         'Country' => array(
  295.                                 'Max Length' => $this->max_country,
  296.                                 'Total Size' => $this->info['country_size'],
  297.                         ),
  298.                 );
  299.         }
  300. }
  301. $SxGeo = new SxGeo('SxGeoCity.dat');
  302. $ip = $_SERVER['REMOTE_ADDR'];
  303. var_export($SxGeo->getCityFull($ip));


// Вся информация о городе
sochirf Отправлено: 03 Октября, 2015 - 11:14:31 • Тема: как получить количество вхождений текста LIKE= ".jpg" в таблице с id=1 • Форум: SQL и Архитектура БД

Ответов: 6
Просмотров: 41
Я понимаю что это извращение, но таблица сторонних разработчиков, и в ней нет данных о количестве изобр.
Но я уже решил проблему (нашел переменную о кол-ве jpg.
Все равно спасибо.
sochirf Отправлено: 27 Сентября, 2015 - 15:55:55 • Тема: как получить количество вхождений текста LIKE= ".jpg" в таблице с id=1 • Форум: SQL и Архитектура БД

Ответов: 6
Просмотров: 41
Подскажите почему может не работать echo в выборке из колонки images

Со всех таблиц все выводится а в колонке images содержится текст в виде:


[{"index":1,"image":"land-rover-range-rover-sport-2011_1_1.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_1_t.jpg","medium":"land-rover-range-rover-sport-2011_1_1_m.jpg"},{"index":2,"image":"land-rover-range-rover-sport-2011_1_2.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_2_t.jpg","medium":"land-rover-range-rover-sport-2011_1_2_m.jpg"},{"index":3,"image":"land-rover-range-rover-sport-2011_1_3.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_3_t.jpg","medium":"land-rover-range-rover-sport-2011_1_3_m.jpg"},{"index":4,"image":"land-rover-range-rover-sport-2011_1_4.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_4_t.jpg","medium":"land-rover-range-rover-sport-2011_1_4_m.jpg"},{"index":5,"image":"land-rover-range-rover-sport-2011_1_5.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_5_t.jpg","medium":"land-rover-range-rover-sport-2011_1_5_m.jpg"},{"index":6,"image":"land-rover-range-rover-sport-2011_1_6.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_6_t.jpg","medium":"land-rover-range-rover-sport-2011_1_6_m.jpg"},{"index":7,"image":"land-rover-range-rover-sport-2011_1_7.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_7_t.jpg","medium":"land-rover-range-rover-sport-2011_1_7_m.jpg"},{"index":8,"image":"land-rover-range-rover-sport-2011_1_8.jpg","thumbnail":"land-rover-range-rover-sport-2011_1_8_t.jpg","medium":"land-rover-range-rover-sport-2011_1_8_m.jpg"}]


код запроса примерно такой:

CODE (htmlphp):
скопировать код в буфер обмена
  1. $resphoto = mysql_query("SELECT * FROM manager_ads WHERE id=$content->id");
  2. $myrow = mysql_fetch_array($resphoto);
  3. $myid_photo=$myrow['images'];
  4. $trt = substr_count($myid_photo, ".jpg");
  5. $iphoto = $trt / 3;
sochirf Отправлено: 27 Сентября, 2015 - 12:21:03 • Тема: как получить количество вхождений текста LIKE= ".jpg" в таблице с id=1 • Форум: SQL и Архитектура БД

Ответов: 6
Просмотров: 41
Не работает
(Добавление)
sochirf пишет:
Не работает

да забыл указать что выборка происходит в колонке images где id=1

Страниц (2): [1] 2 »
Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB