$total_inserted = 0;
foreach ($comArr as $key => $value) {
$postId = $value['postId'];
$id = $value['id'];
$name = $value['name'];
$email = $value['email'];
$body = $value['body'];
// заносим в БД
$comSql = "INSERT INTO `comments` (`postId`, `id`, `name`, `email`, `body`)
VALUES ('$postId', '$id ', '$name','$email','$body')";
if (mysqli_query($conn, $comSql)) {
$total_inserted++;
}
}
echo 'Всего добавлено:' . $total_inserted;
INSERT INTO reg (id, name, phone, login, password) VALUES (NULL,$name,$number,$login,$password);
select id,type from table where type='active'
, я думаю результату оч сложно будет скушать много памяти.select title, content from table where id=1;
$("#form1").submit(function(e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
$.ajax({
type: "POST",
url: '/php/code.php', //возможно тут нужен полный путь к файлу типа http://myweb.ru....
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
});
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
$conn->close();
?>
curl_setopt($ch, CURLOPT_POSTFIELDS,"file=@curriculum.html&source=en&target=fr");
<?php
$re = '/(\d{2}\.\d{2}\.\d{4})/m';
$str = 'только в формате 10.10.2020, если формат ввода не совпадает, должно выдать ошибку';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.example.com/tester.phtml");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"postvar1=value1&postvar2=value2&postvar3=value3");
// In real life you should use something like:
// curl_setopt($ch, CURLOPT_POSTFIELDS,
// http_build_query(array('postvar1' => 'value1')));
// Receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
// Further processing ...
if ($server_output == "OK") { ... } else { ... }
?>
//Author PunBB
//Created 03/02/2017
//подготавливаем массив, к примеру на русском
$lang_pan_statistic = array (
'views_one' => 'просмотр',
'views_several' => 'просмотра',
'views_many' => 'просмотров',
'users_one' => 'посетитель',
'users_several' => 'посетителя',
'users_many' => 'посетителей',
);
function pan_fw_nouns_after_num($count, $form1='', $form2='', $form3='')
{
global $forum_user;
$binary = abs($count) % 100;
$single = $count % 10;
if ($forum_user['language'] == 'Russian')
{
if ($binary >= 11 && $binary <= 19)
return($form3);
if ($single >= 2 && $single <= 4)
return($form2);
if ($single == 1)
return($form1);
($hook = get_hook('pan_fw_fn_nouns_after_num_new_lang')) ? eval($hook) : null;
} else {
if ($count == 1)
return($form1);
else
return($form2);
}
return $form3;
}