Questions tagged as 'php'

1
answer

Error inserting PHP MySql data using the Android volley lib

I'm developing an application that will have to send data to a server. My php source code is this: connection.php <?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = ""; $mysql_database = "ap...
asked by 30.10.2015 / 20:55
1
answer

Is there any way to throw an exception when fwrite can not write?

I use the SplFileObject class to work with files. The same does not occur with the sockets, when necessary to connect, being necessary to use the function fsockopen or stream_socket_client . I need a code snippet in case a...
asked by 22.10.2015 / 15:41
3
answers

How to read a Json file

$(document).ready(function(){ var json = [{ bloco:"bloco1", titulo: "titulo1", perguntas: [{ pergunta1: "Resposta1", opcaoSelecionada: "2" }]; }/*,{ bloco:"bloco2", titulo: "titulo2", perguntas:...
asked by 26.07.2015 / 19:41
3
answers

How to create a mini database written in php using a json-formatted text file

I was needing a personal mini database written in PHP to store some internal data from my site, where I would create new properties, change them and delete later if necessary. The example below shows how this .txt file would look and how to f...
asked by 13.08.2015 / 22:49
2
answers

How to count number of records in a table?

I have a table called noticias , where every news item has id . I also have a table named comentarios , where there is id of the news that the user commented on. How can I tell the comments for that news?     
asked by 25.07.2015 / 23:08
1
answer

What exactly is the "u" modifier for?

What exactly does the u modifier in regular expressions from preg_ to PHP ? Should I use it whenever I process strings that have accented characters? $valor = 'ãẽi ouã'; preg_match('/\w+/u', $valor, $matches); $matches;...
asked by 23.07.2015 / 20:47
1
answer

Javascript - Get object id in a list generated with PHP and HTML

How do I get the object id of a list by sending as a parameter to a javascript function. How do I put the id in the send () function? <?php foreach ($contatos as $contato) { ?> <!-- Inicio da tabela (Na verdade...
asked by 10.08.2015 / 14:17
2
answers

Set and change color in the menu depending on the scroll

Good afternoon I wondered if some way to change the color of a floating menu in a one page template depending on the section of the page where we are. As in this example: link But without using Bootstrap because I would like to keep my o...
asked by 31.07.2015 / 19:28
1
answer

Problem creating SLUG in codeIgniter

Look, I'm developing the portal to my music label, and I'm having a pretty chatinho problem. I'm recording the news, album names, artist names and so on. When I register in the DB I play in a field the original artist name and in the other...
asked by 23.05.2015 / 08:06
1
answer

How to avoid duplication of content in a table without a primary key?

In a virtual store panel that I am building the products have relationships by color and size, where each product color has a size. This is a part of my database for a better understanding of the problem: link When the user wants to associate...
asked by 20.05.2015 / 16:44