1

I'm currently solving pset7 CS50 Finance. The query() function can be used as CS50::query() or simply query(). Both seem to work. So, is there any difference between the two approaches? Are there any conditions in which one might not work while the other will?

1 Answer 1

1

When you are using CS50 IDE with inbuilt CS50 SQL library files then it's easier to use CS50::query() function.

In normal situations, eg in a linux machine, you can use only the query() function.

CS50::query() function saves the time over query() which is

$con =  mysqli_connect('localhost',$username,$password,$database);
$cash = mysqli_query($con,"SELECT cash FROM users WHERE id = {$_SESSION["id"]}");

For more details refer: http://php.net/manual/en/mysqli.query.php

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .