[PHP] Re: Weird Problem

2003-07-04 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
sketchbook.org says...
> Hey,
> 
> I've got a script which disables a banner image when it's time is up, the script 
> also sends an e-mail to both me and the banners owner when the time is up
> 
> I've got a problem which is really weird..
> 
> Everything else works, but when the query is sent to the MySQL database, nothing 
> happens...
> 
> This is the query being sent: UPDATE st_banners SET Disabled='Y' WHERE 
> BannerID='$bannerid'
> 
> But when the script is run, it reports no errors, yet when i do SELECT Disabled FROM 
> st_banners they are all enabled. I then echoed the query and the result it said it 
> sent the query and it all worked, but the database was never updated..

If it works, why doesn't it work??

You can use mysql_affected_rows to test whether an update changed any 
records. You might also try echo-ing the query and feeding it into 
phpMyAdmin or the command line sql to see what happens.

> Any thoughts or suggestions? Or should i be looking for a MySQL list?

Suggestion: set Outlook to wrap lines at around 74 characters :-)

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Optional form variables (IDEA?)

2003-07-04 Thread David Robley
In article <[EMAIL PROTECTED]
manila-usia.gov>, [EMAIL PROTECTED] says...
> Hello, im doing a form that when you pass it will generate a preview report.
> My problem is some fields are optional the optional fields are 5. And for
> those fields I need to make it fit when it generate what idea or codes can
> you suggest?
> 
> Ex, a businesscard preview form. When it generates it will show you a
> businesscard template. But how about those un-filled fields. 
> 
> Can this be done thru if and else statement?
> 

If I correctly understand your problem, you need to test if a variable has 
been set, and if so echo its value?

if(isset($value)) {echo $value;}

You may need to substitute $value with $_POST{'value'} or $_GET{'value} 
depending on whether you have register_globals set off and whether you are 
using GET or POST to pass the value.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: multiple select box not showing values

2003-07-08 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I have a select box that is filled with multiple values and when the user
> clicks submit, it hightlights all the values in the select box and then
> sends this to my PHP file.
> 
> I did a simple:
> 
> echo ($_POST["imgList"]);
> 
> to see what was happening and the only value being carried across is the
> last value selected, even though all values are selected.  What might be
> causing only the last value to be chosen?  I was thinking that it was some
> of the javascript that I use but I recall that it was working just fine with
> it.  I've even tried removing the JS with the same results.  Any ideas.
> 
> thanks

You need to name the SELECT as imgList[] which will pass an array of all 
the selected items to your script.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Retaining formatting problem

2003-07-08 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hello everyone,
> 
> I have a long running problem that i just want to get covered, I have a standard 
> text box for people to insert long lengths of text.
> 
> This text box is in a standard  but when I insert it into the 
> database the line returns dissapear, eg 
> 
> "this 
> 
> little amount of
> 
> text"
> 
> will enter like
> 
> "this little amount of text will enter like"
> 
> Please help me it is p!!$$!ng me right off :P
> 
> Cheers in advance

Mate, newlines in HTML are treated as whitespace, so all the newlines will 
be faithfully stored in your database and faithfully ignored by your 
browser when you display the contents of the database :-) Look at 'View 
Source' and you will see the new lines in the source. You want to feed the 
output from your database to nl2br() to add some  tags so browsers 
will recognise the line breaks.

May I recommend you tell Outhouse to wrap lines at around 74 characters 
for mail lists/newsgroups?

[Lefevre - down in the direction of Semaphore or the Port?]

Cheers
-- 
Quod subigo farinam


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



[PHP] Re: PHP forum

2003-07-09 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Ok some of you might not like this, others of you will know exactly what I
> mean, but it just reminded me so much of this forum that I am sure some of
> you will catch the humor in it:
> 
> http://www.mac-forums.com/forums/showpost.php?postid=5736&postcount=85
> 
> Please keep your flames directed at me instead of the mailing list so we can
> keep this thread to one post.
> 
> Cheers!
> 
> "What's in a name? That which we call a rose by any other name would smell
> as sweet." - Shakespeare

Goodness me! I first saw that sometime in a year that started with 19 :-)


-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Create a Report

2003-07-09 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I'm using MySQL and PHP for building a website, however now I need to create
> a report with something like this:
> 
> -
> {Title}
> {Description}
> 
> {Zone1}
> Detail Zone1.Topic1
> DetailZone1.Topic2
> DetailZone1.Topic3
> 
> {Zone2}
> Detail Zone2.Topic1
> DetailZone2.Topic2
> 
> {Zone3}
> Detail Zone3.Topic1
> DetailZone3.Topic2
> DetailZone3.Topic3
> DetailZone3.Topic4
> -
> 
> I have 2 tables named Zone1 and Zone1detail where I do a join to get values
> I need. How ever  don't know how to make something like this.
> 
> Can anyone help? Thanks in advance

Depends on how you have structured your tables. There should be a common 
field between the tables on which you can join.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: MySQL Results - display issue :S

2003-07-09 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I know im probibly getting irritating to most of you :P but i thought i may
> ask another thing that is on my mind!
> 
> I have a sql query bringing back 200 rows for arguments sake, From this i
> would like an answer to 2 issues i have.
> 
> 1) I know how to display it row after row going down :P duh of course :P,
> but i have seen sites where it goes across then down across then down ect
> ect like X -> X then next row ect. How is this done??

Easy enough; keep a count of how many records you have processed and use 
the modulus operator % to determine where you want to start a new 

> 2) How can i alternate the colours for each row?? row 1 eg light blue and
> the 2nd row dark blue then back to light blue ect ect.

There will be at least n different ways of doing this; one would be to 
change the colour using the above test as a trigger. Another is via a 
simple ternary operator test:

$bgcolour = ($bgcolour == '#FF' ? '#00FF00' : '##FF);

In other words if $bgcolour is currently red then make it blue else make 
it red.

> Thanks in advance
> 

-- 
Quod subigo farinam

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



[PHP] Re: News Reader

2003-07-21 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Could someone advise me of a good news reader. I'm using MS Outlook at the
> moment, and if I reply to any post it sends it to the users email and not to
> the news server. Plus, its not that great in general terms.
> 
> Thanks
> 
> Dave

For Win, I find Gravity to be quite nice.

http://lightning.prohosting.com/~tbates/gravity/

-- 
Quod subigo farinam


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



[PHP] Re: same operation to multiple files

2003-07-21 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I've built a CSV parser that I want to run on every file in a folder.  How
> do I do this?

Get the filenames with opendir() and readdir() and go from there.

Cheers
-- 
Quod subigo farinam


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



[PHP] Re: Running PHP as CGI

2003-07-21 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Can someone direct me as to how to install PHP on a linux system as CGI?  I
> wish to attempt to use posix_setuid() functions.
> 
> Thanks

If you are compiling from source, use your normal configure but without 
reference to --with-apxs and a binary executable will be created. If you 
are using 4.3 I think there is a php-cli which should do what you want.

-- 
Quod subigo farinam

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



Re: [PHP] shell_exec

2003-08-08 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> 
> 
> 
> > Shell side:
> > - must be readable and executable by user (apache or perhaps everyone)
> > - suid bit work only for programs, not scripts I think
> > - shell can only execute cmds for which it's effective user has
> > sufficient permissions
> >
> > Try this (as root on webserver), if you can login as apache.
> > If you can't login as apache, log as a normal user (not root)
> > # su - apache
> > $ cd /path/to/script
> > $ ./myscript.sh
> > You will probably see errors here.
> 
> 
> As Juan suggested I checked /var/log/messages. The shell script I'm trying
> to run is a script that restarts our web content filter. In the script it
> removes the pid file so it will be recreated when the application is started
> again. The error I'm getting in the message log is "dansguardian: Error
> creating/opening pid file." Any ideas on what to do?
> 
> Thanks for your help,
> Rod
> 
> 
Check whether the user that the webserver runs as has appropriate  
permissions in the relevant directory?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] for the love of god, remove me

2003-08-09 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> > It's not usless if you read the page. 
> > [EMAIL PROTECTED]
> 
> As I said, the page is useless. This doesn't work either.
> 
> J.
> 

You may be trying to unsubscribe from a different email address that the 
one used originally to subscribe. The original subscribe confirmation, if 
you kept it, should have the address in it. Failing that, have a look at 
the headers of any message from the list for a clue as to the subscribed 
address. I'd be more specific, but I read from the newsgroup so don't have 
an appropriate set of headers available to refer to.

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] Passing Values between Pages : $_SESSION / $_GET

2003-08-14 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hello again,
> 
> I would appreciate if someone could help me out with this one.
> 
> Thanks again
> 
> --Pushpinder
> 
> 
> 
> 
> On Friday, August 8, 2003, at 11:46 AM, Pushpinder Singh Garcha wrote:
> 
> > Hello All,
> >
> >  I am using php and mysql in my application which allows users to  
> > search/query a database. The database is cast and has about 32 rows  
> > per record. When the user fires the query, the result is in the form  
> > of a table that contains only the 6 important rows of the entire  
> > record. Also there is a provision to allow the user to see the full  
> > record set by clicking on the link under the 'complete profile'  
> > contained in the table. (as shown below). The name of this script is  
> > lookup_results.php
> >
> > Here is the result for a companies in city = 'Charlotte' / Primary key  
> > of the table is the name of the company.
> > --- 
> > --- 
> > -
> > Company Name Main ContactCity Website   
> >E-Mail  Complete  
> > Profile
> > --- 
> > --- 
> > -
> > PSG   Pushpy  Charlotte  
> > http://www.psg.com[EMAIL PROTECTED]--Link--
> > TFNA Napier   Charlotte  
> > http://www.psg.com[EMAIL PROTECTED]--Link--
> > Micro Bates Charlotte   
> > http://www.psg.com   [EMAIL PROTECTED]--Link--
> > CNN  Garcha PSCharlotte   
> > http://www.psg.com   [EMAIL PROTECTED]--Link--
> > --- 
> > --- 
> > -
> >
> >
> > To see the complete profile of the company I use  
> > href=\"full_profile_1.php?name=".$row['company']


I don't see what your question is?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] Your details

2003-08-22 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> This is the only time I'm glad I use Yahoo mail for this list. Seems
> either their AV software or their mangling of attachments provided
> some level of protection. Though I knew they were viri, I wanted to
> check one out. They came across as text files with nothing but the
> list signature in them.
> 
> 
> --- "John W. Holmes" <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] wrote:
> > 
> > > Please see the attached file for details.
> > > 
> > 
> > Did anyone's AV pick up a virus in this email? It went right
> > through 
> > mine but obviously doesn't belong on this list. I just got the
> > latest 
> > definitions from Norton, too...

The list software is set to strip all attachments, I believe

Cheers
-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] Re: OT-Re: worm on th list

2003-08-22 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Is this worm/virus windows specific?

Well, most of them are these days. Easy targets and all that...

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] Re: This is getting rediculus

