
mahenda
Members-
Content Count
102 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout mahenda
-
Rank
Advanced Member
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
how can i fetch data from laravel-mysql using ajax?
mahenda replied to mahenda's topic in PHP Coding Help
When am doing this; $(".employee #name").html(data.employee.name); $(".employee #intro").html(data.employee.intro); $(".department #name").html(data.department.name); $(".department #desc").html(data.department.desc); Nothing work can you help me here, I don't want to change the field names -
how can i fetch data from laravel-mysql using ajax?
mahenda replied to mahenda's topic in PHP Coding Help
The above php return the correct JSON DATA, the issue here is how to pass them to the welcome.blade.php , i know this in the normal php and I was supposed to do the following //the ajax in normal php $.ajax({ type: "GET", url: "/homeController.php", success: function (data) { $(".employee #name").html(data.name); $(".employee #intro").html(data.intro); $(".department #name").html(data.name); $(".department #desc").html(data.desc); } }); Help me i cant figure it in laravel -
how can i fetch data from laravel-mysql using ajax?
mahenda replied to mahenda's topic in PHP Coding Help
//my controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; class homeController extends Controller { public function index() { $employee = DB::table('employee')->orderBy('id','desc')->get(); $department = DB::table('department')->orderBy('id','desc')->get(); //I added this line but the data came in the json format so how to pass it to the view with ajax but remember they are comming from different tables return response()->json(array('employee' => $employee , 'department' => $department)); -
//my controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; class homeController extends Controller { public function index() { $employee = DB::table('employee')->orderBy('id','desc')->get(); $department = DB::table('department')->orderBy('id','desc')->get(); return view('index', ['employee' => $employee , 'department' => $department]); } } //my routes Route::get('index','homeController@index'); //my view using blade temmplating engine @foreach($employee as $emp) <div class="employee"&
-
Help me please!
-
//my php code sample <?php include_once('con.php'); if(isset($_POST['username'])){ $message = []; if(empty($_POST['username'])){ $message['username'] = 'username required'; } #some validation continue... $data = $_POST['username']; if (count($errors) === 0){ #ccode... $message['username'] = 'success your name saved'; } } ?> //my jquery ajax $('.username').click(function() { $.ajax({ url: 'user.php', method: 'POST', data: $('.user').serialize(), success: function(data) { swal('W
-
what if user click the link by tomorrow at the same time
-
how to calculate the difference between the current datetime from the stored one(ie date_field = 2020-08-09 23:13:06) in order to compare with 15min, i mean if the resulted time exceed 15 min and not the same day(date) the provided link will show expire message. i.e $some_variable = $date_in_db - current_date; if((time() - $some_variable > 15*60) && not the same day or the same day){ echo 'the link has expired'; }
-
Ho do they get or save a list of datain the same column in database?
mahenda replied to mahenda's topic in PHP Coding Help
thank -
How to redirect this links to the specific page?
mahenda replied to mahenda's topic in PHP Coding Help
But i have this question why I get undefined variable, when the field in mysql database is set to null value/type. -
How to redirect this links to the specific page?
mahenda replied to mahenda's topic in PHP Coding Help
thank you guys, it is working, i added alias on each table column and using if condition to detect if the data come from first table redirect to first page else second page -
How to redirect this links to the specific page?
mahenda replied to mahenda's topic in PHP Coding Help
No -
How to redirect this links to the specific page?
mahenda replied to mahenda's topic in PHP Coding Help
My query look like this SELECT pr_id, pr_name FROM pr WHERE pr_name LIKE :q UNION SELECT pt_id, pt_name FROM pt WHERE pt_name LIKE :q The problem is when we search it combine all pr_id and pt_id in a single column and all I'd can be retrieved by using pr_id. So when user click the link which carry pt_id it redirect to the page with pr_id details. Help -
I have two table in my database combined by using UNION, when it come to searching via search form, all data are retrieved as expected, but the problem come when i click the link that has the data from second table it redirecting to the page with first table details. Assume i have retrieved data using while loop and the UNION. while($search = $query->fetch()) {?> <div> <a href="pageone.php?po=<?php echo $search['pr_id'];?>">Read More...</a> </div> <?php }?> //the result become <a href="pageone.php?po