$ret = '';
foreach ($list as $rs) {
$ret .= '<li>';
$ret .= '<h2>'.$rs['title'].'</h2>';
$ret .= '<img src="'.$rs['photo'].'">';
$ret .= '<p>'.$rs['description'].'</p>';
$ret .= '</li>';
}
echo $ret;
$news = $mysqli -> query("SELECT id, title, description, img_url
FROM news
ORDER BY id DESC
LIMIT $to, $limit");
$news = $mysqli -> query('SELECT id, title, description, img_url
FROM news
ORDER BY id DESC
LIMIT '. $to. ', '. $limit);
encodeURIComponent(t("inbound6session"))
<?
$name = $_POST['name'];
$phone = $_POST['phone'];
mail('yourmail@gmail.com', 'Code test', 'Message: '. $name .' - '. $phone);
<?
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if( $error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
echo format_error( $errno, $errstr, $errfile, $errline);
}
}
function format_error( $errno, $errstr, $errfile, $errline ) {
$trace = print_r( debug_backtrace( false ), true );
$content = '<table style="background-color: #FFFFFF;margin: 0 auto;">
<thead><th style="width: 100px;">Item</th><th>Description</th></thead>
<tbody>
<tr>
<th>Error</th>
<td><pre>'.$errstr.'</pre></td>
</tr>
<tr>
<th>Errno</th>
<td><pre>'.$errno.'</pre></td>
</tr>
<tr>
<th>File</th>
<td>'.$errfile.'</td>
</tr>
<tr>
<th>Line</th>
<td>'.$errline.'</td>
</tr>
<tr>
<th>Trace</th>
<td><pre>'.$trace.'</pre></td>
</tr>
</tbody>
</table>';
return $content;
}
class PHPFatalError
{
public function set_handler() {
register_shutdown_function(array($this, 'handle_shutdown'));
}
public function handle_shutdown() {
if (($error = error_get_last())) {
// echo сообщения о деталях ошибки
}
}
}
$(function() {
$('.col').on('click', function(){
var SimulatorsIdData = $(this).data('one');
$.post('/server_side.php', {id: SimulatorsIdData}, function(data){
// внутри data будет то, что вы отправите в ответ на запрос. То есть результат SQL-запроса в нужном виде
}, 'json'); // ответ придет в формате json
});
});
$error = FALSE;
// ... какая-то логика
if(isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) !== FALSE) {
$email = $_POST["email"];
} else
$error = 'emailError'; // или текст ошибки или просто TRUE, если нет нужды уточнять
// ... другая логика
if($error === FALSE)
{
mail($sendToEmail, $subject, $content, $senderEmailId);
header("Location: thankyou.php");
}
// ... снова логика
$results = $xpath->query('//div[@class="example"]'); // тут путь до элемента, внутренности которого нужны
$innerHTML = '';
$children = $results->item(0)->childNodes;
foreach ($children as $child)
$innerHTML .= $results->item(0)->ownerDocument->saveHTML($child);
echo $innerHTML; // тут все внутренности
//*[text()[contains(normalize-space(.),"Employment type")]]
//div[contains(@class, "some-class")]/div/span[1]/following-sibling::text()
//div[contains(@class, "some-class")]/div/text()[normalize-space()]
$xml = '<CurrencyRateListAnswer>
<Result>
<Content>
<Item FirstCode="USD" SecondCode="RUB">69.966015</Item>
<Item FirstCode="CNY" SecondCode="KZT">50.799100</Item>
<Item FirstCode="RUB" SecondCode="KZT">4.859019</Item>
<Item FirstCode="USD" SecondCode="KZT">323.777331</Item>
<Item FirstCode="RUB" SecondCode="CNY">0.091096</Item>
<Item FirstCode="USD" SecondCode="CNY">6.070173</Item>
</Content>
</Result>
</CurrencyRateListAnswer>';
$dom = new DOMDocument('UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);
$query = $xpath->query('//Item[@FirstCode="USD" and @SecondCode="KZT"]');
echo $query->item(0)->nodeValue; // 323.777331