danyfir2018-01-28 20:07:25
danyfir, 2018-01-28 20:07:25

After transferring to another hosting, sql queries stopped working. Why?

Moved the site from one hosting to another. The site stopped working sql queries through php. I can't figure out what is the problem
here is the code:

$postID = $_POST['vozrast'];
 $db = new Mysqli("localhost", "логин", "пароль", "бд");
    $db->query('SET NAMES utf-8');
    $result = mysql_query ("SELECT * FROM clgmh_postmeta WHERE meta_key='subject_name' AND meta_value='$postID'");
    while ($row = mysql_fetch_assoc($result)) {
    $buf = $row['post_id'];
    update_post_meta($buf, 'payment', 'Да');    

The output does not update anything at all. As if the code does not reach the while. I checked the connection, it seems to be connected.
The only clue I found was that on the old hosting, the encoding did not allow outputting Russian. inscriptions, on the new allows. Maybe it's a coding issue? Or it can not influence the work of requests?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
OKyJIucT, 2018-01-28

Type this request into PHPMyAdmin manually and see what happens. Perhaps the new hosting has a different version of MySQL or modules for PHP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question