Posts by Thyago ThySofT • 1,091 points
35 posts
-
0
votes0
answers30
viewsQ: Multiple Framworks within a separate folder domain
I have a framework, where I want to divide it into several frameworks (MVC) per folder at the root of the domain. At the root of the domain I have no file, there are folders where I have file at the…
-
2
votes1
answer84
viewsA: Error "Parse error: syntax error, Unexpected '('"
By the syntax error returned on line 24, a comparison is missing || in your condition: Excerpt from his condition ( $D6==$D2 && $D2==$D8 && $D8==$D4 && $D4==$D10 ) (…
phpanswered Thyago ThySofT 1,091 -
4
votes5
answers267
viewsQ: Store arithmetic operator in variable
I have the following code: $value1 = 10; $value2 = $value1 + 10; // $value2 == 20 I need the operator + is variable, that is, in my case I need it to be + or -. I tried the obvious but already sure…
-
1
votes2
answers682
viewsA: Problem with resizing PNG images in PHP
This answer performs what you need and with the quality you need, but you will need to perform a comparison and find where the problem is. It becomes more difficult to find the solution directly in…
-
5
votes4
answers1466
viewsQ: Camelcase conversion function
I already have a function where it performs the conversion of strings for Slug. Below I will give examples for facilitation in understanding my question. 3 examples before conversion: link para uma…
-
3
votes3
answers2091
viewsA: Place an image in the center of another image in PHP
I believe that you are trying to do this through form to send the image, so I worked out an answer thinking about it. <form action="" method="post" enctype="multipart/form-data"> <input…
-
2
votes2
answers468
viewsA: Send text via form and transform in link via PHP
<form action="" method="post"> <input type="text" name"subdomain" value=""> <input type="submit" name"ok" value="Enviar"> </form> <?php …
phpanswered Thyago ThySofT 1,091 -
0
votes1
answer67
viewsA: Escape "/" with htaccess and/or php
The problem of not finding paths is related to the relativity of paths. Instead of defining paths in /app/configs/paths.php in the form of array, define the paths at the root in /index.php through…
-
-2
votes1
answer50
viewsQ: Variable method name
I’ve had this doubt before but I let it go, now I ask: Example, I have 1 function: public function nome_variavel(){ // A função em si nunca muda, preciso apenas que o nome que ela é definida seja…
phpasked Thyago ThySofT 1,091 -
2
votes1
answer1621
viewsA: PHP + Google API Geocode
I performed some tests, first, instead of file_get_html I used in the code below file_get_contents, but what I realized in the test at least using this method, is that you need to send the parameter…
-
3
votes3
answers221
viewsA: Error: the right syntax to use near 'add
The error is in the entry of your column date in Mysql. Your column date is of the defined type date, so this type accepts input values in the format yyyy-mm-dd and its variable $data is trying to…
-
1
votes3
answers1647
viewsA: Take the first and last date of an array
Explanation in the code comment itself $locados = array('2016-01-01', '2016-01-02', '2016-01-03', '2016-01-06', '2016-01-07', '2016-01-08'); // Array a ser tratada $dif = "86400"; // 1 dia em…
-
2
votes1
answer289
viewsQ: Merge 2 mod_rewrite conditions into . htaccess
About . htaccess and mod_rewrite understanding absolutely nothing! The situation is as follows, I have 2 projects in different areas: This first project uses the condition below that directs the…
-
1
votes2
answers31
viewsA: How to remove Level 1 keys using only one Callback method
How do not want to use conditions, considering its fixed array structure, array_merge resolve, it merges one or more arrays. $teste = Array( Array( Array('id_usuario' => 1), Array('idade' =>…
-
1
votes1
answer762
viewsQ: Is PHP client side feasible?
I develop in PHP and, I would love to do everything only in PHP on dynamic programming issues, but, I know that to do everything I need facing "web" impossible would be without a language client…
-
0
votes0
answers23
viewsQ: How to merge Javascript with PHP
I use PHP, when necessary, I use Javascript, but the basics of the basic. I need to capture the screen resolution of the client, I believe it is not possible in PHP because a client-side language is…
-
9
votes1
answer6417
viewsQ: What is the best practice for a "back page" link?
Would you like to know what is the best practice for that standard button/link (back) in the applications? Today I use href="javascript:history.back();" however there are some considerations that…
-
8
votes2
answers5038
viewsQ: What is the difference between "/*" and "/**" comments in PHP?
I’ve always been curious about this, but since it never changed my life at all, I never sought to know. If there is a difference, what would be between these types of comments in PHP? /* Comentário…
phpasked Thyago ThySofT 1,091 -
0
votes1
answer161
viewsA: Upload mysql image
Bruno, the most common practice is to store the image in a directory and only store the path in BD, otherwise you will need to research more deeply on data type blob. The way you’re doing it, you’ll…
-
0
votes0
answers76
viewsQ: Implement PDO with Prepared Statements
I have a code below functional, but I could not understand well how to implement Prepared Statements to this code/Class. After research on subject and attempts, as I understand it is simple, someone…
phpasked Thyago ThySofT 1,091 -
4
votes3
answers2327
viewsA: Upload a file with php
HTML <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="img" id="img"><br /> <input type="submit" name="img_ok" value="Enviar">…
-
1
votes4
answers1698
viewsA: Retrieve checkbox values in an array
Kelly, I just didn’t pass the values to the variables $familia and $familia_id, I did it right away, but make yourself at home. The concept is exactly the one we talked about, the magic is in…
-
1
votes2
answers528
viewsQ: Create Mysql user and database via PHP
1 - New Mysql user and database can be created via PHP script? 2 - If yes, it would involve some security risk such action? Objective: I have a running system (own CMS) where the user does…
-
4
votes2
answers1640
viewsA: How to know if a stdClass is empty?
You could use the function get_object_vars, to return the properties of stdClass in a array. Then you could use the function count or empty, to know if it is empty or not. Example: $object = new…
-
6
votes1
answer4503
viewsA: Structure of MVC Folders
In my experience, the problem of this structuring always occurs with views, since 50 views can use only 1 controller and 1 model, so my suggestion and how to work with my own framework, is to…
-
15
votes1
answer4077
viewsA: What is the difference between the elements <img>, <picture> and <figure>?
<img> Standard element for image loading. <figure> Element to be used in conjunction with the element <figcaption>. Its purpose is to mark diagrams, illustrations, photos, and code…
-
3
votes2
answers175
viewsA: Take only one value from mysqli_fetch_assoc
Felipe, let me get this straight. Create a column in your table controle_saida ex-name.: id_funcionario When performing "Add" pass the value of id of the official table where are the employees I…
phpanswered Thyago ThySofT 1,091 -
1
votes1
answer1490
viewsA: Image upload
Wender, you will need to store this image in question. Below follows a simple upload routine: index.html <form action="exibir.php" method="POST" enctype="multipart/form-data"> <input…
-
1
votes4
answers935
viewsA: How the header() function works in PHP
Probably your request header is after some HTML, so some output has already been sent to the browser. Headers can only be sent before any HTML output. Hence, a ob_start() will take all the output…
-
0
votes1
answer225
viewsA: fsockopen() error
Have you used this function on this server and worked? It is likely that the directive allow_url_fopen is disabled on your server. Put anywhere in your code and view your PHP settings and get the…
phpanswered Thyago ThySofT 1,091 -
0
votes4
answers1708
viewsA: Delete only selected PHP checkbox
Because it occurred after server exchange, it is probably related to the PHP of your new server. If other errors appear, it may be that the PHP version of the new server is newer and functions used…
-
4
votes3
answers14718
viewsA: How to put line breaking in a textarea?
Save to database with line breaks from <textarea>: str_replace("\n",'<br />', addslashes(htmlspecialchars($_POST['valor'] // OPCIONAL: addslashes é para conversão do caracter ' e não dá…
phpanswered Thyago ThySofT 1,091 -
1
votes3
answers329
viewsA: Save a large form to the database
$dados = array("nome_da_coluna_nome" => $_POST['nome'], "nome_da_coluna_idade" => $_POST['idade'], "nome_da_coluna_cidade" => $_POST['cidade']); $db = new…
-
2
votes2
answers1493
viewsA: Share the same Session on Different Domains on the same Server
Alexandre, really this feat is not possible, the session remains active only in the domain that created it, at most what could be done would be to share this session for use in the subdomains of the…
-
2
votes2
answers729
viewsA: How to organize PHP and HTML code to make an e-commerce?
Leonardo, in fact, the order of the factors will not change the final result of your project, but for better visualization and identation of your code, better to be HTML in PHP when PHP predominates…