[PHP] reg exp for smtp error codes

2004-04-23 Thread Robert Kornfeld
hey professionals out there!

does anybody have a script that parses the error-code from a returned
email-header (esmtp)?

thanx!

Robby

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] test

2004-04-23 Thread dfgs
dfstg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] test

2004-04-23 Thread dfgs
dfstg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] insert twice pb

2004-04-23 Thread Ronald Rahal
Why this code is inserting twice in the database ?
 
 
 
 



[PHP] Button ???

2004-04-23 Thread Brent Clark
Hi
I a few minutes ago I came across something interesting

I subscribed to www.phparch.com and when clicking the final button for
"Complete Order"
The button went to to "dead" state, whereby you could not click on it again.
It just sat there

Does anyone know how to do that and be so kind as to share your code \ idea,
that would be most appreciated

Kind Regards
Brent Clark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Button ???

2004-04-23 Thread Thijs Lensselink
Brent Clark wrote on vrijdag 23 april 2004 10:07:

> Hi
> I a few minutes ago I came across something interesting
> 
> I subscribed to www.phparch.com and when clicking the final button for
> "Complete Order"
> The button went to to "dead" state, whereby you could not click on it
> again. It just sat there
> 
> Does anyone know how to do that and be so kind as to share your code
> \ idea, that would be most appreciated
> 
> Kind Regards
> Brent Clark

Something like this:



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Button ???

2004-04-23 Thread Brent Clark

> Something like this:
> 
> 

Hi

Yes this is correct
But how do you get it from an active to disabled state

Kind Regards
Brent Clark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Remove white space?

2004-04-23 Thread Craig
trim($YOUR_VARIABLE) = Remove whitespace from beginning and end of string
http://ie2.php.net/trim

strtolower($YOUR_VARIABLE) = Makes a string lowercase
http://ie2.php.net/strtolower

Hope that helps



"Robert Sossomon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am pulling data from a MySQL DB and I need to remove the whitespace on
> the variable and turn it to lowercase.
>
> 
>
> $get_items = "select * from PFS_items";
> $get_items_res = mysql_query($get_items) or die(mysql_error());
> while ($items = mysql_fetch_array($get_items_res))
> {
>  $item_id = $items[id];
>  $item_num = $items[item_num];
>
> 
>
> Overtime I need to rewrite my DB loading script to handle this for me,
> but right now I need to band-aid it so that I can auto-generate pages
> and get them loaded into a catalog.
>
> Thanks!
>
> Robert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Button ???

2004-04-23 Thread Craig
This has nothing to do with PHP.

Its javascript, http://www.jguru.com/faq/view.jsp?EID=280434
Please keep to topic.

Thanks

"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> > Something like this:
> >
> > 
>
> Hi
>
> Yes this is correct
> But how do you get it from an active to disabled state
>
> Kind Regards
> Brent Clark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escape problems...why?

2004-04-23 Thread Jason Wong
On Friday 23 April 2004 12:21, Ryan A wrote:

> But then am getting a 500 error...

What does the webserver log say?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
take forceful action:
Do something that should have been done a long time ago.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] [PHP-NIX] File upload

2004-04-23 Thread Ragnar
Hi Vk,

I tried this beforehand, but to no avail. The documentation
also states that this form field entry does not overwrite the
max_filesize_setting in php.ini, when uploading.

so even if I set the hidden form field to 30MB and the .ini
setting is 8MB the file will be rejected if it's over 8MB.

I am am wrong on this, let me know.

> 
> are you uploading the file through a HTML form? if so check the FORM for
> the
> following
> hidden input field...
>   
>   increace the above value (in bytes) to a bit
> more
> value than your maximum
> file size you are tring to upload.
> 
> happy coding...
> 
> Vk.
> 
> 
> Ragnar wrote:
> 
> > Hi guys/girls,
> >
> > I am having some major pain here with a php script handling file
> uploads.
> > It's part of an CMS and the file in question takes a PDF, makes a
> thumbnail
> > of it and then moves it to it's proper location on the server.
> >
> > All this works fine with smaller files < ~ 2 MB.
> >
> > I am having a file that needs to be uploaded to the server though, that
> is
> > 2.3MB and the script just doesn't handle it.
> >
> > I have already increased all the PHP.ini setting (i.e. max_file_size,
> > max_input_time, max_execution_time etc.) but to no avail.
> >
> > All the setting are well beyond of what the actual process takes, and
> the
> > script itself doesn't seem to timeout, it just comes back with:
> >
> > "Warning: Unable to open 'none' for reading: No such file or directory
> in
> > ..."
> >
> > which is pointing to the line where the file is copied from it's temp
> > location on the server /tmp/ to it's proper folder.
> > It seems to me, the file (temporary) never actually ends up on the
> server in
> > the first place.
> >
> > As I said above, for smaller files everything works fine.
> >
> > All this is running on:
> > Apache, PHP 4.1.2, Linux
> >
> > The increase for the php.ini variables is only made for one of
> > the domains hosted on that machine via entries in the virtual host part
> > of the httpd.conf and I checked with phpinfo() wether the variables that
> > increased via those setting are actually changing accordingly.
> > All that looked fine.
> >
> > Does anyone have an idea what could be going on?
> > I'd appreciate any help on this, as the client is expecting this to
> > be fixed ASAP.
> >
> > cheers,
> >
> > Ben
> >
> > --
> > "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
> > Jetzt aktivieren unter http://www.gmx.net/info
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/dsl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] [PHP-NIX] File upload

2004-04-23 Thread Viraj Kalinga Abayarathna

can you send me the fread() part of your script? and what is the
OS you are tring this?

any how i like to share my coding which I did few weeksback for
one of my Windows buddy.


Vk.



Ragnar wrote:

> Hi Vk,
>
> I tried this beforehand, but to no avail. The documentation
> also states that this form field entry does not overwrite the
> max_filesize_setting in php.ini, when uploading.
>
> so even if I set the hidden form field to 30MB and the .ini
> setting is 8MB the file will be rejected if it's over 8MB.
>
> I am am wrong on this, let me know.
>
> >
> > are you uploading the file through a HTML form? if so check the FORM for
> > the
> > following
> > hidden input field...
> >   
> >   increace the above value (in bytes) to a bit
> > more
> > value than your maximum
> > file size you are tring to upload.
> >
> > happy coding...
> >
> > Vk.
> >
> >
> > Ragnar wrote:
> >
> > > Hi guys/girls,
> > >
> > > I am having some major pain here with a php script handling file
> > uploads.
> > > It's part of an CMS and the file in question takes a PDF, makes a
> > thumbnail
> > > of it and then moves it to it's proper location on the server.
> > >
> > > All this works fine with smaller files < ~ 2 MB.
> > >
> > > I am having a file that needs to be uploaded to the server though, that
> > is
> > > 2.3MB and the script just doesn't handle it.
> > >
> > > I have already increased all the PHP.ini setting (i.e. max_file_size,
> > > max_input_time, max_execution_time etc.) but to no avail.
> > >
> > > All the setting are well beyond of what the actual process takes, and
> > the
> > > script itself doesn't seem to timeout, it just comes back with:
> > >
> > > "Warning: Unable to open 'none' for reading: No such file or directory
> > in
> > > ..."
> > >
> > > which is pointing to the line where the file is copied from it's temp
> > > location on the server /tmp/ to it's proper folder.
> > > It seems to me, the file (temporary) never actually ends up on the
> > server in
> > > the first place.
> > >
> > > As I said above, for smaller files everything works fine.
> > >
> > > All this is running on:
> > > Apache, PHP 4.1.2, Linux
> > >
> > > The increase for the php.ini variables is only made for one of
> > > the domains hosted on that machine via entries in the virtual host part
> > > of the httpd.conf and I checked with phpinfo() wether the variables that
> > > increased via those setting are actually changing accordingly.
> > > All that looked fine.
> > >
> > > Does anyone have an idea what could be going on?
> > > I'd appreciate any help on this, as the client is expecting this to
> > > be fixed ASAP.
> > >
> > > cheers,
> > >
> > > Ben
> > >
> > > --
> > > "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
> > > Jetzt aktivieren unter http://www.gmx.net/info
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> NEU : GMX Internet.FreeDSL
> Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/dsl


pab.php
Description: application/unknown-content-type-phpfile


upload.php
Description: application/unknown-content-type-phpfile
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] RE: [PHP-NIX] File upload

2004-04-23 Thread Jattie van der Linde
There is some server level setting that alos limits file size uploads. Can not recall 
the detail of it thou!

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]
Sent: 23 April 2004 06:01
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-NIX] File upload


