PHP $stmt->num_rows doesnt work by prepared statements

I want to check if ($numRows >= 1) then it should return something. When I use $con->mysql(“{QUERY}”), it works. But when I use $stmt = $con->prepare(“{QUERY}”), it doesn’t work. Does anyone have a clue? Working method <?php if ($result = $con->query("SELECT username FROM users WHERE username = 'test'")) { $numRows = $result->num_rows; echo $numRows; } … Read more

Pushing into an array object in react but not rendering on the screen

Im using react and displaying some labels via the array object of labels. Now, I want to do this dynamically. So if a user clicks a button, the object updates and the user interface should update accordingly as well. The issue here is that I got the array to update after clicking on the button, as evidenced by a console log line that I wrote in the onclick handler. But the user interface does not update accordingly. Just the array shows the values. Here is what the inital array looks like: