W
W
WeBBeW2017-12-31 19:01:35
C++ / C#
WeBBeW, 2017-12-31 19:01:35

What does this mean? Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in?

Why is it throwing this error?

Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in

The code:
$search_user = mysqli_fetch_array(mysqli_query
($connect,"SELECT * FROM `accounts` WHERE `nickname` = '".$plogin."'  AND `password` = '".$ppass."'"), 0);

If you remove mysqli_fetch_array, then it does not check if there is such an account in the database

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2019-10-22
@Legion123212

Actually

from here

#include <algorithm>
#include <iterator>
#include <iostream>
#include <vector>

using namespace std;

auto fx = [](int x){
  int r = 0;
  switch(x % 3)
  {
    case 0:
      r = x * x;
      break;
    case 1:
      r = x;
      break;
    default:
      r = x / 3;
      break;
  }
  return r;
};

auto calculate = [](const vector<int>& vx, auto fx){
  vector<int> calcValues(vx.size());
  transform(vx.begin(), vx.end(), calcValues.begin(), fx);
  return calcValues;
};

int main()
{
  cout << "Введи кол-во чисел: ";
  int n = 0;
  cin >> n;

  cout << "Введи через пробел " << n << " натуральных чисел:\n" << "$: ";
  vector<int> values(n);
  copy_n(istream_iterator<int>(cin), n, values.begin());

  cout << "Результат твоих расчетов:\n";
  copy_n(calculate(values, fx).begin(), n, ostream_iterator<int>(cout, "\n"));
}

you only need fx for the rest you can not dive, except that
https://ru.wikipedia.org/wiki/Natural_number --> unsigned

B
Bohdan Zhorov, 2019-10-22
@sain_Fa

Your 1st and 2nd conditions are wrong. if(n%3==1) if(n%3==0)

M
Maybe Somebody, 2017-12-31
@WeBBeW

Even though I'm "Mr. stupid advice MMXVII", but try this strange nonsense:

$result = mysqli_query($connect, "SELECT * FROM `accounts` WHERE `nickname` = '".$plogin."'  AND `password` = '".$ppass."'");
if (mysqli_num_rows($result) == 1) { 
  /* типо есть аккаунт */
} else {
  /* типо нет аккаунта */ 
}

ps I understand that this is a bug, but I hope you made protection against SQL Injection...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question