PHP CODING HELP


#1

Hello everyone, I just started coding php. I have a website on which is connected to my database by php file on server. but I had a problem, I need to check when my database changes then “do something”. But my “Hosting” has counted my “query” and the problem is “maximum query per hour”. Is there any way to check my database without running “query”.

THANKS😃

<?php 
    $table = $_GET["table"];
    
    $col = $_GET["column"];
    
    $db_connect = mysqli_connect("server", "user", "pass", "dbname");

	if (!$db_connect) {
	    die('Could not connect: ' . mysqli_error());
	}
	else {
 		echo 'Connected successfully';
	}

    $sql = "SELECT $col FROM $table";
	
    $result = mysqli_query($db_connect, $sql);
    
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        echo "". $row[$col]."";
    } 
    else {
        echo "0 results";
    }

    mysqli_close($db_connect);
 ?>

#2

This is stupid and dangerous. Don’t do it.


#3

To astonecipher, i don’t get your mean.Why?


#4

I’ll tell you why. Because anyone in the world can get everything out of any table they want. So what he said, “This is stupid and dangerous. Don’t do it.”.


#5

You just started in PHP? Learn to do it the correct way before you try to get unusual with how you do things. Otherwise you open yourself up to issues that you aren’t ready for,


#6

To Astonecipher, thank for your advice. I see.
To Benanamen, Thanks. My web’s now just demo, so i try to make it run first. Anything else for later.


#7