Questions tagged as 'php'

1
answer

Get DB name in mysql connection

Well I make a connection to mysql DB like this: // Conecta-se ao banco do servidor ini_set('default_charset', 'UTF-8'); $mysqli = mysqli_connect('127.0.0.1', 'root', '123', 'teste'); Query($mysqli, "SET NAMES utf8"); How can I retrieve the...
asked by 10.08.2017 / 15:07
1
answer

How to return PHP code with Javascript?

Fully edited topic My file Follow_Button.php : <?php require_once '.././app/autoload.php'; $TwitterUsers = new TwitterUsers; require_once '.././app/TwitterOAuthHelper.php'; $helper = new TwitterOAuthHelper; $row = $TwitterUs...
asked by 08.06.2017 / 16:01
2
answers

PHP Search system ignore capital letters and add keywords

I have a simple search engine that looks up values in the DB and displays it on the page. In the table I have a column called keywords where the words I leave as a search parameter are registered. I need two things. The first is that when typing...
asked by 10.06.2017 / 04:05
2
answers

Go through an array where the index is a Date

How do I go through an Array where the index is a date that varies with each query in the database. Just one detail, the dates are dynamic with each query. Array arrives this way: Array ( [2018-04-07] => Array (...
asked by 29.03.2018 / 19:23
2
answers

Percentage vote in php within a while

I need to get the votes of the candidates that are in mysql and generate the percentage of votes that each had. How can I view the result since it is within a while? $sql = mysql_query("SELECT * FROM candidatos ORDER BY nome_candidato"); whil...
asked by 18.04.2018 / 00:19
3
answers

Remove Accents and Transform Spaces in PHP Traces

I updated my PHP and my next Script which I used to transform text without accents, and the dashed spaces (-) no longer works in PHP because ereg_replace is obsolete. > <?php $variavel = "Céu Azul"; $variavel_limpa = strtolower( e...
asked by 14.04.2018 / 23:37
1
answer

Take numbers together with str_replace

I want to take a part of a string, specifically numbers next to the letter, such as: $string = "Parte da string - 60h" Well, I use str_replace as follows: $string = str_replace(' - ', '', $string); $string = str_replace('[ˆ0-99]h', '', $s...
asked by 13.04.2018 / 20:50
2
answers

Submit only one element of two with same name

I have a form , and in this I have to inform the neighborhood, however the element that stores the information of the neighborhood can vary according to the value of the city selected previously. Example: If the city is "main" it s...
asked by 12.04.2018 / 20:19
3
answers

Filter array value [duplicate]

My array will be: $arr = array(); while($r = mssql_fetch_assoc($query)) { $arr = array('cnpj' => $r['cnpj'], 'empresa' => $r['nome']); } No while, there are several results (repeated CNPJ), and I would like to assemble the ar...
asked by 29.11.2017 / 13:43
2
answers

How to save multi-valued metabox checkbox

I have a loop where it shows the taxonomies of the groups in checkbox format, but when saving, it only saves the last% Would you like to know how to save all checked fields? <?php function noticias_dados_meta_box($post){ $val...
asked by 24.02.2014 / 12:52