Hi guys/girls,

I am having some major pain here with a php script handling file uploads.
It's part of an CMS and the file in question takes a PDF, makes a thumbnail
of it and then moves it to it's proper location on the server.

All this works fine with smaller files < ~ 2 MB.

I am having a file that needs to be uploaded to the server though, that is
2.3MB and the script just doesn't handle it.

I have already increased all the PHP.ini setting (i.e. max_file_size,
max_input_time, max_execution_time etc.) but to no avail.

All the setting are well beyond of what the actual process takes, and the
script itself doesn't seem to timeout, it just comes back with:

"Warning: Unable to open 'none' for reading: No such file or directory in
..."

which is pointing to the line where the file is copied from it's temp
location on the server /tmp/ to it's proper folder.
It seems to me, the file (temporary) never actually ends up on the server in
the first place.

As I said above, for smaller files everything works fine.

All this is running on:
Apache, PHP 4.1.2, Linux

The increase for the php.ini variables is only made for one of
the domains hosted on that machine via entries in the virtual host part
of the httpd.conf and I checked with phpinfo() wether the variables that
increased via those setting are actually changing accordingly.
All that looked fine.


Does anyone have an idea what could be going on?
I'd appreciate any help on this, as the client is expecting this to
be fixed ASAP.

cheers,

Ben

-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: insert twice pb

2004-04-23 Thread Craig
Try this and see what happens:




"Ronald Rahal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Why this code is inserting twice in the database ?
>
>
>
>
>   if (   (isset($_POST['empfullname'])) && (isset($_POST['empmidname']))
> && (isset($_POST['empbdate']))
>  && (isset($_POST['emptitle']))&& (isset($_POST['departement']))  )
>  {
>  $empfullname=$HTTP_POST_VARS['empfullname'];
>  $empmidname=$HTTP_POST_VARS['empmidname'];
>  $empbdate=$HTTP_POST_VARS['empbdate'];
>  $empjobtitle=$HTTP_POST_VARS['emptitle'];
>  $empdepartement=$HTTP_POST_VARS['departement'];
>
>  $insert="insert into employee values
> ('','$empfullname','$empmidname','$empbdate','$empjobtitle','$empdeparte
> ment','','')";
> $exec=mysql_query($insert);
> if(!$exec)
> die("Unable To Insert Into Employees Due To An
> Error");
>
> }
>
>  ?>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] $PATH_INFO not working

2004-04-23 Thread Noel da Costa
Hi,

Anyone know what might stop the $PATH_INFO variable from working?  I
developed a nav system using this which works on the test server, but not on
the live server. I'm guessing this is something to do with the way PHP
(4.2.2)  and Apache (2.0) were compiled on the live server (I've posted that
question on php.install), but what I'm wondering is...

Is there perhaps a code fix/work-around I could apply in my scripts to
replace the $PATH_INFO with something that achieves the same effect, without
having to redisign my entire nav system.

Thanks,
Noel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Button ???

2004-04-23 Thread Brent Clark
> This has nothing to do with PHP.
> 
> Its javascript, http://www.jguru.com/faq/view.jsp?EID=280434
> Please keep to topic.

Your right and I apologies

Thanks for the link

Much appreciated
Kind Regards
Brent Clark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escape problems...why?

2004-04-23 Thread Marek Kilimajer
Ryan A wrote:
Hey John,
Thanks for replying.
I cant use strip slashes because there are a number of scripts doing DB
things and searching for all of them and modifying things just for one
client can be a royal PITA.
I tried to use "php_flag magic_quotes_gpc off" in the *existing* .htaccess
file like so:
php_flag magic_quotes_gpc off

Try the above line alone.

If you are still getting 500 error you have to loop $_GET, $_POST , 
arrays and stripslash each element, unless the element is also an array, 
in this case you have to loop this one too:

function strip_slashes_array($var) {
if(!is_array($var)) return stripslashes($array);
foreach($var as $key => $value) {
$var[$key] = strip_slashes_array($value);
}
return $var;
}
$_POST = strip_slashes_array($_POST);

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: $PATH_INFO not working

2004-04-23 Thread Torsten Roehr
"Noel Da Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Anyone know what might stop the $PATH_INFO variable from working?  I
> developed a nav system using this which works on the test server, but not
on
> the live server. I'm guessing this is something to do with the way PHP
> (4.2.2)  and Apache (2.0) were compiled on the live server (I've posted
that
> question on php.install), but what I'm wondering is...
>
> Is there perhaps a code fix/work-around I could apply in my scripts to
> replace the $PATH_INFO with something that achieves the same effect,
without
> having to redisign my entire nav system.
>
> Thanks,
> Noel

Hi Noel,

try accesing it via $_SERVER['PATH_INFO'].

Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Button ???

2004-04-23 Thread "Miguel J. Jiménez"
Well, anyway... you can use this script:


   document.formName.buttonName.disabled=true;

--
Miguel J. Jiménez
ISOTROL, S.A. (Área de Internet)
Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
[EMAIL PROTECTED]   ---   http://www.isotrol.com
TLFNO. 955036800 ext. 111
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to do type/existence checking in PHP5

2004-04-23 Thread Christian Jul Jensen
Hi 

In PHP5 the behaviour of illegal string offsets has changed. This is
documented in the 'thin changes' file.

This gives a problem in checking for existence / types of values,
directly into a deeper level of a multidimensional array.

I reported this as a bug[1] because I find the behaviour unfortunate, and
furthermore it's inconsistent. This was refused, with a note 'So don't
do it'. I think it's a really bad idea not to check the
existence/types of values, before using them, so how should this be done
properly in PHP5, without risking fatal errors in the case of a
non-existent array?

This is a problem in migrating applications from PHP4 because the
error will not appear unless the value deosn't exist, which is exactly
why you do the check.

[1] http://bugs.php.net/bug.php?id=28107

--
./mvh Christian Jul Jensen
  Frelance webprogrammer
  TYPO3 Typehead Denmark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Button ???

2004-04-23 Thread Richard Davey
Hello Craig,

Friday, April 23, 2004, 9:41:48 AM, you wrote:

C> This has nothing to do with PHP.
C> Its javascript, http://www.jguru.com/faq/view.jsp?EID=280434
C> Please keep to topic.

Agreed, but he didn't know it was JavaScript causing it (as was
obvious from his first post). I'm all for keeping "on topic" - but
really, you have to cut some people some slack sometimes.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] calling php function

2004-04-23 Thread T UmaShankari

Hello,

 Is it possible to call php function in the onclick event ?

REgards,
Uma

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calling php function

2004-04-23 Thread John W. Holmes
From: "T UmaShankari" <[EMAIL PROTECTED]>

>  Is it possible to call php function in the onclick event ?

No. Please do research on the difference between "server side" and "client
side" code. Report back to us when finished.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: calling php function

2004-04-23 Thread Aidan Lister
No, you are confusing javascript (client side) with PHP (server side).

"T Umashankari" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hello,
>
>  Is it possible to call php function in the onclick event ?
>
> REgards,
> Uma

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to do type/existence checking in PHP5

2004-04-23 Thread Aidan Lister
I don't understand the question.

One should always check the existence of something before attempting to use
it.

If (isset($var) && gettype($var) == "boolean") is one way of type checking.



"Christian Jul Jensen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> In PHP5 the behaviour of illegal string offsets has changed. This is
> documented in the 'thin changes' file.
>
> This gives a problem in checking for existence / types of values,
> directly into a deeper level of a multidimensional array.
>
> I reported this as a bug[1] because I find the behaviour unfortunate, and
> furthermore it's inconsistent. This was refused, with a note 'So don't
> do it'. I think it's a really bad idea not to check the
> existence/types of values, before using them, so how should this be done
> properly in PHP5, without risking fatal errors in the case of a
> non-existent array?
>
> This is a problem in migrating applications from PHP4 because the
> error will not appear unless the value deosn't exist, which is exactly
> why you do the check.
>
> [1] http://bugs.php.net/bug.php?id=28107
>
> --
> ./mvh Christian Jul Jensen
>   Frelance webprogrammer
>   TYPO3 Typehead Denmark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] Button ???

2004-04-23 Thread Brent Clark
> Agreed, but he didn't know it was JavaScript causing it (as was
> obvious from his first post). I'm all for keeping "on topic" - but
> really, you have to cut some people some slack sometimes.

Hi

Its kewl
I should have known better and investigated it more properly.

Kind Regards
Brent Clark 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to do type/existence checking in PHP5

2004-04-23 Thread Red Wingate
Hi,

this is a plain design fault on your side:



