-
Posts
2,134 -
Joined
-
Last visited
-
Days Won
42
Posts posted by benanamen
-
-
@benanamen: I have already requested that from her (via PM) but no response. Apparently she'd rather have us guessing.
Yeah, so did I.
-
Aside from what @Jaques1 said, when you start numbering things something1, something2 etc. you are doing something wrong.
-
How about posting an sql dump of your DB so we can work with it.
-
Javascript question in the Php forum?
-
Just noticed that you are looking up ICD codes. That data is way to huge to select everything. You are going to have to do something like a chained select where you select a category and work your way down the dropdowns.
@barand makes a good point about the DB structure. What does the current DB look like? One big spreadsheet type table or something else?
-
For starters, you don't need two queries to do the same exact thing. Dont SELECT *. Name the columns specifically.
You are also opening your form AFTER the first select. In the posted code you don't close the form and there is no submit button.
And next time, use the code tags when you post code.
-
This is just for learning OOP. It is not about the function itself really, but how to handle superglobals in a class. The issue actually came up in a login logging class that uses $_SERVER['REMOTE_ADDR'], another superglobal. Several code analyzers (scrutinizer, codacy, code climate ) pointed out a problem with using them in the class.
* As far as what the function is for, it is used to display messages to the user after certain actions such as a db record added or deleted
-
How would I to convert the following function to a class? What is the proper way to deal with GET and POST in a class since they are globals?
My start
class ShowActionMessage { }
Function to convert
function show_action_messages() { if (isset($_GET['insert'])) { $action = 'Added'; } if (isset($_GET['edit'])) { $action = 'Updated'; } if (isset($_GET['deleted'])) { $action = 'Deleted'; } if (isset($_GET['emailed'])) { $action = 'Emailed'; } if (isset($action)) { ?> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="success">Record <?= $action ?></div> </div> </div> <?php } }
-
Change
if (isset($_POST['submit']=="Sign Up"))
To
if ($_SERVER['REQUEST_METHOD'] == 'POST')
You are also trying to use variables in your form without checking if those variables exist.
-
1
-
-
Not even going to try and decipher your code. If you're doing an INSERT you have no need to know what the last insert id is.
-
@pieterjandc, we all know you don't know what your talking about. Just stop already. You're starting to look foolish.
-
You already lose "best answer ever" by using $_SERVER['PHP_SELF'] which is vulnerable to an XSS attack.
-
Problem is I am returning all the "null" values and I am not sure if there is a way to weed them out.
Oh no, no, no, your problem is the entire database structure. Seriously, stop what you are doing right now and go back to the drawing board and start working on a sensible DB Schema. We will be happy to help you get going. What you have is an XY problem to the extreme.
Start with a project summary of what this application is and what it should do then create a requirements document and post it. Once we know what you want and need we can offer the correct direction.
-
In a nutshell, development server you turn on all error reporting and display errors on the page. Production it is off and errors are logged.
-
1
-
-
The SSH is for a remote connection. Your script will run on the server. No SSH needed.
-
Can you let me have a copy of your software that lets you load a database table from an image. I can't find one. Then I could recreate your data on my pc to rewrite your queries.
LMFAO!
-
If you had gone the Vagrant route first you would have saved yourself a lot of time and trouble.
Install Xammp locally for development. If you want to develop or test on the exact server setup that you use in production, use Vagrant with your virtual box. The particular OS doesn't make a lot of difference as far as a LAMP stack. Apache is Apache is Apache. Php is Php is Php. Mysql is Mysql, is Mysql.
My personal Linux choice for production is Debian. Ubuntu and many others are derivatives based off Debian.
-
I have not used anything else recently to be able to tell you another way. Looks like Flowplayer has changed their model since I used it last.
-
-
You will get better answers if you post your current DB SQL Schema with a few rows of sample data. My auto mechanic does a much better job at diagnosing my problems when he has the car in front of him. I suspect you still have other problems that need to be addressed if you want to do this correctly.
-
What have you done with the information you were given? Show the updated code. The fix can't be any simpler, delete a dash.
-
I am unable to change it without messing up other portions of the site.
So you prefer to continue building on a bad DB design? Your problems are only going to compound if you continue on that path. Your DB is the foundation of all the code you are going to write. If that is not correct, everything you build on it will not be correct.
The smart thing would be to make a copy of the site and do the fixes and testing locally and then backup and replace the "old" site.
It would also appear you have additional problems repeating data with your "types". Types should be a separate table with a unique id which you would use to reference the data. You will want to learn about "Foreign Keys".
-
What he didn't mention is that your code is obsolete and has been completely removed from Php. You need to use PDO. https://phpdelusions.net/pdo
-
I'm not sure why PHP programmers are so obsessed with PDO exceptions.
It's probably because every PDO tutorial out there does the "Try/Catch show user the system error " way of doing it. I used to do that as well until I was schooled by @Jaques1 on the proper way with set_error_handler. The only place I use a try/catch now is on duplicate username on registration.
sql query where varchar field contains row from another table
in MySQL Help
Posted · Edited by benanamen
If you did what @Jaques1 said you wouldn't have answered what you did. Go learn Database Normalization, ...then come back if you have problems after updating your DB.