php-general Digest 6 Dec 2004 01:31:06 -0000 Issue 3153

Topics (messages 203516 through 203548):

Re: PEAR::SOAP <return> tag trouble in migration to PEAR::SOAP from NuSOAP
        203516 by: Roland Schorr

Regex Parsing
        203517 by: [ rswfire ]
        203518 by: M. Sokolewicz
        203520 by: [ rswfire ]
        203521 by: M. Sokolewicz

Re: copy() not working
        203519 by: Peter Lauri

Script wont work
        203522 by: Colin

Re: GD lib not working
        203523 by: Dade Register

Re: Session variables not unsetting
        203524 by: steve

No GD Support
        203525 by: Vern
        203535 by: Vern

Please save me from insanity - PHP4 / OO
        203526 by: Ben
        203527 by: John Holmes
        203528 by: Manuel Lemos
        203529 by: Greg Beaver
        203531 by: Ben
        203532 by: Greg Beaver
        203533 by: Greg Beaver
        203538 by: Ben

Google like search engine with php
        203530 by: Graham Anderson

Variables from database
        203534 by: Stuart Felenstein
        203536 by: Dusty Bin
        203540 by: Marek Kilimajer

Coding Question
        203537 by: Al
        203543 by: Ligaya Turmelle

mysql error
        203539 by: Richard Kurth
        203545 by: Ligaya Turmelle
        203547 by: Raditha Dissanayake

Snyc Outlook Calendar with Website
        203541 by: Steve Vernon

Source code/Zend expert required
        203542 by: Colin

create htaccess.
        203544 by: adwinwijaya
        203546 by: Matthew Weier O'Phinney
        203548 by: adwinwijaya

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- I had the same trouble, this is another bug which causes big trouble with many SOAP-Clients. My bugfix now works well with all the clients I use, so maybe this helps you as well:
See http://pear.php.net/bugs/bug.php?id=2877


Rgs - Ro!and.

Jeff Rodriguez schrieb:
I'm trying to migrate to PEAR::SOAP from NuSOAP, but I'm confused as to
why the result sent back from a function is wrapped in a <return> tag.
The return part of my code is simple enough:

return array('lastStatus' => 'ok');

But this gets wrapped in a <return> tag:
<return xsi:type="xsd:string">
<lastStatus
xsi:type="xsd:string">ok</lastStatus></return></ns4:reportInResponse>



Here is the SOAP response:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns4="urn:mwsWSDL"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>


<ns4:reportInResponse>
<return xsi:type="xsd:string">
<lastStatus
xsi:type="xsd:string">ok</lastStatus></return></ns4:reportInResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--- End Message ---
--- Begin Message ---
I wish to improve upon my regular expression skills.  I am creating a journal
object that allows me to post my journals online, while at the same time
maintaining nine different levels of privacy.  For example, if I give a user
Level 3 access, then they would be able to see all parts of my entries marked
as Level 3 or below, but nothing above that.

Below is an example entry.  I'm not sure how to go about doing this.  My
experience with regular expressions is somewhat limited.  I could use a
statement like this:

ereg("[LEVEL1].*[/LEVEL1]", $Contents, $Match);

But if you look at the contents below, you'll see that there are two places
where [/LEVEL1] is at, so that statement will mark the entire page as Level
1, rather than just the first sentence, and the last sentence.

Plus, that statement won't really work.  I need a way to say:  Replace
[LEVEL1].*[/LEVEL1] with ###LEVEL1### and return the contents into an array
for me.  That way, in the second phase of parsing, I can either put the
string back into the page at exactly the same point, or I can put "Level 1
Access Required - Log In" instead.

Any help would be greatly appreciated.  Thank you in advance.


[LEVEL1]Level 1 Access Required to view this section of this entry.[/LEVEL1]

between levels

[LEVEL2]Level 2 Access Required to view this section of this entry.[/LEVEL2]

between levels

[LEVEL3]Level 3 Access Required to view this section of this entry.[/LEVEL3]

between levels

