php

Query in MySQL via PHP

Good time of day! I made a form with a request and a write function in the database, but it introduces empty values. What's w ... me,year,xoz) VALUES ('$name','$year','$xoz')"); if ($result == 'true') { echo "Успешно!"; } else { echo "Неудачно!"; } ?>

SQL Insert or Update

Is there any function that would add values to the database if there are no values with a specific id, and update if the valu ... hen, if it exists, then we perform update, and if not, then insert. Or is there another option, without unnecessary requests?

MySQL syntax error?

$sql = "INSERT INTO league(user,email,password,rival,key) VALUES ('$this->user','$this->email','$t ... near 'key) VALUES ('user1','[email protected]','usrpsw','0','0')' at line 1 Key int(11) NULL(no) DEFAULT 0

Replacing a substring with a regular expression

There is a string. I need to use a regular expression to wrap all matches in the span tag. I do this: $str = 'Строка для зам ... riable n in the second line. How can I fix it so that I can find any number of matches in a string and frame them with a tag?

Text output: should I use echo or not?

When creating any site, you must use HTML code to build blocks and generally build a site. And often this code is located in ... er? Or still can you not think about it and write as convenient as possible? What if you output a lot of HTML code via echo?

How do I set up the correct encoding for MySQL?

Here... I'm learning PHP. I reached the connection to the database. And here's the problem. In the *.php file, I register a c ... irl needs programming here. We have already talked about this issue. I study - so it is necessary. Thanks for understanding:)

Regular expression (prohibition of English letters)

Good evening, everyone. Please help me correctly compose a regular expression. I need to check the field so that it is imposs ... WEVER, if A-Yaa-ya is replaced by A-Za-z, then the Russian text prohibits it, and the English text prohibits it. lets you in.

nginx https to http

The bottom line is this: on the site, under a certain condition, the URL must change from https to http. if (strpos($url, 'ht ... to http), I was thrown back to http Could there be a problem in nginx? Is there a rule that doesn't allow redirects to http?

Declaring Smarty variables

Please tell me how to declare a variable and assign a value to it in the *.tpl file itself. I need something like that: {if ($data.rating >= 600)} {$a='Подходит!'} {/if}

What is postincrement and preincrement?

I'm learning javascript and php, but I don't fully understand things like post-increment and pre-increment. Explain, if you don't mind.

How to disable font-awesome (cdn) in WP

Guys, please tell me I can not on the site (CMS: Wordpress) disable the download of fontawasome by link: netdna.bootstrapcdn. ... /font-awesome/4.7.0/css/font-awesome.css' type='text/css' media='all' Can you tell me how to do this? Thank you in advance!

Redirect to another page

Hello.I saw the code function redirect($url, $statusCode = 303) { header('Location: ' . $url, true, $statusCode); die() ... e, $statusCode); die(); } redirect('http://vk.com'); echo 'true'; Got an error: NS_ERROR_FAILURE: Failure xhr.send(null);

How to pull 1 character in a php string?

There is a string $text="Текс"; How to pull out 1 character? Have you tried echo $text[0] or $text{0} iconv("UTF-8", "window ... text[0]); Returns nothing at alliconv("windows-1251", "UTF-8", $text[0]); result � But if echo $text; the text of the norms

Convert a string to a number

How to use PHP to turn a string into a number? The string is stored in a separate variable. I tried it like this: $var1="1"; ... 2; But in the end, the layout via echo showed that: 1 0 That is, $var2=0, and why is not clear. Please explain and tell me!

Line break

A question from a newbie. The documentation says that \r\n is an indication of the end of the line and the carriage translati ... ; ?> Will give Row1 row2 But it doesn't work in practice. Writes in one line. So I didn't understand. What's the catch.

Getting site content https://www.transfermarkt.us/ (parsing)

Dear colleagues. I need to parse the site in php https://www.transfermarkt.us/ and its internal pages. I'm trying to do this ... .transfermarkt.us: Connection timed out, although in the browser the page opens without problems. Can you tell me a solution?

When you click on a link to a php file, it is downloaded, and does not go to another page of the site

When you click on a link to a php file, it is downloaded, and does not go to another page of the site. There is such a code: ... ex.php , although in theory it should go to the main page of the site. Please tell me what I'm doing wrong and how to fix it?

Checking the NAME with a regular expression [php]

There is a field Name: Maxim What regular expression should be used to make the name: ONLY from English or ONLY from Russian? no spaces,symbols, etc.! Thank you very much in advance!!

Webhook Telegram sends several updates in a row

When connecting, webhook hung up logging of incoming updates on it. I noticed that when I write a telegram bot 1 message, it ... lib error -5" Perhaps this is the reason. But I don't understand what this means, and how it relates to the webhook answers

NodeJS Telegram bot request failed API

The bot stops working after an error: FetchError: request to https://domain.ru/api/get/token failed, reason: connect ETIMEDOU ... ter a while it crashes. I don't understand what the problem is. Sometimes the bot is delayed, but not for long and so always.