[PHP] selecting words
Hi, What I'd like to do is take a string (paragraph) of text consisting of say 500 words and display only the first 100 words. Is there a function able to do this? Thanks. Jamie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] displaying latest DB entries
Hi, I've got a MySQL database setup with several different tables. What I'd like to do is to display the last five records entered into the database. I can do this easily from one table just by listing the records with the five highest IDs, but how can I do this over several tables? I don't want to list the last 5 records entered from each table but from the whole database. Is there any easy way of doing this? Thanks. Jamie Saunders [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] multiple entries in the same field
Hi, In a MySQL database I have one field that holds several entries seperated by a comma (e.g. item1,item2,item3). What I want to do is to get these items from the db from a PHP script and display each item on it's own line (e.g. item1britem2britem3). Is there anyway of doing this easily by simply changing each comma to a 'br' in the script? Thanks. Jamie Saunders [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] shtml includes
Hi, In my site I use shtml extensively. Therefore I have quite a number of text files that serve as shtml includes. Often these text files contain more shtml includes. I'm creating PHP pages and wish to use these text files within the pages, I know how to do this easily enough by using: include(textfile.txt); The problem is that because a lot of these text files contain more includes the PHP pages are passing them over, as it cannot deal with the shtml !-- include -- tag. Here's a brief example: script.php: ? include(text1.txt); ? text1.txt: html !-- include file=text2.txt -- /html What I would like to happen is for the PHP script to be able to look for the !-- include -- tags within the text files and parse them as PHP include(); tags. Is there any way of achieving this? Thanks. Jamie Saunders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] reading records alphebetically
Hi, I have a MySQL database set-up containing a few hundred records. I'm trying to make a script that reads the 'name' field of the records and displays only the records of which the name field begins with a specific letter: if ($letter = A) { display all records of which field 'name' beings with A } else if ($letter = B) { ... I'm just starting out on this, so please excuse my ignorance :) Jamie Saunders [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] resetting the pointer in a MySQL database table
Hi, I have a table set-up so that every time you enter an item, a unique primary key is assigned to it (using auto-increment). However, I've deleted all data from the table but when I go to add an item the pointer is still set at the number of the last item I entered. Is there any way of resetting it? Thanks. Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] searching a MySQL database
Hi, I've set up a MySQL database and an HTML search form. I'd like to know how to search the database with whatever it entered into the form. It only needs to be a simple search, returning anything that matches the word(s) entered into the input box in the form. Thanks. Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] if string contains...
Hi, I want to check whether a string contains a certain word e.g. $varOne = this is a string; if ($varOne contains is) { return true; } else { return false; } Is there an operator for 'contains', if not how do you do this? Thanks. Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] URL redirection
Hi, Is there a PHP function that will redirect the current page to another url? e.g. if ($varTwo == $varOne) { URL redirection code } else { echo You stay right where you are!; } Thanks. Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] adding text to a variable name
Hi, Is it possible to add text onto the end of a variable name? e.g. to add the word 'code' onto the variable $field so it would be $fieldcode Thanks Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Newbie question - adding vars
Hi, How do you add text vars together e.g. $varone = hello; $vartwo = world; $varthree = ($varone, $vartwo); Obviously the above example doesn't work so can someone tell me how to do this? Thanks Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] grabbing variables from the query string
Hi, How do you grab variables from a query string in a URL? I've used this with ASP and it would be done as follows: firstName = request.querystring(fName) I've tried different variations of this in my PHP pages but I can't seem to get it to work. I've looked in the PHP manual but can't find any information relating to the query string. Thanks. Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] integer checking problem from query string
Hi, I'm submitting a phone number from an HTML form to a PHP page that examines it to see if it's an integer: form.html: html form method=get action=validate.php input type=text name=phonenumber input type=submit /form validate.php: html ?php $phonenumber = trim($phonenumber); if (is_int($phonenumber)) { echo Integer; } else { echo Not Integer; } ? /html However, for some reason the script doesn't recognize the number as an Integer - why is this and how can I remedy it? Jamie Saunders Mail: [EMAIL PROTECTED] Web: http://jamie-s.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] simple form validation
Hi, First of all, I've just joined this list, so here's a brief introduction. My name's Jamie Saunders, I'm an 18 year old student from the UK studying for my A-Levels. I'm currently working on a Computer Studies project for a local business which involves setting up several databases on the web. After reading Webmonkey.com's excellent introduction to PHP I've decided to use it in conjunction with MySQL for the project. Later this year, if all goes well I'm hoping to take a 3 years BA Honors course in Multimedia Web Production. Right, you still with me? What I'd like to know is how to validate a text field in an HTML form to make sure it only contains numbers. I know how to check it so it only contains letters, but not numbers - the field I want to check is for phone numbers - so it can't contain any special characters either. I expect this is very simple but I can't seem to get it working properly. Any help appreciated. Cheers, Jamie Saunders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]