2003-08-22 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Some joker is  somehow making all are posts being sent to request
> subscriptions, help-list, unsubscriptions.. etc. I'm not sure how
> we can stop this nonsense.
> 
> Part of the problem is there seems to be nobody in control of this
> list.  I have tried contacting several people about this but I
> haven't had any success.  
> 
> Does anyone know who to contact about this?

Well, the list is run using ezmlm, and the default address for contacting 
a hooman bean in ezmlm is [EMAIL PROTECTED] ...

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] Re: Uploading by email

2003-08-26 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi,
> 
> I know it's slightly not totally about PHP.. but since I wanna do it with
> PHP, i'll post it here. I was wondering if anybody can help me to accomplish
> the following:
> 
> - Somebody sends an email to, for example, [EMAIL PROTECTED] This
> email has some attachments, being photo's to be added to some system.
> - Sendmail recievers the email, and sends it to some PHP script
> - This script parses the input it gets, ...
> 
> Now, what would I need to do for all this to happen?
> Wouter
> 

An alias in sendmail to pipe mail to 'fotoupload' to your php script, and 
the command line version of php available to run the script should be a 
start.

The alias will look something like:

fotoupload: "| /full/path/to/yourscript.php"

Cheers
-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



RE: [PHP] My Sincere Greetings

2003-06-05 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Will someone ban this f***ing spam...
> 
> Anyone believing this is an idiot!
> 
> regards,
> Dark Angel
> 
> 
> -Original Message-


If you have to respond about this sort of crap, please consider deleting 
the original spam so we don't have to put up with it yet again.


-- 
Quod subigo farinam

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



[PHP] Re: Ascii to Decimal Converter

2003-06-05 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hello Everybody,
> I need a PHP program to convert Ascii values to
> Decimal values.
> May i get heLp from anybody?
> Thank You,
> - Chinmoy

I think you want floatval()

-- 
Quod subigo farinam


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



[PHP] Re: how to process incoming mails?

2003-05-28 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi,
> 
> i'm using SuSE Linux 8.1 with Apache 2 and PHP 4...
> here is what i want to do:
> if someone writes a mail to [EMAIL PROTECTED] it should be directly
> processed by a PHP script...
> (I need it for a simple script, that validates email addresses... (similar
> to the PHP newsgroups validation...))
> 
> how can i do that?
> 
> is there a way, that sendmail directly passes incoming mails to a
> PHP-script, when they arrive?
> 
> Thanks in advance for any help...
> 
> - Marco Weber -

Yes - you need to set up an alias entry which points to the script. Add a 
line like

theaddress: "| /path/to/script.php"

to your alias file - IIRC its /etc/alias.txt on Slackware - and as root 
run the command newaliases to update the aliases database. Subsequently 
all mail to theaddress will be piped to the script. Then I think you need 
to open /dev/stdin in your script to access the data from the pipe.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Matching titles from distinct data sources

2003-05-29 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello
> 
> Does anyone know of an algorithm or program for matching pieces of text
> (such as film titles) that are conceptually the same, but which may be
> written/spelled differently?
> 
> eg. I need something which will identify a (likely to be) the same:
> "The Matrix Reloaded"
> "Matrix Reloaded, The"
> "Matrix Reloaded"
> "The Matrix: Reloaded"
> etc.
> 
> Thanks
> James

Maybe one or more of soundex(), metaphone(), levenshtein() or 
similar_text() might do the trick for you. All php functions :-)

Cheers
-- 
Quod subigo farinam



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



[PHP] Re: ldap_add() troubles

2003-05-31 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> Hi list,
> 
> i'm very newbie in PHP so sorry for this simple question but i havn't found any
> differences between my "code" and example code on a lot of website that i visited.
> 
> I use PHP-4.3.1, OpenLDAP 2.1.19, BerkeleyDB-4.1.25 and Apache-2.0.45.
> 
> My problem is that my variables are not taken into account.
> 
> This is the code :
> --
> 
>  
> print "  Username : 
>\n";
> print "  Firstname : 
>\n";
> print "  Lastname : 
>\n";
> print "  Telephon Number : 
>\n";
> print "  Mobile Number : 
>\n";
> print "  Address : 
>\n";
> print "
>\n";

You only need one  here, not one for each value. When you click 
Valider, it only sends the values in that FORM element and of course the 
only variable there is goldap :-(

So remove all  except the first, and remove all  except the 
last and see how you go.

-- 
Quod subigo farinam


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



Re: [PHP] selecting first character from a MySQL table

2003-06-05 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi,
> 
> First, let me say many thanks to those who responded to my cron tab 
> question - it's working well now.  And now for my next trick ;)
> 
> I'm looking for more of an opinion here.  I'm doing an alphabetical listing 
> of members for this site, I've done a general query of my MySQL table to 
> select all the members, but I was wondering if PHP could select only the 
> first character and display only those members who's name begins with an 
> 'A', 'B', 'C', etc?
> 
> I know I can do a selective query in MySQL using the LEFT command - but 
> that would mean doing a query for each letter of the alphabet - is there a 
> better way, or shall I start querying away?

I guess it would be possible to do this with 'DISTINCT' - something like

SELECT DISTINCT LEFT(1,1,field) FROM .

Yes I know the syntax is probably wrong but I can't be hanged checking the 
docs :-)

Cheers
-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: reading a file into variable for using in a javascript

2003-06-10 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi all,
> 
> I am reading the content of a text file into a variable to be used in a 
> javascript. I am reworking some code that was originally done using 
> ColdFusion and the jsStringFormat(var) function. What is the PHP 
> equivalent string function? Is there one? I have searched the docs, but 
> can't figure out which to use.

For those who aren't familiar with that function, can you say what it 
does?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



Re: [PHP] PHP Email....

2003-06-12 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> > Working kind of :)
> >
> > Get one line from it
> 
> Kinda... I get it to return one line...
> 
> The code:
> 
>  define('STDIN',fopen("php://stdin","r"));
> $str = fgets(STDIN);
> mail("[EMAIL PROTECTED]","Test","Test Test...\n\nOriginal
> Email:\n\n$str");
> ?>
> 
> Emails me:
> 
> Test Test...
> 
> Original Email:
> 
> >From [EMAIL PROTECTED] Thu Jun 12 11:41:39 2003

>From the docs (fgets):

"Returns a string of up to length - 1 bytes read from the file pointed to 
by fp. Reading ends when length - 1 bytes have been read, on a newline 
(which is included in the return value), or on EOF (whichever comes 
first). If no length is specified, the length defaults to 1k, or 1024 
bytes." 

So it's reading up to the first newline, as expected :-) Modify the 
example from the manual to suit your needs:

$fd = fopen ("/tmp/inputfile.txt", "r"); 
while (!feof ($fd)) { 
   $buffer = fgets($fd, 4096); 
   echo $buffer; 
} 
fclose ($fd); 

Cheers
-- 
Quod subigo farinam

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



[PHP] Re: PhpMyAdmin / MySQL

2003-06-17 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hello All,
> 
> I am using phpMyAdmin to administer my MySQl DB. I am running Mac OS 
> Jaguar.
> when I try to start up phpMyAdmin I get an error:
> 
> Welcome to phpMyAdmin 2.4.0
> 
> Error
> 
> MySQL said:
> 
> Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
> 
> 
> So I try to start up the MySQL Server manually by typing the following 
> on my command prompt:
> and here are the results:
> 
> [psg:/usr/local/mysql] psgarcha% sudo ./bin/mysqld_safe &
> [1] 558
> [psg:/usr/local/mysql] psgarcha% Starting mysqld daemon with databases 
> from /usr/local/mysql/data
> 030616 10:16:32  mysqld ended
> 
> 
> Please help. Thanks in advance.

Does the mysql log tell you anything useful?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Month name

2003-06-26 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> PiBIb3cgY2FuIEkgZ2V0IHRoZSBtb250aCBuYW1lIGZyb20gYSBkYXRlPyBJZiB5b3UgY291bGQg
> cG9zdCB3aXRoIGFuIGV4YW1wbGUNCj4gaSdsbCBiZSBncmF0ZWZ1bGwNCg0KVHdvIGxpbmtzIHRv
> IGhlbHAgeW91Li4uDQpodHRwOi8vd3d3LnBocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmdldGRh
> dGUucGhwDQpodHRwOi8vd3d3LnBocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLnN0cnRvdGltZS5w
> aHANCg==
> 
> 
Can you fix your mail/news program so it just sends text, please?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: mysql update not working

2003-06-26 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> I have the following code:
> 
> 
> $sql = "UPDATE class_sub SET  desc = '$catdesc', sub_cat = '$subcatname' 
> WHERE id='$catid'";
> echo $sql;
> $sql_result = mysql_query($sql);
> if (!$sql_result)
> {
> echo "Couldn't update record!";
> echo mysql_error();
> exit;
> } else
> {
> header("Location: index.php"); /* Redirect browser */
> exit;
> }   
> here is the actual sql statement:
> UPDATE class_sub SET desc = 'Come play with us! This class is designed 
> to challenge your cardiovascular and muscular endurance. Participants 
> will work or \"play\" in different activities such as team exercises, 
> sprints, obstacle courses, cycling, plyometrics, and core conditioning. 
> Challenge yourself like never before!', sub_cat = 'Recess' WHERE id='4'
> 
> And the error:
> 
> 
> Couldn't update record!
> 
> You have an error in your SQL syntax near 'desc = 'Come play with us! 
> This class is designed to challenge your cardiovascul' at line 1

Desc is a reserved word in mysql


-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: Query for MySQL

2003-07-01 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Question.
> 
> I am looking to try and pull the last modified date out and display it.  So 
> lets say I have 1000 records.  I want to only display the date of the last 
> modified time, I dont care about the id or the name or anything.  How do I 
> query for that?

Given that you don't say what your table structure is and what database 
you are using, I'll be generic in my response.

Try either using max() to select the greatest 'last modified date' value, 
or select 'date' and order by date DESC and use LIMIT 1 to just get the 
most recent date (if your db supports LIMIT)

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: getservbyname

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> getservbyname takes in the following arguments:
> 
> getservbyname(string service, string protocol);
> 
> is the parameter service similar to those diefined under
> unix's /etc/services file or is there something else
> to it?
> 
> Thanks in advance...
> 
> 
> 
>From the docs:

getservbyname() returns the Internet port which corresponds to service for 
the specified protocol as per /etc/services. protocol is either "tcp" or 
"udp" (in lowercase). 

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Formating datevariables...

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I have a column in a mysql table with a timestamp. The value of this column
> is for instance:
> 
> 20020722185242
> 
> How do i change the format on this to "DDMM" (22072002) in php?
> 
> Thanx
> 
> -R

You can do it as you get it out of the db - see DATEFORMAT

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: does this mean ....

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> hi all,
> 
> I'm tring to make a script to prompt for a username & then a password =
> for that user onto the actual machine rather than just a web site...
> 
> now i've come across this this line in some documentation
> 
> if ( $File =3D popen( "$useradd_prog $useradd_name", "r" ) )
> {
> .
> .
> .
>  now to my actual question ..
> 
> does that "r" just mean read? and if so should that "r" be a "w" for =
> write in order for it to work?
> 
> 
> 
> Cheers=20
> 
> Peter=20
> "the only dumb question is the one that wasn't asked"=20
> =20

If you are just checking the name/password against an existing list, then 
you only need read. If you want to add something, then you need a 
different mode.

However, I think you may be better off uing fopen, instead of popen, if 
you are trying to do what I think you are. The documentation for fopen has 
a comprehensive description of the modes available; note that w is kindof 
destructive in the wrong context :-)

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: another problem

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> well, i solved the last problem on my own but now i need help on my new one
> :-)
> 
> how do you convert text to hexadecimal with PHP?
> 
> --
> Regards,
> Georgie Casey
> [EMAIL PROTECTED]

