Questions tagged as 'php'

1
answer

How to pass php variable as a parameter in a JS function call

Hello, I want to pass a php variable, as a parameter in a JavaScript function call. This way: <a href="calcular($numero)">Calcular</a> I have tried to do this: <a href="#">#
asked by 01.10.2016 / 22:04
1
answer

Doubt about IC Sessions

According to: $config['sess_expiration'] = 7200; The session will be destroyed after 7200 seconds, however I was wondering if when I refresh the page or access another page of my system, is this time renewed? If not, is there any configurat...
asked by 28.09.2016 / 21:33
2
answers

Insert rows at the top of the table

I have the following problem, I created a form in which the value that the user writes has to go to the top of the table, leaving the oldest ones down, or have my SELECT select only the last 10 records of the Can anyone help me? UPDATE !!!...
asked by 02.10.2016 / 17:52
1
answer

Image upload with PHP returning an error: undefined index error

Good evening everyone, I am using a script that I have and I have always used to upload images only when I choose some images it returns the error undefined index error The only problem is that in 80% of cases it works normal I did a v...
asked by 05.10.2016 / 03:25
1
answer

Check some array values inside another array

I need to test if an array has some values that are mandatory comparing inside another array, I currently count the required values, loop, and check if the values checked were in the same amount: private function validate_required($data, $...
asked by 24.03.2018 / 01:42
1
answer

implode () vs substr ()

Considering the codes below: $str = ''; for ($i = 30000; $i > 0; $i--) { $str .= 'STRING QUALQUER, '; } $str = subtr($str,0,-2); and this $sArr = array(); for ($i = 30000; $i > 0; $i--) { $sArr[] = 'STRING QUALQUER'; } $str...
asked by 19.03.2018 / 23:08
3
answers

How to check if a snippet of a string is in some array item

Does anyone know how to check if a reference or string is in an array? I tried this method and it did not work $array = "facebook.com, google.com, twitter.com"; $ref = "http://m.facebook.com"; $arrayIds = explode(',', $array); if(isset($ref)...
asked by 23.05.2016 / 19:32
2
answers

form read database

Hello everyone, I'm trying to make a form read MySql database options, but the line of code below shows me only the word "Array". What is my error on this line? Can someone help me. <form id="cadastro" action= "cadastroprodutos.php" meth...
asked by 07.05.2016 / 17:58
1
answer

a more efficient way to bind large insert and update

public function update($table, $data, $where,$criterios) { $set = ""; foreach ($data as $keyname => $value) { $set .= ($set == "") ? "" : ", "; $set .= $keyname . " = " . ":".$keyname ; } $sql = "UPDATE $tabl...
asked by 12.05.2016 / 02:08
1
answer

Use if / else condition within a while

Good morning !! I need some help. In the code below, I generate a file .txt delimited by ";" . However, within the While , in the array, I would like to include a condition, eg: while ( $linha = mysql_fetch_array ( $select )...
asked by 20.10.2016 / 12:02