[LEVEL4]Level 4 Access Required to view this section of this entry.[/LEVEL4]

between levels

[LEVEL5]Level 5 Access Required to view this section of this entry.[/LEVEL5]

between levels

[LEVEL6]Level 6 Access Required to view this section of this entry.[/LEVEL6]

between levels

[LEVEL7]Level 7 Access Required to view this section of this entry.[/LEVEL7]

between levels

[LEVEL8]Level 8 Access Required to view this section of this entry.[/LEVEL8]

between levels

[LEVEL9]Level 9 Access Required to view this section of this entry.[/LEVEL9]

Between levels

[LEVEL1]Level 1 Access Required to view this section of this entry.[/LEVEL1]

between levels

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:
I wish to improve upon my regular expression skills.  I am creating a journal
object that allows me to post my journals online, while at the same time
maintaining nine different levels of privacy.  For example, if I give a user
Level 3 access, then they would be able to see all parts of my entries marked
as Level 3 or below, but nothing above that.

Below is an example entry.  I'm not sure how to go about doing this.  My
experience with regular expressions is somewhat limited.  I could use a
statement like this:

ereg("[LEVEL1].*[/LEVEL1]", $Contents, $Match);

But if you look at the contents below, you'll see that there are two places
where [/LEVEL1] is at, so that statement will mark the entire page as Level
1, rather than just the first sentence, and the last sentence.

Plus, that statement won't really work.  I need a way to say:  Replace
[LEVEL1].*[/LEVEL1] with ###LEVEL1### and return the contents into an array
for me.  That way, in the second phase of parsing, I can either put the
string back into the page at exactly the same point, or I can put "Level 1
Access Required - Log In" instead.

Any help would be greatly appreciated.  Thank you in advance.


[LEVEL1]Level 1 Access Required to view this section of this entry.[/LEVEL1]

between levels

[LEVEL2]Level 2 Access Required to view this section of this entry.[/LEVEL2]

between levels

[LEVEL3]Level 3 Access Required to view this section of this entry.[/LEVEL3]

between levels

[LEVEL4]Level 4 Access Required to view this section of this entry.[/LEVEL4]

between levels

[LEVEL5]Level 5 Access Required to view this section of this entry.[/LEVEL5]

between levels

[LEVEL6]Level 6 Access Required to view this section of this entry.[/LEVEL6]

between levels

[LEVEL7]Level 7 Access Required to view this section of this entry.[/LEVEL7]

between levels

[LEVEL8]Level 8 Access Required to view this section of this entry.[/LEVEL8]

between levels

[LEVEL9]Level 9 Access Required to view this section of this entry.[/LEVEL9]

Between levels

[LEVEL1]Level 1 Access Required to view this section of this entry.[/LEVEL1]

between levels
preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $content, $matches);
--- End Message ---
--- Begin Message ---
> preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $content,
$matches);


You make it look so easy, thanks!  That takes care of step one, but how do I
make it so everything in $content where there is a level set, is replaced
with ###LEVEL?###

Does #Uim tell it to only get the first [/LEVEL1] rather than going to the
bottom and getting the second?  I've always wondered how to tell it to get
the first, rather than the last...

Thanks in advance!

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $content,

$matches);


You make it look so easy, thanks! That takes care of step one, but how do I make it so everything in $content where there is a level set, is replaced with ###LEVEL?###

Does #Uim tell it to only get the first [/LEVEL1] rather than going to the
bottom and getting the second?  I've always wondered how to tell it to get
the first, rather than the last...

Thanks in advance!
U means it'll become UNgreedy (means it ends at the first occurence instead of the last),
m means multiline, so . also matches \n and \r chars.
i means it's case-INsensitive. Which I thought was just useful ;)


print_r($matches) will show what comes out exactly how. Then at some point you'll probably be able to echo something like echo '###LEVEL'.$matches[1][$i].'###';
where $i would be the part you're echoing from.


