get id

Posted 3 years ago by omidparkour

hi i use Form:select and show in this all category and i want to when select any category , insert to table post category name and category id but what i do?

i can insert category name because i get name with Input::get('category') but i cant insert category id

i think should write a query for get id where name = Input::get('category')

i write this but does not work

$data['Category'] = Input::get('Category');
$catid = DB::table('Category')->select('id')->where('fa_name','LIKE','%'.$data.'%')->first();
$datap['Cat_id'] = $catid;

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.