1
1
101002014-04-07 13:54:45
PHP
10100, 2014-04-07 13:54:45

DLE Working with a database, writing data to a table

Hello.
I can't figure out what's wrong. Where am I making a mistake.
1 - There is a Data Life Engine (DLE 10.1) in utf-8 encoding
2 - a template for DLE is also in utf-8 encoding
3 - the database is also in the appropriate encoding
4 - in DLE there is a table in the database called dle_post, which stores lines, each line contains information about the created news, for example:
title - title
full_story - description of the news itself, content
xfields - additional fields
metatitle - The title of the page that is displayed between title>
5 - I connected to the database and start using the script to drive into the dle_post database programmatically new articles.
6 - I use this request to transfer data

$query = "INSERT INTO dle_post(title, full_story, metatitle) VALUES('$ph1', '$pqc', '$mtit')";

This is not the whole code, what I provided above, there is work with only three fields - title, fullstory, metatitle, but in my code there are 5-8 pieces of these fields, I don’t remember exactly, but the code should work in any case and like this:
$ph1 ' - a variable that stores the "title of the article"
$pqc' - the variable stores the "content" of the article itself
$mtit - the variable stores the title between title>
7 -
when I run the script, it fills the database with new articles: fills in all the fields that I indicated to it "fills in both the title and description, and those that I did not specify here, such as" category ", Fills in additional fields - indicating, for example, links to a poster for a movie or series, But for the life of me, the metatitle field remains empty. I already tried it this way and that, it's just empty in every created article.
8 I tried to separately check whether any value is written to the $mtit variable at all - it turned out that it is written. Everything should work, but damn it is EMPTY. Anyone who has this engine at hand or who works with it can try it at home or can call on
Skype if there is time for a fool to poke a mistake.
I tried the "date and time" field (when the article was created, transfer it to the additional field "WHICH BY THE WAY IS PROVIDED THERE") I tried to create a variable and write the time
into it using a function with the following arguments:
$tttt = date("Y-m-w H:i:s");
default :0.00000 and so on is shorter than the standard for some time but not like on the server for example
To sum it up my question is: How to populate the metatitle field in the database
even if I create a variable $pole = "asd" and pass the value to field metatitle it remains empty.a
piece of the field from the table
9946687d09e74b06a1ee462c44e7cc26.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DDanya, 2014-04-07
@DDanya

Why are you creating a $pole variable if you write $mtit to the database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question