I make a script for the digiseller system, there is a site on which there is already a certain user base, here’s the script itself:

<?php $data = $HTTP_RAW_POST_DATA;//Данные с xml-запроса preg_match("|<email>(.*)</email>|sei", $data, $email);//Получаем почту $mysqli = new mysqli(...); if (mysqli_connect_errno()) { printf("Не удалось подключиться: %s\n", mysqli_connect_error()); exit(); } $stmt = $mysqli->prepare("UPDATE users SET group = 'USERS,VIP' WHERE email = ?"); $stmt->bind_param("s", $email[1]); $stmt->execute(); $stmt->close(); $mysqli->close(); ?> 

But for some reason the script does not work, is it also possible in this case to use the 'xmlrpc_encode' function. Perhaps the reason is in quotes? 'USERS,VIP'

Request format:

 <request> <id>1976637</id> <inv></inv> <amount></amount> <type_curr></type_curr> <sign></sign> <fio></fio> <email></email> <key></key> </request> 
  • What error does the script generate? - Dmitriy Simushev
  • No errors, just nothing happens - edvardpotter
  • @edvardpotter show what goes into $ email (for example, output var_dump) and the contents of $ HTTP_RAW_POST_DATA (in stripped-down form) - zenith
  • @zenith Updated the question. - edvardpotter
  • where is $ email? And on the question: the problem is not exactly in quotes. 'USERS, VIP' is just a string that will be inserted in the group field - zenith

1 answer 1

In programming, there is no such task as "Writing to the database data from an xml query". In programming, there can be only two tasks:

  1. "Reading data from xml request"
  2. "Writing data to the database"

And these two tasks should be done separately. And if some of the tasks fail, then ask her a question about it.

You can find out if the code works to solve a particular problem in a way called "checking the results." The method consists in the fact that after the program completes the task, the programmer checks the result of its execution. Comparing the result with the expected.

For each task separately

  • I wrote the code for these 2 tasks, the code does not work, I want to know why. - edvardpotter