Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Exactly where did you get stuck at when you tried this?
  2. The next problem will be the single quotes around 'feel' in the following - $.get("test.php", { feeling: 'feel'} ); That's a string consisting of the letters f, e, e, and l. You would need to remove those single-quotes so that the variable feel would be used at that point.
  3. If the value is actually a number, that part of it will work without the quoting. To add the quoting - <input type="button" id='.$j.' value="Submit" onclick="sendData(\''.$answer.'\')">
  4. This is what the 'view source' is now - <input type="button" id= value="Submit" onclick="sendData(some text)"> This is what it needs to be - <input type="button" id= value="Submit" onclick="sendData('some text')">
  5. The $answer variable inside of the sendData(...) function call needs to be enclosed by literal single-quotes in the HTML, so that is treated as a string. Now, the value echoed out in $answer is bing treated as javascript variables/identifiers. Do a 'view source' of the output in your browser to make sure it is what you expect.
  6. The error message you are getting now cannot possibly be the same one at the start of this thread, because you are using the WRONG variable name as the first parameter to the mysqli_query() statement. $db ISN'T the connection link. You should be getting a php error message at the mysql_query() statement.
  7. Then why not re-search to find the php query functions that would allow multiple queries?
  8. If you are still getting an error at your mysqli_fetch_assoc statement, with the code you have been posting, it's because some of your code inside of your while(){} loop, that you have been cutting out of the post, is reusing and overwriting the $result variable.
  9. The mysqli_select_db statement requires the mysqli link resource ($con in your case) as the first parameter. Do you have php's error_reporting set to E_ALL so that all the php detected errors will be reported? Also, the mysqli_error() statement requires the mysqli link resource as a parameter.
  10. You'll find that the error in your query is because you haven't selected a database. You cannot mix mysql (no i) and mysqli (with an i) statements. You either need to specify the database in the mysqli_connect statement or use a mysqli_select_db statement (or even specify the database name in your query statement.)
  11. The mysql_query statement specifically doesn't support multiple queries because too many php 'coders' don't validate the external data they stuff into query statements.
  12. I'll assume that since you marked the thread as being solved, that you don't actually need any help with this?
  13. Why aren't you populating the fields with the existing values? How would you be able to tell if someone actually wanted to remove a value by clearing the field?
  14. You would start by determining why the code is producing that message. Find out where and then why the entered user id/password don't match wherever and whatever they are being compared with.
  15. If you are on hosting that has a MS SQL server installed, there probably already is an available php extension (sqlsrv) installed that your web host expects you to use.
  16. You also need to make your form field an array, so that you can simply iterate over the submitted form data as an array. See this link - http://us3.php.net/manual/en/faq.html.php#faq.html.arrays
  17. Since nothing you posted shows how your code is going to a 'following' page, your first step would be to post all the relevant code needed to reproduce the problem. Best guess (as a general rule don't expect people to visit links you put in your posts) is you have output buffering turned on in your master php.ini and this is hiding any messages you are displaying and your code is unconditionally redirecting to your 'following' page.
  18. How do you know you can't upload any images? You didn't state the symptom or error you get that tells you that the code doesn't work.
  19. Reusing a variable, assuming you don't need the original contents of that variable, isn't a problem.
  20. The syntax of your query statement is incorrect. The WHERE clause does not go on the end. The following is the basic SELECT query syntax definition (the elements, when present, must be in the order shown) - SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [sTRAIGHT_JOIN] [sql_SMALL_RESULT] [sql_BIG_RESULT] [sql_BUFFER_RESULT] [sql_CACHE | SQL_NO_CACHE] [sql_CALC_FOUND_ROWS] [i]select_expr[/i] [, [i]select_expr[/i] ...] [FROM [i]table_references[/i] [WHERE [i]where_condition[/i]] [GROUP BY {[i]col_name[/i] | [i]expr[/i] | [i]position[/i]} [ASC | DESC], ... [WITH ROLLUP]] [HAVING [i]where_condition[/i]] [ORDER BY {[i]col_name[/i] | [i]expr[/i] | [i]position[/i]} [ASC | DESC], ...] [LIMIT {[[i]offset[/i],] [i]row_count[/i] | [i]row_count[/i] OFFSET [i]offset[/i]}] [PROCEDURE [i]procedure_name[/i]([i]argument_list[/i])] [iNTO OUTFILE '[i]file_name[/i]' [CHARACTER SET [i]charset_name[/i]] [i]export_options[/i] | INTO DUMPFILE '[i]file_name[/i]' | INTO [i]var_name[/i] [, [i]var_name[/i]]] [FOR UPDATE | LOCK IN SHARE MODE]]
  21. The following should have worked - if ($hashed_password == $dbpass) If not, slow down and troubleshoot what your code and data are doing. Echo both of those values. Are they they completely different? Are they different lengths (i.e. $dbpass being shorter because your database table column isn't long enough to hold the value)?
  22. You shouldn't blindly loop though all the $_POST data and put field names/values into queries. That leaves your code open to sql injection. For what you are doing, you should have a specific list of the expected fields (in an array) you want to put into that specific query, then loop through that array of expected fields and access just the $_POST data you want using the field names from the array of expected fields.
  23. Asp tags? Asp tags are/were - <% %>
  24. How is this easier to manage? You have created a structure that is overly complicated to the point that you cannot even figure out how to query the tables to log someone in.
  25. All of your form processing code should be inside of an if(){} conditional statement so that it is only executed if the form has been submitted.
×
×
  • 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.