[PHP] Re: excuting several sql statements in one time

2001-09-20 Thread James Holloway
Hey, Whilst you can't perform statements like this, there are alternatives. If you only have one field in your table, you can use: INSERT INTO com VALUES ('pentium'), ('amd'); // Continue the comma separated values list Or, if you need to specify which fields the data is to go in: INSERT

[PHP] Re: problem with form values

2001-09-12 Thread James Holloway
Sorry, I didn't mean it quite like that. After the user presses submit $string = htmlentities($string); // now, do whatever with the string J - Original Message - From: Niklas Lampén To: James Holloway ; Php-General Sent: Wednesday, September 12, 2001 9:52 AM Subject

[PHP] Re: just 10 characters from a string

2001-08-31 Thread James Holloway
Hi Marcos, use substr(); http://www.php.net/manual/en/function.substr.php $string = substr($string, 0, 10); James Marcos Lloret [EMAIL PROTECTED] wrote in message 019701c131f1$f57bdfa0$371c94c1@mlloret">news:019701c131f1$f57bdfa0$371c94c1@mlloret... hi to all, i have a long string

[PHP] Re: parse error AFTER end of included file??

2001-08-28 Thread James Holloway
Jaxon, do you have a line of white space after your closing tag? Anyway, this looks fishy to me: if (!isset($page_id)) { $sql=select page_id from table where fieldname = $value; $link_id = mysql_connect($host, $usr, $pass) or die (mysql_error());

[PHP] Re: mySQL Query - comparing multiple values with one field

2001-08-22 Thread James Holloway
Hi Niklas, You can use || or OR. Secondly, huge list of values you say? Can this list be exploded by a common denominator, like a space or comma? If so, consider this: $list = // Huge list of words (array), separated by a comma. $words = explode(,, $list); $query = SELECT * FROM table WHERE

[PHP] Re: File uploads in PHP

2001-08-17 Thread James Holloway
Hi there, I haven't tested any of this, and there are probably some things that need adding, but it'll give you an idea at least. Form element: input type=file name=thefile // What files do we want? $types_we_want = array(image/gif, image/jpeg, image/pjpeg); // allows jpegs and gifs // What

Re: [PHP] Upper or Lower Case

2001-08-07 Thread James Holloway
Hi Taz, What happens if they type NeO, or NEO, or nEo, or neO (etc)? ;) Also, if you're using this in a large application (or intend to in the future), are you going to type out all of the names as you have done with the neo example? Bjorn's method is much better, and you're better off getting

[PHP] Re: array + checkbox

2001-08-06 Thread James Holloway
Hi there Tijmen, Firstly, change the input name from this: voorraad to this: voorraad[] then do something like: ? echo Checked values are as follows:brbr; for ($i = 0; $i sizeof($voorraad); $i++) { if (!empty($voorraad[$i])) { echo $voorraad[$i]; } } ? James Tijmen

