Questions tagged as 'php'

1
answer

Get a specific part of a string

I need to get a specific part of a log file, its structure looks something like this: ################################################## ---------------------------------------- Nome: nome_user, Email: [email protected], -------------------------...
asked by 19.06.2016 / 23:44
1
answer

Is it possible to give insert with select?

I have two tables: hardware(ID, DEVICEID, NAME, ...) and softwares(ID, HARDWARE_ID, PUBLISHER, NAME, VERSION, ETC ...). I need to insert into the softwares table, but I do not have HARDWARE_ID , I only get the hardware name (...
asked by 22.11.2016 / 15:11
2
answers

Simple Quotes vs. Doubles in PHP Regex

Considering that I have a path which I want to check with preg_match if it is the desired path, what is the difference between the two following operations? // Single quoted string preg_match('/\/path\/to\/folder\//', $path) //...
asked by 18.10.2016 / 14:38
2
answers

Get Id and move to another function on the click button

Galera, I have the following problem, I have a table and every record I have a link. By clicking this link I get the ID as follows and call a modal. <script> $(document).on("click", "a", function(){ if ($(this).hasClass("cliqu...
asked by 22.11.2016 / 14:45
2
answers

Failed to compare dates before writing to bank

I'm trying to do a date validation, if the date DataInicial is less than DataAtual , ie it can not be retroactive the script should return me an error message with json_encode not allowing the stream continue, which is not ha...
asked by 12.11.2015 / 18:29
5
answers

Induction type for any type of object

I want to make a method of a given class accept an object as a parameter. But this object could be of any type. Example: class classeExemplo { public function meuMetodo(Object $objeto) { // Seguiria aqui o bloco de código }...
asked by 24.11.2015 / 20:59
2
answers

How to generate code before entering data in the database

I need to generate a code that is equal to id which will be auto-incremented in the database. It will be a routine that checks the last id generated and generates a code that will be id later before inserting the data. Fo...
asked by 19.11.2015 / 21:40
1
answer

Improve rating script (star rating)

Can you improve this code? <?php if ($calculation >= 5) { for ($i=1;$i<=5;$i++) { echo '<img src="'.$linkSite.'/img/star1_16x16.png"> ';...
asked by 20.01.2016 / 20:08
3
answers

Database with php

I am trying to query the database with the following script: <?php require("conexao.php"); $exibir = mysql_query("SELECT * FROM produtos"); while ($r = mysql_fetch_array($exibir)){ $id = $r['id'];...
asked by 06.01.2016 / 17:06
2
answers

Error inserting data into the database

I'm following php classes, and in the video the guy uses the mysql command, but I know he's old and insecure and I used mysqli , but the code does not display an error, but does not write data to my table, it follows the page...
asked by 16.12.2015 / 16:44