allright, just set $a to be a string, thats allright, now
you check wether an string-offset ( foo ) is an array or
not which causes an FATAL ERROR on PHP5.

Now if you wrote some clean code you would have done:



Now this makes sense as you first of all would make sure if $a is an
array and not start with the first index ( which doesn't exist as $a
is not even an array )

 -- red

PS: PHP5 says:
Fatal error: Cannot use string offset as an array in /www/htdocs
test_offset.php on line 6

[...]
> Hi
> 
> In PHP5 the behaviour of illegal string offsets has changed. This is
> documented in the 'thin changes' file.
> 
> This gives a problem in checking for existence / types of values,
> directly into a deeper level of a multidimensional array.
> 
> I reported this as a bug[1] because I find the behaviour unfortunate, and
> furthermore it's inconsistent. This was refused, with a note 'So don't
> do it'. I think it's a really bad idea not to check the
> existence/types of values, before using them, so how should this be done
> properly in PHP5, without risking fatal errors in the case of a
> non-existent array?
> 
> This is a problem in migrating applications from PHP4 because the
> error will not appear unless the value deosn't exist, which is exactly
> why you do the check.
> 
> [1] http://bugs.php.net/bug.php?id=28107
[...]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: $PATH_INFO not working

2004-04-23 Thread Noel da Costa
Thanks for the thought...

I was using getenv('PATH_INFO'). I tried  $_SERVER['PATH_INFO'], but it
didn't help.

PATH_INFO is working, ie being filled, but Apache doesn't seem to know what
to do with it. So if my link has a URL: "index.php/section/login" it tries
to find a literal folder with that path, instead of simply passing the
"/section/login" bit to the PATHINFO variable within the index.php file.

This is the error msg: "
Object not found!
  The requested URL was not found on this server. The link on the referring
page seems to be wrong or outdated. Please inform the author of that page
about the error.
  If you think this is a server error, please contact the webmaster
Error 404
  192.9.200.182
  Fri Apr 23 12:35:45 2004
  Apache/2.0.40 (Red Hat Linux) "

I'm sure it's something to do with config, because we just re-compiled PHP
on the test server... and now my script won't run on the test server too!!

Noel



"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Noel Da Costa" <[EMAIL PROTECTED]>
>
> Hi Noel,
>
> try accesing it via $_SERVER['PATH_INFO'].
>
> Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] A to Z incremental

2004-04-23 Thread Ford, Mike [LSS]
On 22 April 2004 15:22, Paul wrote:

> Hi!
> Got this script:
> 
>  for($i='A';$i<='Z';$i++){  echo $i.' | ';  }
> > 
> 
> The output is:
> A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P
> > Q | R | S | T | U | V | W | X | Y | Z |
>  AA | AB | AC |
>  ...
>   YX | YY | YZ |
> 
> where is should display only letters from A to Z.
> Why is that?

Because 'Z'++ (if you see what I mean!) is 'AA'.

(So, at the end of the loop iteration which echoes 'Z', $i becomes 'AA',
which is <'Z', and as a result the loop continues on through all the values
you saw.  The loop terminates after 'YZ' is echoed, since at the end of that
iteration $i increments to 'ZA', which is not <'Z', and Bob's your uncle!)

One way of solving this is:

   for ($i='A'; $i!='AA'; $i++)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] A to Z incremental

2004-04-23 Thread electroteque
use the chr($i) system

> -Original Message-
> From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 23, 2004 9:31 PM
> To: 'Paul'; [EMAIL PROTECTED]
> Subject: RE: [PHP] A to Z incremental
>
>
> On 22 April 2004 15:22, Paul wrote:
>
> > Hi!
> > Got this script:
> >
> >  > for($i='A';$i<='Z';$i++){  echo $i.' | ';  }
> > >
> >
> > The output is:
> > A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P
> > > Q | R | S | T | U | V | W | X | Y | Z |
> >  AA | AB | AC |
> >  ...
> >   YX | YY | YZ |
> >
> > where is should display only letters from A to Z.
> > Why is that?
>
> Because 'Z'++ (if you see what I mean!) is 'AA'.
>
> (So, at the end of the loop iteration which echoes 'Z', $i becomes 'AA',
> which is <'Z', and as a result the loop continues on through all
> the values
> you saw.  The loop terminates after 'YZ' is echoed, since at the
> end of that
> iteration $i increments to 'ZA', which is not <'Z', and Bob's your uncle!)
>
> One way of solving this is:
>
>for ($i='A'; $i!='AA'; $i++)
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>
> --
> 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



[PHP] Re: $PATH_INFO not working

2004-04-23 Thread Torsten Roehr
"Noel Da Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for the thought...
>
> I was using getenv('PATH_INFO'). I tried  $_SERVER['PATH_INFO'], but it
> didn't help.
>
> PATH_INFO is working, ie being filled, but Apache doesn't seem to know
what
> to do with it. So if my link has a URL: "index.php/section/login" it tries
> to find a literal folder with that path, instead of simply passing the
> "/section/login" bit to the PATHINFO variable within the index.php file.
>
> This is the error msg: "
> Object not found!
>   The requested URL was not found on this server. The link on the
referring
> page seems to be wrong or outdated. Please inform the author of that page
> about the error.
>   If you think this is a server error, please contact the webmaster
> Error 404
>   192.9.200.182
>   Fri Apr 23 12:35:45 2004
>   Apache/2.0.40 (Red Hat Linux) "
>
> I'm sure it's something to do with config, because we just re-compiled PHP
> on the test server... and now my script won't run on the test server too!!
>
> Noel

I just searched my email archive. I had this problem with one of my
providers. Then they changed the file permission to 705 and it worked! So
set this for your index.php and try again. I know it sounds strange that
this has got something to do with Apache's look-back feature but it does!

Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Search MySQL and Match Whole Words

2004-04-23 Thread Jay Blanchard
[snip]
I was wondering if anyone knows how to do whole word searches in mysql.
I
have a search textbox that users can enter in multiple words to search
for
in the database, but things like the mysql LIKE match any part of a
word.
Is there a way to search for whole word matches only?  Please let me
know if
you can help.
[/snip]

the following might not be the most efficient way...and not tested

use explode to seperate the words placed in the form field

$arrayWords = explode(" ", $_POST['seach_box'])

then do query with loop to populate IN statement

$getData = "SELECT stuff FROM table ";
$getData .= "WHERE column IN (";

for($i = 0; $i < count($arrayWords); $i++){
   if($i != (count($arrayWords)-1)){
  $getData .= "'" . $arrayWords[$i] . "',";
   } else { 
$getData .= "'" . $arrayWords[$i] . "'";
   }
}
$getData .= ") ";
$dbData = mysql_query($getData, your_connection_string);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: $PATH_INFO not working

2004-04-23 Thread Marek Kilimajer
Torsten Roehr wrote:
"Noel Da Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Thanks for the thought...

I was using getenv('PATH_INFO'). I tried  $_SERVER['PATH_INFO'], but it
didn't help.
PATH_INFO is working, ie being filled, but Apache doesn't seem to know
what

to do with it. So if my link has a URL: "index.php/section/login" it tries
to find a literal folder with that path, instead of simply passing the
"/section/login" bit to the PATHINFO variable within the index.php file.
This is the error msg: "
Object not found!
 The requested URL was not found on this server. The link on the
referring

page seems to be wrong or outdated. Please inform the author of that page
about the error.
 If you think this is a server error, please contact the webmaster
Error 404
 192.9.200.182
 Fri Apr 23 12:35:45 2004
 Apache/2.0.40 (Red Hat Linux) "
I'm sure it's something to do with config, because we just re-compiled PHP
on the test server... and now my script won't run on the test server too!!
Noel


I just searched my email archive. I had this problem with one of my
providers. Then they changed the file permission to 705 and it worked! So
set this for your index.php and try again. I know it sounds strange that
this has got something to do with Apache's look-back feature but it does!
Regards, Torsten

I think it's called X-Bit hack or something like that

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How to do type/existence checking in PHP5

2004-04-23 Thread Christian Jul Jensen

Hi 

Thanks for taking time to look into this.

[EMAIL PROTECTED] (Red Wingate) writes:


> this is a plain design fault on your side:

I'm sorry, but I don't agree. It is standard in PHP4, and one of the
advantages of having a type loose programming language.

> Now this makes sense as you first of all would make sure if $a is an
> array and not start with the first index ( which doesn't exist as $a
> is not even an array )

I understand what the logic behind is, and actually your example, does
not give a fatal error as $['foo'] returns a char, and you can call
is_array with that. Furthermore it's inconsistent, as it behaves
differently depending on which function you call.

In PHP4 this is valid

$my_array = $some_weird_function_that_returns_a_multidim_array();
if(is_array($my_array['some']['special']['value']['that']['i']['need']))
{
apply_logic();
}

in PHP5, in order not to risk a fatal error, this would have to be:

$my_array = $some_weird_function_that_returns_a_multidim_array();
if( is_array($my_array['some']) && 
is_array($my_array['some']['special']) && 
is_array($my_array['some']['special']['value']) &&
is_array($my_array['some']['special']['value']['that']) &&
is_array($my_array['some']['special']['value']['that']['i']) &&
is_array($my_array['some']['special']['value']['that']['i']['need'])
) {
apply_logic();
}

IMHO that's not very nice. You could argue that ending up in
situations like this is bad design, still it's valid in PHP4.

You cannot even encapsulate in a function, because that gives a fatal
error when you call the function (which makes sense).

I find this to be a problem, because it makes it hard to migrate
scripts from PHP4, and I'd rather spend my time using the new object
model and XML support, than going through old scripts to make sure
they comply with a new behaviour which I see no good reason for.

--
./mvh Christian Jul Jensen
  Frelance webprogrammer
  TYPO3 Typehead Denmark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A to Z incremental

2004-04-23 Thread Rob Ellis
On Fri, Apr 23, 2004 at 09:41:39PM +1000, electroteque wrote:
> use the chr($i) system

or range()...

  print implode(' | ', range('A', 'Z'));

- rob

> 
> > -Original Message-
> > From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 23, 2004 9:31 PM
> > To: 'Paul'; [EMAIL PROTECTED]
> > Subject: RE: [PHP] A to Z incremental
> >
> >
> > On 22 April 2004 15:22, Paul wrote:
> >
> > > Hi!
> > > Got this script:
> > >
> > >  > > for($i='A';$i<='Z';$i++){  echo $i.' | ';  }
> > > >
> > >
> > > The output is:
> > > A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P
> > > > Q | R | S | T | U | V | W | X | Y | Z |
> > >  AA | AB | AC |
> > >  ...
> > >   YX | YY | YZ |
> > >
> > > where is should display only letters from A to Z.
> > > Why is that?
> >
> > Because 'Z'++ (if you see what I mean!) is 'AA'.
> >
> > (So, at the end of the loop iteration which echoes 'Z', $i becomes 'AA',
> > which is <'Z', and as a result the loop continues on through all
> > the values
> > you saw.  The loop terminates after 'YZ' is echoed, since at the
> > end of that
> > iteration $i increments to 'ZA', which is not <'Z', and Bob's your uncle!)
> >
> > One way of solving this is:
> >
> >for ($i='A'; $i!='AA'; $i++)
> >
> > Cheers!
> >
> > Mike
> >
> > -
> > Mike Ford,  Electronic Information Services Adviser,
> > Learning Support Services, Learning & Information Services,
> > JG125, James Graham Building, Leeds Metropolitan University,
> > Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> > Email: [EMAIL PROTECTED]
> > Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
> >
> > --
> > 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
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [PHP-NIX] File upload

2004-04-23 Thread raditha dissanayake
Ragnar wrote:

Hi guys/girls,

I am having some major pain here with a php script handling file uploads.
It's part of an CMS and the file in question takes a PDF, makes a thumbnail
of it and then moves it to it's proper location on the server.
All this works fine with smaller files < ~ 2 MB.

I am having a file that needs to be uploaded to the server though, that is
2.3MB and the script just doesn't handle it.
I have already increased all the PHP.ini setting (i.e. max_file_size,
max_input_time, max_execution_time etc.) but to no avail.
 

I think you have missed memory_limit and post_max_size
Please visit http://www.radinks.com/upload/config.php  for a brief guide 
on how to configure PHP for large uploads.

You will also have to look at the LimitRequestBody apache directive.

 



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Richard Davey
Hi all,

It's a warm sunny day and I'm trying to wrap my head around the
following:

I want to be able to check to see if, in a string, the user has
entered too many consecutive characters and not enough spaces. For
example they might enter a subject like:

"hello world! how arrre you today?!!"

Does anyone have a nice technique for checking the following:

1) Count the length of the words in the string, i.e. if there are any
words beyond say 20 characters then I need to know what they are so I
can flag up a warning.

2) Count the number of punctuation characters vs. alphanumerics - I
don't want the exclamation mark syndrome shown above, so I need to set
a friendly trade-off limit somehow.

