Jump to content

phppup

Members
  • Posts

    899
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by phppup

  1. This is a first time effort to create a video of my local pc workstation screen.

    Attempt #1 utilized an application provided in Windows 10 to create the MP4 file.

    Attempt #2 was to convert a Powerpoint 2010 presentation into an MP4 file

    Both seemed to go well, and produced files then when clicked independently on the desktop, will play their clip.

    However, when called from a local webpage "No video with supported format" is the message displayed where the working video is expected.

    <video width="400" controls>
      <source src="mov_bbb.mp4" type="video/mp4">
      <source src="mov_bbb.ogg" type="video/ogg">
      Your browser does not support HTML5 video.
    </video>
    
    <video width="400" controls>
      <source src="Presentation2.mp4" type="video/mp4">
      <source src="Presentation2.mp4" type="video/ogg">
      Your browser does not support HTML5 video.
    </video>

    I borrowed a video clip from W3 and it seems to work fine, which leads me to believe that either I am creating a damaged file or the file is not truly MP4.

    The file PROPERTIES indicate it is MP4 in all instances.

    Where did I go wrong?

  2. More info.....

    Here is my original code that works well PRIOR to attempting to acquire the LAST INSERT ID:

    $query  = "SELECT * FROM table WHERE email='$email' ";   //checks that email is unique
    $result = mysqli_query($conn, $query);                   //RUNS the above query
    if (mysqli_num_rows($result) == 0) {                     //if no duplicates exist, then INSERT
    
    $sql="INSERT INTO $table..... etc etc
    
    }

    So the question remains, how do I retrieve the LAST INSERT ID without having duplicate entries into my table, and without restructuring my code too drastically (as to affect other portions that use the same CONN).

  3. Fought with code until I eventually put this after my INSERT statement:

    if (mysqli_query($conn, $sql)) {
        $last_id = mysqli_insert_id($conn);
        echo "New record is: " . $last_id;
    } else {
        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }

    I finally got the ID value, except all entries into the table are being duplicated from each single form submission.

    It appears that this is because $sql is being called twice.  I even tried to put this into a function (didn't execute at all).

    How do I get to a single table posting?

  4. I don't mean to bother you with silly questions, but I must be using the wrong search terms to find any viable answers to this.

    Hypothetical situation:  I have a table [Customers] with with an auto-increment id, customer_name and email generated from a form.

    Now, I decide to expand my database to include customer-address and telephone number.

    I decide to create a second table named Contactinfo for this purpose (assuming this is a better database practice).

    As Customerinfo is generated, I want it to POST in association with the respective customer (assuming that 'id' is the best field for association).

    I need some examples and best practices to accomplish this.

    Examples, links, or preferred terminology would be great so I can attack this phase.

    Thanks.

  5. Okay, got it.

    Yes, dates are in table.

    I believe I used SQL previously and this will add to it. If I'm not mistaken, I also used a PHP adaptation to test outside of the table (so that I could get comfortable with it and see results more easily).

  6. On a related note, I now have the basics to send a message to people listed in a database on their birthdate.

    It has occurred to me: what is the best way to deal with people with February 29 as their birthday?

    While the most simple solution would be to just forget them, that seems unfair. LoL

    Would the more practical approach be coding along the lines of:

    if(today +1) = March 1, then also include 2/29 from birthdate column? 

    Will something like that work? Is it practical? Is there a better way?

  7. I may implement it.  But I thank you either way.

    Just fiddling around, so it's not a major component of anything I am working with.

    And I'm actually happy to see that my own thought process to develop my own script to overcome this was along similar lines.

    Although yours is much, much cleaner and concise.

  8. At this point I clearly have too much time on my hands, as I started to tinker with different DATE options.

    $originalDate = 2003-03-03;   //March 3rd, 2003 is the day number 62 in that year
    $day_of_the_YEAR = date("z", strtotime($originalDate));    //provides the day of the year starting with ZERO on 01/01
    echo "($day_of_the_YEAR + 1)";      //allows me to ADD the ONE to compensate for the ZERO that begins the counter

    This is all OK, but then I tried to incorporate the English ordinal suffix by using the date format mechanism S.

    Not only did it not work, but when I edited my code to:

    $day_of_the_YEAR = date("zS", strtotime($originalDate));  
    echo "($day_of_the_YEAR)";  //because it won't work at all with the PLUS 1

    the result for echo $day_of_the_YEAR was 61rd  [which is neither accurate for March 3 nor acceptable as the correct English ordinal suffix.

    Is there a remedy, or is this due to trying to combine a non-date with the S switch?

  9. I have used an assortment of document.getElementBy.... to retrieve data

    If (document.getElementById('xyz').value >10) { do this... or that.. etc.

    I have a group of items with radio buttons and will assign a function if the element ID is A, perhaps a different function if the ID is B, or C etc.

    Now I want to assign an element by its CLASS.  How can I incorporate the desire that if the element's CLASS is "bluebackground" then alert("This is of blue background class")

    I had tried

    if(document.getElementsByClassName("bluebackground") == true) {
    alert("message of choice");
    }

    And other variations, but something is not connecting.

  10. In a related problem (which is more PHP) , I now have a SELECT statement to generate a list of people with the same birthdate.

    I also have a formula that will calculate age with a birthdate from a form.

    How and where (in relation to the SELECT) do I place the adapted formula so that it uses the birthdate (stored in my table) to calculate the ages of the listed people with the given birthday?

  11. OK, after plugging in Kicken's corrections, things are working even better than expected.  

    Now my new problem is whether to use the birthdate 1 (transferred via JS and the hidden field) or birthrate2 (assembled by PHP on the server side).

    Too many choices.

  12. My apologies, and thanks.

    When I read Kicken's reply it appeared to me as if he had simply cut and pasted my original code as a reference. ( I actually couldn't figure out why he would do that, but I've seen people repost entire responses just to make a short comment.)

    However, now that I've reviewed it more closely, I have spotted the adjustments And will test them out.  

     

  13. Both kicken and maxxd: your telling me that I need to "change the value attribute on that input element, but your not explaining how I should do that.

    Obviously, if I knew how to remedy this correctly, I would have done so days ago. Please elaborate with an example.

    It's now an obstacle that I need to learn from.

    PS: for practicality, is it preferable to assemble these sort of elements on the server side? Why?

  14. Re-structured my code for a more streamline structure, but same problem.

    My THREE dropdowns that have names and ID's respectively as year, month, and day.

    My only use of JS

    function date_to_database()  {
          birthdate = 
          
          document.getElementById("year").value  + "-" + 
                 document.getElementById("month").value + "-" + 
                 document.getElementById("date").value;  
               alert("The dob to be passed is: " + birthdate);
         }

    I've also added ALERTS to each dropdown ONCHANGE to alert(dob)

    So I am effectively getting a visual confirmation of every instance that the date is effected.

    in HTML;        <input type="hidden" id="birthdate" name="birthdate" value="birthdate">

    My table now has two fields for birthdate1 and birthdate2

    And my PHP is designed as:

    $birthdate1=$_POST['birthdate1'];
    
    $birthdate2= $_POST['year'].'-'.$_POST['month'].'-'.$_POST['date'];

    My result is: The birthdate1 column will only populate the VARCHAR field with the word "birthdate" (or whatever other static value I put as the hidden's value.

    The birthdate2 column will POST the correct information to the birthdate2 column.

    While I realize that using The birthdate2 provides a solution to the problem, I am still confused as to what is preventing the birthdate1 data from being passed from HTML as a hidden input.

    Answers?  Missed steps?  A break in the process?

     

  15. I think I may just re-work the entire script. It may be easier than tinkering with all the little problems, although I am making some interesting discoveries along the way.

    As for Jquery datepicker, it might be an interesting piece to toy with at a later date (no pun intended). LoL

  16. Created a separate button for onclick="function xyz()" and it ran the script and alert validation with no problem.

    But when I used SUBMIT, the same problem remained in that

    <input type="hidden" id="birthday" name="birthday" value="birthday"> 

     inserted the word 'birthday ' into the db  [i had changed it to a VARCHAR column so that ALL entries would be visible]

  17. Yes, the leading zeros are handled acceptably.  Maybe not exactly perfect, but good enough for now.

    I had thought of this, but considered the problem to be something more (although nothing alarming).  I'll give it another look and see if I can resolve it with this insight.

    I don't generally interact well with AJAX or JQuery, but I do like this particular Date Picker as an option (if I modify things later.... too committed to current code, right now.)  Here's a question: How can I tap into that Date Picker to add a feature for the person born in 1955 so I can ask if he knew he was born on a Tuesday?

    PS: the DatePicker sample seems to run from 1992 to 2012, so I would need to figure out how to adjust that for my purposes.

    And while we're tossing ideas around, I had considered bypassing the entire problem by POSTing year, month, and day to PHP and letting PHP reassemble the $birthday rather than using the JS.  Any thoughts or feedback on that methodology?

     

     

  18. I was going to open a new thread, but since MAXXD kept this one alive.....

    My JS code seems to be working fine, but for some reason the input to transfer the birthday to the db table is not making the connection from JS to the hidden input.

    function xyz()  {     // called onclick
    
        - - blah blah blah to add lead zeros - - 
    
      birthday = year.value + "-" + month.value + "-" + day.value;
       
    alert(birthday); //works fine and confirms format and correct date
    
    }
     
    </script>
    
    <input type="hidden" id="birthday" name="birthday" value="birthday"> 

    In my PHP a line was added:   echo $birthday;

    Along with the essentials to post into the db

    The above code will create a BLANK entry into the db after JS confirms in the alert that the correct data is available.

    <input type="hidden" id="birthday" name="birthday" value="2019-01-24"> 

    will confirm 2019-01-24 through echo $birthday and also add 2019-01-24 to the db field, even if 2001-07-04 was confirmed by JS from my form.

    What do I need to do to resolve the broken connection, please?

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