Re: [PHP] Month loop
that's what I'm looking for - thanks. David Nicholson wrote: > Hello, > > This is a reply to an e-mail that you wrote on Thu, 19 Jun 2003 at 20:58, > lines prefixed by '>' were originally written by you. > > > Is there any way I could loop thru and print all the month names (i.e. > > January, February)? > > for($i=1;$i<13;$i++){ > echo date("F",mktime(0,0,0,$i,1,1)); > } > > For more info: > http://uk.php.net/manual/en/function.mktime.php > http://uk.php.net/date > > HTH > > David. > > -- > phpmachine :: The quick and easy to use service providing you with > professionally developed PHP scripts :: http://www.phpmachine.com/ > > Professional Web Development by David Nicholson > http://www.djnicholson.com/ > > QuizSender.com - How well do your friends actually know you? > http://www.quizsender.com/ > (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Month loop
Is there any way I could loop thru and print all the month names (i.e. January, February)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] page name string
I need a really simple function that retrieves the actual page file name from a URL. So, if the URL is http://www.server.com/pagename.php, or if it is http://www.server.com/directory/pagename.php, the function in both cases will return "pagename.php". I'm sorry if this is a ridiculously easy question, but I've combed $_SERVER and Javascript and have come up with nothing, and I am dumbfounded. Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking $_POST variables
I'm running this script to make sure all fields are filled in on a form: foreach($_POST as $p) { if(!$p) { header("Location: signup.php?error=3"); exit(); } } But I need to exclude one field on the form from being checked - Street2. How could I do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve last n records
I see your point, and I'd really like to use Limit in the query. However, what if I want to sort those 5 last records by another field? They're already sorted DESC, so I can't do that. Kevin Stone wrote: > - Original Message - > From: "drparker" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 2:42 PM > Subject: [PHP] retrieve last n records > > > I need to retrieve the last n records of a table, n will probably be 2 > > or 3. I know that I can accomplish this by: select * from table order > > by field DESC Limit n, but i would prefer not to do this way because it > > interferes with my sorting mechanism on the main page. Is there any > > other way to do it? > > Retrieve your records as normal and using mysql_data_seek() to move the > results pointer to the desired row then start your loop. > http://www.php.net/manual/en/function.mysql-data-seek.php > > Please note this is not an efficient way to accomplish the goal. LIMIT is > certainly the way to go and you should be able to do any sorting you need > within the SQL statement. After all retrieving, ordering and grouping > database information is what SQL was designed to do. > > - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] retrieve last n records
I need to retrieve the last n records of a table, n will probably be 2 or 3. I know that I can accomplish this by: select * from table order by field DESC Limit n, but i would prefer not to do this way because it interferes with my sorting mechanism on the main page. Is there any other way to do it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need apostrophe solution
i need to escape all my apostrophes in values submitted to a mySQL database. i know how to do the string replace, but is there a way i can loop thru all the post variables and replace the apostrophes? if so, do i need to refer to my variables like "$_POST[$variable]" instead of simply "$variable" (like i have currently) for it to work? any help would be greatly appreciated... -Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: arrays
this should work: for ($i=0; $i<5; $i++) { $mypics[$i] = $picture; } Edward Peloke wrote: > Ok, very basic question, how do I am going through a loop 5 times, each > time, I want to store a value into an array, do I simply set the value of > > $picture=array($mypics); > > and each time it loops it will take the current value of $picture and then I > can get out each value by $mypics[0], $mypics[1], etc? > > Thanks, > Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting a field value
I'm adding information with the INSERT command to 2 tables. In the first table, called "courses", I have a field called "course_id" that is an auto-increment - assigned by the table. In the second table, called "par", I have a field also called "course_id". I need to assign to this field the value that is assigned for "course_id" in the "courses" table. The problem is, I don't know what it is going to assign, and I can't get the variable with a query such as "SELECT * FROM counties WHERE course_id = ##" because I don't know what number is going to be assigned as the course_id. Basically, I need to store the that course_id value of the course I just added in a a variable, and I don't know how to retrieve that variable. Any help would be greatly appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ordering a text field
I'm running a mysql query with the ORDER BY clause, the problem is that the column that I'm running them on is type tinytext. The data are product numbers, most of which are numbers, but some are like "404R" or whatever else. So if my values are 403, 404R,405, 4150 - the order ends up being: 403 4150 404R 405 Is there any way I can leave these products numbers as text and still order them correctly? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning unique values in columns
Is there any way to run a query in mysql that retuns unique values in a column? For example, say i had this colum: Column: - Fashion - Basics - Fashion - Plus Plus - but I only want it to return unique values - in this case I would only want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion, Plus, Plus I would get if I had run: SELECT column FROM tblname; any help would be greatly appreciated...
[PHP] Converting variables to integer
I have a bunch of form variables that I need to process as integers. The problem is that some users are writing in values with commas - e.g. 100,000, and that isn't read as an integer. There's more than one variable so I don't want to have to do a string replace for each one. Is there a general way to curb this problem? Thanks, Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading an image in binary
I'm having trouble with a script to upload images, which is baffling me because a similar script has worked fine on other occasions. I can get the image file uploaded to the correct directory, but it is uploading in ASCII and I obviously need it in binary. The file name on the form is like this: then the code on the php script looks like this: $uploadpath = 'path/images/'; $source = $_FILES['add_imgthumb']['tmp_name']; $name = $_FILES['add_imgthumb']['name']; $dest = $uploadpath.$name; copy($source, $dest); simple, i know, but that's the way i want it. What do I have to do to get the image to be uploaded in binary? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mySQL question
I'm just starting to use PHP with mySQL, and I have a few basic questions. I've successfully created a mySQL database on my local machine, was able to create tables and populate them (from the command line), query it with php from the browser, etc - no problems there. Now I need to create one on a remote server. 1) Since I have access to the ftp, is that login/pass valid for the mysql database? if not, is there a location where this information (l/p to mySQL) is stored? 2) Are there concrete files in mySQL? For example, can i create the database i want from my local machine and then upload it? where are they located? this is the most puzzling to me - i don't understand how these databases seem to exist in thin air... 3) How do i go about getting that command line setting, the one that i use to create tables and add things and whatever on my local machine, on a remote server? do they have to have telnet enabled? 4) what is phpmyAdmin? could this help my situation? any help would be greatly appreciated -Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs. basic text file
ok - thanks for all the replies. it looks like there are no real drawbacks and plently of advantages in using MySQL instead of text files, so i'll do the next project with it. one more question - is there a concrete file that has the database in mySQL? like a file that I could download and view that contains the entire spreadsheet that i have created? On Mon, 23 Sep 2002, John S. Huggins wrote: > > I was doing this too with good old AWK CGI scripts and text data files. > Once I imported the data into MySQL I said, "Well this is not much > benefit." Then I started sorting. Then I accessed the information from a > different application. Then I wrote a maintenance application so my > customer could sort, review and edit the data. Then I started using > multitable queries. I am now so hooked on the database method, I have > never looked back. > > Keep up with your text data. You will always be able to import it into > MySQL when you are ready. I would do ahead and migrate to a database; You > will have a slight learning curve, but will reap many benefits. > > John > > On Sat, 21 Sep 2002, Doug Parker wrote: > > >-often i use text files at my data sources, delimted by the "|" symbol. > >-i simply delimit the fields of each line, then when i need to open them, > >-i open the text file, populate an array with each line, then explode the > >-fields for each to get the corresponding values. i use this method for > >-catalogs - and even backend interfaces, for which the client can > >-add/edit/delete products. everything seems to be working fine, and > >-there doesn't seem to be a need for MySQL or anything. i was wondering > >-if there is anything i'm not thinking of that perhaps would push me to > >-favor using php and mysql instead of the plain old text file. > >- > >- > >- > >--- > >-PHP General Mailing List (http://www.php.net/) > >-To unsubscribe, visit: http://www.php.net/unsub.php > >- > > ** > > John Huggins > VANet > > [EMAIL PROTECTED] > http://www.va.net/ > > ** > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rewriting a line in a text file
hi - i have a text file that i am using as a database. the format for each line is such (2 lines shown): Fashion|508|Text Text Text.|http://qtbras.com/qtbrascat/images/508_big.jpg|http://qtbras.com/qtbrascat/images/508_thumb.jpg Fashion|510|Text Text Text|http://qtbras.com/qtbrascat/images/510_big.jpg|http://qtbras.com/qtbrascat/images/510_thumb.jpg I'm putting each line into an array, then splitting each value by the pipe symbol to get individual values. i need to know how to select a line in the text file and rewrite over it - for example if i wanted to replace: Fashion|510|Text Text Text|http://qtbras.com/qtbrascat/images/510_big.jpg|http://qtbras.com/qtbrascat/images/510_thumb.jpg with: Allure|533|Text Text Text|http://qtbras.com/qtbrascat/images/510_big.jpg|http://qtbras.com/qtbrascat/images/510_thumb.jpg or something like that, how do i select which line in the text file i want to replace and write over it? i would prefer not to delete the line and then write a new one at the end, but if that's the only way, i'll do it. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php