-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Why do you need this array? You will have a set of query results that will be rows (in an array format) that have all the data you asked for. You are not asking for anything complex here unless you and mac_gyver are in over my head. Change your query to use this: WHERE date_fld_name between '2021-01-01' and '2021-03-31' and you will get a range of records regardless of whether they have the word value you mentioned. Order it like you were doing. Then go thru them with a while loop and present the output. Why the array? I'm not trying to be difficult. I just don't see why this is becoming so convoluted.
-
You originally showed us your results showing counts for those records that have a certain value in them. Then you said you wanted to see the recs that did not have that value as well. The suggestion I made was to skip the where clause which would show you all records in your table. Your latest posts seem to be heading somewhere else. Do you not want all the records? Or do you want only the records that are in a certain date range? Obviously that could easily be answered with a where clause examining the appropriate date field in your records. What else do you need from us?
-
Drop the where clause then. No? You might also write your code to handle more issues such as a bad query or a query that doesn't run for some reason. And post the code here using the <> tag to put it into a more readable format, separate from your text. $q = 'SELECT DATE(`s_created_at`) , COUNT(*) as rec_cnt FROM `tickets` where subject LIKE "%Word%" GROUP BY `s_created_at` order by s_created_at DESC'; if (!$qrslts = $mysqli->query($q)) // check if query runs { echo "Query did not run"; (show mysqli error message also?) exit(); } // show the results now while ($row = $qrslts->fetch()) // not familiar with mysqli format here { echo "{$row1['s_created_at']} {$row['rec_cnt']}<br>"; }
-
When there is an error I just send the screen back with all of the user's input still there. He corrects and re-submits. As for a successful entry, the rest of the process could go somewhere else or could be processed right there and output. For simple things I create a div that I only display when the results are made available. The screen still shows the input form (div) and then the results (div) when present. The user can change the input and click on the Process button to see some new results. Or hit a Return button to exit gracefully to the caller. For more complex apps calling a new page is certainly the way to go. Just save all the user's input into a SESSION array that the next script can look for.
-
This is how I do pretty much all of my input forms. Sometimes I have a JS function that edits one value to suppress the post but mostly my click takes me back to the originating script, validates and either rejects the input or proceeds to the next phase of the app.
-
And I'm trying to steer you away from that. Read my posts.
-
My page DOES 'self-evaluate', it I get what your definition of that is. What don't you see in my description? What second click? I have no second click in mind. User gets screen. User enters data. User clicks on type='submit'. The validate form checks everything out and sends out the same form and waits for the next attempt. BTW - my validate script is the original script that sent the form out the first time. With no data. So when it reads back the form with the data it is very easy to re-send it by making sure your input tags have a value clause using a php var that gets set when the validating logic pulls in the POST data and assigns each input to those php vars. Problem solved.
-
Why not continue the way that you first started telling us. Let your form be directed to the validate.php script where you grab all of the values from the form and validate them. If you then have errors, you re-send the form with all of the user's inputs again and let them correct them. No JS needed. When your validate script finds no fault, you can proceed with whatever is next.
-
Since I don't see the word 'mail' anywhere in your long,long code block, how about you tell us or show us the part of the code that is trying to display it?
- 1 reply
-
- php
- php database
-
(and 1 more)
Tagged with:
-
As you can see from the lack of responses, nobody here understands what you are asking. Lots of us know how to use JSON to go from JS <> PHP. The first question that we are all probably asking is "why does he need to do this?" and that is why I asked for a simple description of what your overall goal is/was. You are not used to intelligent questions I guess and that is what is making you so irate. Many times on these forums when the poster steps back and explains what he wants to do (rather than trying to make us see what he has got himself into), the solution becomes clearer and simpler and gets resolved. I'm trying.
-
Sorry - not enough for this dummy. My thoughts were that perhaps there was a clearer way to solve your riddle if we knew what your overall goal was. You threw some things at us and then ended by asking about js->php. Apparently you don't believe in getting other opinions as a solution.
-
Huh? How about you just try and tell us in plain english (that means no mention of html,php, or js) what you want to accomplish with the data you currently have stored in a spreadsheet? Obviously you are not happy with it being in that format and you want to do something else. Tell us what that is.
-
Need help with building a custom serialized function
ginerjm replied to jcmaad's topic in PHP Coding Help
That is NOT a 'serialized function'. It is a STATEMENT that calls a function that does 'serializing'. My problem is with people who don't know how to ask a valid question. And people who have no idea what they are doing and want someone to do it all for them. The forum (here and everywhere) is to HELP people perform their own writing. If you want to hire someone to do that for you, go to another forum. I'll leave to your own devices now. BTW - did stackoverflow not give you what you were looking for, so you came here? -
Need help with building a custom serialized function
ginerjm replied to jcmaad's topic in PHP Coding Help
If your knowledge of php is zero, then I suggest you find another line of work. Or start by getting a good book and reading it and following whatever tutorials they present. Beginning with serialzed data strings and custom functions is not exactly a starting point. And there are no 'serialized functions'. -
Need help with building a custom serialized function
ginerjm replied to jcmaad's topic in PHP Coding Help
I went to your link and have to ask "Are you kidding me?". The link shows you the code. There is no need for any additional function. It is right there. -
Need help with building a custom serialized function
ginerjm replied to jcmaad's topic in PHP Coding Help
And what have YOU tried to write so far? Post is here (using the <> icon of course) -
Need help with building a custom serialized function
ginerjm replied to jcmaad's topic in PHP Coding Help
Can you be a bit clearer on 'serialize'? Since you seem to show us what you need I am wondering what you want us to do. Oh. And just what is a "serialized function"? -
Passing data from an input tag is simply a matter of declaring a form with POST and and action to your script. Then in your script you grab the $_POST element from the tag's 'name' attribute and use it. Real Simple. You don't need JS to do it necessarily. Reading a book makes a world of difference.
-
"form data javascript" Something that you NEVER EVER MENTIONED!
-
Show us the code, properly posted here of course
-
And you still did not take the advice given. ADD some echo statements to make SURE that what you think is happening is really what you are asking for. Jeez!
-
Ok - so start doing some echo's to show EXACTLY what is happening and be sure the error checking is enabled and turned on. That way you will know if any of your assumptions are incorrect. It's called debugging.
-
Ok I took the time to re-structure the code you posted and I haven't a clue what you are trying to do. Here's what it looks like when written with some sense of format and posted correctly: if (!$chunks || $chunk == $chunks - 1) { // Strip the temp .part suffix off rename("{$filePath}.part", $filePath); //start of name search $searchthis = 'filename'; $matches = array(); $handle = fopen($filePath, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); if(strpos($buffer, $searchthis) !== FALSE) $matches = $buffer; } fclose($handle); } $word = $matches; $words = explode(' ', $word); foreach($words as $ws) if(strlen($ws) > 0) $new_word[] = $ws; $cnt = count($new_word); $cnt = $cnt-1; $line = $new_word[3]; $new_word[3] = str_replace('filename="', ' ', $new_word[3]); $new_word[3] = str_replace(' ', '', $new_word[3]); $new_word[$cnt] = str_replace('"', '', $new_word[$cnt]); array_shift($new_word); array_shift($new_word); array_shift($new_word); $original_name = implode(" ",$new_word); $new = str_replace('/home2/username/domains/domain_name/public_html/plupload//', '', $filePath); $src = "/home2/username/domains/nerjabible.com/public_html/plupload/$new"; $dest = "/home2/username/domains/nerjabible.com/public_html/path_to_the_file/Genesis _ Mad Man Moon.mp3"; $file1 = "src.txt"; $fp = fopen($file1, 'w'); fwrite($fp, $src); fclose($fp); $file2 = "dest.txt"; $fp = fopen($file2, 'w'); fwrite($fp, $dest); fclose($fp); rename($src, $dest); } What is the significance of the 4th item of the new_word array? Have you considered adding some error checking for all of the operations you are performing? Did you even add the error checking that was suggested earlier?
-
1 - use the <> icon to post your code into a box of its own. Standard practice for forums. 2 - what does this line say to you? It doesn't say anything meaningful to me but I can be pretty clueless sometimes. if (!$chunks || $chunk == $chunks - 1) (Note how I posted this code) It seems to be checking if the value of $chunks is true OR if you can compare some value to a reduced value of $chunks. But as it is the beginning of a block of code we have to wonder what you are doing. The rest of the code is not worth wading thru since it is not that readable (as previously mentioned).
-
Allow me to express my ignorance, but what is your code supposed to do? And what is a weebhook? It would be nice if you talked a bit more about what is the problem or told us what you have actually tried that would solve whatever the problem is, but you didn't. So it seems that you threw some code together and it didn't do what you wanted (and we don't know what that is) and you haven't done anything to solve your apparently incorrect code. Not a good approach to coding.