Any thoughts appreciated.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Call to external function

2004-04-23 Thread Jeff McKeon
Is there a way in PHP to make a call to a javascript funtion?

I have a javascript that I want to start when an sql query begins and
stop when the php code is done.  Is this possible?

Thanks,

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Call to external function

2004-04-23 Thread Jay Blanchard
[snip]
Is this possible?
[/snip]

Anything is possible!

Have you considered echoing the javascript code out via PHP?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Call to external function

2004-04-23 Thread Jeff McKeon
>
> [snip]
> Is this possible?
> [/snip]
> 
> Anything is possible!
> 
> Have you considered echoing the javascript code out via PHP?
> 

Yes, but I can't seem to get the right javascript code figured out.

I have the script start when the page loads with an
onload=function('go') in the  tag.

But I need someway to turn it off... A simple:

Echo "function('stop')"; at the end of the page

doesn't seem to work. Should it?

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] TRUE or true?

2004-04-23 Thread Shaunak Kashyap
lowercase

> -Original Message-
> From: Richard Davey [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 7:52 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] TRUE or true?
> 
> 
> Hi all,
> 
> I know from a code point of view it makes no difference at all (i.e.
> they both work), but which format do you all use for booleans?
> 
> TRUE / FALSE
> 
> or
> 
> true / false
> 
> The PHP manual uses both :) Zend Studio tries to auto-complete to the
> lower-case variant.
> 
> I'm not seeking a big debate on this, more of an overall poll-count
> (and any sound arguments for A vs. B, or should I say T vs. t)
> 
> -- 
> Best regards,
>  Richard Davey
>  http://www.phpcommunity.org/wiki/296.html
> 
> -- 
> 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



[PHP] Re: Counting number of characters without spaces between them?

2004-04-23 Thread Torsten Roehr
"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> It's a warm sunny day and I'm trying to wrap my head around the
> following:
>
> I want to be able to check to see if, in a string, the user has
> entered too many consecutive characters and not enough spaces. For
> example they might enter a subject like:
>
> "hello world! how arrre you today?!!"
>
> Does anyone have a nice technique for checking the following:
>
> 1) Count the length of the words in the string, i.e. if there are any
> words beyond say 20 characters then I need to know what they are so I
> can flag up a warning.
>
> 2) Count the number of punctuation characters vs. alphanumerics - I
> don't want the exclamation mark syndrome shown above, so I need to set
> a friendly trade-off limit somehow.
>
> Any thoughts appreciated.
>
> --
> Best regards,
>  Richard Davey
>  http://www.phpcommunity.org/wiki/296.html

Hi Richard,

to count the words and check its length you could use explode() to split the
string into an array by a space (' '):

$words = explode(' ', $input);
$allowedWordLength = 20;
$tooLongWord = false;
$checkChar = '!';
$tooManyChars = false;

// loop through the array and check each word's length and char occurrence
foreach ($words as $word) {
   if (strlen($word) > $allowedWordLength) $tooLongWord = true;

   // check the occurrence of a special character in the word
   if (substr_count($word, $checkChar) > 1) $tooManyChars = true;
}

// print an error if one of the words is too long
if ($tooLongWord) echo 'Error: Your words are too long!';

// print an error if the checked char occurred too often in one of the words
if ($tooManyChars) echo 'You had too many ' . $checkCar . ' in your input!';

The above code is not tested but should work. Hope this helps.

Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Call to external function

2004-04-23 Thread Torsten Roehr
This is more of a JavaScript than a PHP question. Maybe you could search
google for 'stop JavaScript function' or something.

Torsten

"Jeff McKeon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> [snip]
> Is this possible?
> [/snip]
>
> Anything is possible!
>
> Have you considered echoing the javascript code out via PHP?
>

Yes, but I can't seem to get the right javascript code figured out.

I have the script start when the page loads with an
onload=function('go') in the  tag.

But I need someway to turn it off... A simple:

Echo "function('stop')"; at the end of the page

doesn't seem to work. Should it?

Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Tom Rogers
Hi,

Friday, April 23, 2004, 11:50:56 PM, you wrote:
RD> Hi all,

RD> It's a warm sunny day and I'm trying to wrap my head around the
RD> following:

