PHP CODING HELP

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);
 ?>

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

1 Like

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

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.”.

3 Likes

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,

1 Like

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.

2 Likes
Sponsor our Newsletter | Privacy Policy | Terms of Service