Hello. I'm sitting on the 5th day (not counting the weekend) with a trable. Made on php something like a module of VIP ads on the site. The module is working (at first there was a rotator on jquery, then it went down to the random output of the 1st ad) with the included module the site is displayed correctly BUT! the server's answer comes not 200, but 500 O_o. He came to the conclusion that something in ignorance nakosyachil. Please correct this for how it should be correct.
$db = mysql_connect("","",""); //проверка имени и пароля и соединение с базой данных mysql_select_db("",$db); //выборка определенной базы данных mysql_query('SET NAMES utf8'); $result = mysql_query("SELECT LEFT(text, 200) as text, img, contact, sort, what FROM vips order by rand() limit 1",$db); // выборка с базы данных из таблицы table if(!$result) // если нет результата выбовки { echo "<p>Запрос выборки из базы данных не прошел. Напишите, об этом администрацию: mail@life-prog.ru. <br>Код ошибки:</p>"; exit(mysql_error()); //печатание кода ошибки } if (mysql_num_rows($result) > 0) //если выборка произошла { $array = mysql_fetch_array($result); //перекидываем выборку в массив do { echo "<li onclick=\"facechange('.blya');$('#pikame').PikaChoose({startOn:".$array['sort'].", autoPlay:false, showCaption:true});hider1('.hiderrr'); return false;\"> <div class=ttop valign=bottom></div> <img border=0 align=left hspace=13 src=".$array['img']." width=100> <h3 class=radv>".$array['what']."</h3> <p>".$array['text']."</p><br> <div class=bott><span class=contactt valign=bottom>".$array['contact']."</span> </div> </li>"; } while($array = mysql_fetch_array($result)); exit(); } else {echo "Информация не может быть извлечена. В таблице нет записей"; exit(); //остановка вывода в браузер } ?>
UPD.
.htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule> # Кэширование на стороне браузера (отдаем нормальные заголовки) <IfModule mod_expires.c> # Включаем ExpiresActive On # Кэшировать браузером все файлы в течении двух недель (в секундах). ExpiresDefault A1209600 # Не кэшировать файлы, имеющие тип ExpiresByType text/html A1 </IfModule>