S
S
sniff12017-05-19 00:07:43
PHP
sniff1, 2017-05-19 00:07:43

A friend says it's wrong. Is it right?

Is it right? A friend says it's wrong

Look at $table.
a_B5FDX7SGI.jpg
And then the conclusion
lDDDp4puJcs.jpg

There are no errors and the code works fine, just asking.
Code: I make the following output:$tabl = array('test' => '12');
$data = mysqli fetch assoc($query);
if( $data["$tabl[test]"] == '12' ) {
   echo "good!";
} else { echo "bad!"; }

I repeat, there are no errors, the code works. Just asking if everything is correct?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2017-05-19
@BorisKorobkov

Judging by the fact that you cannot even lay out the source code here in a readable form, then all your other code is no better. No normal developer will undertake to support it - it will be much faster to write it in zero correctly than to figure out your if, include, etc.
Although the "select *" piece is hidden on the screen, I can bet that SQL is possible through the registration form in Nick injection. And through the browser, an outsider can merge all your data with one request, and delete your database with the second.

I
Ivan Koryukov, 2017-05-19
@MadridianFox

The first thing that catches your eye is how you work with array elements. Not only do you write the array keys not as strings, but as uninitialized constants, you also take the resulting value in quotes. What for?
In general, the question is very strange. It is necessary to give some explanation - what exactly in this code, for you or your friend, is wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question