Anyway, it'll be SOMETHING like that. I tend to always print_r the results first, and then write more code based on the result.
--- End Message ---
--- Begin Message ---
Solution to the problem:

instead of trying to write it to "/image/filename" I write it to
"../image/filename", that solves my problem :)

/Peter


"Peter Lauri" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Thank you. Now I am getting somewhere, but I get this error-msg now, I do
> not understand the content of it. Have tried to read about the Auth in PHP
> but I did not get any information to solve the problem:
>
> Warning:  move_uploaded_file(): SAFE MODE Restriction in effect.  The
script
> whose uid is 113323 is not allowed to access / owned by uid 0 in
> /customers/devdws.com/devdws.com/httpd.www/admin/imageadmin.php on line 36
> Possible file upload attack!
> Here is some more debugging info:Array
> (
>     [userfile] => Array
>         (
>             [name] => but_hide.gif
>             [type] => image/gif
>             [tmp_name] => /tmp/phpugQpuz
>             [error] => 0
>             [size] => 1054
>         )
>
> )
>
> - BEST OF TIMES
>
> /Peter
>
> "Burhan Khalid" <[EMAIL PROTECTED]> skrev i meddelandet
> news:<[EMAIL PROTECTED]>...
> > On Tue, 2004-11-16 at 14:58 +0100, Peter Lauri wrote:
> > > Best groupmember,
> > >
> > > I am implementing a script to upload a file to my webserver. I am
using
> this
> > > form that I copied from a working application:
> > >
> > [ snipped ]
> > > To handle the form I am using this script...
> > >
> > > if($File) {
> > >   if(copy($File, $File_name)) {
> > >    echo 'The image was not uploaded!';
> > >   } else {
> > >    echo 'The file was not uploaded!';
> > >   }
> > >  }
> > >
> > > It does not even enter the if($File) part (checked it witch echos).
> >
> > Use move_uploaded_file() -- and read
> > http://www.php.net/manual/en/features.file-upload.php
> > --

--- End Message ---
--- Begin Message ---
Hi,

