Jump to content

phppup

Members
  • Content Count

    404
  • Joined

  • Last visited

Community Reputation

0 Neutral

About phppup

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. To Barand, I see. It appears to be required because of mysqli_real_escape_string . Since my code is ONLY being tested locally, I have been negligent with security and focused on functionality. I suppose when I go live I will want to utilize the mysqli_real_escape_string with the proper connectivity. I'm a bit surprised that this needs to be done individually for each variable. Is there a method to simply address "ALL VARIABLES" somehow? PS: Glad that was my only faux pas in my post. ALWAYS LEARNING.
  2. Also, you have EMAIL and SERIAL NO. as UNIQUE keys. From a novice standpoint, I found this to be difficult for testing. Again, I would re-create the table with the SIMPLEST standards and seek success. Then, re-develop and grow so that you can control your experimentation and understand hardships as you overcome them. This helped me learn and develop.
  3. There are many more qualified than me to debug your code, but I recognize your format. Double check everything with a fine tooth comb. A single semi-colon or comma can ruin all your work and make you crazy. Look at the MySQL database and confirm that the database name and table name are spelled EXACTLY identically to what you have in your scripting. I also don't know that you need $con in these lines $fullname = mysqli_real_escape_string($con, $_POST['fullname']); $company = mysqli_real_escape_string($con, $_POST['company']); $email = mysqli_real_escape_string($con, $_POST['email']); $serial_no = mysqli_real_escape_string($con, $_POST['serial_no']); the redundancy may be causing an issue. I would try $fullname = mysqli_real_escape_string($_POST['fullname']); $company = mysqli_real_escape_string($_POST['company']); $email = mysqli_real_escape_string($_POST['email']); $serial_no = mysqli_real_escape_string($_POST['serial_no']); If all else fails, I have found it useful to remove lines of code to establish a single successful effort. Eliminate company, email, and serial_no and SIMPLY work with getting a SUCCESSFUL insertion of $fullname. Then, build from there (to ensure that no single variable is destroying your entire effort.)
  4. Amy suggestions for best method of removing parentheses and hyphen before transferring into the database?
  5. Is there a recommended BEST PRACTICE for storing (and retrieving) telephone numbers from a database table? Is it best to store (in the USA) the area code separate from the rest of the number? Remove parenthesis and/or dashes? Or is there no reason to concern myself with performance or hacking issues regarding the storage of phone numbers as 323-555-1212 or (323)555-1212 inside my table?
  6. Something like that. Thanks for the starting point.
  7. I want to use a particular input for telephone numbers. I have seen working examples, and either need to edit or create code for my end result Aside from the usual telephone number mask, this input field dynamically replaces the value/placeholder that is visible. To elaborate, the user sees the input text box with (___)___-____ displayed. As digits are entered, the field replaces underscores with digits in a progression until complete. (21_)___-____ , next (212)55_-____, then (212)555-12__ until finally (212)555-1212 Any direction would be helpful.
  8. Thanks, Barand. I now see that there are spaces ahead and behind the designated VALUE. I thought I had trimmed them, but apparently more work to be done. At least now I have a direction. Thank you.
  9. ginerjm: I appreciate the input, but that still does not address the problem I am currently experiencing. Currently, with a single IF statement if($a = 'one'){ $variable = "POOR"; } //single EQUAL sign [which CHANGES the value of $a] The result of echo "Your score was $variable " //result is: Your score was POOR But if($a == 'one'){ $variable = "POOR"; } //double EQUAL sign [which COMPARES the value of $a while echo $a displays: one ] The result of echo "Your score was $variable " //result is: Your score was Thus, the $variable is not being 'grabbed' or the comparison is somehow failing.
  10. $selected_value_1 is passed from a form as INPUT with a value of either 'one', 'two', 'three', 'four' $a = $selected_value_1; // in scripting which brings me back to if($a == 'one'){ $variable = "POOR";} if($a == 'two'){ $variable = "GOOD";} if($a == 'three'){ $variable = "VERY GOOD";} if($a == 'four'){ $variable = "EXCELLENT" ;} echo $variable //used later on Currently echo " $a "; Results either one, two, three, four (depending on which input I select).
  11. At that point, a is carrying the value of another variable for simplification $a = $selected_value_1;
  12. An extension of my initial issue is still giving me trouble. if($a == 'one'){ $variable = "POOR";} if($a == 'two'){ $variable = "GOOD";} if($a == 'three'){ $variable = "VERY GOOD";} if($a == 'four'){ $variable = "EXCELLENT";} echo $variable //used later on If I alter the == to a single = then the 'functional result' seems to work, so I know the underlying code is valid. And with single = (as expected) the $variable value displays the TERMINOLOGY that was last replaced as the $a value (because it is re-sretting to each value). But when using == the $variable remains empty from: echo "Your score was $variable even though I inserted echo $variable in random areas and can confirm that it is carrying the value and displaying it elsewhere. Weird.
  13. Thanks for the clarifications guys and examples. Good educational for when my head clears.
  14. It's one of those days after a long weekend and a rainy morning. Simply trying to get the correct message depending on the variable's value if($a = 'one'){ echo "POOR";} if($a = 'two'){ echo "GOOD";} if($a = 'three'){ echo "VERY GOOD";} if($a = 'four'){ echo "EXCELLENT";} Not sure if I need to use ==, extra quotes, or ELSEIF for the best result.
  15. Don't have access to full code at the moment, but if I recall, the query was written once at the top of the code when only Mysql. Does it need to be repeated ahead of this statement with up-to-date MYSQLi? It did work for the other statement without error.
×
×
  • 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.