Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by phppup

  1. Yes. I know this is NOT a Javascript forum (but I've been so engaged with learning PHP's abilities that I don't have time to join a JS group.. LOL)


    I have a page with several "submit buttons" on it to handle several scripts.  <input type="button" onClick=do this or do that value="WHATEVER i decided to write>


    Because my buttons have different VALUES (submit, yabba dabba dooo, etc) the resulting buttons are different widths.


    The problem: I want them all to be uniform.


    I know I can style them INDIVIDUALLY to be the same size, but the real question is whether there's a single way to style them ALL through one script?


    Can they be styled by TYPE (to say; make ALL "button" this size, or can this only be done by NAME)


    It's probabaly already taken me longer to find the answer than if I'd just modify each button seperately, buy curiousity is obsessive.  LOL


  2. Can someone five me the correct code or format to use that will allow my TINYINT columns to carry TWO decimal places when creating my table?  I have a script for creating the table and columns, but only recently learned that I need to ADD the TWO decimal place FUNCTION in order to get whole dollar values to display WITH the trailing zeros (ie.:2.00).  I don't expect to need any values greater than xxx.xx in my columns, I'm just not clear on how to get the desired script when running the initial CREAT script.




    I understand that I can place my HTML code outisde of my PHP tags and have it publish, OR i can put it inside the PHP tags and ECHO every line.


    Am I correct in thinking that either will provide the same result?


    Is there an advantage to one method over the other??


    My code looks something like this:

    //section one

    apples = $POST ['apples']

    donuts =$POST['donuts']


    SQL= blah blah blah


    //section two

    INSERT (apples, donuts) VALUES ($apples, $donuts) etc


    Is "section one" necessary to have in my script, or is redundant since the values are indicated in my results statement?


    I need clarification from people who know this stuff well.  Thanks



  5. Can someone clear up my confusion about FLOAT.


    I have data in a TINYINT field that displays whole numbers WITHOUT any decimal places.  This does not format very nicely when there are ALSO decimalled values to be echoed:




    2.5, etc.    It can be a little confusing.


    The only way I've thought of to resolve the issue (if you know another, please share) is to add a decimal place to get:  1.0



                                                2.5 etc.


    But I am unclear on WHERE to put the commands to get this result.


    Does it go into the actual DB?  Or into my PHP script?


    Please help with a detailed example.  Thanks

  6. if I have a form written in HTML, can I simple place the HTML inside the PHP tags to create the PHP file, or do I need to ECHO each and every line within the PHP in order for it to be published correctly?

  7. Ohhh, these thoughts just run through my head as I sleep.  But will it work?


    Can I set a function so that my UPDATE form will NOT execute after a certain DATE (or even a time of day?)


    I'm thinking something along the lines of:


    if $time>19:00

      echo" You need to make changes before 7:PM";

    else (UPDATE... yadda yadda yadda)


    Yes, i know this is worse than a rough draft, but will it work?  Is it acceptable methodology?

  8. OK.  Is this code tested?


    Looks similar to what I was envisioning if I decide to allow input1 as area code, input2 as pre-fix, and input3 as last four digits.


    Then just put them together and $POST all three as one string (i can do that, can't i????)


    Thanks for the help.

  9. But willl JavaScript be able to validate in a similar manner?


    Thought I was better validating with JS first to lower the requirements of the server (which has the PHP)?


    (too much reading... people write stuff in tutorials, then you come here and discover it was all wrong... geesh)

    (i wonder if it's more frustrating for the newbies OR the pros!)

  10. Didn't know I could do that.  (more info?)

    And then, how would I validate it?  Right now I validate by confirming all characters are numeric. 

    Also, I have a maimum lengh of 10 characters that would be problematic if people start adding dashes and ().



  11. My DB has fields that primarily record numeric values. 

    I've noticed that a NUMBER in a VARCHAR field is aligned to the right and will hold decimal places, and a

    SMALLINT seems to align left and strip whole numbers to the bare digit (eg.: 4.0 is held to 4).


    What's the best way for me to store values, if I want them to hold at least ONE decimal place (so that whole numbers line up EVENLY with fractions:



    2.0 etc?


    Is there a way to "adjust" a setting within MySQL?  Or in the query that pulls the info?

  12. Is there a "PREFERRED METHOD" to handling telephone numbers gathered by a form?


    I'm torn between ideas.


    I need to collect the numbers, and want to be able to view them as (123)555-1212.


    Should I collect them as a 10 digit ONLY string, and strip them into area code, parenthesis, and hyphenated LATER?  Or gather them as 3 seperated input boxes posted to the DB accordingly?


    Obviously, entries will have REQUIREMENTS and error messages, so I am focused on the methodology here.  Thanks.

  13. Hard to believe I'm GIVING advice.  I suppose it's testimony to the learning that takes place here.

    I noticed in your first entry that you have error messages that state:

    "There was an error in the first name field" AND

    ""You have not filled out the form properly."


    This is a BAD idea that will aggrivate users.  Instead of telling them that there IS an error, tell them WHAT the error is so that it can be corrected.


    Use messages that explain WHY the error was triggered:

    "You MUST provide your name in the NAME field."

    "Only alphabetical letters without spaces can be used when filling out your name."

    "Please use ONLY numbers when providing your telephone number," etc.


    Use what is applicable for each independent error message.

  14. I am getting the result I expected with ORDER BY/GROUP BY queries WITH a troubling EXCEPTION: the data is being IN ORDER from 0 thru 9, but 10 (which in this test sample is my LARGEST quantity) is being inserted between the ONE and 2 quantity. 

    Not sure if this will occur with ALL teen values, as well as hundreds.

    The column is a SMALLINT field (not sure if that makes a difference)>

    Is there a solution for this situation?

  15. OKAY, just noticed a twist!

    Apparently I am getting the result I expected WITH a troubling EXCEPTION: the data is being IN ORDER from 0 thru 9, but 10 (which in this test sample is my LARGEST quantity) is being inserted between the ONE and 2 quantity. 

    Not sure if this will occur with ALL teen values, as well as hundreds.

    The column is a SMALLINT field (not sure if that makes a difference)>

    Is there a ssolution for this situation?

  16. I have a database of assorted.  Each row contains defined QUANTITIES for each column item.

    Example: columns for shirt, tie, pants, socks.

    A row would indicate a purchase of 2 shirts, 1 tie, 0 pants, 3 socks for customer A.

    Followed by a row indicate a purchase of 1 shirts, 1 tie, 4 pants, 2 socks for customer B, etc.


    Now I want to sort EACH item, group them by quantity, and get an ordered list by quantity, that provides me with something like this:


    1 shirt customer B

    2 shirt customer C

    3 shirt customer F

    3 shirt customer H

    4 shirt customer D, etc.


    I am using this code for my query:

    $query = "SELECT brisket, COUNT(brisket) FROM pass GROUP BY brisket ORDER BY brisket ASC";


    but it is not organizing the info in a correlated manner.




  17. I am creating several files with the same connection information.  I already REQUIRE_ONCE my connection data that has all the 'secret entry data', but am wondering, if this is my current code in the top of the files:



    $con = require_once('connection.php');

    if (!$con)


      die('Could not connect!' . mysql_error());



    mysql_select_db("$database") or die('Choose a database  ' . mysql_error());


    And then a $query/$result


    Can the lines BEFORE the $query go into an INCLUDE file ALSO if they are going to be constant and repeated, or do they have to be hardcoded into each file individually?



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