-
Posts
895 -
Joined
-
Last visited
-
Days Won
1
Everything posted by phppup
-
Ahhhhhhhhh. Can you give me a code example or web-link. I'm learning (at least I think i am... LOL).
-
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 ().
-
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: 1.0 1.5 2.0 etc? Is there a way to "adjust" a setting within MySQL? Or in the query that pulls the info?
-
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.
-
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.
-
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?
-
How do I accomplish the task of PADDING? IS this a common occurence?
-
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?
-
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. Help?
-
Is REQUIRE ONCE the best method versus REQUIRE or INCLUDE? I've read lots of links, but am curious to hear from a REAL user.
-
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?
-
This WILL be used in a CONTROLLED environment. So what's the easiest/most effective approach (as I'm not acquainted w/JQuery and AJAX)?
-
I have a page that will sort my DB table by name and telephone number. And it has a button. I want visitors to be able to input a last name, and have the telephone number provided in a SEPERATE and NEW window after they click the button. Any suggestions for best procedure? My two initial concepts are: 1- Make this a form, with the "action" leading to a file like SELECT *FROM myTable WHERE last name="$inputname" and have then use Javascript ONSUBMIT to open a NEW window. (not sure it will succeed as I desire) 2- Make this a simple BUTTON with Javascript pointing everything to the file to process the quiery. PS: I've heard IE doesn't always handle "_BLANK" properly, and I'm unaware of a PHP method. Haven't thought it through entirely, so I'm looking for pointers and advise.
-
Unfortunately, php.net is sometimes tOo 'technically oriented for a beginner to wade through, and their are no easy to understand example for the BEGINNERS. The other sites are EASILY understood..... although the code is flawed... LOL.
-
will check it tomorrow. But thanks! Took a quick look and it seems to simplify the process. Enjoy the weekend.
-
I have a form that was written and works well as an HTML file. Now I've learned a little (tip of the iceberg, i'm sure) and want to place password protection BEFORE it. To the best of my knowledge, this will require SESSIONS and turning my form into a PHP file. (I assume LOTS of reading is ahead of me... LOL) Can I simply change the extension to a PHP, add the <? tags > and just keep the HTML in place? Or do I need to make it PHP and ECHO every line of code? Or is there another way? And while on the subject, does a PHP file require anything before publishing, the way an HTML requires the <!DOCTYPE> information?
-
Hey Pik! Haven't had a chance to plug it in. It'll have to wait til another day, but I wanted to see if I was on the rigth track. What do YOU think of it?
-
Isn't that what I did. Are you trying to be a wiseguy and waste my time, or do you have an actual solution to suggest to improve my code? If so, please POST IT!
-
Does out of date mean the code will NOT work?? They do have a friendly look and easy to follow instructions (even if they are WRONG... LOL) What sites DO you RECOMMEND as a learning tool?
-
How would i code if I wanted to do as you suggested and; just increment by 1 every time an update occurs.
-
But then how do you get them to increment?
-
Don't know how to do what you suggested, so I went with what I could think of.. LOL
-
I got to thinking late last night (which generally leads to trouble), so please be gentle if some educating is in order, as I suppose I will touch a few related issues. As I develop my database, I will include two seperate columns. One for the time/date that an order was placed. A second for the time/date that an order is updated (unless there's a better way, please inform me). I pressume that if a record is updated several times, it will continually overwrite the time/date to the point that I will only see the latest update. Now I was wondering if I could create a third column to keep count of the number of times a record had been updated, so if it were altered 16 times, I would know when the last update occurred, and have the count number also. Will something like this coding work? SELECT updates FROM myTable WHERE id="$id" $updates =n if n<1, n=1 }else{ n++
-
Well, i plugged in a TIME charachter that's NEW to 5.1 and it did NOT work. The one for 4.1 did okay though, so, being as I'm too lazy to check the server info, I'm gonna say it's 4.1 Meanwhile, I know the server and DB is on California time. Gosh, I'll have to dig up the code I once wrote that simply added 3 hours to the time (unless someone has it handy). If I remember correctly, I had to add it in a multiple of seconds or minutes (like 3 x 60x 60). Oh well, I have BIGGER issues with the damn database... LOL.
-
I see what mikosiko is saying. Your DATE is being GIVEN on the same page. So date and ID (which I assume is automated by the table) are sort of a guarantee. If you're putting data in for the other fields from a form, you need to MATCH the 'name' in the form with the 'name' in this script so that it can be put into the table (make sense). Backtrack your steps, and make sure the form ACTION is naming THIS FILE with EXTENSION.