Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Stack #4716043

QuestionAnswer
CodeIgniter automatically creates database tables the first time a Model is used. False
Why is CodeIgniter's Query Builder generally considered safer than concatenating raw SQL strings with user input? Query Builder automatically escapes values, reducing the risk of SQL injection
A table has columns id, title, status, created_at. Which line correctly inserts a new row with only a title? $model->insert(['title' => 'Buy groceries']);
Which CodeIgniter file typically stores database connection settings such as hostname, username, and database name? .env
Comparing SELECT * FROM tasks WHERE status = '$status' (built by directly inserting a variable into a SQL string) against $builder->where('status', $status)->get();, which is safer and why? The Query Builder version, because it automatically escapes the value and reduces SQL injection risk.
Chaining where() and orderBy() lets you filter and sort a query in a single statement. True
Which method would you chain to where('status', 'pending') to sort results by creation date, newest first? orderBy('created_at', 'DESC')
The .env file is used to store view templates. False
A developer hardcodes a task list directly inside a controller using a PHP array, even though a database table for tasks already exists. What is the main drawback? Any change to the task list requires editing code, and the two sources of data can fall out of sync.
A page correctly lists all tasks, but clicking into one specific task shows "Undefined variable $task." The controller has: $data['tasks'] = $model->find($id); return view('tasks/show', $data);. What is the bug? The single record is stored under the plural key 'tasks' but the view expects $task (singular).
Which Query Builder method retrieves a single record by its primary key? find($id)
What term describes the special class that represents and manages a specific database table? Model
After correctly configuring .env and creating a Model, a page still throws a database connection error. Which of these is LEAST likely to be the cause? The view has no <title> tag.
Which line correctly retrieves all tasks with status 'done' using a TaskModel instance $model? $model->where('status', 'done')->findAll();
The public folder should contain the application's business logic, including Models. False
A team stores database passwords directly inside a Model's PHP file instead of .env. What is the main problem with this? Credentials embedded in code are more likely to be exposed and harder to change per environment than values in .env.
where() Filters query results based on a condition
What is the primary purpose of a CodeIgniter Model? To manage data and communicate with the database
What is the name of the CodeIgniter file where database connection settings are typically stored? .env
In the typical CodeIgniter data flow, which component calls the Model to retrieve data before passing it to a View? The Controller
findAll() Retrieves every record from a Model's table
$allowedFields Restricts which fields may be mass-assigned during insert or update
What Query Builder method sorts retrieved records by a specific column, ascending or descending? orderBy()
Which Query Builder method retrieves every record from a Model's table? findAll()
What term describes an unauthorized attempt to manipulate a database through injected SQL, which Query Builder helps prevent? SQL injection
Created by: user-2059709
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards