-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
desperate postgrad student in need of some basic help!
ginerjm replied to lenny86's topic in PHP Coding Help
What is "uml sequence" and what is "activity diagram" when used in a single sentence? A post-grad student? Really? -
I am in way over my head... Someone Please Help!
ginerjm replied to PageNumber5's topic in PHP Coding Help
This might be better off in the CMS forum where they talk about things related to WP -
nothing happens when I click the submit button to insert
ginerjm replied to ricky15's topic in PHP Coding Help
And just what is this syntax: $_POST I've never seen that. Is it valid? If you turned on php error checking you might see some errors here. -
return the value? Although it is really bad code, doing queries for single values and closing the connection after each query. Let alone that your function is not written as a proper self-contained "thing", what with doing a close when the open wasn't part of it. A wiser approach would be to do complete queries for all the values you need and only putting it into a function if you need to do that 'better' code multiple times.
-
What you posted is no help for us to help you. That said - the problem is most likely due to you outputting variables (arrays!) that have not yet been defined on the first pass thru your script. A properly structure page will do all the php logic first so that vars that need to be defined for the eventual output are actually defined. Then at the end of your script you generate your html output, which will then be outputting already-defined vars.
-
Why do you close your connection at the end of the get query value function every time? Wasteful!
-
Purpose of second argument to PDO::query()?
ginerjm replied to NotionCommotion's topic in PHP Coding Help
When I looked up fetch, it shows clearly that FETCH_OBJ is a valid option. You have to look under pdo_statement: http://php.net/manual/en/pdostatement.fetch.php -
How to show, edit and save with PHP PDO MSSQL
ginerjm replied to Darkstar0078's topic in PHP Coding Help
I have no idea what your client is looking at so it is impossible to answer your last question. One could design a screen that asks the user to select an activity and then he would be directed to the specific screen to do that thing. Or one could design that same screen to offer the client any of the choices in multiple forms so that all the actions could be accomplished on that one screen. Your choice, but until we see what you "design" we can't answer your question. -
How about this define('MYSQL','d:\wamp\www\'); .. .. .. require(MYSQL.'Connect_login.php'); Never used a define so I may have it a bit wrong, but you can see how mine is different than yours.
-
Alright - so now you have fixed it, but did you add a script name for that require? And why do you use 1 slash twice and end it with 2?
-
What's with the 3 slashes?? And - you are trying to include a script with that require statement but you aren't specifying anything except an attempt at a path.
-
How to show, edit and save with PHP PDO MSSQL
ginerjm replied to Darkstar0078's topic in PHP Coding Help
Yes - site is the name for a website. My question was - are you really creating multiple websites? To be blunt - I do believe you are creating an 'application' on ONE 'website' that may have multiple scripts and screens. From your questions I would suggest that you do some reading up on how to code on the web. Html and PHP manuals/guides/articles would be very helpful. Google is your friend. You appear to need quite a bit of instruction at this point. One can use the sql syntax of : insert into table (fld1, fld2, fld3, ...) values('$val1', '$val2', ...) on duplicate key update fld1='$val1',fld2='$val2', ..."; which would do an update when the primary key already exists on the table. Of course all of those values need to be sanitized before putting them into this query, or be substitute parms in a prepared query statement such as: insert into table (fld1, fld2, fld3, ...) values(:val1a, :val2a, ...) on duplicate key update fld1=:val1b, fld2=:val2b, ..."; If you don't know what the above is, then you definitely need to do some more reading. -
Jacques has provided the better answer in this particular case. The rule is "Never Trust The User's Input" which he is attempting to solve for you. Barand has given you the purely mechanical solution to your question, but J has given you valuable code to build a better app.
-
I would think this is more of an sql question than a php one. If you are getting the contents of your lists from a db query, then you need to add the 'order by' clause to your query statements to do what you want.
-
How to show, edit and save with PHP PDO MSSQL
ginerjm replied to Darkstar0078's topic in PHP Coding Help
You need to read your code and think about it. The first thing you do is check for something and if it is NOT present you proceed to add a record. Huh? You should edit your inputs to ensure that they are not malicious and that they are the kinds of things you expect. Otherwise people are going to be stuffing your db with garbage or worse. Is English your primary language? It's not clear from your post what with all the errors in it. I have to ask you to clarify something. What do you define a "site" as? You state that you have 3 sites. Normally I would suggest that you have one site with perhaps 3 or more screens to handle the different functions you need, although personally I would combine the add/edit functions to one screen. -
yes you can. After your php code has processed the uploaded file and saved it using the true filename and not the temporary filename that was generated by the upload, you can use a PHP string function to grab whatever portion of that filename that you want and then do whatever you want to do with that value.
-
Need to get values on drop-down to sort by two different criteria
ginerjm replied to Skormy's topic in PHP Coding Help
Way too difficult to follow. You need to learn how to write your html code separate from the business logic (the php) so that one can make sense of it. Sort your data before trying to build the html. Then it becomes simply a matter of creating the option tags without worrying about if/else code. -
So many issues. Try turning on php error checking at the beginning. Use the same 'connection' variable both in and outside of your querying function. "con" & "conn" You do all kinds of sanitizing on your input email value, but then you don't do a darn thing with the password. Furthermore you apparently are storing the password in plain text - bad, bad, bad. Do you plan on ensuring that an email address will be unique?
-
Are there always 5 sessions for every room? If so write your loop to repeat those 5 times and in the loop do your fetch without a while verb. If the while fails, then set the values to null and show them that way.
-
Recommended design pattern for updating name/values
ginerjm replied to NotionCommotion's topic in PHP Coding Help
Off the wall suggestion, since I'm not a class-y kind of guy. How about using the get_class() function to get the current object's class name and use that as a key to a 2D array of allowable column names? If the column name is in the array under that classname key, it's a go. -
How to point last element of an array in PHP?
ginerjm replied to Aarav123's topic in PHP Coding Help
You need to 'point' an element? Or 'print' an element? If it is 'print', then Pravins has 'pointed' you to a function which should help. If you truly meant 'point', I'm confused. -
You have written so much English about nothing here. If you can't see that the attitude I expressed is definitely worthy of saying then you have the problem, not us on the forum. To help a possible illegal operation in the making would be not only immoral but possibly prosecutable should the real copyright owner decide to pursue all who brought this to fruition. Go back to "classic asp/.net/sql" where apparently such concerns of legality aren't expressed. Here in the PHP world we do have some morals and concerns other than "CODING help".
-
And why can't I be the 'moral warrior' here? Do you have info that would indicate that I am not a moral person? Thankfully you have told us that you are in fact the owner of this music so the point is moot, but still your statement boggles me.