Re: [PHP] Generating mysql statement from php return an error :-(

2001-07-30 Thread James Holloway
If you want to separate insert statements, you can do it like this: $big_insert_query = INSERT INTO table (id, col1, col2) VALUES ('', '$col1_stuff[$i]', '$col2_stuff[$i]'), ('', '$col1_stuff[$i]', '$col2_stuff[$i]'), ('', '$col1_stuff[$i]', '$col2_stuff[$i]'), ('', '$col1_stuff[$i]',

[PHP] Re: Help with regular expresions! [ASAP]

2001-07-25 Thread James Holloway
Hi Peter, You could try this: ? $string = Blah iitalic/iinput type=\name\ Blah bbold/b; $new_string = preg_replace(/input(.*?)/i, input\\1 class=3D, $string); echo $stringbrbr$new_string; ? preg_replace = regular expression replacement input = first part of tag (.*?) = whatever, but not:

Re: [PHP] date HELP !!!!!

2001-07-23 Thread James Holloway
Better still, use the date(t); to find out how many days are in the given month. This part of the date function is a blessing, given the varying days in months, and the fact that we've a leap year every four years. James Daniel Rezny [EMAIL PROTECTED] wrote in message [EMAIL

[PHP] Re: reg exp help

2001-07-23 Thread James Holloway
Hi Justin, for the username, you can use: if (!preg_match(/^[a-z0-9]*$/, $username)) { // error } else { // ok } The ^ means start of the string, the characters between the [ and ] are ones that we want, the * means however many times, and the $ means the end of the line / string. So

[PHP] Re: Replace ANYTHING between TAG /TAG

2001-07-23 Thread James Holloway
Hi Dan, maybe something like: $newvariablethatwewantbetweenthetags = Long variable!; $string = preg_replace(/(TAG)(.*?)(\/TAG)/i, \\1$newvariablethatwewantbetweenthetags\\2, $string)); There should be a after and before the second part of that statement, but my email proggy strips them.

[PHP] Re: limit items per page

2001-07-23 Thread James Holloway
Hi Steph, as the name suggests, use LIMIT ;) Ie, SELECT * FROM TABLE LIMIT 0,25 The 0 (or other number) is optional, and tells the table which row to start limiting from, the secon number is the number of rows to limit to.. So: SELECT * FROM TABLE LIMIT 25,25 Would bring out 25 rows,

[PHP] Re: limit items per page

2001-07-23 Thread James Holloway
Perhaps I shouldn't have made the assumption that steph was using mysql :) Henrik Hansen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... [EMAIL PROTECTED] (James Holloway) wrote: Hi Steph, as the name suggests, use LIMIT ;) AFAIK it's mysql

[PHP] Re: Using Frames

2001-07-19 Thread James Holloway
Hi Mark, yes it's possible, but with javascript rather than php Do a search on a javascript related site for window.frames James. Mark Lo [EMAIL PROTECTED] wrote in message 000701c11021$c66111a0$caccfea9@Mark">news:000701c11021$c66111a0$caccfea9@Mark... Hi, I would like to know how

[PHP] SQL in array() ?

2001-07-17 Thread James Holloway
Hey guys, I saw a post in here the other day that's prompted me to ask this question... Because I can't seem to get the solution mentioned to work. Maybe I'm missing something obvious... Anyway, here goes. I have a list of categories contained in one table, and a list of entries in another.

[PHP] Re: how to strip just the img tag from html file?

2001-07-16 Thread James Holloway
Hi Shawna Look up preg_replace(); Assuming $file is the contents of your file - $file = preg_replace(/img.*?/i, , $file); James. [EMAIL PROTECTED] wrote in message BB6D932A42D6D211B4AC0090274EBB1D2EEF63@GLOBAL1">news:BB6D932A42D6D211B4AC0090274EBB1D2EEF63@GLOBAL1... I've created a

[PHP] Re: Cookie Expiry Dates?

2001-07-11 Thread James Holloway
Hi Jeff, Yes, use time() Example 86400 seconds in a day. 3600 in an hour. Use some basic maths: $cookie_expire = time() * 86400 * 365; // Sets cookie for a year (365 days). James. Jeff Lewis [EMAIL PROTECTED] wrote in message

Re: [PHP] Searching a MYSQL DB

2001-05-23 Thread James Holloway
Hey, Simple solution: ? $search = hammer; $connection = // Connection to the database details. $query = @mysql_query(SELECT * FROM table WHERE Name LIKE '%$search%' OR Description LIKE '%$search%' ORDER BY Name ASC, $connection) or die (mysql_error()); while($row =

Re: [PHP] How to select rows from Mysql with case senstive ??

2001-05-23 Thread James Holloway
Hey try this, though there are probably better ways, SELECT * FROM foo WHERE name REGEXP '^[PHP]'; James Bass¨Ð¦õªv [EMAIL PROTECTED] wrote in message 9egfot$cfu$[EMAIL PROTECTED]">news:9egfot$cfu$[EMAIL PROTECTED]... Hi , By defualt , select rows from Mysql is case insenstive . For exmaple

Re: [PHP] How to select rows from Mysql with case senstive ??

2001-05-23 Thread James Holloway
*Shrug* Don't have time to test at the moment... That was taken from Chapter 9.3.4.7 of the MySQL manual http://www.mysql.com/doc/P/a/Pattern_matching.html Prior to MySQL Version 3.23.4, REGEXP is case sensitive, and the previous query will return no rows. To match either lowercase or

Re: [PHP] e*reminder and cron

2001-05-21 Thread James Holloway
Hi Henry, I'm not too familiar with Cron, but check the man pages for cron and crontab (type 'man cron' or 'man crontab', or type 'man man' if you've not used man pages before). James. Henry [EMAIL PROTECTED] wrote in message

