Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. I have a type='date' field in my html with an onchange call in it. In the JS function that is triggered by this event I would like to get the newly-selected value and work with it but my JS line that grabs the value of the field is showing the old value still since the onchange apparently occurs before the system has actually updated the html element. What do I have to reference to see the newly chosen date that hasn't made it to the html yet? new_dt = document.getElementById(dt_id).value; // shows new value //alert("1 in changeDay with input of "+typeof new_dt+": "+new_dt); // confirms a string value of new date. dt_new = new Date(new_dt); //converts str to date obj but wrong value The code above reads in the new date value correctly. But - when I attempt to convert that new string value to a date object I get a date that is one day earlier - typical JS logic I presume with 0-based date values. What do I have to change in my last line of code to get a proper date value from the input string of line 1?
  2. I'm going to assume that you have to add a new parameter to this function. And then you will add some code to check what that new value is and perform some piece of the function a little differently, depending on this new value. I would make sure that I set the new argument to a default value (null?) and modify the code changes to do the same old thing if this new value is that default value. Any other value your changed code will then handle. The new argument must be the last in the function header so that if it is not sent in a call the default value will work. Keep the same function name. function xyz($arg, $arg2, $arg3, $newarg=null) { (do something normal) if ($newarg == null) { (continue to do something normal) } elseif($newarg == 'x') { do something new } elseif($newarg == 'y') { do something other new thing } (finish up the function) return; } An example of how it might look. Should give an idea of how to work this out. I can understand your manager not wanting you to duplicate code. It isn't necessary and it only creates more lines of code to maintain down the road which means more hours and such. And now that you see how you could modify this function for his new purpose I hope you understand.
  3. Your code would be far less 'sloppy' if you wrote it one instruction/statement per line so that reading it would be easier. if (empty($SID_errors) && !empty($SID_pageTitle) && $SID_pageTitle === 'File uploaded') { echo '<p>Image transfer complete:</p>'; echo '<p>Image name: ' . htmlspecialchars($_FILES['Upload']['name'], ENT_QUOTES) . '<br>'; echo 'Image Type: ' . htmlspecialchars($_FILES['Upload']['type'], ENT_QUOTES) . '<br>'; if (!empty($SID_dimensions[0]) && !empty($SID_dimensions[1])) { echo 'Image Dimensions: ' . $SID_dimensions[0] . ' x ' . $SID_dimensions[1] . '<br>'; echo 'Image Size: '; if (!empty($SID_kilobytes)) echo $SID_kilobytes . ' KB (' . $_FILES['Upload']['size'] . ' bytes)<br>'; else echo $_FILES['Upload']['size'] . ' bytes<br>'; echo 'Maximum size imposed: ' . $SID_maxDimDigit . '.' . substr($SID_maxDimDecimal, 0, 1) . ' KB (' . $SID_maxDim . ' bytes)<br>'; } }
  4. Do you have a domain? Then of course you can. Create a sub-folder of your web root name and use that. Use $_SERVER['DOCUMENT_ROOT'] appended to the front of your files folder with a slash to join them.
  5. So that function that simulates an Ajax call - does it already work for you somewhere else? Do you know in fact that the event handler is being called? Add an alert to it perhaps to test it out? Of course this is after you get all the pdfs uploaded.
  6. Well thank you for pointing that out. But I still am clueless about what it is doing there and I don't think I have any need to learn about it.
  7. This line: $filename = substr($file, 0, -4); is not doing what I think you want. Given file1.pdf that substr using 0,-4 will give you just file1 Are you trying to let the user select from a list of files (in the buttons) and have your script call another "display script" to put it on the screen for the user? Or is that js code supposed to do something to the current page?
  8. Since I have no knowledge this class you are using (at least I am assuming it is a class) I really can't help you. But look a the docs for it and see what methods are provided. Than add it to the php section after you have done the update and display. If it's just a one line call to a method you could insert it right after the logic I gave you.
  9. You gave that to someone to help but I had no interest in whatever it was/is.
  10. That's the part I said you have to do. I certainly don't know what your app is doing and I'm not going thru the entire block you posted. Is this thing using a db? Find the logic that uses the $article's class and see what methods it has. It has a getview one so maybe it has an "updateview" method.
  11. I assumed that it was an italics tag that s/b showing the new value. Figured if it was outside the <i></i>then it served no purpose. Have no idea what "font awesome" is BTW.
  12. Did you see the echo output that I put in there? Can I see That block of code please? Not the whole thing which I woudn't even look at. Just a little that will give me some context. BTW - do you have error checking enabled? When you say not working does it at least display when you run it? Just ran a test of the code. There is an error in my code which you are not picking up apparently. Turn on error checking or if by not working you mean that you see absolutely nothing on your screen.
  13. Hidden as in HTML hidden fields? Certainly not a PHP thing.
  14. It should be showing the same 'new' value every time since we are not saving it afterwards yet. Try this: $cnt = $article->getViews(); $newcnt = $cnt + 1000; echo "old cnt $cnt; new cnt $newcnt<br>"; echo "<li> <span class='cmp_button_wire'> <i class='fa fa.eye'>$newcnt</i> </span> </li>" see what you get out of that
  15. If this were part of a PHP script it could look like this:< // assuming already in PHP mode $cnt = $article->getViews(); $newcnt = $cnt + 1000; echo "<li> <span class='cmp_button_wire'> <i class='fa fa.eye'>$newcnt</i> </span> </li>"; How you update the $newcnt into where $article is another topic. PS - I corrected your italics tag. The better way is to use CSS for that instead of the old <i> tag.
  16. Yes - <?php has been the norm for awhile now - just didn't cause a failure until recently. It has been the suggested format for some time. Glad you found it. Below is a (perhaps?) cleaner version of your code. Something that makes it a bit clearer (to me at least): // Always specify the column names you want to select, not just a *. // IMHO - define the query in a string var so that you can easily show it if necessary without having to re-type it. Perhaps you may // want to add it to an error output to see what it looks like during debugging. // $q = "SELECT page_id, page_img, page_imgalt, page_title, page_text, page_intro, page_baanner, page_video, page_tags, page_desc, page_onto, page_ontodesc FROM pages WHERE page_website = '$site' ORDER by page_id LIMIT 0,1"; if (!$qst = $pdo->query($q)) { echo "Error - query did not run"; //add error message output here too. exit(); } // process the results now while (list($id, $img, $imga, $title, $text, $int, $banner, $vid, $tags, $desc, $ontology, $ontodesc) = $qst->fetch(PDO::FETCH_NUM)) { // do your output work here with the vars (slightly modified) provided in the list() ... ... } Next step is to learn to use prepared queries, especially when inserting user-provided values in a query.
  17. YOu didn't mention that you were using Ajax for this. Why not just let the script upload the data, do the db update and then return to the player or whatever started this? And then show us the Code that is not working , not all the html and css stuff. Just the php. And maybe the form so we can confirm that you are using named fields properly.
  18. Not sure what you post is supposed to show us. The code sample makes no sense since it is incomplete(?) and disjointed. You show us a query. You show us an html source(?) tag. You show us an ending audio tag. Where's the part that is supposed be trying to add a counter to a table? Where is the part that is supposed to populate the source tag with a query result? Where is the fetch for that query result?
  19. So it means that we have to see that code that is making the call to the wrong page if you want to change it. Find the button that makes the connection and see if the name of the page is specified in the href attribute (?). Change that name to the new name and see if you got it.
  20. Looking to improve on a fulltext-keyed table search process. I have a MyIsam table with a primary index as well as a large varchar column keyed as fulltext. What I would like to learn more about is how to do a search on the fulltext key that uses multiple words. The text field is a set of meeting minutes so there is quite a bit of text in ordinary English. I'd like to improve my current searching capability to help me to do this kind of expanded searching. Right now I can only manage to search on a single word which limits my searching capability and results. I have recently started reading up on this and have gotten myself in pretty deep with Natural Language, Distance and using "" on the search words but it doesn't seem to do what I want to do. Ex. Say I want to find a sentence/phrase that uses "M/C", "donation" and a dollar value indicated by the presence of a $ sign. I apparently am not allowed to do that cause I get no results. And that is why I am here. Here is the query I currently have tried: SELECT meet_date, meet_txt FROM meeting_mins WHERE Match(meet_txt) against('"M/C donation $*" @10 ' in Boolean mode) The above is looking for the existence of 'M/C' and 'donation' and a $ with anything after it. All within 10 words of each other. At least that is what I think I'm composing. I have also tried it without the $ item and again with no slash in the M/C item. No results for any of these. Any mysql aces know what I need to do to accomplish the query I included? To be clear the column 'meet_txt' does have the fulltext index defined. It is using the MyIsam engine and the utf8_general_ci character set. To add some more complexity - would it be possible to derive a position value for where in the field the search was successful, or at least the first place it was?
  21. So what you are Really asking is: How do I convert a csv file to an Excel spreadsheet.
  22. Have the sender give you an xls file?
  23. Because you put your root in a different branch of the file system. I think the sample you used was just that - a sample. Your user (as you now see) had to be "/var/www". When you setup your tree on day 1 if you had used 'usr' things would have worked.
  24. Move the fonts folder to something in or below /var/www such as /var/www/fonts That way all of your apps should see them no matter which domain they are in. Of course I have no experience in running apps so I may be wrong but that would make sense to me.
  25. Are you serving this domain yourself on your own box? Or is it shared hosting from somebody else? If it is shared then you only have the part of the box then begins with the first two parts of that 'root' path, I think. My root has 3 folders of which the lowest one is the web root folder. I can see one folder above that where I store things like my php files so they are not available using html. Your php can probably only see /var/www
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.