Posts by Rafael Andrade • 186 points
13 posts
-
1
votes5
answers2538
viewsA: How to use Try Catch on an Insert
In case you would have to work with the exception class of php the class (Exception), I put a basic example here following the line of your code, but there is a more correct way to work with it.…
-
1
votes1
answer574
viewsQ: How to access objects of a class within an anonymous method?
I researched a lot on the Internet but I did not find in how to develop, I will be very grateful for who can take me that doubt. I would like to develop a php class where you can access your methods…
phpasked Rafael Andrade 186 -
2
votes3
answers112
viewsA: How to simplify the process of verifying a certain value?
I don’t know if this is exactly what you’re looking for but I’ll risk a cleaner and more beautiful way to check if your post variables are being passed: Ex: $nome = filter_input(INPUT_POST, 'nome',…
-
1
votes1
answer163
viewsA: Add tooltip to button that came straight from Php via Ajax
This is because every html element that enters dynamically is not part of GIFT which was loaded into the current document. In order to be able to select these elements you must use some jquery…
-
0
votes1
answer104
viewsA: Login screen does not validate
The first very important thing you have to take into account is that all functions (mysql_* and mysqli_*) are obsolete and since php version 7 have already been removed. The second thing is when you…
phpanswered Rafael Andrade 186 -
0
votes1
answer305
viewsA: Redirect URL to mobile version with . htaccess
You can use htaccess’s 301 redirect. It is very simple to do this, just specify the Redirect 301 and pass two information, the first is the old url and the other is the new url to be permanent. Ex:…
-
0
votes1
answer81
viewsA: Form Encoding
If this code below does not work: header("Content-Type: text/html; charset=UTF-8", true); You may need to use another php feature that causes the variable to be encoded separately. Ex. $nome =…
-
3
votes3
answers327
viewsA: Error reading JSON with PHP
I downloaded your code and tested here, at least the error I identified was that following the format of your json is giving error in the comma in the last items of your list. Ex: (wrong) $json = '{…
-
1
votes1
answer560
viewsA: Unique (dynamic) or custom query?
Friend, I don’t know if I understand very well what you want, but it seems that what you need is a class with persistence with the database that already has the predefined methods where you use it…
-
1
votes2
answers433
viewsA: Check if email is registered in the BD
I know this question has already been answered, but I would like to leave a more secure solution in the case of sql statements aimed at string queries: In the case of your select it would be safer…
-
0
votes3
answers1088
viewsA: How to select Mysql using input date type with php?
Well, if the date column of your mysql table is in the correct type format (date=Y-m-d), I would convert the date according to the mysql table. EX: If you have the stored data whose dates are this…
-
-1
votes4
answers1009
viewsA: Connecting PHP to the Mysql database
Try editing your "mysql_connect" line for this. mysql_connect('localhost', usuario_bd, senha_bd);
-
1
votes3
answers52823
viewsA: How to get current url with PHP
I have a very nice class for this task, feel free to use it, opinion, study, etc... This would be the form of use of the same: <?php $uri = URI::base(); echo $uri; ?> or only... <?php echo…
phpanswered Rafael Andrade 186