RD> I want to be able to check to see if, in a string, the user has
RD> entered too many consecutive characters and not enough spaces. For
RD> example they might enter a subject like:

RD> "hello world! how arrre you today?!!"

RD> Does anyone have a nice technique for checking the following:

RD> 1) Count the length of the words in the string, i.e. if there are any
RD> words beyond say 20 characters then I need to know what they are so I
RD> can flag up a warning.

RD> 2) Count the number of punctuation characters vs. alphanumerics - I
RD> don't want the exclamation mark syndrome shown above, so I need to set
RD> a friendly trade-off limit somehow.

RD> Any thoughts appreciated.

RD> -- 
RD> Best regards,
RD>  Richard Davey
RD>  http://www.phpcommunity.org/wiki/296.html


You could try something like this

$string = "hello world! how arrre you today?!!";
if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){
  echo "too many repeated characters";
  print_r($match);
}
That will catch everything, except numbers, that is repeated 4 or more
times.
-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] reg exp for smtp error codes

2004-04-23 Thread Curt Zirzow
* Thus wrote Robert Kornfeld ([EMAIL PROTECTED]):
> hey professionals out there!
> 
> does anybody have a script that parses the error-code from a returned
> email-header (esmtp)?

You dont need a regex, just a simple explode will work:
 
  list($code, $message) = explode(" ", $result_string, 2);


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Tom Rogers
Hi,

Saturday, April 24, 2004, 12:42:57 AM, you wrote:
TR> Hi,

TR> Friday, April 23, 2004, 11:50:56 PM, you wrote:

TR> You could try something like this

TR> $string = "hello world! how arrre you today?!!";
TR> if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){
TR>   echo "too many repeated characters";
TR>   print_r($match);
TR> }
TR> That will catch everything, except numbers, that is repeated 4 or more
TR> times.

With preg_split() you can do a bit of correction too:

$string = "hello world! how arrre you today?!!";
if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){
  echo "too many repeated characters";
print_r($match);
}

$split = preg_split('/(\w)\1{4,}|(\W)\2{4,}/',$string);
print_r($split);
$out = '';
foreach($split as $key=>$val){
$out .= $val;
if(!empty($match[1][$key])) $out .= $match[1][$key];
elseif(!empty($match[2][$key])) $out .= $match[2][$key];
}
echo $out.'';

The tricks you learn with this PHP :-)

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Richard Davey
Hello Tom,

Friday, April 23, 2004, 3:42:57 PM, you wrote:

TR> $string = "hello world! how arrre you today?!!";
TR> if(preg_match_all('/(\w)\1{4,}|(\W)\2{4,}/',$string,$match)){
TR>   echo "too many repeated characters";
TR>   print_r($match);
TR> }
TR> That will catch everything, except numbers, that is repeated 4 or more
TR> times.

Absolutely perfect - thank you!

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';

Anyone? TIA!

- B1ff Lamer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...


I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';

Anyone? TIA!

- B1ff Lamer

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
I tried it both ways - didn't make any difference (phpmyadmin adds the 
single quotes when I was trying to use its sql function to debug, so I 
figured what the hell)...

On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...
I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Anyone? TIA!

- B1ff Lamer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to do type/existence checking in PHP5

2004-04-23 Thread Curt Zirzow
* Thus wrote Christian Jul Jensen ([EMAIL PROTECTED]):
> 
> Hi 
> 
> Thanks for taking time to look into this.
> 
> [EMAIL PROTECTED] (Red Wingate) writes:
> 
> 
> > this is a plain design fault on your side:
> 
> I'm sorry, but I don't agree. It is standard in PHP4, and one of the
> advantages of having a type loose programming language.

Perhaps you misunderstand the 'loose' part of the variables,
basically there are 4 types of variables:

  1. scalar
  2. array
  3. object
  4. resource

How you can access each one differs.

> 
> > Now this makes sense as you first of all would make sure if $a is an
> > array and not start with the first index ( which doesn't exist as $a
> > is not even an array )
> 
> 
> in PHP5, in order not to risk a fatal error, this would have to be:
> 
> $my_array = $some_weird_function_that_returns_a_multidim_array();
> if( is_array($my_array['some']) && 
> is_array($my_array['some']['special']) && 
> is_array($my_array['some']['special']['value']) &&
> is_array($my_array['some']['special']['value']['that']) &&
> is_array($my_array['some']['special']['value']['that']['i']) &&
> is_array($my_array['some']['special']['value']['that']['i']['need'])
> ) {
> apply_logic();
> }

You just need:

if (is_array($my_array) &&
is_array($my_array['some']['special']['value']['that']['i']['need'])
) {

> 
> I find this to be a problem, because it makes it hard to migrate
> scripts from PHP4, and I'd rather spend my time using the new object
> model and XML support, than going through old scripts to make sure
> they comply with a new behaviour which I see no good reason for.

I think the question is why is this a fatal error versus a simple
E_WARNING. 

 
Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
I tried it both ways - didn't make any difference (phpmyadmin adds the 
single quotes when I was trying to use its sql function to debug, so I 
figured what the hell)...
[/snip]

Those aren't single quotes it adds to table and column names...those are
back tics (on the same key as the tilde) If you chnage those you should
be OK.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
does it just return the error when running in the php page?  If you pull it
out can you run it in mysql without errors?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


I tried it both ways - didn't make any difference (phpmyadmin adds the
single quotes when I was trying to use its sql function to debug, so I
figured what the hell)...


On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

> why are the table and field names surrounded by single quotes?
>
> -Original Message-
> From: Brian Dunning [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 23, 2004 11:19 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] OK SQL experts...
>
>
> I STFW and RTFM and I still can't figure out why this returns a 1064
> parse error:
>
> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
> 'status' = 'active';
>
> Anyone? TIA!
>
> - B1ff Lamer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
- Brian

--
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
It gives the same error when I run it in phpmyadmin.

On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote:

does it just return the error when running in the php page?  If you 
pull it
out can you run it in mysql without errors?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
I tried it both ways - didn't make any difference (phpmyadmin adds the
single quotes when I was trying to use its sql function to debug, so I
figured what the hell)...
On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...
I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Anyone? TIA!

- B1ff Lamer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


- Brian

--
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

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Richard Harb
AFAIK phpMyAdmin uses backticks for table/field names, not single
quotes ...


Friday, April 23, 2004, 5:22:35 PM, thus was written:
> I tried it both ways - didn't make any difference (phpmyadmin adds the
> single quotes when I was trying to use its sql function to debug, so I
> figured what the hell)...


> On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

>> why are the table and field names surrounded by single quotes?
>>
>> -Original Message-
>> From: Brian Dunning [mailto:[EMAIL PROTECTED]
>> Sent: Friday, April 23, 2004 11:19 AM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] OK SQL experts...
>>
>>
>> I STFW and RTFM and I still can't figure out why this returns a 1064
>> parse error:
>>
>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
>> 'status' = 'active';
>>
>> Anyone? TIA!
>>
>> - B1ff Lamer
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
> - Brian

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: "Brian Dunning" <[EMAIL PROTECTED]>

> I STFW and RTFM and I still can't figure out why this returns a 1064 
> parse error:
> 
> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> 'status' = 'active';

Use backticks around table and column names, not single quotes. 

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
Backticks, single quotes, or nothing at all makes no difference. I 
believe the parsing error is due to my parentheses or AND/OR structure. 
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: "Brian Dunning" <[EMAIL PROTECTED]>

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] OK SQL experts...

2004-04-23 Thread Jeff McKeon
> >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> >> 'status' = 'active';

Longshot but try to remove the ' ' from around the field names in the
where statement..

Or 

SELECT * FROM My_Table
WHERE field_1 like '%$keyword%' && status = 'active'
|| field_2 like '%$keyword%' && status = 'active'
|| field_3 like '%$keyword%' && status = 'active'

Jeff

> -Original Message-
> From: Brian Dunning [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 23, 2004 11:30 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] OK SQL experts...
> 
> 
> It gives the same error when I run it in phpmyadmin.
> 
> 
> On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote:
> 
> > does it just return the error when running in the php page?  If you
> > pull it
> > out can you run it in mysql without errors?
> >
> > -Original Message-
> > From: Brian Dunning [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 23, 2004 11:23 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] OK SQL experts...
> >
> >
> > I tried it both ways - didn't make any difference 
> (phpmyadmin adds the 
> > single quotes when I was trying to use its sql function to 
> debug, so I 
> > figured what the hell)...
> >
> >
> > On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:
> >
> >> why are the table and field names surrounded by single quotes?
> >>
> >> -Original Message-
> >> From: Brian Dunning [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, April 23, 2004 11:19 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: [PHP] OK SQL experts...
> >>
> >>
> >> I STFW and RTFM and I still can't figure out why this 
> returns a 1064 
> >> parse error:
> >>
> >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> >> 'status' = 'active';
> >>
> >> Anyone? TIA!
> >>
> >> - B1ff Lamer
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> > - Brian
> >
> > --
> > 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
> >
> >
> - Brian
> 
> -- 
> 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] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
[/snip]

