Skip to content

Instantly share code, notes, and snippets.

server {
server_name lamtakam.com www.lamtakam.com;
root /var/www/website/myweb;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
CREATE TABLE `users` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`f_name` varchar(29) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`l_name` varchar(29) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`national_id_real` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Registered by the user',
`national_id` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'For customers, it''s for beh pardakht psp (generated randomly)',
`national_code_verification` tinyint NOT NULL DEFAULT '0',
`birth_certificate_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`cellphone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`subscription_expire_time` timestamp NULL DEFAULT NULL COMMENT 'Null means a free user ',
1. Create a database connection:
First, you need to create a connection to the MySQL database using PHP. You can do this using the PHP mysqli_connect() function, which takes four arguments: the database host, the username, the password and the name of the database.
$conn = mysqli_connect("hostname", "username", "password", "database_name");
2. Check the connection:
Once the connection has been established, you can check whether it was successful by using the mysqli_connect_errno() function. This will return 0 if the connection was successful, or another error code if there was an error.
@sajadshafizadeh
sajadshafizadeh / input.scss
Created November 10, 2022 10:16
Generated by SassMeister.com.
.parent{
.child {
color: red;
}
}
/* ----------- */
.parent{
& .child {
SELECT q.type,
q.author_id author,
q.deleted,
q.deleter_id,
COUNT(DISTINCT a.id) answers_num, -- it will be 0 for answers
COUNT(DISTINCT v.id) votes_num
FROM qanda q
LEFT JOIN qanda a ON q.id = a.related
LEFT JOIN votes v on q.id = v.post_id
WHERE q.id = ?
function removeWrongClass(el){
el.removeClass('wrong');
}
$(".ask_q_title_input").on('focus', function(){ removeWrongClass($(this)) });
$("#qandatextarea").on('focus', function(){ removeWrongClass($(this)) });
$(".make_bounty > a").on('click', function(){ removeWrongClass($('.make_bounty')) });
$(".chosen-single").on('click', function(){ removeWrongClass($(this)) });
$("#ask_q_tags").on('click', function(){ removeWrongClass($(this)) });
SELECT pr1.id AS user_id,
pr1.title AS user_name,
pr2.id AS liker_id,
pr2.title AS liker_name,
x.which AS which_table
FROM (
SELECT rid, rootid, 'vote' which FROM p_likes
UNION ALL
SELECT rid, rootid, 'comment' which FROM p_comments
UNION ALL
// Valid ---------------- without subdomain
www.example.com
http://example.com
http://www.example.com
https://example.com
https://www.example.com
// Valid ---------------- with subdomain
www.sub.example.com
http://sub.example.com
QUERY 1:
INSERT INTO votes (post_id, user_id, value, date_time)
SELECT :pt,:ui,:v,:dt
FROM $table_name t
WHERE t.id=:pt limit 1
QUERY 2:
INSERT INTO votes (post_id, user_id, value, date_time)
SELECT :pt,:ui,:v,:dt
else{
$(".error").hide();
clearTimeout(close_error_msg);
$("#form-"+pure_id).submit(function(e){
e.preventDefault(e);
comment(pure_id);
});
}
function comment(pure_id){