Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Jacques1 - Thank you for giving me something I can work with. I will try this later as even us retirees have things to do besides code all day. ps - hoping that 'JSON.decode()' is a pure JS thing since I still haven't learned JQ and will most likely not do it soon. Do you have a recommended book for learning this?
  2. I actually am pretty good at JS - have written a lot of it. I just don't use json at all and have no idea how a php script called via ajax is going to return the data I need. Last time I'll ask. Can you Tell me what my ajax script s/b returning? You seem to be avoiding giving me that detail.
  3. YOu posted samples of jquery that I've already said I haven't yet learned. So they are not very much use to me now. That is if those examples are what you think my JS should be doing. You didn't answer my last question, nor did you explain what a 'javascript string' (your term) is. Please tell me what you want my php script to return to the ajax caller - in coding terms.
  4. I do believe that the mail function requires the headers to be in the 4th (missing) parameter. For one thing you absolutely have to provide a from address there.
  5. Still not getting anywhere here. So I make an ajax call to get php to gather my data as it currently does. Then what? What do I echo out for my js to then handle?
  6. Since you haven't seen my script, I'm afraid I don't know what you mean by spaghetti code? My code is (imho) very well structured and does not mingle html and php and js except for where the logic drives the creation of it. In this script I use php to gather all the attributes of my files that I need to create the html img tags and pass the variable created to my html output function. Second - I have no event handlers - simply event attributes on html tags. Do you call that an event handler? Lastly - I believe I have said that I don't know how I would use an ajax-called script any differently. As many people (who know far less than I think I do) say - can you tell me what you mean in coding terms? I am very amenable to doing the right thing - I just don't know what it is.
  7. Sorry - don't understand your point at all. Not at all.
  8. That code is correct. Where are you getting the attributes you speak of? Are they part of the query results? If so , just use them to form your img tag. If not, how do you expect to assign them to each image?
  9. You have a loop in which you create a table and show the exact same information 5 times. What do you think your output will be??? While it may be a small misnomer, the mysqli_fetch_array fetches an "array of the fields of one record" of the results. Not an array of all the records. Therefore your loop is processing just one result record at a time. Consequently you have to go thru the loop 6 times(?) to get all the records. Thus it would make sense to only create the table one time - before the loop begins, with the end tag after the loop ends. Of course a quick read of this function in the php manual might have made this immediately clear.
  10. I think if you had error checking enabled you would see an error in your function calls. Try it.
  11. your mail statement has an error in it?
  12. When I do an ajax process, I use js to make the call, but it is calling a PHP script which returns a "string". WTH is a 'javascript string'? And (as mentioned by others in this conversation) how is receiving this string any different than pasting it into the code like I'm doing now? Yes I use prepared queries but I don't see your example as being helpful to me here. Thank you for your continued patience too.
  13. Jacques1 - I appreciate your comments but I don't understand what your alternate approach entails. I would love to do this the "right" way and make you satisfied with my code, but I don't know what you mean! Are you possibly suggesting that I actually output a js array from my php code and just assign that value in my script section of my eventual output or to a file that then gets included in my output? Probably not, but that's all I see available.
  14. After all the advice you've been given, you still believe that this a good idea? You have to realize that you are talking about trying to write code that examines an incoming webpage that can change at any time and that your code won't change unless you find out that it happened. How are you going to do that? Plus each website is most likely (definitely?) going to different and you will have to have a different method of reading each of them. This a job that involves flying blind most of the time and you want to recruit people to do it for you? Great if you can do it, but what happens once they have been paid (a lot probably!) and you need those changes I mentioned? You think they'll come back or that you will be able to maintain the code? Doing this for just one website is quite possible - I've done it myself. Doing it for many sites is just a monumental task with tons of pitfalls.
  15. I've got a file with some strings that have both types of quotes in them. And I seem to have managed to get the data, display it in my html, store it in a js array (using a json_encode in php and then simply inserting it into my js) but I cannot seem to pass the string as a parameter form an onclick function call to js. For most strings the addslashes makes it work in the function call. But for those with both sets of quotes it won't work. My console tells me there are "unterminated string constants..". I've experimented with many silly changes but none make it work. Ex. of the strings: What do you mean "It's crooked"? Of course I could remove the contraction and that would probably work, but that would be a hack, would not it?
  16. Is this the ajax implementation? If it is how is it different than what I'm doing? The same php code will produce my data again, it is merely the js that is doing something different, yes? Since I haven't learned JQ in the last 3 hours, I don't understand what you are showing me.
  17. From your last - the data isn't secret, no. But why put it in a div tag? I had it as part in the JS portion of my output at first and only moved it to a div tag at your suggestion and don't know why. So - if I do not use the escape option on my php json_encode call, how do I read the damn stuff in js when it has all those backslashes in it? And for the third time - how would ajax alleviate all of your concerns? Please, please show me.
  18. I understanding your concern, but I am at a loss how this situation is a concern. It is a compendium of data from image files on my site which I have uploaded. Period. What Exactly would I need to do to escape this data? And how (again) would Ajax be a solution? I did put this into a hidden div container, but it still shows up in the source code when viewed in the browser.
  19. Moving ahead here is what I have done. Remember - this data is derived from using glob() on a given path to get image files and then using getimagesize() to get the size and building a php array element for each file found. In my mind - this data is not suspect. in my php I did: $json_imgs = json_encode($ar_imgs,JSON_UNESCAPED_SLASHES); to create my JS input. In my html output I did: $code=<<<heredocs <div style='display:none;'> <script type="text/javascript"> img_data = $json_imgs; </script> </div> heredocs; echo $code; And now I have a js array which can be read by my js function which was my goal. What I don't see is why Jacques1 used a display:none in his example since my results are clearly visible to anyone viewing the source of the web page.
  20. You should really read the manual for the functions you are using. There are many good examples of how they relate to other functions so it will help you construct some good code. 1 - your current code cannot possibly run - Turn On Error Checking at the top of every php script you write while in development mode. error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); 2 - Plan what you want to do - your current process is not in the correct order to do your task. You do a fetch of a query result (with an error that makes the statement non-executable) and THEN you check to see how may rows were returned. Does anything seem backwards here?
  21. Pretty explicit message. Handle it.
  22. Jacques1 - Sorry but I don't read jquery. Just looking at it I don't get how you have taken my php-generated data and turned it into a js array. I know you have lectured me before on security concerns, but I still fail to see how data that I am generating without user input or interference can end up being a security concern for my appl. And yes - ajax is available but what is that going to do for me when all I want to do is load a js array. How does one ajax call to a php script do what I want to do better than my current approach?
  23. Uhhh, not a php question per se here but let me ask you - Just how do you know exactly how a search is conducted on each and every website? Is there some "standard" for web designers to follow when adding a search button to their site that I have not noticed when I browse sites daily? I know when I am trying to find something I have to scan the whole page (or pages) looking for how to do a search on that specific site and I'm using my eyes and intelligence to find it. You are talking about a non-AI appl that will do this for you? Or are these sites all identical and you already know how to engage their search protocol?
  24. Even if the data I am using in this case is simply filenames and values that I have collected from the file system?/ Care to elaborate on what your last means, in code terms?
×
×
  • 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.