If you are asking what I think you are asking - use ord to get the ascii 
(decimal) value of each character, then use dechex to convert to hex.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I think I'm pretty close to getting this right (maybe!), I've been reading
> through the manual, but can't seem to work it out. I keep getting this
> error:
> 
> [Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not a
> valid File-Handle resource in index.php on line 66
> 
> I'm trying to open a URL, read the contents, then pull out specific info
> found between specific HTML tags. This is what I have so far:
> 
> 63|  64|   $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
> 65|   $contents = fread($filename, 100);
> 66|   while($headlines = fscanf($filename, " 45\">%[a-zA-Z0-9,. ]",
> $headline)) {
> 67|   extract($headlines);
> 68|   print " href=\"http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
> ne";
> 69|   }
> 70|   fclose($filename);
> 71| ?>
> 
> Any ideas? Any other functions I could try instead of fscanf()?

That error indicates that fopen failed to open the requested file. Given 
that the URL works fine in a browser, is it possible that your php is not 
configured to do remote fopen? Check the setting of allow_url_fopen in 
phpinfo()

It is a good idea to test the result of such calls before trying to use 
the result:

fopen('Whatever') or exit('Couldn't get it, Boss!');

or

if(fopen('whatever') {
  do good things;
}else{
  bleat vigorously;
}

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Question to 'DIR'

2002-07-23 Thread David Robley

In article <000801c231e3$414d08e0$7897fea9@N4N8U9>, [EMAIL PROTECTED] says...
> It´s a silly question, but how can I create a directory on web?
> 
> 
Using PHP? mkdir() is the function - but beware that the user your web 
server runs as may not have permissions to create directories in some 
places.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so

2002-07-23 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> 
> I tried to upgrade from PHP 4.2.1 to 4.2.2 due to the security bug
> announce in the web site. When I do make install, it stopped with
> errors. The following are the last few lines from the output:
> 
> [activating module `php4' in /usr/local/apache/conf/httpd.conf]
> cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so
> cp: cannot stat `libs/libphp4.so': No such file or directory
> apxs:Break: Command failed with rc=1
> make[1]: *** [install-sapi] Error 1
> make[1]: Leaving directory `/usr/src/php-4.2.2'
> make: *** [install-recursive] Error 1
> 
> When I checked the directory libs, there are only files
> libphp4.a   libphp4.la
> 
> I tried to make symlink called libphp4.so to one of this files, and then
> the make install run without error. But then when I started my apache,
> it gives me:
> 
> bash $> /usr/local/apache/bin/apachectl start
> Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
> Cannot load /usr/local/apache/libexec/libphp4.so into server:
> /usr/local/apache/libexec/libphp4.so: invalid ELF header
> /usr/local/apache/bin/apachectl start: httpd could not be started
> 
> Any help on this would be greatly appreciated. Thanks in advance.
> Reuben D. Budiardja
> 
> 
Did you do 'make install' as root?

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] install to unix... hastles

2002-07-23 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> sorry forgot to say that I've tried to locate the unix.h file in other
> distribs etc but wif no luck
> 
> > -Original Message-
> > From: Peter [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 24 July 2002 12:33 PM
> > To: php_gen
> > Subject: [PHP] install to unix... hastles
> >
> >
> > Hiya,
> >
> > I'm new to installing php onto unix i can get the ./configure
> > command to run
> > with out error (well any that are obvious)
> > but when i do the make it comes up with
> >
> > # make
> > Making all in Zend
> > make[1]: Entering directory `/usr/local/php-4.2.1/Zend'
> > /bin/sh ../libtool --silent --mode=compile
> > gcc -DHAVE_CONFIG_H -I. -I. -I../main
> > -D_POSIX_PTHREAD_SEMANTICS -I../TSRM
> >   -g -O2 -prefer-non-pic -static -c -o zend_language_parser.lo `test -f
> > zend_language_parser.c || echo './'`zend_language_parser.c
> > In file included from zend_compile.h:24,
> >  from zend_language_parser.c:147:
> > zend.h:55:19: unix.h: No such file or directory
> > make[1]: *** [zend_language_parser.lo] Error 1
> > make[1]: Leaving directory `/usr/local/php-4.2.1/Zend'
> > make: *** [all-recursive] Error 1
> >
> > now i understand that it can't find unix.h and am assuming that
> > this is why
> > it doesn't work ...
> >
> > does any one have any ideas for me  php ver is 4.2.1 for now... though
> > will upgrade to 4.2.2 soon..

Sounds like you are missing the system header files - what 'unix' are you 
using?

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] install to unix... hastles

2002-07-23 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
>  > > Hiya,
> > > >
> > > > I'm new to installing php onto unix i can get the ./configure
> > > > command to run
> > > > with out error (well any that are obvious)
> > > > but when i do the make it comes up with
> > > >
> > > > # make
> > > > Making all in Zend
> > > > make[1]: Entering directory `/usr/local/php-4.2.1/Zend'
> > > > /bin/sh ../libtool --silent --mode=compile
> > > > gcc -DHAVE_CONFIG_H -I. -I. -I../main
> > > > -D_POSIX_PTHREAD_SEMANTICS -I../TSRM
> > > >   -g -O2 -prefer-non-pic -static -c -o
> > zend_language_parser.lo `test -f
> > > > zend_language_parser.c || echo './'`zend_language_parser.c
> > > > In file included from zend_compile.h:24,
> > > >  from zend_language_parser.c:147:
> > > > zend.h:55:19: unix.h: No such file or directory
> > > > make[1]: *** [zend_language_parser.lo] Error 1
> > > > make[1]: Leaving directory `/usr/local/php-4.2.1/Zend'
> > > > make: *** [all-recursive] Error 1
> > > >
> > > > now i understand that it can't find unix.h and am assuming that
> > > > this is why
> > > > it doesn't work ...
> > > >
> > > > does any one have any ideas for me  php ver is 4.2.1 for
> > now... though
> > > > will upgrade to 4.2.2 soon..
> >
> > Sounds like you are missing the system header files - what 'unix' are you
> > using?
> >
> > Cheers
> > --
> > David Robley
> > Temporary Kiwi!
> >
> am using Solaris 9 

Had a feeling you were going to say the Sun word :-) It sounds like you 
are missing a bunch of system header files, used for compiling any 
programs. IIRC they live in something like /usr/include (at least on a 
slackware linux) or /usr/src/[architecture]/include.

Either that or they are located somewhere where the compiler can't find 
them; does 'locate unix.h' return anything - assuming locate is up2date on 
your system.

If not, unless there is a Sun guru here, you might want to check on a Sun-
specific list about exactly what you need to get and how.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Newman and his session management.

2002-07-23 Thread David Robley

In article <004c01c232d3$9a600ef0$0401a8c0@philip>, [EMAIL PROTECTED] 
says...
> I have started a session on the server, and now would like to add a user
> name and password, and some other information to the session to carry it
> across all the other pages that are in this session.  Any hints on where to
> start?

session_register() ?

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so

2002-07-24 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> On Wed, 2002-07-24 at 08:29, Ian Ball wrote:
> > Assuming you are installing from your php-4.2.2 directory, it would appear 
> > the libphp4.so hasn't actually been made, which would point to a possible 
> > error in the configuration parameters.  I am also assuming your php 4.2.1 
> > made OK which would mean all necessary libraries etc are available on your 
> > system.  What are you using for the configure?  On my system it was
> > ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs
> > I did have ldap in there too, but for most people this is not necessary.  
> 
> Here is my configure line. Yes, my prev php 4.2.1 made and install fine
> with the same configure line. I did exactly the same steps as when I
> install 4.2.1
> 
> /configure --with-mysql --enable-track-var --disable-debug
> --prefix=/usr/local/apache/php
> --with-config-file-path=/usr/local/apache/lib
> --with-apxs=/usr/local/apache/bin/apxs --with-gd --with-zlib
> 
> > 
> > If a fresh run from the start fails, then without further information, my 
> > best suggestion is to completely delete the php-4.2.2 directory and ocntents, 
> > and start again with the tar -zxf php-4.2.2.whatever, ./configure..
> 
> I did that already, deleting the php-4.2.2 and start with un-tar the
> download. Many times. But still no luck.
> 
> Thanks.
> Rdb

OK - after you do 'make' is there a file libphp4.so in the lib directory 
under where you unpacked the install tarball? If not, something has 
apparently gone wrong with the make process or the configure; you might 
check (I think it is) config.log in the top of the install directory for 
any clues.

I'm not sure, but it might be --enable-track-vars (unless that is a typo); 
check with configure --help | grep track

Cheers 
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] install issues on Solaris

2002-07-25 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> ok unix.h problem solved but now it's saying can't locate .libs/libZend.a
>  any ideas?
> 
> 
> ~thinks: sheesh no wonder more and more people just use windose for PHP
> since it looking like its too bloody hard to install any where else lol~
> 

Furrfu - don't tar all *nix with the same brush :-) Presumably, for some 
reason, that file hasn't been created? Have a look in the libs directory 
under your tarball extraction directory; but perhaps the few lines out of 
make output prior to the error might be useful?


Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] RE: [PHP-DB] Re: arrays, variables, and register_globals

2002-07-25 Thread David Robley

On 25 Jul 2002 at 2:04, GOLD, MATTHEW wrote:

>  thank you very much for your quick response.
> 
> How do I run mysql_fetch_row before the while loop?  I don't want two
> loops, because I just want this variable to print out once.
> 
> I tried this, but it didn't work:
> 
> $query = "Select blah1, blah2, blah3 from blahtable";
> $result = mysql_query ($query)
>  or die ("Cannot complete query");
> 
> $row = mysql_fetch_row ($result))
> print ("$row[4]");
> 
> while ($row = mysql_fetch_row ($result))
> {
>  print "$row[1], $row[2], etc.");
> }
> 
> ?>
> 
> I realize that my problem is that I don't really understand arrays...but I
> am new to all of this, and I very much appreciate your help.
> 
> best,
> 
> Matt

So what you want to do is print a field from the first row extracted from the table, 
then 
loop through all the rows and print several fields? I think you want mysql_data_seek.

Whenever you do a mysql_fetch_row, php grabs the current row from the result set, and 
shifts a pointer to the next record in the result set. In this case it seems you need 
to 
print from the first record, then reset the pointer to the first record and print from 
all 
records found. So:

$row = mysql_fetch_row ($result))
print ("$row[4]");

mysql_data_seek($result, 0);  // Add this

while ($row = mysql_fetch_row ($result))

Unless I misunderstand what you are trying to do

Cheers
-- 
David Robley
Temporary Kiwi!
Quod subigo farinam

"I've been to a film festival in the South of France," said Tom cannily.



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




[PHP] Re: preg_match() occurence position

2002-07-25 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello,
> 
> Can I get the starting position of my string occurence when using any
> regexps searching functions in PHP ?
> 
> for example:
> $mem='this is a test';
> preg_match('/test/', ...) should return me somehow: 10
> 
> 
> Thanks

strpos might be useful

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] RE: [PHP-DB] Re: arrays, variables, and register_globals

2002-07-26 Thread David Robley

On 25 Jul 2002 at 2:04, GOLD, MATTHEW wrote:

>  thank you very much for your quick response.
> 
> How do I run mysql_fetch_row before the while loop?  I don't want two
> loops, because I just want this variable to print out once.
> 
> I tried this, but it didn't work:
> 
> $query = "Select blah1, blah2, blah3 from blahtable";
> $result = mysql_query ($query)
>  or die ("Cannot complete query");
> 
> $row = mysql_fetch_row ($result))
> print ("$row[4]");
> 
> while ($row = mysql_fetch_row ($result))
> {
>  print "$row[1], $row[2], etc.");
> }
> 
> ?>
> 
> I realize that my problem is that I don't really understand arrays...but I
> am new to all of this, and I very much appreciate your help.
> 
> best,
> 
> Matt

Not sure if I responded to this, so 

$query = "Select blah1, blah2, blah3 from blahtable";
$result = mysql_query ($query) or die ("Error: ". $mysql_error() )
//mysql_error gives you a useful error message!
// or die ("Cannot complete query");

$row = mysql_fetch_row ($result))
print ("$row[4]");
mysql_data_seek($result, 0);  //Reset pointer to first record
while ($row = mysql_fetch_row ($result))
{
 print "$row[1], $row[2], etc.");
}

?>

You might want to look at extract as well.

Cheers
-- 
David Robley
Temporary Kiwi!
Quod subigo farinam

"This is mutiny!" said Tom bountifully.



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




[PHP] Re: How do I show the sourse code?

2002-07-28 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> I have seen on some of the script-sites around some nice ways of presenting
> the source code. Often in nice colors. So, the natural question is: how is
> that done (cause I don't think anyone has the patience to put < and >
> around all the <>)

If you are using php v4 you can do this with show_source(), or if using 
apache, you can configure it to serve source code with syntax highlighting 
rather than parsing the code.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: mod_php4.c errors on Apache Complie

2002-07-28 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Howdy,
> 
> I've successfully complied PHP and the straight cigfiguration of apache
> 1.3.26 but when i go to configure php as a module in apache using
> 
> #./configure --enable-module=max --enable-shared=max --activate-module=src/m
> odules/php4/libmodphp4.a
> 
> i get the following error
> 
> mod_php4.c:28:18: zend.h: No such file or directory

> 
> does any one have any idea's on why it is and what i can do about it?

I was under the (possibly wrong) understanding that .a libraries are 
static, not dynamically loadable.

The way I usually get apache/php as a DSO is to compile apache first, with 
--enable-modules=max --enable-shared=max blah blah whatever else you 
need (but not -activate-module)

Then copmile php with whatever config options you need _and_ 
--with-apxs=/full/path/to/apxs 
--with-apache-conf=/dir/where/your/apacheconf/files

Last config item might be slightly different - can't remember exactly :-) 
Try ./configure --help |grep apache for the correct syntax.

Then when you do make install for php it will install libphp4.so in the 
correct place and also amend your httpd.conf to activate php as DSO. The 
nyou just (re)start apache and off you go.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: PHP Acronym: What does it mean to you?

2002-07-28 Thread David Robley

In article <01c236b2$e5af1350$f5563944@cc1966780a>, 
[EMAIL PROTECTED] says...
> Visit http://phpacronym.coolfreepage.com
> <http://phpacronym.coolfreepage.com/>  and submit what the PHP acronym
> means to you!

Hmm, at least it is 404-compliant :-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] Re: libphp4.so

2002-07-30 Thread David Robley

Peter wrote:

>> >howdy,
>> >
>> >i've got it all configured correctly .. well it doesn't spit any
>> errors out
>> >on make
>> >but when i got to view a web page it opens a down load box ..so
>> i added this
>> >
>> >LoadModule php4_modulelibexec/libphp4.so
>> >
>> >to httpd.conf as per the manual and restarted apache but it didn't start
>> >saying it couldn't find libphp.so which leads me to my question
>> .. that file
>> >is created automatically correct?
>> >
>> >i havent been able to find that file on my machine any where.. so i
>> >can't point it to another location ... any one got any ideas what i
>> should do as i
>> >have not seen any info any where that will direct me in this
>> >situation...
>>
>> Do the "make install" again and pay attention to what scrolls by and see
>> where it puts the libphp4.so file.
>>
>> Then, make sure that's where Apache expects it.
>>
>> the LoadModule directive acts in conjunction with the one above all the
>> LoadModules that tells Apache where to start looking for Modules in the
>> first place.
>>
>> Some folks set that in httpd.conf to include the "libexec" part, so then
>> your libexec in the LoadModule line is ending up "doubling" the libexec
>> in the path and that ain't gonna work.
>>
>> If there are any *working* LoadModule lines, you can try digging around
>> to find them on your hard drive, and make sure libphp4.so is sitting next
>> to them, and then do the LoadModule the same way as the working ones.
>>
>> http://apache.org will explain all the stuff I just said in
>> formal language.
>> :-)
> 
> Ok i followed what you have suggested and Apache didn't spit out anything
> on libphp4.so so I am lead to beleave it wasn't created..
> 
> my apache config like was
> 
> 
> #./configure --enable-module=most --enable-shared=max
> #--activate-module=src/
> modules/php4/libphp4.a
> 
> cheers
> Peter
> 
> 
Peter - if you are still battling with this, perhaps you might try an 
alternate approach, where you first compile apache with dso support, then 
compile php as a loadable module.

For guidance, here are the configure files I use for each:

Apache
./configure --prefix=/usr/local/apache --enable-module=most 
--enable-shared=max

You'll possibly have apache in a different place so may need to change the 
value for prefix.

PHP
#! /bin/sh
#
# Created by configure

"./configure" \
"--enable-debug=no" \
"--enable-gd-imgstrttf" \
"--enable-gd-nativett" \
"--enable-sysvsem=yes" \
"--enable-sysvshm=yes" \
"--enable-track-vars=yes" \
"--with-apxs=/usr/local/apache/bin/apxs" \
"--with-config-file-path" \
"--with-config-file-path=/usr/local/apache/conf" \
"--with-freetype-dir=/usr/X11R6" \
"--with-gd=/usr/local/src/gd-2.0.1" \
"--with-jpeg-dir=/usr" \
"--with-mysql=/usr/local/mysql" \
"--with-png-dir=/usr" \
"--with-xml" \
"--with-xpm-dir=/usr/X11R6" \
"--with-zlib" \
"--with-zlib-dir=/usr" \
"$@"
#"--with-mnogosearch" \

The two things you need specifically here are --with-apxs which allows the 
loadable module to be built, and the two with-config-file entries. The 
latter of these points to the directory where you have installed apache 
configuration files, and allows the php install process to find the apache 
config file and add the necessary entries to get php up and running.

So the order of play is
Apache
  configure
  make
  make install
  optionally start to ensure its all working

PHP
  configure
  make
  make install

Apache
  restart to re-read the config file

That should get you up and running. I just did the php part earlier today 
to upgrade my laptop to 4.2.2 and it only took a few minutes.

Cheers
-- 
David Robley

NUMBER CRUNCHING: Jumping on a Computer.

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




[PHP] Re: Not a Valid File-Handle Resource

2002-07-30 Thread David Robley

Chris Carlson wrote:

> I am trying to create a php program and am getting an error in this area
> of my script:
> 
>   $dataFile =
> @fopen("/home/blurredv/data/".$username."Contact.txt","w");
>   fputs($dataFile, $line);
>   fclose ($dataFile);
> 
> These are the errors:
> 
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/blurredv/public_html/redcarbon/update.php on line 34
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/blurredv/public_html/redcarbon/update.php on line 35
> 
> Note:  My script work perfectly with different path names under Windows
> NT.  Do I have to do something special for Unix.
> 
> Thanks in advance,

At a guess, the value you are using as a filename is incorrect, but you are 
suppressing any error message from fopen - better that you test that result 
and be prepared to handle an error situation.

For a further guess, the value $username doesn't have a trailing slash.

-- 
David Robley

NUMBER CRUNCHING: Jumping on a Computer.

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




[PHP] Re: Question on File Move / Delete and Create Directory

2002-07-31 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Dear all
> I had setup a web server in windows NT 4.0 (IIS Server), there is some
> question i want to ask bask on the file management!
> 
> 1. Is there any function in php that can create a folder/Directory in a
> specific path?
> 
> 2. Is there any function in php that can move particular files to other
> location?
> 
> 
> --
> Thx a lot!
> Jack
> [EMAIL PROTECTED]
> 
> 
> 
http:/www.php.net/filesystem
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: stripping quotes within an image tag

2002-07-31 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> hi how is it possible to strip quotes from an image tag ?
> i need
> 
> 
> to look like
> 
> 
> 
> 
$string_no_quotes = str_replace('"', '',$yourstring);

if the tag can be placed in a variable/

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: use data-ba_se

2002-08-11 Thread David Robley

In article <[EMAIL PROTECTED]>, list+php-
[EMAIL PROTECTED] says...
> Hi,
> 
> I just noticed a little problem(?) while using databases.
> 
> Some time ago I wrote myself a little class that made it easier to
> handly my mysql-tasks. The class connected to a database and used a
> query like "use $database" to switch to the given database.
> 
> This worked without a problem just as in the command-line tool "mysql",
> today however I had a database called like "data-ba_se". 
> 
> "use"ing it gave me a note "cannot use database data-ba_se" as result.
> However it worked in the command-line mysql and it works using
> mysql_select_db(). Login, Database and password were checked for typo's
> of course.
> 
> PHP is 4.1.2, default woody-package.
> 
> Any idea what can be the reason for this?
> 
>  Balu
> 

The underscore is a mysql wildcard for a single character; it may be that 
mysql is attempting to treat it as a wildcard rather than a literal in the 
circumstances in which you are using it.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Trying to delete

2002-08-13 Thread David Robley

In article <01c2433c$e2e3e4c0$e5c405c8@gateway>, [EMAIL PROTECTED] 
says...
> Hi all.
> 
> I have a small problem here. I have this full-PHP site working with a
> MySQL db and came to a dead road when trying to delete a record from it
> from the Administrator's page. I have PHP to make this decision after
> the Administrator selected the record to delete and answered YES to the
> =BFAre you sure...? The last part will pass a hidden value of $editpic
> which tells the deleting script which artid to delete from the db. This
> is the code that does the deletion:
> 
> else if ($deleteyes)
> {
>   $query =3D "DELETE FROM saav_arts WHERE artid =3D '$editpic' LIMIT
> 1";
>   $result =3D mysql_query($query) or die (mysql_error());
> 
>   if (!$result)
>   {
>   echo "The Picture could NOT be deleted";
>   echo "";
>   echo " value=3D\"Back to Edition\">";
>   echo "";
>   }
>   else if ($result)
>   {
>   echo "The Picture was deleted sucsesfully";
>   echo "";
>   echo " value=3D\"Back to Edition\">";
>   echo "";
>   }
> }
> 
> Cesar Aracena
> CE / MCSE+I

You have made some wrong assumptions in your code here; it is quite 
possible that $result may be true but no entries have been deleted. You 
perhaps should look at the possibility of testing mysql_affected_rows to 
determine whether any rows have been updated/deleted.

WHERE artid = '$editpic' 

implies that you expect artd to be a text field of type char or 
varchar because you have enclosed the value that you are testing in single 
quotes; if artid is in fact an integer type, this query will not affect 
any rows, as the text value will never match an integer field value.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Session, error occurs

2002-08-14 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I have jsut recently installed a php development kit on my windows platform.
> Im interested in using the session functions but I am recieving this error
> when I use session_start():
> 
> Warning: open(/tmp\sess_540ded508edf231c47fe85bd970f936a, O_RDWR) failed: m
> (2) in d:\phpdev\www\phpdev4\samples\samp13.htm on line 4
> 
>  Im assuming it has got to do something with the location it store the
> seesion id file. I had a look in my php.ini file and here is the the
> following configuration:
> 
> [Session]
> ; Handler used to store/retrieve data.
> session.save_handler = files
> 
> ; Argument passed to save_handler.  In the case of files, this is the path
> ; where data files are stored.
> session.save_path = D:\phpdev\php\temp;

Does this directory exist? If not, you may have problems.


> Im not to sure why this is all ways happening. If anyone haas a solution or
> knows why this might occur could you please respond or email me at
> [EMAIL PROTECTED]
> 
> Much appreaciated
> 
> Daniel
> 
> 
> 

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: newbie PHP/HTML pull down menu problem

2002-08-14 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi,
> 
> I want to pull information out of my mySQL database and use it as a pull
> down menu ona web page.  There are two sets of information that I need, one
> is a color, and the other is the color_id, so I want to use it in the way
> below but without having to physically enter all the data.  I'd like to use
> color_id as the value and the actual color name as the text in the pull down
> button.  Can someone please help me on how to pass the info into a useable
> way to get the info out of PHP and into HTML?  I've haad no problems going
> from HTML to PHP, but can't seem to grasp going the other way, especially
> with a list of things.  I've been banging my head against this for two days,
> but something tells me it's extremely easy.
> 
> Thanks,
> 
> Brian

Just the pseudocode to give you an idea...

query = Select color, colorid from table
run dbquery


 

loop through dbresults
  
end loop

 


See the mysql functions for exampls of how to submit a query and use the 
results in a while loop.


Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: wanto uninstall php manual

2002-08-14 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi,
> 
> I upgraded php from 4.0.4p11 to 4.0.6 with up2date (a RedHat Update 
> Agent). The new php includes a huge manual but I cannot find where is
> it after installed, and I don't know how can access it. And more, my free
> disk space is only 120M. So I am thinking to uninstall this manual. Any
> one know how can do uninstallation? Thanks in advance!
> 
> Alex
> 
> P.S. thank @ Edwin for your suggestion for upgrading.
> 
> 

Getting a bit off topic from php - but have you tried 'man up2date' to 
find out how to determine 1) what was installed where and 2) how to 
uninstall it.

As a Slackware user I am unfamiliar with up2date.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Session, error occurs

2002-08-15 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> "Per" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Daniel Canil wrote:
> > > I have jsut recently installed a php development kit on my windows
> platform.
> > > Im interested in using the session functions but I am recieving this
> error
> > > when I use session_start():
> > >
> > > Warning: open(/tmp\sess_540ded508edf231c47fe85bd970f936a, O_RDWR)
> failed: m
> > > (2) in d:\phpdev\www\phpdev4\samples\samp13.htm on line 4
> >
> > Run a phpinfo() to see what session.save_path you have registred. It
> > seems like php tries to open from the default directory /tmp.
> > Maybe you have not restarted the web server after altering the php.ini.
> >
> > /Per
> >
> 
> Hi,
> 
> Yeh I did restart apache every time i changed the php.ini file, and it still
> has session_save_path = /tmp.
> 
> I check through both php.ini and httpd.cong file for the string tmp but
> there where no matches.
> 
> I also checked there error log and there wasn't any help in that.
> 
> ???

It's possible you have more than one php.ini and the one you are editing 
is not the one php is reading? Again, look in phpinfo() for where php 
expects to find php.ini.


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Got another ripper for you all ;-)

2002-08-15 Thread David Robley

In article <00c101c2441b$83a612a0$0e00a8c0@luke>, 
[EMAIL PROTECTED] says...
> Hey guys,
> 
> yep, another one...
> 
> 
> I do this:
> echo "-".$dir."-";
> 
> I get this:
> 
> -/home/eXtremail/mbox/i-redlands.net/9/1/liam
> -
> 
> Note the new line at the end.
> 
> Is there a way to get rid of any new lines in a string?
> Because this is making my directory listing go whacko.
> 
> 
> Cheers,
> Liam

trim()

Liam is an Irish name, is it not :-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Help please

2002-08-15 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello;
> 
> I have a Mandrake 8.2 machine that I'm trying to get a php webmail
> application running on. Apache is running, php is installed, and when I
> attempt to view/use index.php my browser offers to download "index.php"
> for me. I have tried 4 different browsers on three different machines.
> 
> I have absolutely no idea what I did wrong. Can someone point me in the
> right direction?
> 
> Thanks so much in advance
> 
> Paul Kelly

There need to be some AddType entries in your httpd.conf to let apache 
know what type of files need to be parsed by php.

Something like (from one of mine):

# AddType allows you to tweak mime.types without actually editing it, 
or to
# make certain files to be certain types.
 
# For PHP 4.x, use:
AddType application/x-httpd-php .php .php3 .html
AddType application/x-httpd-php-source .phps

This will cause .php .php3 and .html files to be parsed by php and will 
cause .phps files to be shown as highlighted source code. Modify to suit 
your needs and remember to restart apache after making changed to either 
httpd.conf or php.ini.


Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: A Question about PHP upload file

2002-08-15 Thread David Robley

In article <002a01c24474$33be4d80$[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> SXMgdGhlcmUgaXMgYSB2b2x1bWUgbGltaXR0ZWQgZm9yIFBIUCB1cGxvYWQgZmlsZQ0KdXNpbmcg
> SFRUUD8NCkkgaGVhcmQgb2YgdGhlcmUgaXMgYSA4LTlNYiBsaW1pdHRlZCxpcyBpdCB0cnVlPw0K
> SXMgdGhlcmUgYSBtZXRob2QgdG8gc29sdmUgaXQ/DQo=
> 

If you can set Outhouse to send just text, those of us _not_ using ita 
might have a better chance of responding to your queries.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: How retrieve database data from email?

2002-08-15 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> Hello People:
> 
> I have my pages built in PHP / Mysql, all working ok, but now I need
> solve a problem I don't know how to solve or even how search about. Case
> this problem was already discussed in this list, I would be grateful if
> someone pass to me correct date so I can search about.
> 
> My problem is very simple: I have customers who dont want enter into
> html pages to retrieve some info (suppose info are stock values), but
> rather they want to send email with formatted query into mail subject
> (or at least in body) , and then receive response again by email.
> 
> For instance, customer could send this for [EMAIL PROTECTED]
> 
> to: [EMAIL PROTECTED]
> subject: name=ibm, year=2001
> body: (empty)
> 
> In response, he should receive an email with all IBM stock prices day by
> day.
> 
> That't all, I hope this will have solution, but I can't figure how email
> could communicate automatically with PHP/Mysql.
> 
> Thanks
> 
> Miguel

Depending on the type of system you are running on and the level of 
control you have, have mail to a nominated address piped to a php script 
which parses the mail and responds accordingly.

This would need php compiled as an executable to run the script as mail is 
received.


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Search Engine

2002-08-15 Thread David Robley

In article <001401c244aa$d31e1b90$ff1ffea9@billsgate>, [EMAIL PROTECTED] 
says...
> Whats wrong with this code?
> 
>   $arrSearch = explode(" ", $_REQUEST['string']);
>  $RSQuery = "SELECT * FROM referenzen_tbl";
>  if (strlen($arrSearch) > 0) { // Überhaupt einschränken?
>   $Query .= " WHERE (";
>   $Query .= " referenzen_tbl.kat LIKE '%" . $arrSearch[0] . "%'";
>   $Query .= " OR referenzen_tbl.head LIKE '%" . $arrSearch[0] . "%'";
>   $Query .= " OR referenzen_tbl.text LIKE '%" . $arrSearch[0] . "%'";
>   $Query .= " OR referenzen_tbl.technik LIKE '%" . $arrSearch[0] . "%'";
>   $Query .= " OR referenzen_tbl.year LIKE '%" . $arrSearch[0] . "%')";
>  // mehrere Suchwörter sind UND-Verknüpft
>  for($i = 1; $i < count($arrSearch); $i++) {
>   $Query .= " AND (";
>   $Query .= " referenzen_tbl.kat LIKE '%" . $arrSearch[$i] . "%'";
>   $Query .= " OR referenzen_tbl.head LIKE '%" . $arrSearch[$i] . "%'";
>   $Query .= " OR referenzen_tbl.text LIKE '%" . $arrSearch[$i] . "%'";
>   $Query .= " OR referenzen_tbl.technik LIKE '%" . $arrSearch[$i] . "%'";
>   $Query .= " OR referenzen_tbl.year LIKE '%" . $arrSearch[$i] . "%')";
>   }
>  }
>  $Result = mysql_query($Query, $connect);
>  if (mysql_fetch_row($Result)<0) {
>   echo "Es wurden keinen Beiträge zu ".$_REQUEST['string']."";
>  } else {
>   echo "Die Suche war erfolgreich!";
>   while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) {
>echo '';
>echo $arrResult['referenzen_tbl.kat']."";
>echo $arrResult['referenzen_tbl.head']."";
>echo $arrResult['referenzen_tbl.text']."";
>echo $arrResult['referenzen_tbl.technik']."";
>echo $arrResult['referenzen_tbl.year']."";
>echo '';
>   }
>  }
> ?>
> 
> I know that there is a result comming out of the string i entered, but these failure 
> messages are comming up when i load the page:

I think you may be in error here and in fact there is no result, which 
is what is triggering the error messages :-) Try this, which will return a 
useful error string if there is a problem with your query:

$Result = mysql_query($Query, $connect) or exit("Error: ".mysql_error());

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Apache

2002-08-20 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Please help me with my trouble.
> This is not php trouble but trouble with apache and perl scripts. How I
> configure apache (httpd.conf) for running pearl script in web page. If I
> create script with some name (e.g. test.pl) and if in www expoler write
> http://server/test.pl result is source code of script. But I need result of
> this script.

You probably should be asking this in an Apache newsgroup or mailing list.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Dumb question

2002-08-21 Thread David Robley

In article <000901c2498b$ce972950$0e00a8c0@luke>, 
[EMAIL PROTECTED] says...
> Hey guys, got a basic question for you...
> 
> 
> 
>  function getvar()
> {
>  $vari = "bollocks";
> }
> 
> getvar();
> echo $vari;
> ?>
> 
> 
> How do I make that function return the variable?  
> 
> 
> Thanks,
> Liam

Strangely, by using return.

function getvar()
{
 $vari = "bollocks";
 return $vari;
}

$answer = getvar();
echo $answer;
?>


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Blank db entry??

2002-08-26 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Forgot to add one thing - I don't need to add the new number after detection
> to the db but rather just print it out
> 
> 
> "Johnp" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ok I have a script done but it does not work - If there is no info in the db
> row I need the script to detect that and enter a number - the problem I am
> having is that if the row is empty it will return nothing - is there a
> function or something else that you can use to return true if a db row is
> completly empty??
> 
> Thanks - JohnP

Perhaps if you can show the code that doesn't work?

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Virtual includes

2002-08-26 Thread David Robley

In article <01d301c24ce0$a818d460$63a429c4@tech01>, 
[EMAIL PROTECTED] says...
> Hi all,
> 
> I'm trying include .php files which reside in alternative directories or
> sub-directories. Such as a file which reside in www/chat/page.php, and for
> this page I would like to include a file which resides in www/forum/include/
> 
> I've tried the following which just results in a error:
> include '/forum/include/test.php'; aqnd multiple variations of it.
> 
> How do I get around this problem?
> 
> Greg
> 
> 
If you are including from the local file system, you need to use the full 
pathname, not the URI.

Assuming www is really /www, you would need 

include '/www/forum/include/test.php'


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Date conversion problems

2002-08-26 Thread David Robley

In article <[EMAIL PROTECTED]
maeci.gc.ca>, [EMAIL PROTECTED] says...
> Having a little trouble with converting dates.
> 
> I have, in my database, a bunch of dates stored like this: -M. Month is
> obviously the number of the month (5), not the name (May).
> 
> I want to convert the format to MMM,  (ex: May, 2002), so I used the
> mktime function. Basically I extract the date with a regular MySQL query,
> then explode the date, and my components look great. However, when I put the
> components into my mktime function, sometimes it'll work and sometimes it
> won't. It won't work if the date is too far off in the future (2085, etc.),
> but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
> works fine.
> 
> My code is this (after grabbing the query results):
> $enddate = explode("-", $datereuslt[0]);
> $fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
> $finaldate = date("M, Y", $fullenddate);
> 
> Any ideas? Alternatively, if anyone has an easier way of doing this, I'm all
> ears.
> 

Hmm, as mktime returns a unix timestamp it'll be constrained by that; 
currently the unix timestamp covers a range from 1 Jan 1970 to (mumble) 
January 2038.

However, if your date is stored using one of the mysql date or time 
formats, why not try using mysql's DATE_FORMAT to pretty it up as you 
select from the db? IIRC some of the date column types have a range of 
around 10,000 years, which should meet your needs.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: time stamp

2002-08-28 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I am using PHP with MySQL and have a timestamp field in my db table.  What 
> would be the easiest way to get the newest timestamp out of the db?
> 
> Thanks in Advance
> Steve

Use an ORDER BY on the timestamp field in your select statement, and use 
LIMIT to restrict the number of rows you retrieve (if you want a subset of 
rows).


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Building a query on multiple variables, how to test for which variables are valid?

2002-08-28 Thread David Robley

In article <000201c24ec3$d884db50$8102a8c0@000347D72515>, 
[EMAIL PROTECTED] says...
> So these 4 variables walk into a bar :^]
> 
> I have a form with 4 drop downs. Each of these drop downs might have a value
> and there is no order in which they might have a value. A query needs to
> built (the WHERE and AND portions) that takes into account which ever
> variables have been set. A user may choose a variable that would not be in
> the first location.
> 
> $var1 = is not set
> $var2 = is set
> $var3 = is set
> $var4 = is not set
> 
> (or any other combination) The query, of course, needs to be in order taking
> into account the above example;
> 
> $query = "SELECT foo ";
> $query .= "FROM bar ";
> $query .= "WHERE thus = '" . $var2 . "' ";
> $query .= "AND thus = '" . $var3 . "' ";
> 
> If three of the variables are set then there would need to be an additional
> AND statement, etc. It would be foolhardy to construct an if or case
> statement that would take into account each possible combination. I have
> been thinking this through for an hour or so, but I am not seeing a clear,
> elegant, and efficient piece of code. Has anyone done anything like this, or
> does anyone have an idea of how this might be done?
> 
> TIA!
> 
> Jay

One possibility:
make an array of the $varn that are set
count the array elements
if 0 elemet - error handling
build basic query 
// $query = "Select foo from bar WHERE x = $element[0]"
if >1 element, add additional AND by looping through balance of array

Code is left as an exercise for the student :-)

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Where is my REMOTE_USER?

2002-08-29 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> At 06:03 29/8/2002 -0400, David T-G wrote:
> 
>  > Frank, et al --
>  > ..and then Frank said...
>  > %
>  > % Hi,
>  > %
>  > % when logging in with username and password with the good old "Require 
> user"
>  > % mechanism in Apache I could earlier see the name of the user logging 
> in as
>  > % $REMOTE_USER.
>  > This sort of thing has come up on the list frequently.
>  > You should set
>  > register_globals = on
>  > in your php.ini file and kick your web server.
>  >
>  > HTH & HAND
> 
> But! Two things:
> 
> 1. register_globals were already turned on
> 2. Surely the PHP designers would not force users to have such a major 
> security advantage turned off for getting a variable that is a true apache-var?
> 
> So problems remains: Where did the REMOTE_USER go?
> 
> I am BTW running Apache 2.0 with PHP 4.2.2 as a CGI-module. When it worked 
> last time I was "only" running Apache 1.3.26. Maybe the Apache-guys changed 
> something?! Could be a RTFM-case...
> 
> Well, probably I should drop using Apache's old auth-sceme and run all in 
> PHP anyway.
> 
> Thank you for the input.
> 
> Best
> 
> Frank
> U5com

Is this snippet from the docs possibly relevant?

Chapter 17. HTTP authentication with PHP

The HTTP Authentication hooks in PHP are only available when it is running 
as an Apache module and is hence not available in the CGI version. 

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: date from mysql

2002-08-29 Thread David Robley

In article <01ae01c24f4f$51dc7bd0$b50a@web18>, [EMAIL PROTECTED] says...
> i want Y (year format) printed on my php script (looping), i already tried
> it but i got same Year format (ex 1978) in all row in my table
> 
> my loop script  is:
> 
> 
> $query  = ("select * from table");
> $result = mysql_query($query);
> while ($row = mysql_fetch_row($result))
> $number =  mysql_numrows($result);
> 
> 
> $i = 0;
> while ($i < $number):
> $date  = mysql_result($result, $i,$date");
> 
> if ($i%2 == 0){
> 
> echo "$date";
> if ($i%2 == 0){
> echo "$date";
>   }
> $i++;
> ENDWHILE;

If the date is stored in one of MySql's date type fields, you could use 
the mysql DATE_FORMAT function to format your date.

I think the logic of your looping above is a bit suspect??

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: eregi_replace() problems

2002-08-29 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Can anyone tell me why my emoticons arent appearing? Please?
> 
> Note: $message is a variable set by a web form. The field `pattern` is the
> string to search for, like ":-)", and `url` is the relative url to the
> emoticon. I just get the plain emoticon. Note: this bit is above the INSERT
> statement in the script.
>  
> $emotes = mysql_query("SELECT `pattern`,`url` FROM `emoticons`");
> for ($t = 0; $t < mysql_num_rows($emotes); $t ++) {
> $emotes_array = mysql_fetch_row($emotes);
> eregi_replace($emotes_array[0], " alt=\"$emotes_array[0]\">", $message);
> }
> 
> ?>

Shouldn't you be assigning the result of your eregi_replace to a variable, 
then do something with it?

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Average Number For Math Functions

2002-09-01 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Ok I think your definently going in the right direction - when I put this
> into my "series" I seem to be getting this message for each result:
> "Resource id #40" or some other number that in some way represents
> something?  Any Clue?  Here is my SQL:
> 
> $rsum =mysql_query("select sum(rating) from ratings")or
> die (mysql_error());
> 
> John

You are missing quite a bit there - $rsum is merely a pointer to the data. 
Look at http://www.php.net/mysql_fetch_assoc which has an example of how 
to connect to mysql, issue a query and display the results of the query. 
Also, you might find http://www.php.net/extract useful in future.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] Re: Mail problem

2002-09-01 Thread David Robley

In article <002101c25029$2ca0c490$[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I have this set on both boxes. Here are the settings -
> 
>   local box (which does send mail)isp box (does not send
> mail)
> sendmail_from me@@localhost.com   'no value'
> sendmail_path /usr/sbin/sendmail -t -i/usr/sbin/sendmail -t -i
> SMTP  localhost   localhost
> 
> 
> >
> >
> > I actually had to set the SMTP setting to localhost on our
> > solaris boxes to
> > get this to work. I discovered this because we have a few
> > older machines
> > without php.ini files altogether, and the default is to have
> > this set (the
> > older machines worked).
> >

You may wish to test the value tht mail() returns - if it returns true 
then the mail has been successfully handed off to the MTA and beyond the 
scope of PHP; in this case you then need to look at your system mail logs 
to see if there is something useful there. It may also be that the mail is 
successfully sent, but bounces for whatever reason; a check of the 
relevant mailboxes (postmaster, admin etc) may turn up more info.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Why doesn't the second instance work?

2002-09-02 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...



> //create a list of editible items
> echo "";
> echo "";
> for ($i=3D0; $i <$num_results; $i++)
> {
>   $row =3D mysql_fetch_array($result);
>   echo " $row[id], =
> $row[productname]";
> }
> echo "";
> echo "";
> echo "";
> ?>=00=00
> 
> Everything is good, Everything is fine, so I decide to put the same=20
> snippet of code in again, this time pointing to a different page -- 
> One=20=
> 
> page lets you edit the fields, the other shows you the final output,=20
> the item from the database featured on a web page.
> 
> preview an endpage:
> 
>  //create a list of editible items
> echo "";
> echo "";
> for ($i=3D0; $i <$num_results; $i++)
> {
>   $row =3D mysql_fetch_array($result);
>   echo " $row[id], =
> $row[productname]";
> }
> echo "";
> echo "";
> echo "";
> ?>=00=00
> 
> The second instance does not work, I get a select with "," as each=20
> option, no population with the id or productname. Clearly, I don't=20
> understand something here, can anyone tell me what?

Each time you invoke mysql_fetch_array (or any of the functions to get 
data) to fetch a row of data from a mysql result set, a pointer is moved 
to the next row, so that the next call to mysql_fetch_array knows where to 
get its next chunk of information. When you reach the last row in the set, 
the pointer is set to 'beyond end of set' and needs to be repositioned 
before it can usefully point to data. Here you ned to use mysql_data_seek 
to reposition the pointer at the first row so you can again cycle through 
the records you have selected.

For future reference, the same principle applies when looping through an 
array with some of the array handling tools.

And just to make your code a bit more 'readable', you might find the 
extract() function handy for grabbing variable values from a result set.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Pass array in HTTP_POST_VARS question

2002-09-03 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Is it possible to pass an array in a form post? If so, how do I reference
> the array on the next page?
> 
> Thank You
> Paul
> php

I believe you may need serialize/unserialize here. Use serialize($array) 
to create a simple variable that can be passed, then at the other end, use 
unserialize to restore it.

http://www.php.net/serialize for more info

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: E-mail a submit

2002-09-10 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
(Chuck \"Pup\" Payne) says...
> Hi,
> 
> Is there a way that when someone add a submit or edits a record that I can
> have my php page e-mail that record? And is hard to do?
> 
> Chuck Payne

Yes. No. See mail()

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: mysql_insert_id

2002-09-11 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi guys,
> 
> I never can get mysql_insert_id?
> Is this broken with PHP4?
> Please let me know if you can get it to work. or work around.
> 
> Thanks.

I have had no problem with it - perhaps if you could show the list your 
code someone might be able to see if you have a problem there.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Mail() function problem

2002-09-11 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi,
> 
> does that mean I can do nothing about it?
> 
> Alva
> 
> "Pekka Saarinen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > At 9/10/2002, you wrote:
> > >Hi Everyone,
> > >
> > >I did a simple test with this script:
> > >
> > > > >mail("[EMAIL PROTECTED]", "test", "this is a test mail");
> > >echo "done";
> > >?>
> > >
> > >I run the script from web accounts on different servers. I can receive
> the
> > >test mail from some but not from others. Is there any configurations that
> I
> > >am missing here?
> >
> > My guesses:
> >
> > Many mail servers are configured so that they send mail only if the sender
> > receives mail at the same time. One other possible pitfall is that reverse
> > IP lookup is not working correctly and your server rejects the mail as it
> > cannot verify the sender host. Also, many (well configured) servers do not
> > send when there is no live account for that sender.

You can use the fourth argument to mail() to set additional headers, such 
as From: [EMAIL PROTECTED] to try and get around the 
problem.

-- 
David Robley

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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




[PHP] Re: How do I upgrade my version of PHP?

2002-09-12 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> Could you explain what "man patch" does or is? I haven't updated using a
> patch before. Thanks.
> 
> > From: [EMAIL PROTECTED]
> > Newsgroups: php.general
> > Date: Wed, 11 Sep 2002 23:14:55 +0200
> > To: [EMAIL PROTECTED]
> > Subject: Re: How do I upgrade my version of PHP?
> > 
> > You should use the patch command, feel free to "man patch".
> > 
> > --
> > 
> > Nicos - CHAILLAN Nicolas
> > [EMAIL PROTECTED]
> > www.WorldAKT.com - Hébergement de sites Internet
> > 
> > "Monty" <[EMAIL PROTECTED]> a écrit dans le message de news:
> > [EMAIL PROTECTED]
> >> I've downloaded the patch file for 4.2.2 to 4.2.3 from the PHP website,
> > but,
> >> not sure what to do with this file. I have a Linux 7.x server. Can anyone
> >> tell me how to patch my version of PHP or point me to a source that
> > explains
> >> how this is done?
> >> 
> >> Thanks!

patch is a *nix program to apply patches such as the one you have 
downloaded. man is a *nix program which displays help about the program 
supplied as an argument to man - so 'man patch' will show you the manual 
page for patch.

-- 
David Robley

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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




[PHP] Re: what is wrong?

2002-09-12 Thread David Robley

In article <001701c25a2c$4758d4a0$5583@hiborya>, mdemirkus@momentum-
dmt.com says...
> Hi,
> I want to understand what is wrong with this code?I am trying to understand
> when an empty inputs come from form and I will then give a warning message..
> 
> if($_POST[new_password1] == "   ")
> 
> echo "empty input";
> 
> 
> 
> thanks..
> 
> meltem

Well, you are comparing it to a non-empty string of three spaces rather 
than an empty value "".


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: curl_init() ??

2002-09-12 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hi,
> I am using PHP v.4.1.2,  CURL v7.7.2   with Apache server on MacOS X 
> 10.1.5
> I have a PHP script containing the following:
>   $ch = curl_init();
>   curl_setopt($ch, CURLOPT_URL,"http://omitted.com";);
>   curl_setopt($ch, CURLOPT_FAILONERROR, 1);
>   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
>   curl_setopt($ch, CURLOPT_POST, 1);
>   curl_setopt($ch, CURLOPT_POSTFIELDS, "salexml=$saleXML");
>   $result=curl_exec ($ch);
>   curl_close ($ch);
> 
> When I run the script I receive the following error:
> Fatal error: Call to undefined function: curl_init()
> 
> My reading of the PHP manual, Curl man pages, curl web site and PHP
> books and articles in the curl-php mailing list indicate that this 
> should work.
> 
> Can someone tell me how to get PHP to recognise the function
> "curl_init()" or tell me another method of getting a PHP script to
> simulate POST method as though the data was being sent from a form.
> 
> TIA

It seems that the version of PHP you are using doesn't have curl support 
compiled in/ doesn't have curl libs loaded through the ini file.

Run a script with  to confirm you don't have curl 
support; you may have to recompile or if you have the appropriate curl 
exstension lib you can probably add/uncomment curl in the etensions 
section of yor php.ini

> --
> Geoff Hill
> Information Technology Training & Solutions
> A.B.N. 28 712 665 728

So I don't need to withold tax on this reply:-) 

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: headers already sent

2002-09-12 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> I'm doing a little form:
> In the first page i have the form to insert datas,then redirect the 
> control to a script that check if the filds are correct.If they are 
> correct redirect the output to a prospect else to the first page.The 
> problem is that it gives an error like this
> "Warning: Cannot send session cache limiter - headers already sent "
> but I wrote "session_start()" in the highest part of all the scripts.
> I redirect the output with "header("Location: http://..";) is it correct 
> or there is an other way ?
> 
> If i don't write "session_start()" in the html's page the variables dont 
> appear in the fields(if i insert before,naturally).
> 
> Someone help me please?
> 
> Tanks Gian Michele

Check that you don't have _any_ whitespace before the  tags, and 
of course don't send any other output before the header function.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Regex for split() to split by , which is not in ()s?

2002-09-17 Thread David Robley

In article <[EMAIL PROTECTED]>, eurleif@buyer-
brokerage.com says...
> I'm looking for a regex which splits a string by commas, but only if the 
> comma is not in parenthesis.   I know I'm being lazy and should write it 
> myself, but that's just it... I'm lazy!

Well, as it happens I'm too lazy to write it for you :-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Join in MySQL-select doesn't work

2002-09-18 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello
> I'm using PHP4 and MySQL on Apache webserver.
> I have a table valled "liste" with names of some people, and a table 
> called "postnummer" with zip-codes and citynames.
> My select should join the adress and zip from one table with the 
> cityname from the other table.
> But my join-line does not work.   =:(
> 
> My code results in this line:
> 
> Warning: Supplied argument is not a valid MySQL result resource in 
> /var/www/html/find/resultat.php on line 27
> 
> The code is:
> mysql_select_db("adresser");
> $query = ("SELECT fornavn, efternavn, gade, postnummer.postnummer, 
> postnummer.postbynavn FROM liste
> left outer join postnummer on liste.postnummer = postnummer.postnummer
> WHERE MATCH (fornavn, efternavn) AGAINST ('$search');");
> $result = mysql_query($query);

Add here

echo mysql_error();

which will return you an error string from mysql which will probably be an 
error in your query syntax. It might also be useful to echo $query to 
ensure that it contains what you expect it does (possible register_globals 
problem?)

> while(list($cpr, $fornavn, $efternavn, $gade, $postnummer, $postbynavn) =
> mysql_fetch_row($result))
> 
> What is going on?
> The select is ok if I do not join, but then I'm not able to get the 
> field "postbynavn" from the other table.
> 
> PLEASE HELP!


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Loop through POST-result

2002-09-18 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I would like to get all the data from a POST-result into an array.
> 
> Is there a function like that adds all the vars from the post into an array
> where Key is the name of the form-field and Value is the value entered in
> this field.
> 
> Like this:
> array('firstname' => 'fname', 'lastname' => 'lname');
> 
> Thanks,
> // Michelle

each() From the docs:

Example 125. Traversing $_POST with each() 

echo "Values submitted via POST method:\n";
reset ($_POST);
while (list ($key, $val) = each ($_POST)) {
   echo "$key => $val\n";
} 
After each() has executed, the array cursor will be left on the next 
element of the array, or on the last element if it hits the end of the 
array. You have to use reset() if you want to traverse the array again 
using each. 


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: MySQL > Access

2002-09-20 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.

Google is your friend. Try 
http://www.google.co.nz/search?q=convert+access+to+mysql

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: auto_prepend: *Exactly* like include()?

2002-09-29 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Does using the auto_prepend config option in the php.ini file act 
> exactly like and include() call.
> 
> An include call will read the file off disk ... will auto.prepend do the 
> same thing or will PHP keep the file in memory for quick retrival?
> 
> Jc

Whether a document is kept in memory cache or not is not something that 
php has any control over, I think; your operating system is generally what 
looks after that.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Can I pass the ftp transfer mode in a string?

2002-10-02 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Thanks guys, I was unaware having quotes around it would make a difference.
> Works fine once I removed the quotes.
> 
> "John Kelly" <> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Can I pass the ftp transfer mode in a string like ...
> >
> > $filetype = "FTP_ASCII";
> > $upload = ftp_fput($conid, $dfile, $sfile, $filetype);
> >
> > I ask as when I do I get the following error message ...
> >
> > Warning: ftp_fput() expects parameter 4 to be long, string given
> >
> > If I replace $filetype with the text FTP_ASCII or FTP_BINARY it works
> fine.

Quick explanation: FTP_ASCII is a symbolic constant, "FTP_ASCII" is a 
string.

-- 
David Robley

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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




Re: [PHP] Works from the command line but NOT from PHP

2002-10-02 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> DonPro wrote:
> 
> >$queryID = mysql_query("SELECT HSCode, UOM, EDescript FROM HSCodes WHERE
> >MATCH(EDescript) AGAINST ('" . $description . "') ORDER BY HSCode, UOM,
> >EDescript");
> >
> I don't see what is wrong but try echoing the text of the query itself 
> and see if it contains what you think it does around the $desription area.
> 
> HTH
> Chris

Two bob says this is a register_globals problem

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: mail function problems

2002-10-02 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I use the mail function tons, never had a problem.  I am working with a client with 
>a different
> hosting vendor, they are using PHP 4.2.3, which I guess was a recient upgrade, 
>anyway I was
> informed by the client that he wasnt getting email submissions from the website, but 
>he was
> getting other emails, to those same accounts that were from outside the website.  
>Short story
> long, I took one of the functions that uses the mail function inside of it, and I 
>placed it on my
> server, and it worked flawlessly, place the same exact code on back on the other 
>site, and
> nothing.  Oh and I dont have access to their error logs.  :(
> 
> What sounds wrong?  What sounds bad?  Any thoughts?  Anything i can look for?
> 
> thanks,
> 
> dan

Are you setting a From: field? It may be that the from address as sent by 
the provider won't resolve, which may cause problems.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: quotes in text strings

2002-10-02 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi
> 
> Single quote's in strings entered via a text input field are subsequently 
> appearing with what appears to be an escape character -
> 
> comm\'ents
> 
> how can i correct this?  I've tried
> htmlspecialchars($string, ENT_QUOTES);
> and
> htmlentities($string, ENT_QUOTES);
> 
> but these don't seem to work (maybe its me).

stripslashes() is the immediate solution, but you might also want to 
consider the various 'magic_quotes' settings in your php.ini
 
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Database help

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I am querying a database to populate a list. The list is suppose to start
> with the first line of information in the database and continue untill have
> been displayed.
> 
> The problem I am having is the first line in the database is not being
> displayed. The display starts on the second line.
> 
> Here are the MySQL commands to retrieve the data...
> 
>  $fSelect = "SELECT lot,size,price FROM properties WHERE status =
> 'Available' ORDER BY lot ASC";
>  $fSql = mysql_query($fSelect, $db) or DIE("Unable to retrieve data");
> $useFields = mysql_fetch_array($fSql, MYSQL_ASSOC);

The previous line gets the first record. Any further requests to the 
result set will get the second and subsequent records.
> 
> The next line prints the lot field to the screen. The number printed to the
> screen is the second lot number that matches this database query.
> 
> Any suggestions on how to get the first information displayed to the screen?

There is a perfectly good example in the docs for mysql_fetch_array - but 
to paraphrase it for your circumstance:

$fSql = mysql_query($fSelect, $db) or DIE("Unable to retrieve data" . 
mysql_error() ); //Add debugging aid
while($usefields = mysql_fetch_array($fSql, MYSQL_ASSOC) {
  extract($usefields);  //Read the docs for extract()
// do whatever here
}

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: MySQL back up

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi All!
> 
> Anyone know how to code the MySQL command in PHP to make the database script
> download to your local hard disk, without writing 100 lines of code?
> 
> I tried the mysqldump without any luck, but I think there is an easy way to
> do it, just not sure how to code it.
> 
> Thanks in advance!

passthru and mysqldump should be able to do that for you - perhaps if you 
were to show the code you tried, someone might be able to suggest 
improvements.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: =Next to last record in a file=

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Anthony Ritter wrote:
> > I am trying to access a website that has tab delimited data and use
> > PHP to open the file, read from the
> > file for output.
> >
> > I'd like to then place this data into an array, loop through the
> > array and output only the next to last record.
> >
> > Is there any way to loop through the following records - there are 96
> > - and keep only the *next to last last one* (which would be the most
> > current record) before hitting EOF.
> >
> > They store the records every 15 minutes for a 24 hour span.
> >
> > I do not need all 96 records - only the most current -  or - next to
> > last - record.
> 
> Read the file with the file function (http://www.php.net/file). This will
> give you an array, with each element representing a line in the original
> file.
> Pop the last element away (http://www.php.net/array_pop) twice. The second
> time you do this, store the element you will gain (pop will return the
> element it popped). There you have it...
> 
> In code:
> 
>  $content = file(
> 'http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_no=01420500' 
> );
> array_pop( $content );
> $current = array_pop( $content );
> ?>

OK - this is a fine candidate for 'how many ways can it be done?'. My 
contribution [NB untested]:

http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_no=01420500
');
$current = $content{count($content)-2};

Use count to find the number of elements and use count-2 to select the 
second-to-last element. Recall that the first element is [0].

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Installing both static and dynamic modules

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> In the INSTALL file notes for PHP is says:
> 
> "1: Only install either the static module or the dynamic one.  Do not
>install both."
> 
> No reasoning is given for this statement.  Does anyone know what the reason
> for this is?
> 
> The reason I want to know is because I run both the Apache module and the
> static cgi module on my server and I haven't had any problems.  I have the
> cgi module for running php scripts as cron jobs.
> 
> Anyone know why the statement?
> 
> Thanks,
> Jonathan Duncan

You seem to be confusing the static (Apache) module with the standalone 
php binary, sometimes referred to as the CGI version and which is what I 
think you mean by 'static cgi module'.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: mysql_num_rows error

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I have a file. I'll paste from line 32 to 34
> 
>  .
> $sql = "select USUARIO from docente where USUARIO = '$usuario'";
> $result = mysql_query($sql, $link);

Replace the above line with (all on one line)

$result = mysql_query($sql, $link) or die("Error: " . 
mysql_error()."Query: ".$sql);


> if (mysql_num_rows($result) == 1) { // line 34
> 
> ?>
> 
> I get the next warning:
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/olimpiad/public_html/base/alta1.php on line 34
> 
> I'm running the script on a linux server.
> could someone help me.
> Thank you.

And when you get the error message, you will have the actual query to 
check.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: how to setup mysql logging from php scripts

2002-10-17 Thread David Robley

In article <1034836283.1253.23.camel@dell>, [EMAIL PROTECTED] says...
> Hi
> I need to be able to see logs of all mysql queries from php scripts on
> my server.
> I have a multitude of virtual hosts on my RedHat server, with many mysql
> db's, and would like to be able to see what queries are done against the
> db's from which scripts. The reason being is that I suspect that some of
> the scripts on some domains are causing problems, for example infinite
> loop db queries etc. Yesterday again I had mysql freeze up completely on
> the server, and the only "interaction" with mysql are from php scripts
> on the various domains, so looking at the mysql.log file gives no help.
> 
> Ideally I would like to see something like the following logged:
> 
> time || path/to/script.php || sql_query || mysql_error
> 
> or ANYthing that will help me to determine what went wrong.
> At the moment I can merely blame the gremlins, and I don't know if it is
> a poorly written script causing this or not, so I can't do anything
> about the situation...
> ANY suggestions or methods being used by ppl out there are also welcome.
> 
> Thanks alot.

Mysql has its own logging procedure - search the mysql site for any of the 
following topics:

The MySQL Log Files

MySQL has several different log files that can help you find out what's 
going on inside mysqld:


Log fileDescription
The error log   Problems encountering starting, running or stopping mysqld.
The isam logLogs all changes to the ISAM tables. Used only for debugging 
the isam code.
The query log   Established connections and executed queries.
The update log  Deprecated: Stores all statements that changes data
The binary log  Stores all statements that changes something. Used 
also for replication
The slow logStores all queries that took more than long_query_time to 
execute or didn't use indexes.
All logs can be found in the mysqld data directory.  You can force mysqld 
to reopen the log files (or in some cases switch to a new log) by 
executing FLUSH LOGS. See FLUSH.



Error log   The Error Log
Query log   The General Query Log
Update log  The Update Log
Binary log  The Binary Update Log
Slow query log  The Slow Query Log
Log file maintenanceLog File Maintenance

Sorry about the crappy copy/paste, but that's what comes out of the .hlp 
file.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: File Upload Problem

2002-10-30 Thread David Robley
In article <002e01c27f99$20e35b50$030a0a0a@skink>, 
[EMAIL PROTECTED] says...
> Hi All
> 
> I'll start by saying that I've checked the online manual (and comments)
> as well as having done a Google search on this with no success.
> 
> My problem is that files uploaded through a form are increasing in size.
> For example, I upload an image that is 7658 bytes and the uploaded
> version is 7685 bytes, or upload 11106 bytes and it's 11133 bytes when
> uploaded.  Images uploaded through my form are broken in the process and
> no longer display.
> 
> This is only happening on my production server (RH Linux-based).  My
> development environment is Win XP with Apache and PHP and the exact same
> code works perfectly.
> 
> I've checked through /etc/php.ini for anything related without success.
> I use move_uploaded_file() to handle the uploaded file once it's on the
> server.
> 
> Can anyone suggest where else I should be looking to resolve this?
> 
> Thanks,
> Dave

Doesn't that look like the EOL characters are being translated after the 
fashion of ftp ascii transfers? Maybe have a look at the two versions in a 
hex viewer and see if that is the case? 

Not a solution, but maybe a further step in the debugging process?

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: File Random Access

2002-10-30 Thread David Robley
In article <00b601c2801a$a5c3e8e0$0500a8c0@honeybee>, 
[EMAIL PROTECTED] says...
> I never noticed before...there is no easy way to perform random-access read and 
>WRITE on a
> file.
> 
> I vote/recommend/suggest that this most basic functionality be added to the next 
>release
> of PHP.  This would not be an enhancement; rather, it is correcting a serious flaw.
> 
> Or am I missing something
> 
> - Original Message -
> From: "Marek Kilimajer" <[EMAIL PROTECTED]>
> To: "PHP" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 30, 2002 6:28 AM
> Subject: Re: [PHP] write on the begin of a file
> 
> 
> There is no insert in fputs, you need to make a new file and then rename
> it to
> your old one, or build it in the memory and then overwrite it.
> 
> Sébastien Eckert -- Netika wrote:

I'm going to stick my neck out here - as I understand it, this is not an 
omission in php, rather it is a restriction of the underlying OS/file 
system.  To the best of my knowledge, neither the FAT 
based system of M$DOS or e2fs under *nix will allow random access _to the 
contents of a specific file_ without the need to read/rewrite the 
entire file. Is there in fact any file system that allows this?

Now I shall don my Nomex gear and await responses from those more 
knowledgeable :-)

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




  1   2   3   4   5   6   7   8   9   10   >