1

I'm just thinking of what I do after cs50: I've completed pset7 already, but I'm eager to remake this pset without the use of CS50's library "Query" function. So my question would be how to replace

$cash = CS50::query("SELECT cash FROM users WHERE id = {$_SESSION["id"]}"); Any help would be greatly appreciated :D

(Note that I already fixed the 'multiple' arguments of the query by just using the { } code demarcation)

0

Simply use the query function in php.

$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

1
  • Thanks for the comment over 1 year later! In the meantime I had found out a way of that myself, indeed using msqli (but I added in my homemade prepared statement function as well, was a hassle tho) Jun 9 '17 at 22:17

You must log in to answer this question.

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