Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Since you already seem to be aware of the strtolower function I don't understand the need for your question.
  2. If you are stuck with the current format, here is one way to handle it. $input_str = "action: Added; quantity: 1; item_code: RNA1; product_name: Mens organic T-Shirt; colour: white; size: XL"; $items = explode(';',$input_str); foreach($items as $item) { list($k,$v) = explode(':',$item); $k = trim($k); $v = trim($v); $final_arr[$k] = $v; } echo "final result: <pre>",print_r($final_arr,true),"</pre>"; exit(); Note: the comma at the end of your original input sample is possible incorrect. I replaced it with a semi.
  3. I'd like to see your entire form html so I can see how you named all of your other input elements and why you chose one of them for the mystery name.
  4. Are you able to send just a simple text email with a simple "hello world" message in it instead of all this other stuff? Testing the ability to send emails is priority one now I think.
  5. YOu really can't be using a variable value as the name attribute of an html tag. Simply call your comment input "comment" and reference that in the $_POST or $_GET array when you receive the submitted data. The use of SESSION for this is kinda screwy!
  6. PPS - if connupdate is an ajax-called-only script then the display_errors setting wont' work since you have no console/client to show messages on. Have you found the error_log file and checked it out lately?
  7. PS - is this line correct? data: {streamId : streamId} Seems like there s/b quotes in there; otherwise it simply looks like two varnames
  8. OK - that is not what you first posted. Do you know IN FACT that connupdate is NOT getting called? And the query statement you just posted is incorrect. Try simply doing an echo at the beginning of the called script and then exit. Don't do anything else. Then in your caller, show the message returned from that exercise and prove that the ajax call is actually happening. You have me confused as to what's not working with your changes in posted code samples here.
  9. Am I mis-reading the ajax call where it says to call index.php?
  10. The php script that you call index.php is the php script and it does not have any ajax code in it. The calling script (whatever it's name is) is using JQ to make the ajax call and you say you are getting no response back from the "index.php" script. That tells me that (if it all works as you have said) it must not even be getting called, hence the problem is with the AJAX JQ call. Try this - change the ajax call to some dummy php script such as ajaxtest.php. Create that one-line script to simply echo back a message to prove it got called and then test the whole thing out. If you don't get a message back then the call didn't go thru. IF you do get a message back then the problem is with the script that you says "works fine".
  11. So you are saying that your js code may be the problem here and NOT the php code? You have tested the php script previously and only now you can't get it to be triggered by an ajax call? Then maybe you s/b posting in a JS forum.
  12. As I said before - run the script yourself without the ajax call. Add a line to set your variable instead of looking for a post value. Add some echos to output things that may be relevant and echo out the results to the screen. Run it as if ajax was not involved and see what happens. Maybe make a new copy of it and play with it until you fix it and understand how it works. Maybe you just want a script that does exactly what you are saying you want to happen. BTW - is this script in your root folder and is "index" your default script name for php? That is not good if so.
  13. This is not what you had referenced before. So - what is the problem now? What message do you get back from your ajax call? The default error log name is "error_log" and would be located in the same folder as your php script resides in.
  14. Show us the php file in total, if it's not a lot of code. That or run it as a stand-alone script, providing the input value directly instead of from the POST array and add some output to it to display what is going on. It's called debugging.
  15. Ok - so you have defined your table to have 2 field/columns. And currently you have only one record. So when you want to update a specific record you really need to use a key value to identify the exact record you want to update. If you don't then every record that you may have in that table will be updated with the same streamid value. Is that what you want, assuming that there will be multiple records in this table at some future time? I assume that the "id" field is some kind of key value so perhaps you want to add that to your query statement to help it choose the record to be modified. Of course you have to make sure that this "id" will be unique in the table so the query will properly work
  16. You have only 2 RECORDS or 2 FIELDS? Makes a big difference. Records are "rows" in your table. Fields are "columns" within each and every record. By telling me that you "have only two records .... Id and streamID" you are saying that you have two fields in your record definition. Which is why I am asking how you are picking the record to be updated since your query statement does not have a "where" clause. PS - your line referencing the $_POST[test] value works but really REALLY should use quotes on the index value. Yes - php will eventually default to the proper element but it works better and faster and is more readable when you properly quote the index name as in $_POST['test']. This is basically true for all array references unless the index value is a variable name.
  17. But - which RECORD? Is there only one record in your table?
  18. As mentioned already you should be dumping out some of the vars to be sure they contain what you think they should. Also - do you have php error checking on just to catch some errors you may have? Such as $headers. You first create it as an array but then you append a string to it. I have no idea what you might have at that point so a var_dump of that would be important. And - don't use the @ sign to suppress things. If there is an error you should be handling it! Plus the From assignment is incorrect (I believe). It should be "From: xxx" not "From = xxx".
  19. When you do this update query WHICH record are you updating?
  20. I would begin with the invoice numbers table and perhaps add the user id to it. Then insert a new record there with the user id , then get back the just-created invoice number. You don't have to add the user id since you have it in the billable lines table already. Next time though you should think about your db design. BTW - where IS your user data stored, such as address, contact info, etc.? Second - you would then select those billable lines that match that user id and do not yet have an invoice number. The question that comes up tho is do you want to invoice ALL of these lines or do you give the user a screen to select those to be invoiced? Once you have decided on which billable lines are to go on the new invoice it's a simple matter to do an update query to add the invoice number to the matching billable line ids for that user id which would be a simple query, not a loop process. Read up on the "where in() " sql clause.
  21. not following all of your discussion but suggesting this: do not create unnecessary table entries for something already saved in the billable items table do create the user record for the new invoice id along with its date and anything else necessary add the new invoice id to EACH billable item in the billable items table. I assume that you already have the userid in that same table. no need for saving any kind of total since it can always be re-calculated using a query.
  22. Do you have php error checking on to catch any typos you may made in all of this new (and tedious) code?
  23. Why don't you compare the two sets of code (cause I am not going to!) and see what you changed. You do know you have a big chunk commented out?
  24. Hmmm.... 23 hours ago and no problem or code forthcoming. Guess this is resolved.
×
×
  • 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.