Lets say i have this code
$sql = "SELECT Lname,Fname FROM users WHERE username = ."$username;
$result = $this->db->query($sql);
Is my syntax correct?
Plus, do i have to declare $result like $result[] if i need multiple result values from it like above where i want to get the last name and first name of the username inputted.
Im only using this as my reference.
$sql = "SELECT id FROM users WHERE firstname LIKE '%" . $firstname . "%'";
Im not sure what purpose '%" has. All i know is that when i echo something, if i were to put a value. it would be like this
echo "select from user where username =".$username;