How about this?

SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%' OR 
field_2 LIKE '%$keyword%' OR field_3 LIKE '%$keyword%') AND 
status = 'active';

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
what value is being put in the $keyword variable?  You are sure all these
columns exist?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

> From: "Brian Dunning" <[EMAIL PROTECTED]>
>
>> I STFW and RTFM and I still can't figure out why this returns a 1064
>> parse error:
>>
>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
>> 'status' = 'active';
>
> Use backticks around table and column names, not single quotes.
>
> ---John Holmes...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
- Brian

--
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] OK SQL experts...

2004-04-23 Thread Edward Peloke
if you echo out the query..what is the output?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


Backticks, single quotes, or nothing at all makes no difference. I 
believe the parsing error is due to my parentheses or AND/OR structure. 
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

> From: "Brian Dunning" <[EMAIL PROTECTED]>
>
>> I STFW and RTFM and I still can't figure out why this returns a 1064
>> parse error:
>>
>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
>> 'status' = 'active';
>
> Use backticks around table and column names, not single quotes.
>
> ---John Holmes...
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
- Brian

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
Yes, I've checked and rechecked the spelling on everything. I've been 
testing with a word that I know appears in at least one of the fields.

On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:

what value is being put in the $keyword variable?  You are sure all 
these
columns exist?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?


On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: "Brian Dunning" <[EMAIL PROTECTED]>

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

--
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

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
phpmyadmin echoes it out exactly as I copied & pasted into my first 
post.

On Apr 23, 2004, at 8:56 AM, Edward Peloke wrote:

if you echo out the query..what is the output?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?


On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: "Brian Dunning" <[EMAIL PROTECTED]>

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

--
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

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Mark

--- Brian Dunning <[EMAIL PROTECTED]> wrote:
> Yes, I've checked and rechecked the spelling on everything. I've
> been 
> testing with a word that I know appears in at least one of the
> fields.
> 

I'm coming in a bit late, but have you tried echoing out the query
variable contents and copying and pasting that to the MySQL command
line?

Also, any chance you could post the table decription? 

> 
> On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:
> 
> > what value is being put in the $keyword variable?  You are sure
> all 
> > these
> > columns exist?
> >
> > -Original Message-
> > From: Brian Dunning [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 23, 2004 11:36 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] OK SQL experts...
> >
> >
> > Backticks, single quotes, or nothing at all makes no difference.
> I
> > believe the parsing error is due to my parentheses or AND/OR
> structure.
> > Any thoughts on that?
> >
> >
> >
> > On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:
> >
> >> From: "Brian Dunning" <[EMAIL PROTECTED]>
> >>
> >>> I STFW and RTFM and I still can't figure out why this returns a
> 1064
> >>> parse error:
> >>>
> >>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
> >>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
> >>> 'status' = 'active';
> >>
> >> Use backticks around table and column names, not single quotes.
> >>
> >> ---John Holmes...
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> > - Brian
> >
> > --
> > 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
> >
> >
> - Brian
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Daniel Purdy
>>> I STFW and RTFM and I still can't figure out why this returns a 1064

>>> parse error:
>>>
>>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
>>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
>>> 'status' = 'active';

