Jump to content

phppup

Members
  • Posts

    862
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by phppup

  1. An obvious answer would be ok. Sometimes the most difficult solutions are in plain sight.

    I am not doing the images in a database, so I am looking at JS scripting.

    I want sure if the destination folder is required to be at the top of a script, or file some specific guidelines.

    I'm sure I'll eventually find the answer, but I was hoping for a clue that might help me save some time.

     

  2. It always seems so simple.... LOL

    Hello to my old friends,

    I have been toying with adding an UPLOAD SCRIPT for moving images from a desktop to a website in order to eliminate the need to log into the server to post images.

    I've seen a few online scripts of various degrees and some with demos), yet the one blaring question remains: Where is the line that dictates where the files end up?

    So many of the scripts explain how wonderfully they look and operate, but they do not indicate where to edit in order to control the endpoint.

    Any insight, as well as guidance to avoid pitfalls with regard to this venture will be appreciated.

    Happy Halloween, as if coding isn't scary enough (at times).  *wink*

     

     

  3. 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.

  4. 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.

  5. 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.)

     

  6. 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?

  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. 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.

     

  9. $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).

  10. 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.

     

  11. 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.

     

  12. 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.

  13. I think this code was working before I updated MySQLi coding.

    Now I am receiving an error:

    Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in....

     

    I haven't gone through all my code, but are there any obvious symptoms to note from the following segment:


    if (mysqli_num_rows($result) > 0) {

        while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {

    //do this

    }

    }

     

    All else style to be functioning as specified.

    Thanks

     

     

     



     

     

     

     

  14. Thanks KICKEN.

    I came up with something similar at 2:AM this morning, which uses Javascript in a shoddy kinda way, but looked as if it would get the job done.

    This seems like an excellent alternative to weigh in contention, and looks as if it too, would do EXACTLY what I am attempting to accomplish.

    Thanks again.

  15. Or perhaps I am misunderstanding.

    When the link states: 

    If the string is empty, the browser will create a new window every time

    are the statement meant to indicate "... Everytime that a singular new window is opened" but that once opened, it will forever be pointed to until closed?

    Or does everytime meet my goal, which is to open a new window everytime a submit button is clicked???

    So confused now.

     

  16. I've read the link.

    It seems to indicate in the first section that leaving the windowName empty will cause new windows to be opened, yet that does not seem to be the case.

    is this bc I'm using chrome at the moment (I would think not).

    so what am I doing wrong?

    I've read the link.

    It seems to indicate in the first section that leaving the windowName empty will cause new windows to be opened, yet that does not seem to be the case.

    is this bc I'm using chrome at the moment (I would think not).

    so what am I doing wrong?

  17. I seem to be getting an acceptable result, sort of.

    I believe at this point the problem is more with the "target" because I on placing results for submitting 1,2, or 3 on the same target.

    If I submit with button 1, a valid result opens in a new window. If I then submit with button 2, the SAME "new window" repopulates and updates with data associated to that query.

    I am currently unable to get a second "new window" to open for a side by side comparison of on screen data.

    I was thinking of using JS to alter the name of the "target" so I could hopefully evade the conflict in that manner.

    But not having much luck there either.

     

×
×
  • 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.