codeiginiter: How to handel foreign key error when deleting data

I have a problem in deleting data I wrote a function in model to delete data and it works but when foreign key constraint occur it show this error You may find this error here and I want to handle this error in the code and when this error occurs I want to show an … Continue reading “codeiginiter: How to handel foreign key error when deleting data”

WordPress – adding a custom font via font-face

I’ve built a front-end site which I’m now uploading to wordpress using the html5blank theme. I’ve never uploaded a custom font file before and I think I’m getting the file path wrong. The font-files are in a fonts folder in my child theme folder. This is how I have my code – style.css @font-face { … Continue reading “WordPress – adding a custom font via font-face”

PHP File Upload tmp_name Does Not Exist

I’m trying to upload a screenshot with a file input and an ajax request. This is my request code: var formData= new FormData(); formData.append(‘pictureFile’, fileInput.files[0]); $.ajax({ url: ‘data/Upload.php’, type: ‘POST’, processData: false, contentType: false, data: formData, success: function (result) { console.log(result); } }); My php code: $fileName = $_FILES[‘pictureFile’][‘tmp_name’]; echo $fileName; move_uploaded_file($fileName,”dirname”); The upload doesn’t … Continue reading “PHP File Upload tmp_name Does Not Exist”

Change the Database Connection Dynamically in Laravel

I have the master database with login table and corresponding database settings for each user. On login I should dynamically change the db settings fetching from the table. I can change the db connection but this is not persisting. Config::set(“database.connections.mysql”, [ ‘driver’ => ‘mysql’, “host” => $usr_host, “database” => $usr_database, “username” => $usr_username, “password” => … Continue reading “Change the Database Connection Dynamically in Laravel”

Contact fotm 7 loads forever but sends mail correctly.Unfortunately no info at the end

At my wordpress site I am using Contact Form 7 plugin. It works correnctly… it sends mails but without any information at the end. I have all time the rounding circle… It should shows me that the message is sent correctly. What could be wrong with this message ? For more info please click herehttps://stackoverflow.com/q/46776036

How to disable error message in REST API output

Recently I have upgraded WordPress theme and plugins of my website to enable REST API. My site has more the 30 thousand custom post types currently with few meta information. When I try to access https://example.com/wp-json/wp/v2/book It gives me a fatal error about allowed memory size which has full file name with the full path … Continue reading “How to disable error message in REST API output”

Passing parameters to __construct library in Codeigniter

I am really new to Codeigniter, and just learning from scratch. checked the documentation on Creating Libraries but no success on my example: I need to pass a value to __construct library. class: libraries/Myclasses/Bird <?php defined(‘BASEPATH’) OR exit(‘No direct script access allowed’); class Bird{ public $fly; public $goodsound; public function __construct($fly, $goodsound) { $fly = … Continue reading “Passing parameters to __construct library in Codeigniter”

Laravel 5.4 required if validation issue

I have 2 fields, accepts_usd and price_usd. For price usd I have a validation rule: ‘price_usd’=>’integer|required_if:accepts_usd,1’, And for accepts_usd: ‘accepts_usd’=>’boolean|required’, When I want to store data if I set accepts_usd to false it still asks for price_usd. whats the issue here? What am I doing wrong? For more info please click herehttps://stackoverflow.com/q/42931659

How to set attributes for stdClass object at the time object creation

I want to set attribute for a stdClass object in a single statement. I don’t have any idea about it. I know the following things $obj = new stdClass; $obj->attr = ‘loremipsum’; It takes two statements. $obj = (object) array(‘attr’=>’loremipsum’); It takes single statement but it is not direct method. $obj = new stdClass(array(‘attr’=>’loremipsum’)); It … Continue reading “How to set attributes for stdClass object at the time object creation”

Change diacritics color with javascript in html/PHP

I am using the following script to remove the diacritics from text, and I was wondering if there is a way to color the diacritics in html or PHP instead of removing them (the example is in Arabic, but the same applies to Jewish, French, even English.. etc.). Javascript code: $(document).ready(function(){ var bodyText = $(‘#page_content’).html(); … Continue reading “Change diacritics color with javascript in html/PHP”

Page 1 of 6312345678910...203040...Last »

Have a question or need a custom quote?
info@smartinfocare.com