Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. When one posts code and says the menu is empty the IMPLIED statement is that one has actually run that code. Otherwise why offer it for display and say that results were bad? Glad to have helped tho.
  2. You seem to be rusty on html as well. Your input tags have no value= clause. PS - imho - shorter var names are better. Who needs to be typing 10 or 20 char var names again and again? Too prone to error. Plus - as a newbie you would be smart to turn on php error checking - it will come in handy when you do misspell one of the var names.
  3. Order the query by that field and then in your processing loop add a field to retain the last value of that field. At the beginning of the loop, check if the new record has the same value, and if so accumulate your data in an 'output' var for the email. Once the new record doesn't match, do your email, re-init the output var and then continue on and process the record that started the new value and keep on going. Pseudo code: lastvalue='xxx'; while(loop logic) { if newvalue <> lastvalue and lastvalue <> 'xxx { call your output function that sends email with accumulated data in vars } process new record by taking new data and accumulating into vars lastvalue = newvalue } Hope this makes sense.
  4. Once again - are you one of those re-typers who post fake code that they "say" is what they ran but really isn't? Please - only post ACTUAL code that ACTUALLY ran so that we don't all waste our time solving the wrong problem. Your open php tag is not an open php tag, so nothing is happening in that loop. Plus - it makes for easier typing, easier reading when you don't choose to go in and out of php mode like you are doing. Just used php and echo the entire piece of code instead of only the php var. <?php echo '<select name="quantity">'; echo "<option value='$quantity'>Maximum of $quantity available</option>"; for ($q=1; $q<=$quantity; $q++) { echo "<option value='$q'>$q</option>"; } echo '</select>';
  5. Php gets input data from a form via the 'name=' attribute of an input element. So - if you want to post that data being typed into the textarea tag you need to look for THAT element's name in the POST array. That would be $_POST['main'] since that is what you named it. As for the query statement. Read the manual on mysqli prepared queries. Then you can build a safe query to do your database updates. I don't use mysqli myself so I can't help you. PDO, yes. Mysqli - no. PS - once you get this piece built how do you plan on the users retrieving specific text entries from your database. You have no identifying criteria in a one-field table. Perhaps you want to think about your database design and add some fields. Maybe add a date added, a date modified, a username or id, a 'type' field to perhaps separate different types of entries from each other. Then a specific user can sign on with their uid and provide a date or a type and query the table for entries they have made that match. Sound like a plan?
  6. If you turn on php error checking you may see some errors. Additionally you should be using prepared queries and not such an unsafe query that you are using with that post var being plugged in. Incorrectly as well. As for you code - you are trying to update a table with the value of a form field named 'header'. Perhaps you gave me the wrong code again? I don't see a form field with that name. That said - I have to wonder what you are doing here. You have one big giant meaningless paragraph of text that you are storing into an unkeyed table. Whatever for? PS - when referencing an array element you should ALWAYS quote the index.
  7. Actually I don't see what you are doing. 1 - show me the script that contains the form and the fields involved in it 2 - show me the php code that grabs the form's inputs and what you have attempted to do to save them in a db table. Please name the blocks of code with actual script names so I can be sure of what I am looking at. I am trying to approach this very slowly in order to help you understand what should be happening. If you don't want to do it that way, I'll move on .
  8. Let's start slowly. Post the script that creates your form and process the entries made on it. Let's just focus on that part of your project.
  9. Be sure that the data on the screen is wiped off upon completion? Or as was suggested on another forum have a random token buried in your form and save it to a session var when you first save the data. If that token then matches the session var you have already posted this data.
  10. your postings make no sense. How about 1 - turn on php error checking 2 - stop opening and closing php mode. 3 - put together some code that shows the entire problem, not 3 pieces that we don't know how to put together.. Be sure to show us the form code and point out to us which is line 26
  11. pdo is a better choice. At least that's what most people say here. I find it pretty easy to use. Just make sure you read Jacques1 writeup on how to use it properly and how to make your standard connection logic do it correctly.
  12. What does "it says this ) here" mean? The message is telling you the file and line number. Show us that. More importantly the line number is a good hint of where to look. If it is the end of the named file, then you are definitely missing a curly brace. Walk thru your code looking to see that they are all paired up. If you are using a good ide that highlights your code it s/b easy to locate the unmatched brace; otherwise it's a pia but a necessary part of debugging.
  13. If you switched to either mysqlI or pdo you would be able to fix the problem of unescaped input (contining quote marks) by using prepared queries. You really need to read up on the dangers of running queries against your db with unsanitized inputs - probably from malicious users!
  14. And while you are changing things, you really should change your db interface to be mysqlI or PDO instead of the DEPRECATED MYSQL
  15. Your definition terms are confusing. You want to get "a contact form" (html?) into a "header" (a PHP include module perhaps?) ? Uhhh... Could you be a little more specific in your description so that we can at least understand what you are trying to do?
  16. Why do you use php tags for every statement? Rather silly. Turn it on. Turn if off. Turn it on. Turn if off. Talk about code bloat! Turn on error checking (see my signature). Add checks of your query calls to ensure that they ran.
  17. Why do you check if a function exists that you are only going to create? Are you duplicating some already installed function name? As for your real problem - you do a connect using mysqli but then you try and use MySQL functions which are deprecated.
  18. One thing the manual suggests is that the from address match the domain from which this script is sending it. Also - try including a space in your header following 'from: ' PS - Since mail() and many other functions return a result value (Boolean in this case) you REALLY should be checking that result before simply echoing out a success message.
  19. Has this topic been hijacked by Frank_b or are things transpiring that the rest of the forum are not privy to?
  20. Huh? What was that you said? Oh, never mind. We obviously think differently.
  21. You don't have to change any names - just continue to use the aliases you assigned to the tables in the from clause (p,i).
  22. I find your statement "I know a lot about database designs" hard to believe. One who knows such things would never use it this way. You have DATA that is now unusable except in this one circumstance. What good is that DATA to any other purpose you may in the future? It's like creating a telephone book with the phone numbers in Cyrillic characters and the names in English ones. It's only good for people who can read both and so is your highly constricted data storage plan. IMO - You don't have much of a future as a db administrator.
  23. LeJack - re-read the OP opening statement. It's pretty clear on what is taboo. As for my suggestion to use a 'text' file - a text file is just that - text. Whether it has commas, pipes, tabs or whatever in it doesn't change what it is - a poor-man's db and should only be used as a last resort.
  24. Your first reply was most accurate. That message constantly appears for every new user of this technology. Show us the code from your query statement, your query execution and your handling of the response/results. As suggested, you should (during development!!) show the results of mysqlI_error when checking if the query runs ok (you do do that ?). And of course you should NOT be using any function starting with MySQL only - that interface is deprecated which you should have noticed in the manual.
  25. Some things wrong with your code I think 1 - you can't group a query unless you have some kind of summarization going on. Perhaps you meant to 'order by'. 2 - you have the guts of your next query - you just want to figure out how to build the where clause. Why not start slow and build the input/selection form first and grab the values and validate them. That's a big part of this process - to be sure you are able to get the values and to be sure that you either scrub them properly or build prepared queries to use them in. Then you can start to work on the code to examine each input value and decide how to build the "where" clause. Keep us posted!
×
×
  • 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.