Category : php

There is some error in connecting PHP and MySQL, but I can’t seem to find it. Can someone please help with it? I opened XAMPP control panel started Apache and MySQL and after entering localhost/phpmyadmin/, created a database named ‘experiment’, created two .PHP files. First connection.php file for functions OpenConn and CloseConn, and second index.php ..

Read more

Who can translate the PHP code here to me with node.js. Can we make this code node.js compatible. Please help me I need a lot <?php class Shopier { private $payment_url = ‘https://www.shopier.com/ShowProduct/api_pay4.php’; private $api_key, $api_secret, $module_version, $buyer = [], $currency = ‘TRY’; public function __construct($api_key, $api_secret, $module_version = (‘1.0.4’)) { $this->api_key = $api_key; $this->api_secret ..

Read more

I Want to Display just the first object (location in my case). @forelse($locations as $key => $value) I tried this: <?php @forelse($locations as $key => $value) { $value = $locations->first(); } ?> it gives a syntax error, unexpected ‘as’ (T_AS), expecting ‘)’ $result = $query->get(); $locations = $result->pluck(‘name’, ‘id’); $price_groups = SellingPriceGroup::forDropdown($business_id); if ($show_all) { ..

Read more

I have this script that is receiving data from a vue js client <?php header(‘Access-Control-Allow-Origin: *’); header(‘Access-Control-Allow-Methods: GET, POST’); header("Access-Control-Allow-Headers: X-Requested-With"); $image = ”; if(isset($_FILES[‘property_files’][‘name’])) { $image_name = $_FILES[‘property_files’][‘name’]; $valid_extensions = array("jpg","jpeg","png"); $extension = pathinfo($image_name, PATHINFO_EXTENSION); if(in_array($extension, $valid_extensions)) { $upload_path = ‘uploads/’ . time() . ‘.’ . $extension; if(move_uploaded_file($_FILES[‘property_files’][‘tmp_name’], $upload_path)) { $message = ‘Image Uploaded’; ..

Read more

TLDR version: how to utilize PharData::buildFromIterator in order to build .tar archive from /path/to/project/, but excluding a list of files, like /path/to/project/file0.txt, /path/to/project/file1.txt, /path/to/project/file2.txt? Longer version, what-have-I-tried included: In order to build .tar archive from dir path, I tried with the simple PharData::buildFromDirectory method which has a second, optional argument which… kind of… does exact ..

Read more

I want to get the student award date and replace the value in the existing input but I write some jquery it is not working place help to fix this issue. I attached my code down. Controller public function show(Request $request) { if($request->studentId!=”) { $html = ""; $StudentCDate = Student::where(‘id’, $request->student_id)->first(); $data = $StudentCDate->stud_completion_date; $html ..

Read more

I’m using Laravel 8 for my project and in this project, I have made a page for creating users by admins. And basically, each user has a role, so in order to show the roles, I have added this: <div class="form-group"> <label class="col-sm-2 control-label">Role</label> <select class="form-control" name="role" dir="ltr"> @foreach(AppModelsRole::all() as $role) <option value="{{ $role->id }}">{{ ..

Read more

Obviously I’m missing something, but can’t figure out how to compare strings which are date&time but both got in different ways. Code: $mod_datetime = get_the_modified_date() .’ ‘.get_the_modified_time(); $curr_datetime = date(‘Y-m-d H:i’); $plus_datetime = strtotime($mod_datetime) <= 0*0*0*60; date_default_timezone_set(‘Europe/Warsaw’); if( ($curr_datetime < strtotime($mod_datetime)) > $plus_datetime){ echo ‘True’; } elseif ( 0*0*0*60 < (time() < strtotime($mod_datetime)) ) { ..

Read more

I’m trying to creat custom Error class in laravel. When I’m running throug xdebug i see such values in it *Exception*string, *Exception*trace and *Exception*previous. What this ** means and name between it. I thought, that it’s class name, where this variables define and not redefined in another place. I created custom classes and extend one ..

Read more