What is the difference between using "$sql = ..." and "mysql_query(...)" in PHP?
When using "$sql = ...", you are simply assigning a SQL query string to a variable. However, to execute the query and interact with the database, you need to use functions like "mysql_query(...)". This function sends the query to the database and returns a result resource that can be used to fetch data or perform other operations.
$sql = "SELECT * FROM users";
$result = mysql_query($sql);
Related questions
-
SQL injection PDO form validation
-
PHP database calculations
-
SQL injection cross-site scripting insecure file handling