Questions tagged as 'php'

1
answer

Access a certain line of the variable

Some time ago I asked a question about regular expressions and a user answered me using this code, using xpath : $dom = new DomDocument; $dom->loadHTMLFile("http://ciagri.iea.sp.gov.br/precosdiarios/"); $xpath = new DomXPath($dom);...
asked by 19.01.2015 / 13:24
1
answer

UPDATE, field with placeholder query failed to execute

Follow the code: $campo = $_POST['campo']; $valor = $_POST['valor']; $id = $_POST['id']; $mysqli = new mysqli("localhost","root","","tabela"); mysqli_set_charset($mysqli,"utf8"); $consulta = $mysqli -&g...
asked by 20.01.2015 / 01:38
1
answer

Show variable in script src

I need to pass two parameters via url and create a JS function to get these parameters and place them in the source of a script. Follow what I already have. Link to the parameters: <a href="<?php bloginfo( 'url' ); ?>/co...
asked by 21.01.2015 / 14:28
1
answer

How to get the record total from a table

I need to know how many records there are inside my table and add the total found in a variable. I'm doing the following but it does not work: <?php $w_querybusca = "SELECT * FROM Elem_matr;"; $w_queryresultado=f_class_co...
asked by 26.11.2014 / 14:01
3
answers

Search by selection field

I'm creating some filters to search for products, having the products all visible, I would like to know how I can make a selection field and through the category that the user chooses, only the products of that category would appear. I have the...
asked by 19.01.2015 / 16:33
2
answers

Search for MySQL data list

Currently on my system, I'm calling each column at once: $sql2 = mysqli_query($db, "SELECT group_id FROM login WHERE userid = '$userid'"); $exibe2 = mysqli_fetch_assoc($sql2); $_SESSION['group_id']=$exibe2['group_id']; And in the file I'm c...
asked by 21.03.2015 / 18:07
1
answer

Warning when using preg_match ()

I had to migrate from PHP 5.2 to 5.3, so thousands of DEPRECATED messages started coming in my PHP system, but some are too complicated, follow the code: if (!preg_match($SUBMENU.':', $sm)) { $sm = explode($SUBMENU.":\n", $sm); $sm = t...
asked by 16.03.2015 / 01:10
1
answer

json_encode in html tag

How do I put a json generated by php into a link tag $array = array('a','b','c'); $json = json_encode($array); $link = '<a href.. tag="'.$json.'">'; // tried with JSON_HEX_QUOT | JSON_HEX_TAG and does not work     
asked by 21.03.2015 / 14:07
1
answer

Get data according to date in MySQL

I need to provide the option to view the data according to a time X determined by the user, for example I want the data from 03/01/2011 to 12/25/2014 How can I do this with MySQL? How do I set the table so everything can work out?     
asked by 26.12.2014 / 03:33
2
answers

How to create validation with special characters

I would like to know how to create a validation with preg_macth() where you have to accept these keyboard characters: /^([a-zA-Z0-9]{6,40})$/ '~!@#$%^&*()_-+={}[]\|:;"'<>,.?/ Less spaces.     
asked by 14.03.2015 / 16:05