Re: [PHP] checking to see if part of a variable exists?

2001-05-21 Thread James Holloway
Hi Sandeep, ? if (preg_match(/@monkeys.com/i, $variable)) { echo Got some monkeys.; } else { echo No monkeys here.; } ? preg_match(); ereg(); eregi(); Will all help you. James. Sandeep Hundal [EMAIL PROTECTED] wrote in message

Re: [PHP] Quotes in GET variables

2001-05-21 Thread James Holloway
Hi Mark, It's nice in that it adds to how secure PHP code is, but it can be a hassle. Out of curiousity, what are the security implications? Presumably a failure to validate input properly leading to unintended actions, but I can't think of any examples to help me decide whether to turn

Re: [PHP] Check multiple cookies

2001-05-21 Thread James Holloway
Hi Sam, The following is exactly what I typed in (just copy and pasted) but I'm still getting the error: Cannot add header information - headers already sent by (output started at web.php:2) in web.php on line 19 Make sure that all output for Cookies and header information is sent before

Re: [PHP] Problem with PHP_SELF

2001-05-18 Thread James Holloway
Hi Richard. Two methods, POST and GET: Post for forms and best works with hidden elements. Get can be put across URL's: echo a href=\$PHP_SELF?page=$next_page$metode=$search\Next/a; Or FORM ACTION=? echo $PHP_SELF; ? METHOD=POST INPUT TYPE=hidden NAME=? echo $metode; ? VALUE=? echo $search;

Re: [PHP] Problem with PHP_SELF

2001-05-18 Thread James Holloway
Gah! Forgot an element for that form: Page element. INPUT TYPE=hidden NAME=page VALUE=? echo $next_page; ? :) Hi Richard. Two methods, POST and GET: Post for forms and best works with hidden elements. Get can be put across URL's: echo a

Re: [PHP] Links as a query point instead of form drop down box

2001-05-17 Thread James Holloway
Hi Laurie, If the data to be displayed was in a database, and each row of data corresponded to an auto incrementing id, you could reference by id number, which is a much better way of doing things via the GET method than messing around with long names. Assuming that you have two tables, one

Re: [PHP] UGH

2001-05-17 Thread James Holloway
Neither will work. Think about it.. If you did 17 - 3 (17th May - 3rd June) - you get 14. But if you add 14 days from today, you get 31st May, which is clearly wrong. What if there are 30 days in the month instead of 31? Or 28? Or even more obscurely 29? You cannot rely on this method

Re: [PHP] UGH

