Questions tagged as 'php'

1
answer

How to make multiple checkbox records in the database at once?

How do I make multiple records with checkbox ? I need to make multiple records according to my tag in every% of% and include in the column checkbox the same id_item that comes from the variable ID in all records....
asked by 12.02.2016 / 04:08
2
answers

Call protected variable within static method

<?php class Foo{ protected $calc; function __construct(){ $this->calc = 2; } public static function getCalc(){ return $this->calc * 5; } }...
asked by 15.02.2016 / 17:09
2
answers

Validate file jpg - Laravel 5

I'm trying to use Validator to validate the upload file type but I do not know if the syntax is correct $data=Input::all(); $file = $data["picture_url"]; $rules = array('picture_url' => 'required|max:10000|mimes:jpg');...
asked by 12.02.2016 / 19:13
2
answers

How to work with authorization levels with PHP? [closed]

I am putting together a school report system to train my skills in php. And I'm having a hard time. It is the following: I have 3 types of users: teacher, admin and student. The teacher can put note and change the note, but this note is only...
asked by 02.01.2017 / 16:01
2
answers

Check ip, register in array, convert to json and write to file

Personally I'm having a problem. I have a script in php that opens a json file, decodes it with json_decode and then checks to see if the json object exists in the current visitor's ip, if it has it, but if it does not, it registers in an array...
asked by 09.01.2017 / 19:12
2
answers

How to inject a variable into a page that was required by a function

I'm having the following problem, I'm using an MVC template for a CMS in PHP study, however I'd like it to be possible to use themes, so I've created a configuration variable that stores the theme name for test , and when I use my controller...
asked by 19.11.2015 / 11:36
2
answers

Remove a part of the text inside a txt file

Colleagues. I have the following code where I get a csv file through upload and store it in a txt file, from which you have to have the formation of the positions according to the database of a program. For this I am using the code below:...
asked by 19.11.2015 / 15:02
1
answer

How to transform the row of a query into columns and group according to the first 4 characters?

I would like to transform the return of my SQL query into an array where I select the first four characters, which will work as a sort of group, and return the values referring to that group in columns. I'm analyzing the PHP language. HowI'd...
asked by 31.10.2017 / 18:10
1
answer

Remove space between menu and content

Hello, I'm having a little problem ... Let's say that between the menu and the contents of the pages are with this huge hole ... And I would really like to remove it ... the worst that has nothing in the code to increase this space ......
asked by 24.10.2017 / 14:58
4
answers

Increment a counter inside a foreach in php

In a foreach loop, I need to increment a counter to set the tabindex of the form fields so that the result is: <input type="text" name="endereco[0][cep]" value="00000-000" tabindex="1"> <input type="text" name="endereco[0][rua]" va...
asked by 03.11.2017 / 20:50