I've done this to session.c but the my pages wont work.
Is there something iam missing?why doesnt it work?

 char *val;
                   int vallen;

                   val = php_session_encode(&vallen TSRMLS_CC);

                   char *vala = (char *)calloc(sizeof(vala), strlen(val) + 
1);

                   sprintf(vala, "%s", val);

                   if (vala) {
                           ret = PS(mod)->s_write(&PS(mod_data), PS(id), 
vala,
                           efree(vala);
                   } else {
                           ret = PS(mod)->s_write(&PS(mod_data), PS(id), "", 
0
                   }
cheers
-colin 

--- End Message ---
--- Begin Message ---
It's a new installation. I did restart Apache after re-compiling PHP.
phpinfo() shows my config command I used is:
./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' 
'--with-mysql=/usr/local/mysql' '--with-zlib-dir=/usr/local/lib' 
'--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' 
'--with-png-dir=/usr/local/lib' '--with-libxml-dir=/usr/local/lib' 
'--with-iconv-dir=/usr/local/lib' '--with-gd-dir=/usr/local/lib' 
'--without-xpm' '--enable-gd-native-ttf' '--enable-exif' '--enable-ftp' 
 
phpinfo does not show a gd section. I'm assuming that's why it doesn't work. Am 
I compiling it wrong? I verified that all my libs are located @ /usr/local/lib.
 
-Dade

Jason Wong <[EMAIL PROTECTED]> wrote:
On Sunday 05 December 2004 17:37, Dade Register wrote:
> It seems that my install of php does not like the GD library. I've tried
> everything, and read past forum messages. Here's what I'm running: FreeBSD
> 5.2.1
> Apache 2.0.52
> Php 5.0.2
> GD 2.0.32
>
> Php compiles fine, and even the tests pass for the GD lib, but any GD
> function fails including gdinfo() and imagecreate. Fatal error: Call to
> undefined function imagecreate().
>
> I need some help. Anyone have any ideas? Thanx.

Is this a new installation? A re-installation? An upgrade?
Did you restart apache?
Does phpinfo() show:

(i) that the ./configure command was indeed that one that you used?
(ii) that you have a GD section showing GD info?

-- 
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
------------------------------------------
/*
People don't usually make the same mistake twice -- they make it three
times, four time, five times...
*/

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


                
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.

--- End Message ---
--- Begin Message ---
Steve wrote:

> I'm having a problem with session variables.

Never mind. Seems that the hosting company decided this week to switch from
register_globals off to register_globals on. I'm not the first person to
call them about this!

-- 
@+
Steve

--- End Message ---
--- Begin Message ---
I have just installed a new Fedora Core box and do not have GD support in 
PHP. Can anyone tell me how to add that? The GD library is installed however 
when I do phpinfo() I do not get the GD support listed.

Thanks 

--- End Message ---
--- Begin Message ---
In case anyone wants to know the answer to this you must install the php-gd 
rpm.

"Vern" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I have just installed a new Fedora Core box and do not have GD support in 
>PHP. Can anyone tell me how to add that? The GD library is installed 
>however when I do phpinfo() I do not get the GD support listed.
>
> Thanks 

--- End Message ---
--- Begin Message ---
class Ob {
        var $prop;
}
class Test {
        function setMe(&$ob) {
                $ob->prop = $this;
        }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");
else error_log("PHP is a fucking MARE");

What is my problem here? Please help!

Thanks,
Ben

--- End Message ---
--- Begin Message --- Ben wrote:
class Ob {
    var $prop;
}
class Test {
    function setMe(&$ob) {
        $ob->prop = $this;
    }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");
else error_log("PHP is a fucking MARE");

What is my problem here? Please help!

How about you explain what you're trying to do instead of asking why some random code snippet doesn't work (according to you)?


The code does "work" for me, btw... for whatever it's supposed to be doing. $ob->prop is now a "Test" object...which is what the code does...

For example, if you added

var $foo = 'bar';

to the Test object and then printed out $ob->prop->foo, you'd get 'bar'.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hello,

On 12/05/2004 03:46 PM, Ben wrote:
$ob->prop = $this;

It should be $ob->prop = &$this; under PHP 4/Zend Engine 1.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message --- Ben wrote:
class Ob {
    var $prop;
}
class Test {
    function setMe(&$ob) {
        $ob->prop = $this;
    }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");
else error_log("PHP is a fucking MARE");

What is my problem here? Please help!

You've run into the "I really need PHP5" problem :)

<?php
class Ob {
    var $prop;
}
class Test {
    function setMe(&$obj)
    {
        $ob->prop = &$this; // note another &
    }
}
$ob = new Ob;
$test = new Test;
$test->setMe($ob);
if ($ob->prop) {
    error_log("PHP is more than OK");
} else {
    error_log("I forgot the second &");
}
?>

Here's your PHP5 version

<?php
class Ob {
    public $prop;
}
class Test {
    public function setMe($obj)
    {
        $obj->prop = $this;
    }
}
$ob = new Ob;
$test = new Test;
$test->setMe($ob);
if ($ob->prop) {
    error_log("PHP5 is *way* more than OK");
} else {
    error_log("This can't happen");
}
?>

Greg
--- End Message ---
--- Begin Message --- Thanks a lot for your responses guys. Unfortunately it still isn't working for me. I've tried both :

        $ob->prop = &$this
and     $ob->prop &= $this (just in case)

Neither produce a "PHP is OK".

I'm using version 4.2.2 btw. (If ONLY I was on 5)

Thanks again,
Ben


Greg Beaver wrote:

Ben wrote:

class Ob {
    var $prop;
}
class Test {
    function setMe(&$ob) {
        $ob->prop = $this;
    }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");
else error_log("PHP is a fucking MARE");

What is my problem here? Please help!


You've run into the "I really need PHP5" problem :)

<?php
class Ob {
    var $prop;
}
class Test {
    function setMe(&$obj)
    {
        $ob->prop = &$this; // note another &
    }
}
$ob = new Ob;
$test = new Test;
$test->setMe($ob);
if ($ob->prop) {
    error_log("PHP is more than OK");
} else {
    error_log("I forgot the second &");
}
?>

Here's your PHP5 version

<?php
class Ob {
    public $prop;
}
class Test {
    public function setMe($obj)
    {
        $obj->prop = $this;
    }
}
$ob = new Ob;
$test = new Test;
$test->setMe($ob);
if ($ob->prop) {
    error_log("PHP5 is *way* more than OK");
} else {
    error_log("This can't happen");
}
?>

Greg

--- End Message ---
--- Begin Message --- Ben wrote:
Thanks a lot for your responses guys. Unfortunately it still isn't working for me. I've tried both :

    $ob->prop = &$this
and    $ob->prop &= $this (just in case)

Neither produce a "PHP is OK".

I'm using version 4.2.2 btw. (If ONLY I was on 5)

Thanks again,
Ben

Greg wrote:

class Test {
    function setMe(&$obj)
    {
        $ob->prop = &$this; // note another &

this line should be $obj->prop = &$this, just a typo

Greg
--- End Message ---
--- Begin Message --- Ben wrote:
class Ob {
    var $prop;
}
class Test {
    function setMe(&$ob) {
        $ob->prop = $this;
    }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");

You should use "if (is_a($ob->prop, 'test'))"

Greg
--- End Message ---
--- Begin Message ---
Thanks a lot Greg - those pesky &s! Code now all working...

Greg Beaver wrote:
Ben wrote:

class Ob {
    var $prop;
}
class Test {
    function setMe(&$ob) {
        $ob->prop = $this;
    }
}
$ob = new Ob();
$test = new Test();
$test->setMe($ob);
if ($ob->prop) error_log("PHP is OK");


You should use "if (is_a($ob->prop, 'test'))"

Greg

--- End Message ---
--- Begin Message ---
What is the proper way to build a dynamic subquery ?

I want to allow the user to use AND, OR, and NOT in his/her query
like $query = "Hola AND Adios, OR  Goodbye, NOT hello"
or..
WHERE (greeting LIKE %Hola% AND greeting LIKE %Adios%) OR (greeting LIKE
%Goodbye%) AND (greeting NOT LIKE %hello%)

I am a bit new at this so any help would be appretiated :)

My Guess:
AND,OR,NOT,'+', and '-' would be extracted from query and put into an array.
So all the operators become $wordOperator[ ]
where:
'hola' : $wordOperator[0] = "AND"
'Adios': $wordOperator[1] = "AND"
'greeting' : $wordOperator[2] = "OR"
'hello' : $wordOperator[3] = "NOT"



// My script in its current state


$query = "Hola Adios" //taken from a GET request

//parse by a space
$searchwords = explode(" ",$query);

$x = 1;
$operator = "AND";
$not_search_word = array('if', 'for', 'in', 'on','and','with');

//taken from a GET request
$searchwords = explode(" ",$query);

foreach ($searchwords as $word) {

   if (!in_array($word,$not_search_word)){  //relevant search term only

   //if we are on the first word...format subquery like this
   if ($x == 1){

         $sql .= ' AND(media.'.$language.' Like "%'.$word.'%"';
         $sql .= ' OR artist.'.$language.' Like "%'.$word.'%"';
         $sql .= ' OR artist.name Like "%'.$word.'%")';
         $x++ ;

//formatting for everything past 1st word
    }else{

$sql .= ' '.$operator.'(media.'.$language.' Like "%'.$word.'%"';
$sql .= ' OR artist.'.$language.' Like "%'.$word.'%"';
$sql .= ' OR artist.name Like "%'.$word.'%")';
}
}
}
$sql .= ' ORDER BY artist.name ASC,';
$sql .= ' media.'.$language.' ASC LIMIT 0,60';

--- End Message ---
--- Begin Message ---
I haven't try this yet but wondering if it's possible.
 
Can I do something like this:

select fieldone from table ;

$myvar = $fieldone ?

And more so could I do it with a where clause ?

i.e. select fieldone from table where fieldone = 3

$myvar = $fieldone ?

This is probably a stupid question.  I am also
wondering about syntax.

Thank you,
Stuart

--- End Message ---
--- Begin Message --- Stuart Felenstein wrote:
I haven't try this yet but wondering if it's possible.
Can I do something like this:


select fieldone from table ;

$myvar = $fieldone ?

And more so could I do it with a where clause ?

i.e. select fieldone from table where fieldone = 3

$myvar = $fieldone ?

This is probably a stupid question.  I am also
wondering about syntax.

Thank you,
Stuart
Stuart,
why don't you try it first, then if you get the syntax wrong(as you have), you can fix it. Then if you are still in trouble, you can come to this newsgroup with a more meaningful request. It'll save you loads of time too.
Best regards. . . Dusty

--- End Message ---
--- Begin Message --- Stuart Felenstein wrote:
I haven't try this yet but wondering if it's possible.
Can I do something like this:


select fieldone from table ;

$myvar = $fieldone ?

And more so could I do it with a where clause ?

i.e. select fieldone from table where fieldone = 3

$myvar = $fieldone ?

This is probably a stupid question.  I am also
wondering about syntax.

you can use extract()

--- End Message ---
--- Begin Message ---
I've searched the PHP manual and can't find an answer for this question

I'd like to use the "OR DIE" construct; but instead of "DIE" I'd like to use "RETURN FOO". I haven't found a way to do it.


$string= file_get_contents($filename) OR die("Could not read file");

$db_link= mysql_connect($host, $user, $pw)
       OR die("Could not connect: " . mysql_error());

Seems like it would be nice to not have to test first, e.g., if(is_readable($filename)){.... }

Thanks....
--- End Message ---
--- Begin Message ---
<snip>
> $db_link= mysql_connect($host, $user, $pw)
>        OR die("Could not connect: " . mysql_error());
</snip>

try:
$db_link= mysql_connect($host, $user, $pw);
if (!$db_link){
   // do whatever if there is something wrong
}

maybe try something like that with the file_get_contents also?

Respectfully,
Ligaya Turmelle

---
Life is a game... so have fun.
---
www.PHPCommunity.org
Open Source, Open Community
Visit for more information or to join the movement



Al wrote:
I've searched the PHP manual and can't find an answer for this question

I'd like to use the "OR DIE" construct; but instead of "DIE" I'd like to use "RETURN FOO". I haven't found a way to do it.


$string= file_get_contents($filename) OR die("Could not read file");

$db_link= mysql_connect($host, $user, $pw)
       OR die("Could not connect: " . mysql_error());

Seems like it would be nice to not have to test first, e.g., if(is_readable($filename)){.... }

Thanks....


--- End Message ---
--- Begin Message ---
Could somebody tell me way these query gets a error 1064 and does not
work.
error=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
'"SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'


query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'
AND `county` = 'clark' AND `price` > '150000' OR `price` <= '200000'";
  

-- 
Best regards,
 Richard                          mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'
> AND `county` = 'clark' AND (`price` > '150000' OR `price` <= '200000');";

if that doesn't work - break it down into individual parts and find out where the problem is.

Respectfully,
Ligaya Turmelle

---
Life is a game... so have fun.
---
www.PHPCommunity.org
Open Source, Open Community
Visit for more information or to join the movement



Richard Kurth wrote:
Could somebody tell me way these query gets a error 1064 and does not
work.
error=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
'"SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'


query="SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'
AND `county` = 'clark' AND `price` > '150000' OR `price` <= '200000'";



--- End Message ---
--- Begin Message ---
Richard Kurth wrote:

Could somebody tell me way these query gets a error 1064 and does not
work.


no. wrong list.


--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
Hiya,

Any help or advice would be great.

At the moment I sync my mobile with my computer (Microsoft Outlook), with
all my tasks and calendar entries.

I have made a PHP website with my own coded calendar system. The entries in
the calendar are stored in a MySQL database.

At the moment every day I go to my website and updated the calendar, so the
information on my website is the same as in Outlook.

This takes time so I would like to be able to automate this!

What I would like to be able to do is automatically say once a day is send
all my calendar entries to my website. Has anyone done anything like this?

What I was thinking of was:

        On my localhost having PHP link to Outlook and get the next weeks 
        Sending them as POST data from my computer to my website, this is
received by a PHP script on my website
        The PHP script then adds the new entries to the database (the
database will automatically ignore duplicates)

Guess this will work but I haven't tried anything like this, especially the
PHP talking to Outlook. Can a PHP script send POST data to another one
simply? 

Am I in the right direction? Is there anything I should know or think about?
Is there a good example already made?

Don't mind making this, or even trying parts of it, if I know this will
work!

Thanks!

Steve

--- End Message ---
--- Begin Message ---
Hi,

I need someone who knows a good deal about editing the php source code and 
especially the session source code.

I need one urgently to help me in my school project.....

Please help!

contact me cokeeffe[at]gmail.com

cheers

--- End Message ---
--- Begin Message ---
Hello php-general,

I have a question about htaccess (I cannot modify httpd.conf in the
server since I just host on server, not dedicated one.

I want to be able to convert from :

www.mysite.com/index.php?f=module_a.php

into

www.mysite.com/index/module_a.php


and am I able to do :
www.mysite.com/index.php?f=module_a.php?name=abc&address=bcdefgh
?

thx
--
Best regards,
adwin

--- End Message ---
--- Begin Message ---
* Adwinwijaya <[EMAIL PROTECTED]>:
> I have a question about htaccess (I cannot modify httpd.conf in the
> server since I just host on server, not dedicated one.
>
> I want to be able to convert from :
>
> www.mysite.com/index.php?f=module_a.php
>
> into
>
> www.mysite.com/index/module_a.php

In you .htaccess:

    <File index>
        ForceType application/x-httpd-php
    </File>
    DirectoryIndex index

Then, in your script, you'll need to access the PATH_INFO environment
variable via the $_SERVER array to parse out the argument(s):

    $pi   = $_SERVER['PATH_INFO']; // Grab PATH_INFO
    $pi   = substr($pi, 1);        // Remove the opening slash
    $args = split('/', $pi);       // Create array of arguments
    $f    = $args[0];              // Grab first argument

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

--- End Message ---
--- Begin Message ---
Hello Matthew,
Monday, December 6, 2004, 11:33:28 AM, you wrote:

MWOP> In you .htaccess:

MWOP>     <File index>
MWOP>         ForceType application/x-httpd-php
MWOP>     </File>
MWOP>     DirectoryIndex index

MWOP> Then, in your script, you'll need to access the PATH_INFO environment
MWOP> variable via the $_SERVER array to parse out the argument(s):

MWOP>     $pi   = $_SERVER['PATH_INFO']; // Grab PATH_INFO
MWOP>     $pi   = substr($pi, 1);        // Remove the opening slash
MWOP>     $args = split('/', $pi);       // Create array of arguments
MWOP>     $f    = $args[0];              // Grab first argument

MWOP> -- 
MWOP> Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
MWOP> Webmaster and IT Specialist       | http://www.garden.org
MWOP> National Gardening Association    | http://www.kidsgardening.com
MWOP> 802-863-5251 x156                 |
MWOP> http://nationalgardenmonth.org


I just want to clarify,

if I type:
www.mysite.com/article/file/19911/year/2004
means: www.mysite.com/article.php?file=19911&year=2004 right ?
:)

and i have to put this script on my article.php, is it right ?

$pi   = $_SERVER['PATH_INFO']; // Grab PATH_INFO
$pi   = substr($pi, 1);        // Remove the opening slash
$args = split('/', $pi);       // Create array of arguments
$f    = $args[0];              // Grab first argument

thank you ...



-- 
Best regards,
adwin
www.kuya-kuya.net

--- End Message ---

Reply via email to