2001-05-17 Thread James Holloway
In addition - if you did 3rd June as the end date - 17th May as today, 3 - 17, the original $days_to_go would be a minus number (What I meant to say in the first place Also, this would be better: if ($date_today $school_out) { echo We're already on holiday!; $new_difference =

Re: [PHP] Problem with outputting date and time

2001-05-17 Thread James Holloway
Hi There, I had a similar problem because of BST (British Sumer Time). Have a look on Yahoo / Google etc for a site about Greenwich Mean Time, and find out the dates that the schemes take effect - I think it is March 25th to beginning or end of October. Then use a simple if statement. ?

Re: [PHP] need some ideas here...

2001-05-16 Thread James Holloway
Hi Christian, I have an account with f2s.com that I use for sampling scripts with - I set up a mailform yesterday after reading this, using mail() to send the email to myself. It got here - albeit 6am today (I sent it yesterday lunchtime) Perhaps you're using the mail() function

Re: [PHP] Image Upload??

2001-05-16 Thread James Holloway
From phpinfo() on f2s.com upload_max_filesize 2M So, something like, @copy($file, /path/to . $file_name) or die (Blam, something's up!); should work - haven't got time to try it at the moment. James. What am I doing wrong here? Is there a way to get around the temporary folder? Tnx

Re: [PHP] Needing help hear

2001-05-15 Thread James Holloway
Hi Richard, I *always* get this word wrong, but here goes You need to concantenate (grimace), which means (simply) add to to the variable, using .= Modify your code slightly: ? $recipient = ; $result = @mysql_query($sql); $num_rows = mysql_num_rows($result); while($myrow =

Re: [PHP] detecting HTML tags

2001-05-15 Thread James Holloway
Hi Bill ? if (preg_match(/([\])([^\]{1,})*([\])/i, $string)) { echo Houston, we have a problem.; } ? James. bill [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there a way to detect the presence of HTML tags? I don't want them stripped out, I just

Re: Re[2]: [PHP] Newbie redirect/variable question

2001-05-10 Thread James Holloway
Steve, The way you are doing things could leave yourself open with all kinds of problems - one of which is address spoofing. A better way would be to TEST the link against values in the database before updating the link with a hit and exiting. Have the URL's marked against an auto-incremented

Re: [PHP] MAX_FILE_SIZE : warning

2001-05-09 Thread James Holloway
Jacob, When you upload a file, it appends a few of its own variables. One of them is size - assuming the file is a variable called $file: if ($file_size $max_size) { echo $file_name . was too big!; } Also, you could check for Mime types. if ($file_type != image/jpeg || $file_type !=

Re: [PHP] appended with \

2001-05-04 Thread James Holloway
Magnus, $string = stripslashes($string); http://www.php.net/manual/en/function.stripslashes.php James. magnus lawrie [EMAIL PROTECTED] wrote in message 9cu11s$6k1$[EMAIL PROTECTED]">news:9cu11s$6k1$[EMAIL PROTECTED]... I am using a form to test posting a variable. If my variable looks like

Re: [PHP] date calculation

2001-05-04 Thread James Holloway
Gary, Yes. Check the manual for mktime(); and getdate(); http://www.php.net/quickref.php James Is there a way to do calculations with dates? Preferably ignoring weekends. Thanks, Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: [PHP] date list

2001-05-02 Thread James Holloway
Jon, Try this ... I know the code could be trimmed down, but I wrote it this way for ease of reading. select name=Date ? $startday = 01; $startmonth = 01; $staryear = 01; $endday = 01; $endmonth = 07; $endyear = 01; $startperiod = mktime(0,0,0,$startmonth,$startday,$startyear); $endperiod =

Re: [PHP] redirection to another page function

2001-04-23 Thread James Holloway
One thing that doesn't seem to have been considered is the use of the refresh meta tag. Whilst it depends on whether or not the browser is archaic (and let's face it, most people nowadays seem to be running at least version 4 of either IE or Netscape), it's something that can't be turned off (at

[PHP] Update All fields?

2001-04-06 Thread James Holloway
Hi There, I currently have a MySQL table, with around 700 populated rows in it. I'd like to know if there's a quick and easy way to update one column across all of the rows in the database. I shouldn't imagine it's a difficult job, but I'm having a mental block :) Thanks in advance. --

[PHP] Reading specific data from a .txt file into PHP

2001-01-16 Thread James Holloway
Hi all, I'm attempting to write a weather script, which will display weather conditions for areas in the UK. I have the data I need, which is stored in a file on another server. The data comes in the format: 2001/01/16 13:50 SCT010 BKNDPIP WYXWE Q1012 2001/01/16 13:46 CYGL 161346Z

Re: [PHP] Reading specific data from a .txt file into PHP

2001-01-16 Thread James Holloway
Glen Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... James, The trouble is, that there are about 3000 cities in the text file. I'm assuming that I fill use fopen(); and fread(); to open and read the files, but does anyone know of a way of singling out