[PHP] help - php script - no interaction
http://www.site1.com http://www.site2.com http://www.site3.com I have 3 sites above in a html. I do not want to create click each site, one at a time to see 1 page info. I want to write a script to go get all 3 sites, and bring it back into 1 page (the content of 3 pages concatinated). Is this doable in php? any other scripts? Thanks.
Re: [PHP] help - php script - no interaction
On Thu, Oct 16, 2008 at 1:10 PM, John Smtih [EMAIL PROTECTED] wrote: http://www.site1.com http://www.site2.com http://www.site3.com I have 3 sites above in a html. I do not want to create click each site, one at a time to see 1 page info. I want to write a script to go get all 3 sites, and bring it back into 1 page (the content of 3 pages concatinated). Is this doable in php? any other scripts? Thanks. Check into curl, http://www.php.net/curl -- that should do what you want. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] help with script needed
Richard Lynch wrote: You could also just use: if (($i % 15) === 0) echo FooBar; elseif (($i % 3) === 0) echo Foo; elseif (($i % 5) === 0) echo Bar; 15 works because 3 and 5 are mutually prime or whatever it's called. Good point, missed that one. A minimalist might not even bother with the 15 and would skip the 'else' and just do: if (($i % 3) === 0) echo Foo; if (($i % 5) === 0) echo Bar; echo \n; I personally think that's less comprehensible, however, and less maintainable, so I'd rather see a couple more CPU cycles than have code I have to think about to figure out what it does, until it's a proven bottleneck. Except that you're not displaying the actual number when it's not divisible between 3 or 5, so that doesn't meet the spec. Sorry. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
You could also just use: if (($i % 15) === 0) echo FooBar; elseif (($i % 3) === 0) echo Foo; elseif (($i % 5) === 0) echo Bar; 15 works because 3 and 5 are mutually prime or whatever it's called. The order matters, though, as moving the 15 after the other if tests would fail, as 3 and/or 5 would kick in first. It's also a game played in grade school when learning clock arithmetic (aka the modulus operator) at least here in the Midwest, usually around 4th grade (age 10), as I recall. Each person in turn says the next number or Fizz or Buzz or FizzZBuzz, and if somebody messes up, you razz them for it, and start over at 1. The person who makes the mistake could also be out in a musical chairs sort of thing, though that risks boredom creeping in for a large group of people no longer actively playing. You do not want a roomful of bored 4th-graders. Trust me on that one. :-) If the numbers are not mutually prime, you would have to do an test as Stut posted. A minimalist might not even bother with the 15 and would skip the 'else' and just do: if (($i % 3) === 0) echo Foo; if (($i % 5) === 0) echo Bar; echo \n; I personally think that's less comprehensible, however, and less maintainable, so I'd rather see a couple more CPU cycles than have code I have to think about to figure out what it does, until it's a proven bottleneck. YMMV On Wed, March 7, 2007 4:00 pm, Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Stut wrote: Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php $upto = 100; $cur = 1; for ($cur = 1; $cur = $upto; $cur++) { if ($cur % 3 == 0) { print 'Fizz'; if ($cur % 5 == 0) print 'Buzz'; } else if ($cur % 5 == 0) { print 'Buzz'; } else { print $cur; } print br /; } no need to do each modulo twice per iteration :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with script needed
I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
try this if ($i%5 == 0) echo foobr; -afan I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
oops, ofcourse whe have the modular :) On 3/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: try this if ($i%5 == 0) echo foobr; -afan I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Are you only using 3 and 5? just echo 3 and 5 instead of Foo and Bar. and for both, just have a 3rd condition including both ... if (($i%3 ==0) ($i%5 == 0)) echo both or foobar.. does this help? Jake - Original Message - From: Bruce Gilbert [EMAIL PROTECTED] To: Martin Marques martin@bugs.unl.edu.ar Cc: Tijnema ! [EMAIL PROTECTED]; PHP-General php-general@lists.php.net Sent: Wednesday, March 07, 2007 4:00 PM Subject: Re: [PHP] help with script needed Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
LOL I told'ya I rememberd it from my 2nd semester :) Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] help with script!!!
echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); If you look at http://www.php.net/echo you'll see that echo does not support this syntax. If you want to use this syntax then you should probably be using some form of printf (see http://www.php.net/printf). CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
On Sat, 1 Feb 2003, Hugh Danaher wrote: echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); try echo | %s | %s | %s | %s | %s |br /.$array[id]. .$array[username]. .$array[password]. .$array[status]. .$array[notes]; dots not comas between variables. echo takes on commas as we can echo multiple variables which isn't something we can do with print. This is also the main difference between echo and print. So, the commas are okay here but as someone else already stated, echo doesn't behave like printf so no special %formatting% with echo. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
?php mysql_connect(hostname, mysqluser, mysqlpassword)||die(db error msg...); mysql_select_db(databaseName)||die(database error msg...); $result=mysql_query(select * from table_name); /*heres the trick*/ while($array=mysql_fetch_array($result)){ printf(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); } and make sure that your array indexes are right they are case sensitive in mysql...so array[id] is different than array[Id] or array[ID]... - Original Message - From: Karl James [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 1:37 AM Subject: [PHP] help with script!!! Hello guys and gals!!! can you tell me why i can't get this script to print my table thanks Karl please check out the code below obviously i left my username and passwords blank :-) - ? $sqlhost = localhost; $sqllogin = login; $sqlpw = password; $sqldb = database table name; (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { die(mysql_error()); } (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } $result = mysql_query(SELECT * FROM `assignment_one`); while($array = mysql_fetch_array($result)) { echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); } ? - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with script!!!
Hello guys and gals!!! can you tell me why i can't get this script to print my table thanks Karl please check out the code below obviously i left my username and passwords blank :-) - ? $sqlhost = localhost; $sqllogin = login; $sqlpw = password; $sqldb = database table name; (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { die(mysql_error()); } (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } $result = mysql_query(SELECT * FROM `assignment_one`); while($array = mysql_fetch_array($result)) { echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); } ? - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); try echo | %s | %s | %s | %s | %s |br /.$array[id]. .$array[username]. .$array[password]. .$array[status]. .$array[notes]; dots not comas between variables. Hope this helps. Hugh - Original Message - From: Karl James [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Friday, January 31, 2003 10:37 PM Subject: [PHP] help with script!!! Hello guys and gals!!! can you tell me why i can't get this script to print my table thanks Karl please check out the code below obviously i left my username and passwords blank :-) - ? $sqlhost = localhost; $sqllogin = login; $sqlpw = password; $sqldb = database table name; (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { die(mysql_error()); } (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } $result = mysql_query(SELECT * FROM `assignment_one`); while($array = mysql_fetch_array($result)) { echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); } ? - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
On Sat, 1 Feb 2003, Karl James wrote: Hello guys and gals!!! can you tell me why i can't get this script to print my table thanks Karl please check out the code below obviously i left my username and passwords blank :-) - ? $sqlhost = localhost; $sqllogin = login; $sqlpw = password; $sqldb = database table name; (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { die(mysql_error()); } (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } $result = mysql_query(SELECT * FROM `assignment_one`); while($array = mysql_fetch_array($result)) { echo(| %s | %s | %s | %s | %s |br /, $array[id], $array[username], $array[password], $array[status], $array[notes]); } ? Maybe this will help: ?php if (!mysql_connect($host, $user, $pass)) { echo Could not connect to MySQL; exit; } if (!mysql_select_db($dbname)) { echo Could not select database ($dbname) : . mysql_error(); exit; } $sql = SELECT id,username,password,status,notes FROM assignment_one; $result = mysql_query($sql); if (!$result) { echo Could not run query ($sql) : . mysql_error(); exit; } while ($row = mysql_fetch_assoc($result)) { extract($row); echo | $id | $username | $password | $status | $notes |br /\n; } ? Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with script!!
HYPERLINK http://host.makethewebsecure.com/~admin12/do_adduser.phpshttp://host.m akethewebsecure.com/~admin12/do_adduser.phps can someone take a look at this and see why this wont work. karl --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002
Re: [PHP] help with script!!
Without the error message you are making it kind of tough. What's the response that you get. Also you should use long ?php and not just ? Single quote your arrays as in $_POST['f_name'] and not $_POST[f_name] This will help if you ever move to a serve that's not so lax. *** REPLY SEPARATOR *** On 01/01/2003 at 12:54 PM Karl James wrote: HYPERLINK http://host.makethewebsecure.com/~admin12/do_adduser.phpshttp://host.m akethewebsecure.com/~admin12/do_adduser.phps can someone take a look at this and see why this wont work. karl --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!
on 02/01/03 7:54 AM, Karl James ([EMAIL PROTECTED]) wrote: can someone take a look at this and see why this wont work. why don't you start by telling us what's wrong, or HOW it doesn't work? Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with script
Sorry guys!!! Well im trying to add the form to my database table. Which is this link!! HYPERLINK http://host.makethewebsecure.com/~admin12/show_adduser.htmlhttp://host .makethewebsecure.com/~admin12/show_adduser.html then when I hit add user!!! I get this error message Added to auth_users: Access denied for user: 'kjames@localhost' to database ' ultimatefootballleague_com' Which is this site HYPERLINK http://host.makethewebsecure.com/~admin12/do_adduser.phphttp://host.ma kethewebsecure.com/~admin12/do_adduser.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002
Re: [PHP] help with script
There's your answer... You do not have permission to insert into the database with that user. Contact your DBA! :-) and if that's you read the MySQL manual. Especially about the mysql.user table *** REPLY SEPARATOR *** On 01/01/2003 at 1:19 PM Karl James wrote: Access denied for user: 'kjames@localhost' to database ' ultimatefootballleague_com' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with script - if possible
Hi All Thanks for everyones help in trying to get my script to work - I'm learning fast. But have the following problem: I am using the following select command for searching a table with regards to booked villas according to id number: $sql = SELECT COUNT(*) as count FROM bookings WHERE '$book_start_date' BETWEEN booking_start AND booking_end OR '$book_end_date' BETWEEN booking_start AND booking_end AND villa_id = '$place'; This counts as far as I believe an displays a 0 if available and number of times it occurs if unavailable. The problem I have is that still counts the number of entries regardless of the villa_id number it is given. In other words if I have a villa that is booked between 2002-04-10 and 2002-004-20 for villa_id 1 and I search using the same dates (via a FORM) but on villa_id 3 it still comes back and says that the villas is unavailable. Which of course it is wrong for villa_id 3 (it is villa_id 1 that is booked). I have tried to find a command (something like IF villa_id =3 THEN count) but to no avail that would only count if the villa_id matches as well. Can anyone help Thanks for your time. Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with script - if possible
Try putting brackets round the date selection part. I think the database treats AND with a higher precedence than OR, and evaluates ANDs first. So what your query is doing is like A OR (B AND C) But what you want is (A OR B) AND C Where A is '$book_start_date' BETWEEN booking_start AND booking_end B is '$book_end_date' BETWEEN booking_start AND booking_end C is villa_id = '$place' HTH, Richy == Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: [EMAIL PROTECTED] -Original Message- From: Ray Healy (Data Net Services) [mailto:[EMAIL PROTECTED]] Sent: 28 August 2002 17:49 To: [EMAIL PROTECTED] Subject: [PHP] Help with script - if possible Hi All Thanks for everyones help in trying to get my script to work - I'm learning fast. But have the following problem: I am using the following select command for searching a table with regards to booked villas according to id number: $sql = SELECT COUNT(*) as count FROM bookings WHERE '$book_start_date' BETWEEN booking_start AND booking_end OR '$book_end_date' BETWEEN booking_start AND booking_end AND villa_id = '$place'; This counts as far as I believe an displays a 0 if available and number of times it occurs if unavailable. The problem I have is that still counts the number of entries regardless of the villa_id number it is given. In other words if I have a villa that is booked between 2002-04-10 and 2002-004-20 for villa_id 1 and I search using the same dates (via a FORM) but on villa_id 3 it still comes back and says that the villas is unavailable. Which of course it is wrong for villa_id 3 (it is villa_id 1 that is booked). I have tried to find a command (something like IF villa_id =3 THEN count) but to no avail that would only count if the villa_id matches as well. Can anyone help Thanks for your time. Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php