Why don't you try rebuilding the query. I mean go into phpmyadmin and
issue select * from `my_table` if that works. Then add on one where
clause
Select * FROM `my_table` WHERE (`field_1 LIKE '%key%' )  , and just put
it back together piece by piece until it breaks. That should at least
help narrow down what is breaking.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
[/snip]

*slaps forehead*

"SELECT * FROM my_table WHERE (field_1 LIKE '%" . $keyword . "%' OR 
field_2 LIKE '%" . $keyword . "%' OR field_3 LIKE '%" . $keyword . "%')
AND 
status = 'active'";

The single quoted variables do not get parsed

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
I don't have access to the MySQL command line; it's hosted at my ISP.

:(

On Apr 23, 2004, at 8:54 AM, Mark wrote:

--- Brian Dunning <[EMAIL PROTECTED]> wrote:
Yes, I've checked and rechecked the spelling on everything. I've
been
testing with a word that I know appears in at least one of the
fields.
I'm coming in a bit late, but have you tried echoing out the query
variable contents and copying and pasting that to the MySQL command
line?
Also, any chance you could post the table decription?

On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:

what value is being put in the $keyword variable?  You are sure
all
these
columns exist?
-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference.
I
believe the parsing error is due to my parentheses or AND/OR
structure.
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: "Brian Dunning" <[EMAIL PROTECTED]>

I STFW and RTFM and I still can't figure out why this returns a
1064
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

--
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

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to 
fight to death to defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] OK SQL experts...

2004-04-23 Thread Chris W. Parker
Brian Dunning 
on Friday, April 23, 2004 8:19 AM said:

> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
> 'status' = 'active';

have you tried simply:

SELECT * FROM my_table WHERE status = 'active';

??

if that works move up into:

SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';

if that works continue until you get an error.



chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';

if that works continue until you get an error.
[/snip]

That'll give you an error right there. That old single quoted variable
will get you every time. :)

WHERE (field_1 LIKE '%$keyword%') 

WHERE (field_1 LIKE '%" . $keyword . "%') 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi,

Saturday, April 24, 2004, 1:55:36 AM, you wrote:
JB> [snip]
JB> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
JB> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
JB> 'status' = 'active';
JB> [/snip]

JB> *slaps forehead*

JB> "SELECT * FROM my_table WHERE (field_1 LIKE '%" . $keyword . "%' OR
JB> field_2 LIKE '%" . $keyword . "%' OR field_3 LIKE '%" . $keyword . "%')
JB> AND 
JB> status = 'active'";

JB> The single quoted variables do not get parsed

JB> --
JB> PHP General Mailing List (http://www.php.net/)
JB> To unsubscribe, visit: http://www.php.net/unsub.php


They do if they are themselves inside double quotes :)

echo "'$var'"; will get parsed ok

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
if that works move up into:
SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';
Yes, I actually did exactly that. Everything works until I have more 
than one statement inside the (x LIKE x OR x LIKE x) parens. That's why 
I figured there has to be something wrong with my paren structure. When 
I RTFM I saw someplace to use {}+ instead of () but it gave a different 
error.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
They do if they are themselves inside double quotes :)

echo "'$var'"; will get parsed ok
[/snip]

I know, but since I saw no double quotes I had to go for the obvious. :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[4]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi,

Saturday, April 24, 2004, 2:03:36 AM, you wrote:
JB> [snip]
JB> They do if they are themselves inside double quotes :)

JB> echo "'$var'"; will get parsed ok
JB> [/snip]

JB> I know, but since I saw no double quotes I had to go for the obvious. :)

Yes I would like to see the "whole truth" as well :) including the
mysterious search word.

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian,

Friday, April 23, 2004, 5:02:00 PM, you wrote:

BD> Yes, I actually did exactly that. Everything works until I have more
BD> than one statement inside the (x LIKE x OR x LIKE x) parens. That's why
BD> I figured there has to be something wrong with my paren structure. When
BD> I RTFM I saw someplace to use {}+ instead of () but it gave a different
BD> error.

I don't think it's anything to do with your () placement, I just
tested and the follow 3 queries all bring back the same results:

SELECT * FROM table WHERE (field LIKE '%var%') OR (field2 LIKE
'%var%') AND field3 = 'condition'

SELECT * FROM table WHERE (field LIKE '%var%' OR field2 LIKE
'%var%') AND field3 = 'condition'

SELECT * FROM table WHERE field LIKE '%var%' OR field2 LIKE
'%var%' AND field3 = 'condition'

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread William Lovaton
How are you manipulating the whole SQL string?? 

$sql = "SELECT..."; ???

or 

$sql = 'SELECT...'; ???

In this case you will have to use double quotes because PHP won't parse
single quote strings for searching embedded PHP variables.

May be this is the problem.


-William


El vie, 23-04-2004 a las 11:02, Brian Dunning escribió:
> > if that works move up into:
> > SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
> > 'active';
> 
> Yes, I actually did exactly that. Everything works until I have more 
> than one statement inside the (x LIKE x OR x LIKE x) parens. That's why 
> I figured there has to be something wrong with my paren structure. When 
> I RTFM I saw someplace to use {}+ instead of () but it gave a different 
> error.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Call to external function

2004-04-23 Thread William Lovaton
No... PHP and JavaScript are executing at different time and at
different place.  Besides, they are executed by different programs.

Are you trying to measure execution time of a query??

Look at:
http://www.php.net/microtime


-William


El vie, 23-04-2004 a las 09:09, Jeff McKeon escribió:
> Is there a way in PHP to make a call to a javascript funtion?
> 
> I have a javascript that I want to start when an sql query begins and
> stop when the php code is done.  Is this possible?
> 
> Thanks,
> 
> Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]):
> I STFW and RTFM and I still can't figure out why this returns a 1064 
> parse error:
> 
> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> 'status' = 'active';

You might want to change your subject to 'mind reading experts'.  A
lot of things can be wrong with this, as per the whole discussion
on this topic has shown.

All you need to do is echo mysql_error() and echo the actual string
that you are passing to mysql_query(). You're problem will be
solved rather quickly if you do that.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Chris Shiflett
--- Richard Davey <[EMAIL PROTECTED]> wrote:
> I want to be able to check to see if, in a string, the user has
> entered too many consecutive characters and not enough spaces. For
> example they might enter a subject like:
> 
> "hello world! how arrre you today?!!"
> 
> Does anyone have a nice technique for checking the following:
> 
> 1) Count the length of the words in the string, i.e. if there are any
> words beyond say 20 characters then I need to know what they are so I
> can flag up a warning.

You can explode on a space and loop through the resulting array, checking
strlen() as you go.

> 2) Count the number of punctuation characters vs. alphanumerics - I
> don't want the exclamation mark syndrome shown above, so I need to set
> a friendly trade-off limit somehow.

Perhaps substr_count() and a bit of guesswork to find an acceptable
proportion of punctuation allowed?

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Call to external function

2004-04-23 Thread Curt Zirzow
* Thus wrote Torsten Roehr ([EMAIL PROTECTED]):
> 
> I have the script start when the page loads with an
> onload=function('go') in the  tag.
> 
> But I need someway to turn it off... A simple:
> 
> Echo "function('stop')"; at the end of the page

OnLoad is probably occuring after your you're 'stop' call.  Onload
generally will be called when the document gets fully loaded.
Instead put the 'go' call in the  of your document.



function('go');

...


function('stop')




 
Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Richard Davey
Hello Chris,

Friday, April 23, 2004, 5:41:59 PM, you wrote:

CS> You can explode on a space and loop through the resulting array, checking
CS> strlen() as you go.

In the end I used a regexp to strip out all non alpha-numeric
characters from the string - and then compared the length of this to
what was left. Using it I can tell if there are vastly more
"non-alpha" characters. Seemed to be a bit quicker than looping
through arrays, etc, although it does involve the overhead of the preg
engine I guess.

BTW - Nice piece in Int PHP Mag this month :)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Reristration form

2004-04-23 Thread Erik Gjertsen
I shall made a registration schema to user log on. But when I fill in
everything I still com up messages that you must go back and try again.
Or can someone help me to find a script I can use??
I have set 1 Where I think it is problem. The following code is


 
Enter your information in the form below
 Name: 
 Email: 
 
 User name: 
 Password: 
 Confirm Password: 
 
  


 0) {
  $name = TRUE;
  echo 'Du har sktevet inn navnet';
 } else {
  $name = FALSE;
  echo 'You have forgot to enter your name';
  }
 // check for email adress
 if (strlen($_POST["email"]) > 0) {
  $email = TRUE;
  echo 'Du har sktevet inn mailen din';
 } else {
  $email = FALSE;
  echo 'You have forgot to enter your email adress';
  }
 // check for a usermame
 if (strlen($_POST["usermame"]) > 0) {
  $usermame = TRUE;
  echo 'Du har skrevet inn brukernavnet';
 } else {
  $usermame = FALSE;
  echo 'You have forgot to enter your usermame';
  }

 //check for a password and match against the comfirmed password.

 if (strlen($_POST['password1']) > 0 )
   {
 if ($_POST['password1'] == $_POST['password2']) {
 $password = TRUE;
   } else {
 $password = FALSE;
 echo 'Your password did not match the confirmed password!';
   }
  } else {
   $password = FALSE;
   echo 'You forgot to enter your password!';
  }
  1..if ($name && $email && $username && $password)
  { // if everyting's okay.
  //Register the user.
  echo 'you are now register.';
  } else { //Something is not TRUE.
  echo 'Please go back and try again.';
  }
 } else {// Display the form
 }
 ?>



Thanks for any help
Erik Gjertsen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reristration form

2004-04-23 Thread Richard Davey
Hello Erik,

Friday, April 23, 2004, 6:00:42 PM, you wrote:

EG>   1..if ($name && $email && $username && $password)

Look carefully at the spelling of $username above and here:

EG>  if (strlen($_POST["usermame"]) > 0) {
EG>   $usermame = TRUE;
EG>  } else {
EG>   $usermame = FALSE;
EG>   }

$username <> $usermame

:)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Reristration form

2004-04-23 Thread Edward Peloke
you are looking for $username but your id is $usermame.

-Original Message-
From: Erik Gjertsen [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 1:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Reristration form


I shall made a registration schema to user log on. But when I fill in
everything I still com up messages that you must go back and try again.
Or can someone help me to find a script I can use??
I have set 1 Where I think it is problem. The following code is


 
Enter your information in the form below
 Name: 
 Email: 
 
 User name: 
 Password: 
 Confirm Password: 
 
  


 0) {
  $name = TRUE;
  echo 'Du har sktevet inn navnet';
 } else {
  $name = FALSE;
  echo 'You have forgot to enter your name';
  }
 // check for email adress
 if (strlen($_POST["email"]) > 0) {
  $email = TRUE;
  echo 'Du har sktevet inn mailen din';
 } else {
  $email = FALSE;
  echo 'You have forgot to enter your email adress';
  }
 // check for a usermame
 if (strlen($_POST["usermame"]) > 0) {
  $usermame = TRUE;
  echo 'Du har skrevet inn brukernavnet';
 } else {
  $usermame = FALSE;
  echo 'You have forgot to enter your usermame';
  }

 //check for a password and match against the comfirmed password.

 if (strlen($_POST['password1']) > 0 )
   {
 if ($_POST['password1'] == $_POST['password2']) {
 $password = TRUE;
   } else {
 $password = FALSE;
 echo 'Your password did not match the confirmed password!';
   }
  } else {
   $password = FALSE;
   echo 'You forgot to enter your password!';
  }
  1..if ($name && $email && $username && $password)
  { // if everyting's okay.
  //Register the user.
  echo 'you are now register.';
  } else { //Something is not TRUE.
  echo 'Please go back and try again.';
  }
 } else {// Display the form
 }
 ?>



Thanks for any help
Erik Gjertsen

-- 
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] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote:
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 'field_2' 
LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 'status' = 'active';

Anyone? TIA!

- B1ff Lamer

What does mysql_error() tell you?

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

Brian Dunning wrote:
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
Anyone? TIA!
- B1ff Lamer
What does mysql_error() tell you?
You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
doesn't look like your $keyword value contains anything.

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 1:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...



On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

> Brian Dunning wrote:
>> I STFW and RTFM and I still can't figure out why this returns a 1064 
>> parse error:
>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
>> 'status' = 'active';
>> Anyone? TIA!
>> - B1ff Lamer
>
> What does mysql_error() tell you?

You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:27 AM, Edward Peloke wrote:

doesn't look like your $keyword value contains anything.
My error. Here is the actual return:

You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%custom%' OR 'field_

I am searching for the word "custom," which I put in at least one of 
the fields in several records, so the search SHOULD find something.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]):
> 
> On Apr 23, 2004, at 10:13 AM, John Nichel wrote:
> 
> >Brian Dunning wrote:
> >>I STFW and RTFM and I still can't figure out why this returns a 1064 
> >>parse error:
> >>SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> >>'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> >>'status' = 'active';
> >>Anyone? TIA!
> >>- B1ff Lamer
> >
> >What does mysql_error() tell you?
> 
> You have an error in your SQL syntax. Check the manual that corresponds 
> to your MySQL server version for the right syntax to use near 
> ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian,

Friday, April 23, 2004, 6:18:43 PM, you wrote:

BD> You have an error in your SQL syntax. Check the manual that corresponds
BD> to your MySQL server version for the right syntax to use near 
BD> ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

my_table should NOT be quoted in this instance and it causes the mysql
error above. I just tried a query on a table and put the table name in
quotes and it generated the exact same error. You can use back-ticks:
` but not the ' character which is what was in your post above.

Also - wrapping field_1 in ' quotes ' DOES effect the outcome of the
query, it should not have anything around it. If you wrap the field
name in back-ticks that is fine.

Unless the back-ticks have been converted to quotes by your email
client automatically, that is most definitely the root of the problem.

If PHPMyAdmin offers the ability to enter an execute a standard SQL
statement - try it for yourself and you'll see what I mean.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that 
corresponds
to your MySQL server version for the right syntax to use near
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'
Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.
NOW IT WORKS!! I thought I had tried back ticks and nothing - I did try 
it, must have made a typo. But all is well now. THANKS VERY MUCH

- B1ff Lamer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Call to external function

2004-04-23 Thread Jeff McKeon
> 
> No... PHP and JavaScript are executing at different time and 
> at different place.  Besides, they are executed by different programs.
> 
> Are you trying to measure execution time of a query??
> 
> Look at:
> http://www.php.net/microtime

No, I'm trying to get a little animation on the left frame to start when a query 
begins a pull (when the page begins to load) and then stop the animation when the page 
and data are fully loaded.

The top part of the page loads, and then the table containing the data from the mysql 
pull takes a while.  I want something to show the user that the server is still 
"thinking".

Jeff McKeon
IT Manager
Telaurus Communications LLC
[EMAIL PROTECTED]
(973) 889-8990 ex 209 

***The information contained in this communication is confidential. It is intended 
only for the sole use of the recipient named above and may be legally privileged. If 
the reader of this message is not the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication, or any of its 
contents or attachments, is expressly prohibited. If you have received this 
communication in error, please re-send it to the sender and delete the original 
message, and any copy of it, from your computer system. Thank You.***



> -Original Message-
> From: William Lovaton [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 23, 2004 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Call to external function
> 
> 
> No... PHP and JavaScript are executing at different time and 
> at different place.  Besides, they are executed by different programs.
> 
> Are you trying to measure execution time of a query??
> 
> Look at:
> http://www.php.net/microtime
> 
> 
> -William
> 
> 
> El vie, 23-04-2004 a las 09:09, Jeff McKeon escribió:
> > Is there a way in PHP to make a call to a javascript funtion?
> > 
> > I have a javascript that I want to start when an sql query 
> begins and 
> > stop when the php code is done.  Is this possible?
> > 
> > Thanks,
> > 
> > Jeff
> 
> -- 
> 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] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: "Brian Dunning" <[EMAIL PROTECTED]>
> My error. Here is the actual return:
>
> You have an error in your SQL syntax. Check the manual that corresponds
> to your MySQL server version for the right syntax to use near
> ''my_table' WHERE ('field_1' LIKE '%custom%' OR 'field_
>
> I am searching for the word "custom," which I put in at least one of
> the fields in several records, so the search SHOULD find something.

Take out the single quotes around your table name! If you must, use
backticks, but even they aren't necessary. Then tell us what the new error
is.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that 
corresponds
to your MySQL server version for the right syntax to use near
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'
Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.
NOW IT WORKS!! I thought I had tried back ticks and nothing - I did try 
it, must have made a typo. But all is well now. THANKS VERY MUCH

- B1ff Lamer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote:
On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

Brian Dunning wrote:

I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
Anyone? TIA!
- B1ff Lamer


What does mysql_error() tell you?


You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

I think this has been mentioned already, but your field names shouldn't 
have quotes around them.  You should be using back ticks.

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Call to external function

2004-04-23 Thread Mark

--- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> > 
> > No... PHP and JavaScript are executing at different time and 
> > at different place.  Besides, they are executed by different
> programs.
> > 
> > Are you trying to measure execution time of a query??
> > 
> > Look at:
> > http://www.php.net/microtime
> 
> No, I'm trying to get a little animation on the left frame to start
> when a query begins a pull (when the page begins to load) and then
> stop the animation when the page and data are fully loaded.
> 
> The top part of the page loads, and then the table containing the
> data from the mysql pull takes a while.  I want something to show
> the user that the server is still "thinking".

Given the information that, I believe, Curt provided, you could put
the "start" function in the  section, and use OnLoad() to stop
the animation. I don't have access to my server at the moment to test
it.


> 
> Jeff McKeon
> IT Manager
> Telaurus Communications LLC
> [EMAIL PROTECTED]
> (973) 889-8990 ex 209 
> 
> ***The information contained in this communication is confidential.
> It is intended only for the sole use of the recipient named above
> and may be legally privileged. If the reader of this message is not
> the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication, or
> any of its contents or attachments, is expressly prohibited. If you
> have received this communication in error, please re-send it to the
> sender and delete the original message, and any copy of it, from
> your computer system. Thank You.***
> 
> 
> 
> > -Original Message-
> > From: William Lovaton [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, April 23, 2004 12:39 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Call to external function
> > 
> > 
> > No... PHP and JavaScript are executing at different time and 
> > at different place.  Besides, they are executed by different
> programs.
> > 
> > Are you trying to measure execution time of a query??
> > 
> > Look at:
> > http://www.php.net/microtime
> > 
> > 
> > -William
> > 
> > 
> > El vie, 23-04-2004 a las 09:09, Jeff McKeon escribió:
> > > Is there a way in PHP to make a call to a javascript funtion?
> > > 
> > > I have a javascript that I want to start when an sql query 
> > begins and 
> > > stop when the php code is done.  Is this possible?
> > > 
> > > Thanks,
> > > 
> > > Jeff
> > 
> > -- 
> > 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
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Call to external function

2004-04-23 Thread Jeff McKeon
> 
> OnLoad is probably occuring after your you're 'stop' call.  
> Onload generally will be called when the document gets fully 
> loaded. Instead put the 'go' call in the  of your document.
> 
> 
> 
> function('go');
> 
> ...
> 
> 
> function('stop')
> 
> 
> 
> 

Weird that works when the site is on an apache server but doesn't when
it's on a MS IIS server.

Actually the apache server is the reason I needed this functionalitly.
When the site is on a MS IIS server the little flag in IE keeps waving
while the php script runs.  In Apache, it doesn't.  If you don't look at
the status bar in IE it and see that it still says "loading
http://blahblah"; appears that the page has already loaded...

jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP modifying data from DB?

2004-04-23 Thread Gabe
I have a field in a DB that contains a date.  The format of the date is:

04/08/2004

However, when I retrieve the date from DB using PHP, it displays the 
following:

2004-04-08 00:00:00

Is PHP tacking on the zero's?  I've tried using the date() function to 
reformat it back to how I want it, but haven't gotten it to work.

Any ideas?

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP modifying data from DB?

2004-04-23 Thread Gabe
I should also probably mention that I'm using ADOdb as well.

Gabe wrote:

I have a field in a DB that contains a date.  The format of the date is:

04/08/2004

However, when I retrieve the date from DB using PHP, it displays the 
following:

2004-04-08 00:00:00

Is PHP tacking on the zero's?  I've tried using the date() function to 
reformat it back to how I want it, but haven't gotten it to work.

Any ideas?

Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP modifying data from DB?

2004-04-23 Thread Richard Davey
Hello Gabe,

Friday, April 23, 2004, 7:20:14 PM, you wrote:

G> However, when I retrieve the date from DB using PHP, it displays the
G> following:

G> 2004-04-08 00:00:00

G> Is PHP tacking on the zero's?  I've tried using the date() function to
G> reformat it back to how I want it, but haven't gotten it to work.

You are probably using a datetime field in your database, as opposed
to a date field - which is where the extra zeros are coming from.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP modifying data from DB?

2004-04-23 Thread Gabe
Hi Richard,
	
I checked the field type in access and it is a date/time field (it's the 
only option).  However, in access I told it to do a short date format 
mm/dd/.  Unfortunately it still gives me those extra zero's.

Let's say that getting those zero's is ok.  Is this the code that I 
would write to form the proper date I want?

$dbDate = value from the date field in the database

date("m-d-Y", $dbDate);



Richard Davey wrote:

Hello Gabe,

Friday, April 23, 2004, 7:20:14 PM, you wrote:

G> However, when I retrieve the date from DB using PHP, it displays the
G> following:
G> 2004-04-08 00:00:00

G> Is PHP tacking on the zero's?  I've tried using the date() function to
G> reformat it back to how I want it, but haven't gotten it to work.
You are probably using a datetime field in your database, as opposed
to a date field - which is where the extra zeros are coming from.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >