mam problem chcialbym wyswietlic date i 100 pierwszych slow z bazy danych jesli pomoze to pokaze odczyt z selecta
znajduje sie
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 41 w lini 41
i wyciaga mi wszystko po dacie ale nie wyswietla skroconego tekstu tylko caly tekst
i dalej jest blad w lini 41
$query = mysql_query ("SELECT `data`, `SUBSTRING(tresc, 0, 100)` FROM `sport` ORDER BY data DESC" );
$query = mysql_query ("SELECT `data`, SUBSTRING(`tresc`, 0, 100) FROM `sport` ORDER BY data DESC" );
Notice: Undefined index: zrodlo in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 45 Notice: Undefined index: image in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 46 Notice: Undefined index: login in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 47 Notice: Undefined index: temat in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 48 Notice: Undefined index: tresc in C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php on line 49
$query = mysql_query ("SELECT `data`, SUBSTRING(`tresc`, 0, 100) FROM `sport` ORDER BY data DESC" ); echo "<img id='img' src='{$shout['image']}'/>" .'<b id="autor"> '.'Autor: '.$shout['login'].'</b> ' .'</br>' .'<h1 id="temat">'.$shout['temat'].'</h1> ' .'</br>' .'<p id="art_tre">'.$shout['tresc'] .'</p>'.'</br>' .'<br/>' .'Czas Napisania: '.$shout['data'] .'</br>' .'</div></div>'; }
$ip = $_SERVER['REMOTE_ADDR']; mysql_query ("INSERT INTO `sport` (`zrodlo`, `image`,`login`, `data`, `ip`, `tresc`, `temat`) VALUES('$zrodlo' ,'$image', '$login', '$data', '$ip', '$tresc', '$temat')"); } else { $query = mysql_query ("SELECT `data`, SUBSTRING(`tresc`, 0, 100) FROM `sport` ORDER BY data DESC" ); echo "<img id='img' src='{$shout['image']}'/>" .'<b id="autor"> '.'Autor: '.$shout['login'].'</b> ' .'</br>' .'<h1 id="temat">'.$shout['temat'].'</h1> ' .'</br>' .'<p id="art_tre">'.$shout['tresc'] .'</p>'.'</br>' .'<br/>' .'Czas Napisania: '.$shout['data'] .'</br>' .'</div></div>'; } }
<form action="sport.php" method="POST"> <input type="url" name="zrodlo" class="wyg_input" autocomplete="off" required placeholder="Podaj link skąd wzięty został artykuł..."/> <input type="url" name="image" class="wyg_input" autocomplete="off" required placeholder="Podaj link do zdjęcia..."/> <input type="text" name="login" class="wyg_input" required placeholder="Podaj swój nick..."/> <input type="text" name="temat" class="wyg_input" required autocomplete="off" placeholder="Podaj treść twojego tematu... "/> </form>
to wszystko działa
to już nie działa
$query = mysql_query ("SELECT `data`, SUBSTRING(`tresc`, 0, 100) FROM `sport` ORDER BY data DESC" );
$query = mysql_query ("SELECT `data`, `zrodlo`, `login`, `image`, `ip`, `temat`, SUBSTRING(0, 100) as `tresc` FROM `sport` ORDER BY `tresc` DESC" );
$query = mysql_query ("SELECT `data`, `zrodlo`, `login`, `image`, `ip`, `temat`, SUBSTRING(0, 100) as `tresc` FROM `sport` ORDER BY `data` DESC" );
[0]=> string(19) "2015-01-08 11:07:16" ["data"]=> string(19) "2015-01-08 11:07:16" [1]=> string(62) "http://wiadomosci.onet.pl/tylko-w-onecie/je-suis-charlie/zjr5l" ["zrodlo"]=> string(62) "http://wiadomosci.onet.pl/tylko-w-onecie/je-suis-charlie/zjr5l" [2]=> string(10) "jaca121212" ["login"]=> string(10) "jaca121212" [3]=> string(171) "http://ocdn.eu/images/pulscms/NGQ7MDQsMmM2LDRmZCxiM2EsNWFlOzA2LDM2NiwxYjg7MGMsMjc0YzFkNjQ2NzA4MmMzZTZkZmU5ZDA5
ZjRhNmRmNmIsMSwxLDAsMA__/114e12a82c3289fa9daec131539fdb1f.jpg" ["image"]=> string(171) "http://ocdn.eu/images/pulscms/NGQ7MDQsMmM2LDRmZCxiM2EsNWFlOzA2LDM2NiwxYjg7MGMsMjc0YzFkNjQ2NzA4MmMzZTZkZmU5ZDA5
ZjRhNmRmNmIsMSwxLDAsMA__/114e12a82c3289fa9daec131539fdb1f.jpg" [4]=> string(15) "Je suis Charlie" ["temat"]=> string(15) "Je suis Charlie" [5]=> string(0) "" ["tresc"]=> string(0) "" } C:\xampp\htdocs\test\log_rej\pliki\pliki\sport.php: 47
<form action="sport.php" method="POST"> <input type="url" name="zrodlo" class="wyg_input" autocomplete="off" required placeholder="Podaj link skąd wzięty został artykuł..."/> <input type="url" name="image" class="wyg_input" autocomplete="off" required placeholder="Podaj link do zdjęcia..."/> <input type="text" name="login" class="wyg_input" required placeholder="Podaj swój nick..."/> <input type="text" name="temat" class="wyg_input" required autocomplete="off" placeholder="Podaj treść twojego tematu... "/> </form>
<?php ?> <?php { $ip = $_SERVER['REMOTE_ADDR']; mysql_query ("INSERT INTO `sport` (`zrodlo`, `image`,`login`, `data`, `ip`, `tresc`, `temat`) VALUES('$zrodlo' ,'$image', '$login', '$data', '$ip', '$tresc', '$temat')"); } else { $query = mysql_query ("SELECT `data`, `zrodlo`, `login`, `image`, `temat`, SUBSTRING(0, 100) as `tresc` FROM `sport` ORDER BY `data` DESC" ); echo "<img id='img' src='{$shout['image']}'/>" .'<b id="autor"> '.'Autor: '.$shout['login'].'</b> ' .'</br>' .'<h1 id="temat">'.$shout['temat'].'</h1> ' .'</br>' .'<p id="art_tre">'.$shout['tresc'] .'</p>'.'</br>' .'<br/>' .'Czas Napisania: '.$shout['data'] .'</br>' .'</div></div>'; } } ?>
$query = mysql_query ("SELECT `data`, `zrodlo`, `login`, `image`, `temat`, SUBSTRING(`tresc`, 0, 100) AS `tresc` FROM `tematy` ORDER BY `data` DESC" );
SELECT `data`, `zrodlo`, `login`, `image`, `temat`, `tresc`, SUBSTRING(`tresc`, 0, 100) AS `tmp` FROM `tematy` ORDER BY `data` DESC