Closed elieobeid7 closed 7 years ago
You can use the where
modifier. Example:
$users = $db->users->select()
->where('name LIKE :keyword', [':keyword' => '%tom%'])
->where('WHERE MATCH (description) AGAINST(:keywords)', [':keywords' => 'keyword1 keyword2'])
->run();
And about the form, I recomend use a library to manage forms. Anyway, you can do this:
<input type="text" name="data[firstname]"><br>
<input type="text" name="data[lastname]">
$db->users->insert()
->data($_POST['data'])
->run();
Thank you !
$db->users->insert()
->data($_POST['data'])
->run();
How to pass multiple parameters? in addition to POST above, I'd like to also insert
'photo' -> $photo
It has to be a variable and not coming from post because I have to verify and resize.
nevermind fixed it by adding it to the array
How to do
category LIKE '%keyword%'
or full text search
WHERE MATCH (description) AGAINST('keyword1 keyword2')
And an addition question, I just want to know if it's possible, probably not I'd like to ask. suppose I have like 30 input fields. And each input field has the same name in mysql table
Like this i mean:
and the database has
id firstname lastname
And so one, each html input field has the same exact name in a table. Is it possible to insert all of them automatically? Each input field to its correspondent Mysql field? not like this
If such feature exists or if it could be implemented it would do a huge help.