-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
So - you have a txt file. What do you want to do with it? You're not telling us anything at all here.
-
How/What is the correct way to create a function for MS SQL Queries.
ginerjm replied to kat35601's topic in PHP Coding Help
You are creating a PHP function, correct? Code up the function like this: function DoQuery($where) { // the $where parameter is a complete where= clause $q = (your query statement here with the where clause being replaced by $where) (the rest of your process to produce the result return $result; } // build the where clause if ($runDay) $where = (your where clause for Day); elseif($runWeek) $where = (your where clause for Week); elseif($runMonth) $where = (your where clause for Month); // run the query $answer = DoQuery($where); (use the value of $answer where you want it to show up) -
It sounds like a good plan. Could be done in one script, or in multiple. Perhaps create 3 connection functions and use them before the groups of queries that access them. The key would be developing that query function (or functions) that can be used over and over again for each of your so-called 'pages'.
-
As was suggested by CyberRobot - you should work on formatting it so that you can use one set of code for all of your needs to make the whole process simpler and easier to maintain. All that you want from the included file is some data. No need for html it sounds like, altho I don't know how your whole process handles that now. In the end you could have a script that looks like this: (open db connection) (set some parameters to do a query such as table name, values that alter the query results) (call a function to do the query and return the result value) (do something with the results, such as outputting them) (do this all over again with new parameters). and repeat. You'll probably only have one include for the connection logic and another for the sql code.
-
echo "$num2 | Week"; And remove the echo $num2 from the include-file.
-
Pages? What pages? Scripts that do the same thing over and over? And they all contain a bunch of useless html that you just want to glean some data from? Doesn't sound like the original purpose of all this effort. Personally I would do what cyberRobot said - dump the html, keep the php/sql logic and wrap each in a function. Open one db connection and then call each function and assemble the individual outputs at the end (or wherever) and output them.
-
You wrap your simple db query and logic in some html code and then return a result to the main file to be output? Very strange way of coding. So instead of echo'ing that $num2 var, just USE the var where you need it. Like in the other echo that you are executing.
-
Modify the include file to store a var instead of echo'ing it.
-
Then you really need to follow my suggestion.
-
Perhaps using a more universal coding method would work better. Instead of relying on some blind code to output a value for you, why not return the value in a var and then use the calling script to output it as it sees fit?
-
PHP 7.0.8 password_verify not returning a value
ginerjm replied to cjburkey01's topic in PHP Coding Help
Now that clarifies things! -
PHP 7.0.8 password_verify not returning a value
ginerjm replied to cjburkey01's topic in PHP Coding Help
Jacques stated initially 'Don't use password_default'. That is what I was questioning. Not the cost. -
PHP 7.0.8 password_verify not returning a value
ginerjm replied to cjburkey01's topic in PHP Coding Help
requinex: This would refute Jacques1 position that one should specify the algorithm and not use PASSWORD_DEFAULT. Hmmm... Of course, the manual also says what you imply - use the default constant and let the authors supply the actual algorithm so that (as you say) don't have to worry about it. I'mmm soooo confused.... -
Jacques1 - Well said! LovePHP - If you want to help someone in the future, and want to post code, how about posting YOUR code, code that YOU know and can support and not some random script you found. The OP could have easily done that so why do you think that you needed to do that very same thing? We're here to help people with their code and not to be research automatons. Your brief response in #13 shows that you aren't up to this task. We take this seriously. If you wish to remain on this site and wish to be of help, responses such as #13 will not do much to improve your reputation.
-
You check all the lines? What does that mean? In order to know if something doesn't work you actually have to execute it. As for your html, where did you learn this? You have a label tag linked to a field that doesn't exist. What's the point? Your style on the first input element - why is the width set to 100%? You want that field to fill the page width? I'm not aware of your previous postings, but just looking at this one makes me wonder what your background is.
-
back to PDO and get strange error on online host not on wamp
ginerjm replied to lovephp's topic in PHP Coding Help
Do a simple search of your program files. -
back to PDO and get strange error on online host not on wamp
ginerjm replied to lovephp's topic in PHP Coding Help
Cut your losses now. Switch and the saving in headaches will be worth it. -
Two INSERT statements with UNION in one query
ginerjm replied to vivis933's topic in PHP Coding Help
Probably s/b on the sql forum. It's not a php problem -
Yes - please post the RELEVANT code so that we can help you. What have you tried to do so far? Mail?
-
I think your question/statement answers itself. One of your points refers to proper storage of data in general and the other goes right to the heart of the matter when discussing data storage - How to Get It Back.
-
I may get my head bit off here, but here goes. Data is data. RDBMS is a tool/environment for data. JSON is a tool for passing data - not for safekeeping. My point is - Don't store your data in a db in json format. Store it like you would any data and then when you need to encode it for a purpose, do so with the appropriate function.
-
I don't like how he mentions "so the user will stay at my site". I hate it when developers think it's alright to do that to users.
-
And maybe you could do what Good Programmers do and add some COMMENTS to the code so we can follow it. And perhaps you could restructure it so that the php is segregated from the html to make it easier to decipher and follow and maintain. And since the only query execution statement is commented out, maybe you could show us how you are retrieving this data? And when you have solved this problem maybe you could make the transition to a new db interface such as mysqlI or PDO since you are only doctoring up outdated code that is soon going to break and not be useable. So much work to do.
-
#1 - please post code in the proper code tags #2 - Don't understand much about your question other than "it shows all jobs" #3 - Why do you think we need to see ALL THIS CODE? Can't you pinpoint where you think your problem is? #4 - If I took a guess I would have to say that you need to filter what your query is calling for. Change your where clause to only select what you want to display.
-
I think Jacques point was to use you 'new' skills to correct the old script. Progress!