[PHP] PHP Problem or MySQL (Match ... against)?

2002-12-02 Thread jtjohnston
I'm stuck. I have been to the MySQL lists for this.

Now I'm reconsidering my PHP code.
http://ccl.flsh.usherb.ca/print/display.table.inc.phps

I just don't know where I'm going wrong anymore.

If I run this SQL in PHPMyAdmin, it works. jdaxell.ccl should have one
entry for "ready maria".

SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
('"ready maria"' IN BOOLEAN MODE) ORDER
BY id asc

When I run the same (copied and pasted) SQL in PHP, it is as though
MySQL is doing a boolean search for `+ready +maria` without the double
quotes and finding results in every database. if you search for "ready
maria" it should only find one entry.

http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B

So what have I done wrong now :(

John


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




Re: [PHP] PHP Problem or MySQL (Match ... against)?

2002-12-02 Thread jtjohnston
Chris, or anyone,

I have tried to escape the slashes. Debugging ...

$sql = 'SELECT ... ...
AGAINST (\'"ready maria"\' IN BOOLEAN MODE) ...';

This works. But if I addslashes or stripslashes, or do nothing, it does not
work.

See these 3 variations. Neither work. What should I do? A part from hang
myself :)

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.addslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.$search.'\' IN BOOLEAN MODE) ORDER BY id asc';

John




> > SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH
> (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
> > ('"ready maria"' IN BOOLEAN MODE) ORDER
> > BY id asc
> >
> > When I run the same (copied and pasted) SQL in PHP, it is as though
> > MySQL is doing a boolean search for `+ready +maria` without the double
> > quotes and finding results in every database. if you search for "ready
> > maria" it should only find one entry.
>
> Escape the double quotes.('\"ready maria\"' IN BOOLEAN 
>
> g.luck,
> ~Chris


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




[PHP] Quickie array question

2003-06-11 Thread jtjohnston
foreach($newlines as $newline) {

#how do I get the index of the array each time $newline is printed out?

echo ??;
}


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



[PHP] 4 hours staring - can't see clear.

2003-06-11 Thread jtjohnston
Can someone see clearly through what I'm trying to do please?
I've been at this for 4 hours trying to see where I have gone wrong.

# contents of a text file #
Enregistrement
TI: ... So They Understand ...: Cultural Issues
AU: Schneider,-William
PB: Logan, UT : Utah State UP, 2002. 198 pp.
Enregistrement
TI: La Favilla and Italian Ethnicity in Canada
AU: Gualtieri,-Antonio-Roberto
SOM: Canadian-Ethnic-Studies/Etudes-Ethniques-au-Canada
###

I have the text above in a textfile that I upload:
I want to separate it into two records.
Then I want to parse each line so that each value:

$TI, $AU, $PB and $SOM

equal the contents of the rest of the line, so I can build some SQL.

AU: Gualtieri,-Antonio-Roberto

$AU = "Gualtieri,-Antonio-Roberto";

The problem is that in the end, $sql holds nothing meaningful.

And because I'm filtering from one database type to my own set of
values,

$TI, $AU, $PB and $SOM

MUST become:

$ST, $AU, $BT and $JR

so I refer to this array:

###
###
$var = array (
 'TI' => array (
 'Description' => 'Title: (TI)',
 'Option'  => 'ST',
 ),
 'AU' => array (
 'Description' => 'Author(s): (AU)',
 'Option'  => 'AU',
 ),
 'PB' => array (
 'Description' => 'Publication Information: (PB)',
 'Option'  => 'BT',
 ),
 'SOM' => array (
 'Description' => 'Source (Bibliographic Citation): (SO)',
 'Option'  => 'JR',
 )
);
###
###

Here is my code, or what is left of it.
Please help me make sense so I make $sql work.:

###
###

$fh=fopen($_FILES['userfile']['tmp_name'], 'r');
...
$fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name']));
...
$lines=explode("Enregistrement",$fileContents);

foreach($lines as $line) {

 $line = stripslashes($line);
 $line = str_replace("\r", "", $line);

 $newlines=explode("\n",$line);

  foreach($newlines as $newline)
  {
   foreach ($var as $key => $value)
   {
# This foreach should parse each record line,
# looking in $var to find the corresponding
# value so that:
# $TI, $AU, $PB and $SOM
# become:
# $ST, $AU, $BT and $JR

   if(!$$key){$$key = filter_strings("$key:",$line);}

# breaking each line into two values so that:
# $TI = "So They Understand ..."
# $AU = "Schneider..."
# $BT = "Logan, UT..."
# etc.

#I'm f***ing up in here someplace. What should I put back in?

$sql = "insert into ".$dbtable." (ST,AU,BT,JR) VALUES
('".$ST."','".$AU."','".$BT."','".$JR."');";

   }
  }#end of foreach($newlines as $newline)

}#end of foreach($lines as $line)


echo $sql;


function filter_strings($tofilter,$line){
  if(eregi('^'.$tofilter.'(.*)$',$line,$m)) {
$filtered=$m[1];
return $filtered;
 }
}


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



[PHP] \nhelp

2001-05-16 Thread jtjohnston

Hi,

I am parsing the contents of a text file.

I have certain lines that start with "&&4;" I would like to attach these
lines to the previous line as follows. But I don't know how. I figure I
have to search and replace for "\n&&4;" but ... ?

BEFORE:
Here is an example of before.
&&4; here is the second line.

AFTER:
Here is an example of after. &&4; here is the second line.

Thanks,
John
(An email post & reply would be helpful. :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP]

2002-01-18 Thread jtjohnston

This is the input of a . I don't suppose there is an easier
way of doing this?

$mydata->KW = str_replace("\r", "", $mydata->KW);
$mydata->KW = str_replace("\n", "", $mydata->KW);
$mydata->KW = str_replace("", "", $mydata->KW);

What does htmlspecialchars do exactly?
Yes I've read the docs, but didn't really follow.

An email post & reply would be real helpful :)
John


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] How? :)

2002-01-29 Thread jtjohnston

Let's say I have two fields TNum and AU.

TNum is a BritishAmericanCanadian
AU  name of an author. I want to sort them as follows.

 British
   Shakespeare
 American
   Joyce
   Samuels
   Twain
 Canadian
   Majors
   Kamboureli

How do I get this to work in this code below?
I want to echo TNum one time only and echo every AU.

$news = mysql_query("select * from bookmarks ORDER by TNum,AU asc");
 while ($mydata = mysql_fetch_object($news))
  {
if (...??) #when TNum occurs the first time, echo it once only.
{
$body .= "".$mydata->TNum.":";
}
$body .= "".$mydata->AU."";
  }
--



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How? :)

2002-01-29 Thread jtjohnston

Couldn't do it fast than that :o) !
Thanks,
J

Martin Towell wrote:

> --
> $news = mysql_query("select * from bookmarks ORDER by TNum,AU asc");
> $old_TNum = "";
>  while ($mydata = mysql_fetch_object($news))
>   {
> if ($old_TNum != $mydata->TNum) #when TNum occurs the first time, echo
> it once only.
> {
> $old_TNum = $mydata->TNum;
> $body .= "".$mydata->TNum.":";
> }
> $body .= "".$mydata->AU."";
>   }
> ------
>
> tada!!
>
> Martin
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 30, 2002 2:05 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How? :)
>
> Let's say I have two fields TNum and AU.
>
> TNum is a BritishAmericanCanadian
> AU  name of an author. I want to sort them as follows.
>
>  British
>Shakespeare
>  American
>Joyce
>Samuels
>Twain
>  Canadian
>Majors
>Kamboureli
>
> How do I get this to work in this code below?
> I want to echo TNum one time only and echo every AU.
>
> $news = mysql_query("select * from bookmarks ORDER by TNum,AU asc");
>  while ($mydata = mysql_fetch_object($news))
>   {
> if (...??) #when TNum occurs the first time, echo it once only.
> {
> $body .= "".$mydata->TNum.":";
> }
> $body .= "".$mydata->AU."";
>   }
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Martin: [PHP] How? :)

2002-01-29 Thread jtjohnston

Martin,
Are you guys getting yours by email or monitoring a newsgroup reader?
John

Works wonderfully:)
http://DELETETHISccl.flsh.usherb.ca/bookmarks/DELETETHIS

Martin Towell wrote:

> --
> $news = mysql_query("select * from bookmarks ORDER by TNum,AU asc");
> $old_TNum = "";
>  while ($mydata = mysql_fetch_object($news))
>   {
> if ($old_TNum != $mydata->TNum) #when TNum occurs the first time, echo
> it once only.
> {
> $old_TNum = $mydata->TNum;
> $body .= "".$mydata->TNum.":";
> }
> $body .= "".$mydata->AU."";
>   }
> ------
>
> tada!!
>
> Martin
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 30, 2002 2:05 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How? :)
>
> Let's say I have two fields TNum and AU.
>
> TNum is a BritishAmericanCanadian
> AU  name of an author. I want to sort them as follows.
>
>  British
>Shakespeare
>  American
>Joyce
>Samuels
>Twain
>  Canadian
>Majors
>Kamboureli
>
> How do I get this to work in this code below?
> I want to echo TNum one time only and echo every AU.
>
> $news = mysql_query("select * from bookmarks ORDER by TNum,AU asc");
>  while ($mydata = mysql_fetch_object($news))
>   {
> if (...??) #when TNum occurs the first time, echo it once only.
> {
> $body .= "".$mydata->TNum.":";
> }
> $body .= "".$mydata->AU."";
>   }
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] .

2002-01-30 Thread jtjohnston

.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Forcing close of thread

2002-01-30 Thread jtjohnston

I have read the FAQ
http://www.php.net/manual/en/function.mysql-close.php
This might even be a mysql question, but I could really use some advice
from people using php scripts to access mysql.

I have been getting a lot of this on my windows/mysql server:

020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close
of thread 3  user: 'root'

I get like 20 of them over a period of 20 minutes, according to the
logs.
This hangs my mysql-apache server and causes me to go in and restart it
a lot.

My question is: is this because I have not added mysql_close to any of
my scripts?
Under normal circonstances, I have never ahd to add it before when
running my scripts on a unix server elsewhere.

John



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] .

2002-01-30 Thread jtjohnston

Yipper!
I had previously sent something today realising I did not subscribe my email
address at work. So I subscribed it and sent a test . - to see if the server
would now flush out the original message two hours ago now that I have
subscribed this email address too!
:) Sorry Mart
J

Martin Towell wrote:

> sure about that ?
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 31, 2002 2:10 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] .
>
> .
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Forcing close of thread

2002-01-30 Thread jtjohnston

I'm having growing pains with my mysql server (Windows).

I get a lot of "Forcing close of thread ..."
Do I need to add mysql_close() to the end of everything? I never had to
before on a Unix mysql server. Is "mysql_close($myconnection);" correct?
Is it necessary?

$myconnection = mysql_pconnect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

 $news = mysql_query("SHOW TABLE STATUS FROM ".$db." LIKE '$table'");
while ($news_story = mysql_fetch_array($news))
{
 $table_comment = $news_story['Comment'];
}

mysql_close($myconnection);

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql_pconnect & mysql_connect

2002-01-30 Thread jtjohnston

What is the difference between:

$myconnection = mysql_connect($server,$user,$pass);
and
$myconnection = mysql_pconnect($server,$user,$pass);

I read the faq.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_pconnect & mysql_connect

2002-01-30 Thread jtjohnston

Jim,

Thanks. What I don't really get is what persistent means.

A problem I'm having with my mysql server is that it is a whole bunch of
messages with in the space of 5 minutes like:

020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of
thread 3  user: 'root'

All I have to do is reload the same page a dozen times.

To test out the whole thing I'm replacing all my mysql_pconnect for
mysql_connect and adding mysql_close to force a closure of the connection.
Scripts just didn't seem to be closing. Hence the question. It's supposed to be
persistent only until the script finishes, but I can prove otherwise. A windows
thing? Who knows?

John


Jeff Sheltren wrote:

> At 11:09 PM 1/2/2002 -0500, jtjohnston wrote:
> >What is the difference between:
> >
> >$myconnection = mysql_connect($server,$user,$pass);
> >and
> >$myconnection = mysql_pconnect($server,$user,$pass);
> >
> >I read the faq.
>
> mysql_pconnect creates a persistent connection to the server... check here:
> http://www.php.net/manual/en/function.mysql-pconnect.php
>
> -Jeff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_pconnect & mysql_connect

2002-01-30 Thread jtjohnston

Actually, from what I understand, with the persistent connection, it is
left open even after the script is finished - that's why it's called
persistent.

Jeff, (Not Jim :) - it's getting way late for my tired eyes :) Sorry.

Thanks. I suppose I had to read it one more time.
That at least makes sense. I was getting errors like can't find localhost on web
pages dynamically displaying data from a db. Imagine what was happening with
multiple persistent connections jamming up my poor pentium's memory. Mysql was
freaking.
I would have to come into the office at midnight to restart the server.
When I did, I would find errors of persistent connections jamming up my memory
causing people not to be able to use pages. I simply changed mysql_pconnect for
mysql_connect and I'm ready to go home :)

A fresh restart of the server and a few tests later, I think everything is going
to be all right until the ext problem :)
John


> >Thanks. What I don't really get is what persistent means.
> >A problem I'm having with my mysql server is that it is a whole bunch of
> >messages with in the space of 5 minutes like:
> >
> >020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of
> >thread 3  user: 'root'
> >
> >All I have to do is reload the same page a dozen times.
> >
> >To test out the whole thing I'm replacing all my mysql_pconnect for
> >mysql_connect and adding mysql_close to force a closure of the connection.
> >Scripts just didn't seem to be closing. Hence the question. It's supposed
> >to be
> >persistent only until the script finishes, but I can prove otherwise. A
> >windows
> >thing? Who knows?
> >
> >John
>
> Actually, from what I understand, with the persistent connection, it is
> left open even after the script is finished - that's why it's called
> persistent.  Read this excerpt from the link I sent you:
>
> mysql_pconnect() acts very much like mysql_connect() with two major
> differences.
> First, when connecting, the function would first try to find a (persistent)
> link that's already open with the same host, username and password. If one
> is found, an identifier for it will be returned instead of opening a new
> connection.
> Second, the connection to the SQL server will not be closed when the
> execution of the script ends. Instead, the link will remain open for future
> use (mysql_close() will not close links established by mysql_pconnect()).
> This type of link is therefore called 'persistent'.
> Note: Note, that these kind of links only work if you are using a module
> version of PHP. See the Persistent Database Connections section for more
> information.
>
> -Jeff (not Jim)




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] limit 0,30

2002-01-31 Thread jtjohnston

I want to do something like this on a page:

Pages:  1 2 3 [Next>>]

How can I code SELECT * FROM `bookmarks` LIMIT 0, 30 ?

Thanks?

John


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Anyone Up?

2002-01-31 Thread jtjohnston

Anyone Awake? Up?

I'm using 12 checkboxes



dynamically generated by mysql. Each has an id as primary index so I do
this:

id."\"
VALUE=\"".$mydata->yourname."\">

When I submit, I want to echo to see if anyone clicked on them. But I
can't get my variable right to find $check1 through $check12. How do I
express in a for loop. $Check.$i does not work of course!

for ($i = 1; $i <= $NMax; $i++)
{
echo $Check.$i"";
}

:) Help


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Anyone Up?

2002-01-31 Thread jtjohnston

Luke is that 6:47 pm tomorrow? :) You lost an entire day!
Enough Oz Jokes. Here is my predicament in Canada :-)

$varname = "Check".$i;

$varname = "Check1" but I want $varname = "Your Name1" to "Your Name12".

One more try? :)




etc.

for ($i = 1; $i <= $NMax; $i++)
{
#$varname = "$Check".$i;
$varname = "Check".$i
#echo $varname;
if ($varname)
echo "$varname = $i";
}

Thanks much!
John (Brr it's cold up here.)


Luke Welling wrote:

> "Jtjohnston" wrote:
> > Anyone Awake? Up?
> It is 6:17 pm.  I would have trouble sleeping at this time of day :)
>
> > I'm using 12 checkboxes
> >
> > 
> >
> > dynamically generated by mysql. Each has an id as primary index so I do
> > this:
> >
> > id."\"
> > VALUE=\"".$mydata->yourname."\">
> >
> > When I submit, I want to echo to see if anyone clicked on them. But I
> > can't get my variable right to find $check1 through $check12. How do I
> > express in a for loop. $Check.$i does not work of course!
>
> There are two ways I can think of.
>
> 1) You could change the way that your code creates the checkbox names, so
> that rather than getting 12 variables, you get an array with 12 elements.
>
> 2) You could repeat your MySQL query on the echo page, and loop though code
> something like this:
> $varname = "Check".$mydata->id;
> echo $$varname;
>
> Good Luck.
>
> Luke Welling.
> --
> PHP and MySQL Web Development
> by Luke Welling and Laura Thomson
> http://www.amazon.com/exec/obidos/ASIN/0672317842


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Anyone Up?

2002-01-31 Thread jtjohnston

Niklas,
Bingo. I wondered if it was somehting like that? Same thing in JS more or
less.
Thanks,
John

> eval() is your solution.
>
> for ($i = 1; $i <= $NMax; $i++)
> {
> $variable = "\$Check$i";
> eval("\$string = \"$variable\";");
> echo $string."";
> }
>
> Niklas
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: 1. helmikuuta 2002 9:16
> To: [EMAIL PROTECTED]
> Subject: [PHP] Anyone Up?
>
> Anyone Awake? Up?
>
> I'm using 12 checkboxes
>
> 
>
> dynamically generated by mysql. Each has an id as primary index so I do
> this:
>
> id."\"
> VALUE=\"".$mydata->yourname."\">
>
> When I submit, I want to echo to see if anyone clicked on them. But I
> can't get my variable right to find $check1 through $check12. How do I
> express in a for loop. $Check.$i does not work of course!
>
> for ($i = 1; $i <= $NMax; $i++)
> {
> echo $Check.$i"";
> }
>
> :) Help
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED] To
> contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Yawn, good morning? night? Whateva! :)

2002-02-03 Thread jtjohnston

Good day, morning, night? It's dark, so that makes it sleepy bye time.
Bit before I do, I'm trying to work this out.
I have a little bit of code to print Next n>> articles in my database.
Can someone help me straighten out these lines of code, pretty please
... before I go fleeping nuts :)

if(!$rendu)
{
$rendu = 0;
}
$nombre = 10;

$news = mysql_query("select * from $table ORDER by DT desc");
$num_rows = mysql_num_rows($news);

$nouveau = $rendu + $nombre;
if ($nouveau < $num_rows)
{
if ($nombre < $num_rows)
{
$nouveau = $num_rows - $nombre;
#when there are 23 articles, and I am number 20 on the screen, I
want to display the remaining 3, not ten.
}
$myinsert  = " Next ".$nouveau." Articles
>>\n";

}

John



RQ = str_replace("\r", "", $mydata->RQ);
 $mydata->RQ = str_replace("\n", "", $mydata->RQ);
 $mydata->RQ = str_replace("", "", $mydata->RQ);
 $mydata->CM = str_replace("\r", "", $mydata->CM);
 $mydata->CM = str_replace("\n", "", $mydata->CM);
 $mydata->CM = str_replace("", "", $mydata->CM);

 ### Display WHO Once 
 if ($old_WHO != $mydata->WHO) #when WHO occurs the first time, echo it
once only.
{
$old_WHO = $mydata->WHO;
$body .= "From ".$mydata->WHO.":";
}
 ## Description ###
 if($mydata->RQ)
 $body .= "".$mydata->RQ."\n";
 ## Description ###
 if($mydata->CM)
 $body .= "".$mydata->DT." - ".$mydata->CM."\n";

 }#end of while
 mysql_close($myconnection);


#
$nouveau = $rendu + $nombre;
if ($nouveau < $num_rows)
{
if ($nouveau < $num_rows)
{
$nouveau = $num_rows - $nouveau ;
}
$myinsert  = " Next ".$nouveau." Articles
>>\n";

}
#

echo "".$table_comment."

$course_description
.. $myinsert
.. $num_rows
.. $nouveau = $rendu + $nombre
if ($nouveau < $num_rows)

$body


";

?>


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




Re: [PHP] Can php Read contents from MS Word in Exactly sameformat

2002-02-03 Thread jtjohnston

Is there a function or class written to convert rtf reliably to html? :)
Let me know,
John
A post & reply would be helpful if you can.

"Jason G." wrote:

> MS Word is a proprietary, binary (i think), format...  Have fun.
>
> There may be a solution out there.
>
> If you could convince her to save it in Rich Text Format (rtf) and then
> upload it, your life would be much easier...
>
> -Jason Garber
>
> At 01:51 PM 2/4/2002 +0800, Jack wrote:
> >Dear all
> >I had made  a news input page for one of the HR Manger to input the news for
> >the whole company to read, she is quick comfort with using MS word as a
> >editor, so is there anyway that the php can read the contents from the MS
> >Word and display as exactly same format to html?
> >
> >If there is so, could any one suggest a book to me?
> >
> >Thx a lot
> >Jack
> >[EMAIL PROTECTED]
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] MySQL

2002-02-05 Thread jtjohnston

In MySQL, I have a date field that is formatted 000-00-00 Is there a
function in PHP I did not find yet that does this?
John


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




[PHP] Re: MySQL

2002-02-05 Thread jtjohnston

$date = date ("Y-m-d"); #works?
:)

Jtjohnston wrote:

> In MySQL, I have a date field that is formatted 000-00-00 Is there a
> function in PHP I did not find yet that does this?
> John


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




[PHP] << Previous n Articles

2002-02-05 Thread jtjohnston

I'm using this code to create a "Next n Articles >>" on my index.page
from my mysql database.
I worked most of it out myself. Then I got some help. It works. I
thought I understood my own code enough to be able to construct a "<<
Previous n Articles". I guess not. My coding skills need help.
So how do I reverse my code to construct the previous n articles from my
sql database.

if(!$offset)
{
$offset = 0;
}
$limit = 5;
$num_rows = 13;#I get this from a mysql operation

#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit > $num_rows)
{
  $disp = $num_rows - $new_offset;
}
if ($disp > 0)
{
  $nextinsert  = " Next ".$disp." Articles
>>\n";
}

 Thanks if you have a second.

John


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




[PHP] Re: Dynamic Dropdown menu question.

2002-02-05 Thread jtjohnston

Michael,
I think you're trying to kill yourself coding. here's what I do for myself:


Select Someone
EM."\">".$mydata->FirstName."
".$mydata->LastName."\n";
 }

mysql_close($myconnection);
?>



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




[PHP] autoindex

2002-02-05 Thread jtjohnston

I want to reset the autoindex in a mysql table using php if I can.
I found this. Can anyone help?

http://www.mysql.com/doc/m/y/myisamchk_other_options.html

J


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




Re: [PHP] << Previous n Articles

2002-02-05 Thread jtjohnston

Jason,

I'm not ssure I follow.
$offset is the number i read in in my 
$limit is the number displayed.
$num_rows is the number of rows in my database.

What are you doing with $previous? $previous would be my string, not the
previous offset?
Could you show me again?

> > if(!$offset)
> > {
> > $offset = 0;
> > }
> > $limit = 5;
> > $num_rows = 13;#I get this from a mysql operation
> >
> > #
> > $new_offset = $offset + $limit;
> > $disp = $limit;
> > if ($new_offset + $limit > $num_rows)
> > {
> >   $disp = $num_rows - $new_offset;
> > }
> > if ($disp > 0)
> > {
> >   $nextinsert  = "  HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> >>\n";
> > }
> >
>
> Something like:
>
>   $previous = $offset - $limit;
>   if ($previous < 0) { $previous = 0; }
>
> then incorporate $previous into your previous link in a similar fashion to
> the next link.


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




[PHP] http://

2002-02-07 Thread jtjohnston

I'm looking for a function that will find occurences of urls in any
given string and do this:

http://www.nowhere.com/
becomes
http://www.nowhere.com/";>http://www.nowhere.com/

Could, should also look for
mailto:[EMAIL PROTECTED]
telnet:blah.blah
or even news:blaj.blah

Does such a thing exist?

--
John Taylor-Johnston
-

Collège de Sherbrooke:
http://www.collegesherbrooke.qc.ca/languesmodernes/
Université de Sherbrooke:
http://compcanlit.ca/



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




[PHP] phpmyadmin-mysql

2002-02-17 Thread jtjohnston

Hello,

I'm looking for code to display all my mysql databases in a .
On change, I want to display all my tables in a .
Finally, on change, it has to display all record of the table selected:

Print Record


id YR   AU   BT
 1 1997 Fee, Margery Writing Orality: Interpreting Literature
 Display in English by Aboriginal Writers in North
 America, Australia and New Zealand

Can someone give me a hand getting started?
I would normally use phpmyadmin, but I want to customise something they
don't offer.




[PHP] Frustrating ?

2002-02-17 Thread jtjohnston

Heres's a frustrating, and maybe not so stupid question?

I'm getting "Warning: Supplied argument is not a valid MySQL result
resource" on this line:

while ($mydata = mysql_fetch_object($news))

So what am I doing wrong here:

$where = "id like $id";
$news = mysql_query('select * from ccl where '.$where.' order by AU
desc'); //desc => z-a

 while ($mydata = mysql_fetch_object($news))
  {
 echo "id\">Print
View$mydata->id$mydata->AU$mydata->ST$mydata->BT\n";

  }#end of while

I've tried variations like:

$news = mysql_query('select * from ccl where id like $id order by AU
desc');
$news = mysql_query("select * from ccl where id like $id order by AU
desc");

$id checks out ok. I use index.html?id=4
AU exists; ok. So ... ?

John


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




[PHP] More: Frustrating ?

2002-02-17 Thread jtjohnston

> > while ($mydata = mysql_fetch_object($news))
> > So what am I doing wrong here:
> > $where = "id like $id";
> > $news = mysql_query('select * from ccl where '.$where.' order by AU desc');
> //desc => z-a

> A) Have you already confirmed that a valid database connection was made?

Yes. A copy and paste of working code:
$news = mysql_query("select * from ccl ORDER by AU asc");
Connection was made.

So I do?

$news = mysql_query("select * from ccl where '.$where.' order by AU desc");

or ?

$news = mysql_query("select * from ccl where '.%$where%.' order by AU desc");

The % are not necessary? because id is an auto_increment number from 0 to
1,000+.

Why the ' inside " ?


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




[PHP] setcookie()

2002-05-11 Thread jtjohnston

This is a bug "Feature/Change Request" I made to:
http://bugs.php.net/bug.php?id=17158

setcookie() states "cookies must be sent before any other headers
are sent (this is a restriction of cookies, not PHP).

I argue this is a restriction of PHP, not cookies.

Here is my proof:

http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm

I can do this any time in  :


   setCookie("TestCookie","first time",expdate);
   var DisplayData = getCookie("TestCookie");
   document.write(DisplayData);
   setCookie("TestCookie","second time",expdate);
   var DisplayData = getCookie("TestCookie");
   document.write(DisplayData);
 

I want to be able to setcookie() anytime I want, before and after I
declare any HTML.
This will never get changed, unless we ask for it.

I would appreciate your vote of support at:

http://bugs.php.net/bug.php?id=17158

before the bug people "close" this thread.


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




Re: [PHP] setcookie()

2002-05-11 Thread jtjohnston

Rasmus
server-side / client-side, that's not the point.

My point is PHP can, could and should be able to set a cookie after HTML is
set.
But of course, Jan has already closed the issue, as usual.
http://bugs.php.net/bug.php?id=17158




> PHP is a server-side language and as such it deals with server-side
> issues.  If you want to write javascript that sets a client-side
> Javascript cookie, go ahead.  It has nothing to do with PHP and PHP will
> certainly not get in your way.
>
> -Rasmus
>
> On Sat, 11 May 2002, jtjohnston wrote:
>
> > This is a bug "Feature/Change Request" I made to:
> > http://bugs.php.net/bug.php?id=17158
> >
> > setcookie() states "cookies must be sent before any other headers
> > are sent (this is a restriction of cookies, not PHP).
> >
> > I argue this is a restriction of PHP, not cookies.
> >
> > Here is my proof:
> >
> > http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm
> >
> > I can do this any time in  :
> >
> > 
> >setCookie("TestCookie","first time",expdate);
> >var DisplayData = getCookie("TestCookie");
> >document.write(DisplayData);
> >setCookie("TestCookie","second time",expdate);
> >var DisplayData = getCookie("TestCookie");
> >document.write(DisplayData);
> >  
> >
> > I want to be able to setcookie() anytime I want, before and after I
> > declare any HTML.
> > This will never get changed, unless we ask for it.
> >
> > I would appreciate your vote of support at:
> >
> > http://bugs.php.net/bug.php?id=17158
> >
> > before the bug people "close" this thread.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] setcookie()

2002-05-11 Thread jtjohnston

If the issue has pissed you off in tha past,
complain. Vote: http://bugs.php.net/bug.php?id=17158


> Rasmus
> server-side / client-side, that's not the point.
>
> My point is PHP can, could and should be able to set a cookie after HTML is
> set.
> But of course, Jan has already closed the issue, as usual.
> http://bugs.php.net/bug.php?id=17158
>
> > PHP is a server-side language and as such it deals with server-side
> > issues.  If you want to write javascript that sets a client-side
> > Javascript cookie, go ahead.  It has nothing to do with PHP and PHP will
> > certainly not get in your way.
> >
> > -Rasmus
> >
> > On Sat, 11 May 2002, jtjohnston wrote:
> >
> > > This is a bug "Feature/Change Request" I made to:
> > > http://bugs.php.net/bug.php?id=17158
> > >
> > > setcookie() states "cookies must be sent before any other headers
> > > are sent (this is a restriction of cookies, not PHP).
> > >
> > > I argue this is a restriction of PHP, not cookies.
> > >
> > > Here is my proof:
> > >
> > > http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm
> > >
> > > I can do this any time in  :
> > >
> > > 
> > >setCookie("TestCookie","first time",expdate);
> > >var DisplayData = getCookie("TestCookie");
> > >document.write(DisplayData);
> > >setCookie("TestCookie","second time",expdate);
> > >var DisplayData = getCookie("TestCookie");
> > >document.write(DisplayData);
> > >  
> > >
> > > I want to be able to setcookie() anytime I want, before and after I
> > > declare any HTML.
> > > This will never get changed, unless we ask for it.
> > >
> > > I would appreciate your vote of support at:
> > >
> > > http://bugs.php.net/bug.php?id=17158
> > >
> > > before the bug people "close" this thread.
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
>
> --
> John Taylor-Johnston
> -
>
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] eval()

2002-05-20 Thread jtjohnston

I know I'm not doing this right, but ..

What I want to do is display the value of $q1 through $q3.
How? I can't get eval() to do it, can I?

for ($i = 1; $i <= 3; $i++)
{
$x= eval ("\$q".$i);
echo"$x\n";
echo"\n";
}

John


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




[PHP] inspirational

2002-05-25 Thread jtjohnston

I want to detect the url my .php lies in.

This is over kill and BS:

$myurlvar = "http://".$SERVER_NAME.parse($SCRIPT_NAME);

How do I get "http://foo.com/dir1/dir2/dir3/";.

There seems to be nothing in phpinfo() that will give me a full url to
play with.

Flame me if you will, but I browsed TFM and found nothing inspirational.

Looked at phpinfo() too and got discouraged.

I need a full url.

John



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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing  somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0 && $today_ts==$day_i_ts) {
   echo "".$link_i."";

  }
  else {
   echo "".$link_i."\n";

  if ($day_i==7 && $i<$daysInMonth) {
   echo "\n";
   }
   else if ($day_i==7 && $i==$daysInMonth) {
   echo "\n";
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h<7; $h++) {
   echo " \n";
}
   echo "\n";
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing  somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0 && $today_ts==$day_i_ts) {
   echo "".$link_i."";

  }
  else {
   echo "".$link_i."\n";

  if ($day_i==7 && $i<$daysInMonth) {
   echo "\n";
   }
   else if ($day_i==7 && $i==$daysInMonth) {
   echo "\n";
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h<7; $h++) {
   echo " \n";
}
   echo "\n";
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing  somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0 && $today_ts==$day_i_ts) {
   echo "".$link_i."";

  }
  else {
   echo "".$link_i."\n";

  if ($day_i==7 && $i<$daysInMonth) {
   echo "\n";
   }
   else if ($day_i==7 && $i==$daysInMonth) {
   echo "\n";
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h<7; $h++) {
   echo " \n";
}
   echo "\n";
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing  somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0 && $today_ts==$day_i_ts) {
   echo "".$link_i."";

  }
  else {
   echo "".$link_i."\n";

  if ($day_i==7 && $i<$daysInMonth) {
   echo "\n";
   }
   else if ($day_i==7 && $i==$daysInMonth) {
   echo "\n";
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h<7; $h++) {
   echo " \n";
}
   echo "\n";
  }
  } //end else




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




[PHP] Need help

2002-02-20 Thread jtjohnston

Yeeesch! I neet help.

I need a method to flush out lists of authors in a MySQL field called
"KW".

The field looks a bit like this:


&&1; Caribbean and West Indies; Guyana;&&4; Birney,(i) Earle; Harris,(i)
Wilson; Hope,(i) Alec Derwent; King,(i) Bruce; James,(i) Henry;
Olson,(i) Charles; Rushdie,(i) Salman; Purdy,(i) Al; Joyce,(i) James;
Macleish,(i) Archibald; Cummings,(i) Edward Estlin (E.E.); Auden,(i) W.
H.; Atwood,(i) Margaret; Tutuola,(i) Amos; Simon,(i) Claude;&&7;
comparison of authors and works;


In the section that starts with &&4
I need to look for (i) search backward to the prewious ; and search
forward to the next ; and extract into an array the contents between the
semi-colons to arrive at something that looks like:

Birney, Earle
Harris, Wilson
Hope, Alec Derwent
King, Bruce
James, Henry
Olson, Charles
Rushdie, Salman
Purdy, Al
Joyce, James
Macleish, Archibald
Cummings, Edward Estlin (E.E.)
Auden, W. H.
Atwood, Margaret
Tutuola, Amos
Simon, Claude

Can someone please help me get started?

John


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




[PHP] phpmyadmin

2002-02-21 Thread jtjohnston

I know this is a bit off the wall for most, but for what purpose do you
use phpmyadmin & mysql?
What are your projects?
Does anyone know of any good articles that discuss databasing, PHP,
MySQL and or PHPMyAdmin for academic purposes?
I'm a university researcher and want to collect some data.

John Taylor-Johnston
-

  ' ' '   Université de Sherbrooke:
 ô¿ô   http://compcanlit.ca/
   -


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




[PHP] gzip?

2002-02-21 Thread jtjohnston

What header do I type to gzip something out on the screen? To make the
output go faster, such as this text output:
http://ccl.flsh.usherb.ca/db/export_to_nb_format.php
I don,t want to actually zip the output, just make it go faster. Someone
once told me I could do that so the server spits output faster.

J


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




[PHP] More: gzip?

2002-02-21 Thread jtjohnston

It's called GZIP output buffering whatever that may be?



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




[PHP] This?: ob_start

2002-02-21 Thread jtjohnston

Does this do it?

ob_start();

while ($personne = mysql_fetch_object($news))
 {
$output = "";
$output .= "R#:".$personne->id."¶\n";
if($personne->TNum != ""){$output .= "T#:".$personne->TNum."¶\n";}
$output = ob_get_contents($output);
echo $output;
ob_end_clean();
 }



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




[PHP] Result: ob_start

2002-02-21 Thread jtjohnston

I've narrowed down working code to this, but does it really do the job?
Does this really go faster?

header("Content-type: text/plain");
...
while ($personne = mysql_fetch_object($news))
 {
ob_start();
$output = "";
$output .= "R#:".$personne->id."¶\n";
if($personne->TNum != ""){$output .= "T#:".$personne->TNum."¶\n";}
print_r ($output);
$output = ob_get_contents();
ob_end_clean();
echo $output;
 }


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




[PHP] foreach not in reach

2002-02-21 Thread jtjohnston

Question 1:
How can I append strings to my authors array?
Me thinks this doesn't work :§) ?
$authors .= explode(";", $mydata->KW);
I'm getting "Invalid argument supplied for foreach()"

Question 2:
Once I get this working, I want to (a) alphabetise the contents of the
array, (b) count repititions, (c) elimintate copies, and create an array
I can print with tow things "$author[i]\t$counter[i]", so I end up with
something like:

Adam2
Louis5
John3
Mary8



$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select KW from $table");

while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(";", $mydata->KW);
}

foreach ($authors as $author)
{
echo "$author\n";
}


I'm learning, slowly but surely Martin :)
J


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




[PHP] how to build an array

2002-02-22 Thread jtjohnston

I guess it's because I didn't really follow Niklas' post, so I'll ask
the first part of yesterday's question again, if someone can help me
think my way through it. I've been looking at
http://www.php.net/manual/en/ref.array.php but don't really get HOW to
build an array from my MySQL data.

I'm exploding data from $mydata->KW
explode(";", $mydata->KW);
(It's a bunch of author names separated by ; in a bibliographic
database.)

I want to compile everything in One Single array, called $authors and
output it to the screen. Later, I'll aphabetise and sort the output ...

Where/How do I start in building a new array? ".=" doesn't work:

$authors .= explode(";", $mydata->KW);

How do I construct the array?
Will I be able to alpabetise it?

-snip--
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select KW from $table");

while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(";", $mydata->KW);
}

foreach ($authors as $author)
{
echo "$author\n";
}

John


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




[PHP] Not Quite: how to build an array

2002-02-22 Thread jtjohnston

OK. I use:

 while ($mydata = mysql_fetch_object($news))
 {
 $authors = explode(";", $mydata->AS);
 }

Then why "Invalid argument supplied for foreach()"
Am I indeed building an array as I go through my database?

 foreach($authors as $author)
 {
#echo sort($author)".\n";
 echo "$author\n";
 }

http://www.php.net/manual/en/control-structures.foreach.php
foreach ($arr as $value) {
echo "Value: $value\n";
}

I have the right syntax? Did I build the array?
Newbie, but have to learn it somehow :)

snip-
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

 $news = mysql_query("select AS from $table");

 while ($mydata = mysql_fetch_object($news))
 {
 $authors = explode(";", $mydata->AS);
 }

 foreach($authors as $author)
 {
 echo "$author\n";
 }



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




Re: [PHP] Re: how to build an array

2002-02-22 Thread jtjohnston

Yeah but, this doesn't work either? I'm trying :)

 $news = mysql_query("select AS from $table");

 while ($mydata = mysql_fetch_object($news))
 {
# $authors = explode(";", $mydata->AS);
 array_push ($authors, explode(";", $mydata->AS));
 }

 foreach($authors as $author)
 {
 echo "$author\n";
 }



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




Re: [PHP] login determines content on page

2002-02-22 Thread jtjohnston

What's the difference between
if (isset($submit_happening))
and
if $submit_happening)

John

[EMAIL PROTECTED] wrote:

> On Fri, 22 Feb 2002 21:38:16 -0500, you wrote:
>
> >I'd to know how difficult it is to achieve the following:
> >
> >Create login page, when the submit button is clicked, the user info is checked 
>against a database as
> >to whether is login info is valid. if it is valid, a page is displayed that lists 
>all of the classes
> >that the user has registered for, meaning each user will see a different list of 
>classes.
>
> At first, I thought this was a homework question, but that seems
> unlikely. Ok, one way to do this is to have a form submit to itself.
>
> Briefly :
>
>  if (isset($submit_happening)) {
> if ($username == "david" && $password="xyzzy") {
> echo("Successfully logged in");
> } else {
> echo("Not logged in");
> }
> } else {
> ?>
> 
> 
> 
> 
> 
>  }
> ?>
>
> Untested. If you want to store a user's logon status permanently, look
> at sessions. http://www.php.net/manual/en/ref.session.php
>
> djo

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] Not Quite: how to build an array

2002-02-23 Thread jtjohnston

I'm splitting mysql entries to build an array of author names called $authors.

> As someone already suggested, you could use:
>  array_push($authors, explode(";", $mydata->AS));

http://ccl.flsh.usherb.ca/db/authors_under_study.php

It works, but still gets "First argument to array_push() needs to be an array"
and fails before it gets to "print_r($authors)". Am I doing something wrong
here:

 $authors = array_push($authors, explode(";", $mydata->AUS));

---snip
$news = mysql_query("select id,AUS from $table");
$authors = array();
 while ($mydata = mysql_fetch_object($news))
 {
 echo $mydata->id."|".$mydata->AUS."\n";
 $authors = array_push($authors, explode(";", $mydata->AUS));
 }
print_r($authors);
-snip-

The data looks like:

id->1 = "Zola, Émile";
id->2 = "Mendès, Catielle ??; Grutman; Bernabé, Jean; Andrade, Mario de;
Sutherland, Ronald; Faulkner, William Harrison; Nabokov, Vladimir; Klein,
Abraham Moses; Chassay, Jean-François; Glissant, Édouard; Martí, José;
Jonassaint, Jean; Aguiar, Flavio";
id->3 = "Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie";
id->4 = "Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie";
id->5 = "Tremblay, Michel; Glassco, Bill; Freeman, David; Meunier, Claude;
Gaboriau, Linda; Fennario, David;";
id->6 = "Tremblay, Michel; Laurendeau, André; Gélinas, Gratien; Glassco, Bill;
Dassylva, Martial; Desbiens, Jean-Paul; Dubé, Marcel; Germain, Jean-Paul;
Renaud, Jacques; Van Burik, John; Renaud Jacques;";



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




[PHP] countless

2002-02-23 Thread jtjohnston

Success. After a bit of tinkering :) and reading up. Thanks for the
ideas.

Now one last question. here is my array $authors:
http://ccl.flsh.usherb.ca/db/authors_under_study.php
sorted alphabetically.

How do I go about sorting again it so it renders:

Aguiar, Flavio1
Andrade, Mario de1
Ashcroft, W.D.  1
Atwood, Margaret 3
Auden, W. H.3
Bernabé, Jean1
Birney, Earle  4

Basically, I want to start a new array (do i have to?)
and count every time an author appears, eliminating repetition.

J


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




[PHP] Re: I need a random number eather one or two

2002-02-23 Thread jtjohnston

rand (1, 2)
http://www.php.net/manual/en/function.rand.php
?
J

"Philip J. Newman" wrote:

> I'm trying to make a random number kind of a coin toss,
>
> heads = 1 = left
> tales = 2 = right
>
> any solutions
>
> Philip J. Newman
> Philip's Domain - Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
> Phone: +64 25 6144012

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] Convert An Array

2002-02-24 Thread jtjohnston

http://ccl.flsh.usherb.ca/db/authors_under_study.php
or
$names = array ("john", "mary", "bill", "mary", "bill", "mary", "bill",
"john", "bill", "john");

1) How do I count the elements of $names to produce:

bill   4
john   3
mary   3

2) How do I store the counted elements into a new array? How do I create
this:

$new_array = array ("bill"=>4, "john"=>3, "mary"=>3)

I'm looking at http://www.php.net/manual/en/function.array.php
but not sure.




Re: [PHP] Access Array Values?

2002-02-24 Thread jtjohnston

I knew there was areason why I stopped Perling :) THANKS!
How do I disassemble its values? How would I foreach? Something like this?

foreach (array_count_values ($names) as $name and $count) <-??
{
echo"".$name." (".$count.")`;
}

bill (3)
john (3)
mary (4)

http://www.php.net/manual/en/function.array-count-values.php talks about how
it counts. But how do I access each separate value?

John

--snip---
$names = array ("john", "mary", "bill", "mary", "bill", "mary", "bill",
"john", "bill", "john");
echo"";
print_r($names);
echo"";
echo"";
print_r(array_count_values ($names));
echo"";


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




Re: [PHP] Email Verification

2002-02-24 Thread jtjohnston

Is this what you want?

function validateEmail ($email) {
return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' .
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email));
 }

This will also do the job. It actually connects to the mail server name and
runs it to see if valid :

 http://px.sklar.com/code-pretty.html?code_id=508



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




[PHP] Re: ? re phpwebhosting.com - still in business??

2002-02-24 Thread jtjohnston

What's their deal? How do they offer all that and be so cheap?
Using my site like Geocities to advertise?
http://www.phpwebhosting.com/host_details.html
J


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




Re: [PHP] Access Array Values?

2002-02-24 Thread jtjohnston

:)
foreach (array_count_values ($names) as $name=>$count)
Thanks M! :)


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




[PHP] mysql 4 windows

2002-02-24 Thread jtjohnston

Does anyone know if mysql 4 windows is up to snuff yet?
I'm running  http://www.easyphp.org/
Can it be installed as localhost2?

John


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




[PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Has anyone tried:



instead of :

>\">

I can't get this to work:
if(isset($submit))

with:



I'm not coding correctly?


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




[PHP] Re: PHP MAIL function...why wont it work????

2002-02-27 Thread jtjohnston

Your smtp is valid? Try error checking for that? See you php.ini. If you are
running it on localhost you might try the same smtp that is used in your
emailer. I gaffed on that once. :)

Brad Wright wrote:

> Hi all... I have a line in a page that should send me an email when the page
> is loaded.
>
> Here is the line i am using:
>
>  mail("[EMAIL PROTECTED]", "worked", "Line 1\nLine 2\nLine 3");
>
> when i load the page...i get NO error msgs, but the function does not send
> the mail. There is no record of any activity in the mail log...any ideas...
>
> I AM GOING INSANE
>
> Thanks in advance,
> Brad

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

I s'pose, but where/why are you getting submit.x=118&submit.y=20

Martin Towell wrote:

> I used this code
>
> 
>  value="submit">
> 
>
> when I clicked on the image, I got this url
>
> file:///C:/inetpub/wwwroot/top.html?submit.x=118&submit.y=20
>
> so php would get this as $submit_x and $submit_y
>
> HTH
> Martin
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] if(isset($submit))
>
> Has anyone tried:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> instead of :
>
> >\">
>
> I can't get this to work:
> if(isset($submit))
>
> with:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> I'm not coding correctly?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Nope, not following.
:)
More particularily why will isset accept type=submit and not type=image ?

Martin Towell wrote:

> I used this code
>
> 
>  value="submit">
> 
>
> when I clicked on the image, I got this url
>
> file:///C:/inetpub/wwwroot/top.html?submit.x=118&submit.y=20
>
> so php would get this as $submit_x and $submit_y
>
> HTH
> Martin
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] if(isset($submit))
>
> Has anyone tried:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> instead of :
>
> >\">
>
> I can't get this to work:
> if(isset($submit))
>
> with:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> I'm not coding correctly?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

So I can forget using type="image" :(
Wah, it's not fair!

:) J

Martin Towell wrote:

> I used this code
>
> 
>  value="submit">
> 
>
> when I clicked on the image, I got this url
>
> file:///C:/inetpub/wwwroot/top.html?submit.x=118&submit.y=20
>
> so php would get this as $submit_x and $submit_y
>
> HTH
> Martin
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] if(isset($submit))
>
> Has anyone tried:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> instead of :
>
> >\">
>
> I can't get this to work:
> if(isset($submit))
>
> with:
>
>  src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
>
> I'm not coding correctly?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




[PHP] isset?

2002-02-27 Thread jtjohnston

So what is the good of isset? What does if(isset($submit)) do
differently than if($submit) ??

J


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




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Over kill?

Martin Towell wrote:

> or have a hidden field, maybe, called "submit" 
>
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:33 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] if(isset($submit))
>
> So I can forget using type="image" :(
> Wah, it's not fair!
>
> :) J
>
> Martin Towell wrote:
>
> > I used this code
> >
> > 
> >  > value="submit">
> > 
> >
> > when I clicked on the image, I got this url
> >
> > file:///C:/inetpub/wwwroot/top.html?submit.x=118&submit.y=20
> >
> > so php would get this as $submit_x and $submit_y
> >
> > HTH
> > Martin
> >
> > -Original Message-
> > From: jtjohnston [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 28, 2002 4:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] if(isset($submit))
> >
> > Has anyone tried:
> >
> >  > src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
> >
> > instead of :
> >
> > >\">
> >
> > I can't get this to work:
> > if(isset($submit))
> >
> > with:
> >
> >  > src=\"next.gif\" border=\"0\" align=\"ABSCENTER\">
> >
> > I'm not coding correctly?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> John Taylor-Johnston
> 
> -
>
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




[PHP] Apache & PHPMyAdmin

2002-03-02 Thread jtjohnston

Hi,
No one seems to be home at my favourite apache newsgroup :) so I'll ask
here.
I'm trying to reconfigure my PHPMyAdmin.

What do I add to my conf file so as in http://phpmyadmin.somehere.com/
points
to a specific directory on my (windows) drive?

For example, how would I point http://www.somehere.com// to a
different directory than http://somehere.com/ , or
http://123.somehere.com// to a different directory than
http://456.somehere.com/ ?

John Taylor-Johnston

-

  ' ' '   Université de Sherbrooke:
 ô¿ô   http://compcanlit.ca/
   ~


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




[PHP] Does anyone follow?

2002-03-04 Thread jtjohnston

Does anyone follow what I'm trying to do?

I have a list of authors I explode from a field called AUS. I sort them
sort($authors);

The layout is agreeable. What I would like now to do is change:

   array_push($authors,$singleauthor);

for

   array_push($authors,$singleauthor,$mydata->id);

But how do I sort them now? These two lines permitted me to:

sort($authors);
foreach (array_count_values ($authors) as $author=>$count)

sort, count and display each occurence only once.

O'Henry, James (5)  #<--- there were 5 occurences of O'Henry in my
database explode

Now what I want to do is display the id number (record number) of each
occurence of O'Henry:

O'Henry, James (5) [record 1, record 4, record, 87, record 119, record
120]

How do I re-evaluate this code, modify it to display authors one time
only,
count the number of occurences in my database
and somehow integrate $mydata->id  ?

Does anyone follow what I'm trying to do?

--snip---
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query("select id,AUS from $table");

$authors = array();

while ($mydata = mysql_fetch_object($news))
{
$mydata->AUS = str_replace(" ;", ";", $mydata->AUS);
$mydata->AUS = str_replace("; ", ";", $mydata->AUS);
$tempauthors = explode(";", $mydata->AUS);
 foreach ($tempauthors as $singleauthor)
  {
   if ($singleauthor <> "")
   array_push($authors,$singleauthor);
  }
 }

sort($authors);
foreach (array_count_values ($authors) as $author=>$count)
{
echo "".$author."
(".$count.")\n";
}

mysql_close($myconnection);




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




Re: [PHP] Does anyone follow?

2002-03-04 Thread jtjohnston

Can you show me how :) ? I'm in over my head.
I get working with arrays, but need more practice,
examples etc. to learn how to code from. How would two arays work?
John


> Does anyone follow what I'm trying to do?
>
> I have a list of authors I explode from a field called AUS. I sort them
> sort($authors);
>
> The layout is agreeable. What I would like now to do is change:
>
>array_push($authors,$singleauthor);
>
> for
>
>array_push($authors,$singleauthor,$mydata->id);
>
> But how do I sort them now? These two lines permitted me to:
>
> sort($authors);
> foreach (array_count_values ($authors) as $author=>$count)
>
> sort, count and display each occurence only once.
>
> O'Henry, James (5)  #<--- there were 5 occurences of O'Henry in my
> database explode
>
> Now what I want to do is display the id number (record number) of each
> occurence of O'Henry:
>
> O'Henry, James (5) [record 1, record 4, record, 87, record 119, record
> 120]
>
> How do I re-evaluate this code, modify it to display authors one time
> only,
> count the number of occurences in my database
> and somehow integrate $mydata->id  ?
>
> Does anyone follow what I'm trying to do?
>
> --snip---
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
>
> $news = mysql_query("select id,AUS from $table");
>
> $authors = array();
>
> while ($mydata = mysql_fetch_object($news))
> {
> $mydata->AUS = str_replace(" ;", ";", $mydata->AUS);
> $mydata->AUS = str_replace("; ", ";", $mydata->AUS);
> $tempauthors = explode(";", $mydata->AUS);
>  foreach ($tempauthors as $singleauthor)
>   {
>if ($singleauthor <> "")
>array_push($authors,$singleauthor);
>   }
>  }
>
> sort($authors);
> foreach (array_count_values ($authors) as $author=>$count)
> {
> echo " href=\"match.php?searchenquiry=".urlencode($author)."&match=partial+match\">
> ".$author."
> (".$count.")\n";
> }
>
> mysql_close($myconnection);


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




[PHP] Ifrst

2002-03-04 Thread jtjohnston

Is this over kill? Is there a "better" way? I have an array.
I want to display all occurences of strings that start with "a" or "A".

http://www.php.net/manual/en/function.substr.php
$rest = substr($mystring, 0, 1); // returns "a"

?


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




[PHP] case insenstive

2002-03-04 Thread jtjohnston

I need to make this case insensitive. This seems like over kill?

 if((substr($author, 0, 1) == "a") or (substr($author, 0, 1) == "a"))
{
}


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




[PHP] sort()

2002-03-04 Thread jtjohnston

Thanks!
Has this ever been improved? It sorts but case insensitively. Is this
over kill :)

usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));

D'Alpuget, Blanche
d'Alpuget, Blanche
da Silva e Orta, Teresa Margarida
Dabydeen, Cyril
de Campos, Haroldo
De Certeau, Michel
de Certeau, Michel


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




[PHP] exists?

2002-03-05 Thread jtjohnston

It's late, I'm tired.
I want to parse $searchenquiry

if("%" exists in $searchenquiry)
{
do ...
}else{
do ...
}



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




[PHP] $db_list = mysql_list_dbs

2002-03-06 Thread jtjohnston

mysql-list-dbs works but displays all databases. How do I limit to
display those that a user has access rights to?

http://www.php.net/manual/en/function.mysql-list-dbs.php

$link = mysql_connect($server, $user, $password);
 $db_list = mysql_list_dbs($link);

 while ($row = mysql_fetch_object($db_list))
 {
 echo $row->Database . "\n";
 }




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




[PHP] how to access an ini file using PHP

2002-03-06 Thread jtjohnston

[Posted and Replied]
Salut Marc,

You could find an ini file function. Something like:

http://www.zend.com/apidoc/c1948.php
http://ca.google.yahoo.com/bin/query_ca?p=how+to+access+an+ini+file+using+PHP&y=on&hc=0&hs=0

You would have to add one line:

[MyData]
name=foo
age=100
sex=y

I've done it with Perl, but have never found anything for PHP.
Have you thought of a mysql database? That's all I use now.



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




[PHP] Re: File/Directory Permissions

2002-03-06 Thread jtjohnston


I know you would want to code your chmod, but I use my CuteFTP window to
auto-calculate which permissions I want to use/code. Not necessary on Windows,
but on Unix it's an absolute.
I use 644 (Read Owner, Read Group, Read Public,Write Owner, on a Unix
server with no trouble for normal *.PHP files.

 


[PHP] Is flock necessary?

2002-03-06 Thread jtjohnston

Group: Is flock even necessary?
Allan: You look like you have Perled. It was necessary for Perl.
Have you thought of MySQL instead?


Alan McFarlane wrote:

> I've just written a couple of simple routines which read an write small text
> files to the server:
>
> function readData( $filename, &$data )
> {
>  if (!$fd = @fopen($filename, "r"))
>  {
>   return false;
>  }
>
>  flock($fd, LOCK_SH);
>  $data = fread($fd, filesize($filename));
>  fclose($fd);
>
>  return true;
> }
>
> function writeData( $filename, $data )
> {
>  if (!$fd = @fopen($filename, "w"))
>  {
>   return false;
>  }
>
>  flock($fd, LOCK_EX);
>  fwrite($fd, $data);
>  fclose($fd);
>
>  return true;
> }
>
> Now, the question is... How much time elapses between the fopen() statement
> and the flock() statements?
>
> Looking at the code, it would appear that two separate threads may call
> writeData() almost simultaneously giving the following execution:
>
>  assume $filename = "sample.txt";
>
> Thread #1 - $fd = fopen($filename, "w");  // succeeds
> Thread #2 - $fd = fopen($filename, "w");  // succeeds (I think)
> Thread #1 - flock($fd, LOCK_EX);  // Does this succeed or fail?
> Thread #2 - flock($fd, LOCK_EX);  // fails (I think)

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] Use an ini file

2002-03-07 Thread jtjohnston

Anyone know of an easy to use library/or code that will read and write
an ini file?



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




[PHP] Re: Use an ini file

2002-03-07 Thread jtjohnston

> > Anyone know of an easy to use library/or code that will read and write
> > an ini file?
> See parse_ini_file() together with the file handling functions.

Dave,
http://www.php.net/manual/en/function.parse-ini-file.php
Good, but no code to write to an ini file?
:) John


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




[PHP] CSS

2002-03-08 Thread jtjohnston

Has anyone any code that creates a CSS file? A GUI?

As in:







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




[PHP] CSS Group

2002-03-09 Thread jtjohnston

Can anyone recommend a good CSS news group?



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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] rec_copy

2002-03-13 Thread jtjohnston

You might have seen a version of this function:

http://www.php.net/manual/en/function.copy.php

I would like to rework this line:

  mkdir($to_path, 0777);

where mkdir will ignore $to_path if
the directory already exists. I have already tried this:

#if(!mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

but that doesn't work. I suppose that is because the
function calls itself when it creates sub-directories.

Any ideas?

John

##--- snip 
$date = date ("Ymd");
rec_copy($from_path, $to_path);

echo "files copies from $from_path and backed up to $to_path";


function rec_copy ($from_path, $to_path) {
mkdir($to_path, 0777);

#if(!mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
 echo "if (is_dir($from_path))";
 }
}# end function



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




Re: [PHP] rec_copy

2002-03-13 Thread jtjohnston

So I just declare at the beginning:

if(!is_dir($to_path))
mkdir($to_path, 0777);

The code works. But how can I make sure $from_path exists first and fails if
not?
Same thing?

if(!is_dir($from_path))
{
echo "failed";
exit;
}

The first time I ran it, I ran it with a non-existing $from_path directory
and the function ran anyways.
I thought the function had a built-in safe-guard?

-snip--
if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

#if(mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function





> > http://www.php.net/manual/en/function.copy.php


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




[PHP] Double slash

2002-03-13 Thread jtjohnston

On a windows server,

echo getcwd()."";

gives me:

C:\WINDOWS\Bureau\php\microweb

How do I double slash it? Is this ok:

$test_path = getcwd()."\\test1\\";
echo $test_path;

It seems ok, when I echo it? Any screwy Windows thing I need to know
about?

John


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




Re: [PHP] Double slash

2002-03-13 Thread jtjohnston

>looks good to me - only screwy thing I can think of is the backslash thing -
>REALLY annoying - and confusing sometimes

Yeah, no kidding. Thanks Martin!

What about if I try copying $to_path onto a Network server?

Do you see any problems with the code and $to_path?

(Not that I have a server to test it on yet. Not that Works &
Services are going to take 2 weeks :-( to replace my stolen server!
But I have to prepare for the inevitable.)

---snip-
$date = date ("Ymd");
$from_path = getcwd()."\\mysql\\";
$to_path = "/sirius/data/usager/ccl/backups/".$date."/";

if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

#if(mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function



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




[PHP] Re: What permissions for uploading?

2002-03-13 Thread jtjohnston

Not to but in, but you might want to check on your version. www.php.net
published an advisory on a possible flaw on that very issue:

http://www.php.net/release_4_1_2_win32.php
http://security.e-matters.de/advisories/012002.html

Leif K-Brooks wrote:

> I have a script that allows the user to upload a file.   Right now, though,
> it says permission denied when I try to upload.  The permissions for the
> folder I want to upload to is 755 right now.  What should I change it to?

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] New Day, New Problem

2002-03-14 Thread jtjohnston

If I change:

$to_path = "c:\\".$date."www\\";

to

$to_path = "c:\\".$date."\\www\\";

It doesn't work? Otherwise, it works.
Can anyone help? Undoubtably something f-ed in the code, or is it a
Windows thing?



###
$date = date ("Ymd");
###
###  Don't forget trailing slash  #
###
$from_path = "c:\\program files\\easyphp\\ccl_www\\";
$to_path = "c:\\".$date."ww\\";
###

if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#

function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function




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




[PHP] Weird?

2002-03-15 Thread jtjohnston

Does anyone have time to run this code?
This is definitely weird. Either a Windows or a code problem. If I set:

$to_path = "c:\\ccl_www\\".$date."ccl_www\\";

to:

$to_path = "c:\\ccl_www\\".$date."\\ccl_www\\";
(I add \\)

It fails to create c:\ccl_www\20020315\ccl_www, but otherwise will
create c:\ccl_www\20020315ccl_www

I've tried debugging this thing backwards, but have not found my
problem.

If for example, I tried creating manually:

c:\ccl_www

thinking it was a root thing. It worked, then it didn't.

:x( John
P.S. By the by, I tried this on a Unix box, and thought it worked, but
then it didn't when I went back to it this morning. I'm confused!


snip
$date = date ("MD");
###
###  Don't forget trailing slash  #
###
$from_path = "c:\\program files\\easyphp\\ccl_www\\";
$to_path = "c:\\ccl_www\\".$date."ccl_www\\";
###

if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#

function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function




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




[PHP] [More] Re: Weird?

2002-03-15 Thread jtjohnston

Miguel,
No, You're right I wasn't running E=All.  It's a windows machine, so I have
all the write priveledges I want.
These are the errors I'm getting:

 Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
 directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: MkDir failed (No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
 Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
 (errno=2 - No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: MkDir failed (No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
 Warning: Unable to create 'c:\ccl_www\MarFriccl_www\Nouveau
 dossier/aa.txt': No such file or directory in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
 Warning: Unable to create 'c:\ccl_www\MarFriccl_www\aa.txt': No such
file or
 directory in  C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
 files copies from c:\program files\easyphp\ccl_www\ and backed up to
 c:\ccl_www\MarFriccl_www\

The code calls itself each time it enters another level.
If I create c:\ccl_www myself, I get this error:

 Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
 directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
 (errno=2 - No such file or directory) in
C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 files copies from c:\program files\easyphp\ccl_www\ and backed up to
 c:\ccl_www\MarFriccl_www\

But despite "(errno=2 - No such file or directory)" the code does create
c:\ccl_www\MarFriccl_www and does copy the necessary files.

Can anyone help?


-snip--
$date = date ("MD");
$from_path = "c:\\program files\\easyphp\\ccl_www\\";
$to_path = "c:\\ccl_www\\".$date."ccl_www\\";

if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }else{
#  echo "error if (is_dir($file))";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function



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




[PHP] Update: [PHP] Weird?

2002-03-16 Thread jtjohnston

I have created date :)
$date = date ("MD");
That's not it. It seems to fail at one level or another, I think, becuase the
function calls itself - and probably gets lost somehow.
John

> ... i think you might have to create the
> $date directory before writing a file to it.
> writing to /tmp/dir/file.txt will fail if
> the directory "dir" doesn't exist.

";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function

?>


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




[PHP] PHPMyAdmin: [PHP] From: Newman, using " and ' or ` in My Sql

2002-03-16 Thread jtjohnston

> The standard quote (') should be used to delimit string literals in MYSQL
> statements. Use it to surround strings you're inserting into or comparing
> against VARCHARs, CHARs, TEXTs, etc.

>  $sql = "UPDATE mytable SET name='Best Table Of All' WHERE id=3";

That is ok if you call MySQL in your .php. But in PHPMyAdmin, it seems preferable to 
use `.


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




[PHP] No Sense: [PHP] Update: [PHP] Weird?

2002-03-16 Thread jtjohnston

No!? $date is a string?!

$date = date ("MD");

How does that make a difference?

$to_path = "c:\\ccl_www\\".$date."\\ccl_www\\";

You want me to change it to:

$to_path = "c:\\ccl_www\\$date\\ccl_www\\";

Does anyone follow why?

>Scott Furt wrote:

> I meant, have you created a physical directory
> named $date?
> That's your problem.  There's no directory named $date on your computer, and
> you're
> trying to write files into a non-existent directory.
>
> jtjohnston wrote:
> > I have created date :)
> > $date = date ("MD");
> > That's not it. It seems to fail at one level or another, I think, becuase the
> > function calls itself - and probably gets lost somehow.
> > John
> >
> >
> >>... i think you might have to create the
> >>$date directory before writing a file to it.
> >>writing to /tmp/dir/file.txt will fail if
> >>the directory "dir" doesn't exist.
> >>
> >
> >  >
> > ###
> > $date = date ("MD");
> > ###
> > ###  Don't forget trailing slash  #
> > ###
> > $from_path = "c:\\program files\\easyphp\\ccl_www\\";
> > $to_path = "c:\\ccl_www\\".$date."ccl_www\\";
> > ###
> >
> > if(!is_dir($from_path))
> > {
> > echo "failed";
> > exit;
> > }else{
> > rec_copy($from_path, $to_path);
> > echo "files copies from $from_path and backed up to $to_path";
> > }
> >
> > #
> > function rec_copy ($from_path, $to_path) {
> > if(!is_dir($to_path))
> > mkdir($to_path, 0777);
> >
> > $this_path = getcwd();
> >  if (is_dir($from_path))
> >  {
> > chdir($from_path);
> > $handle=opendir('.');
> >
> > while (($file = readdir($handle))!==false)
> > {
> >  if (($file != ".") && ($file != "..")) {
> >   if (is_dir($file))
> >   {
> >   rec_copy ($from_path.$file."/",  $to_path.$file."/");
> >chdir($from_path);
> >   }else{
> > #  echo "error if (is_dir($file))";
> >   }
> >   if (is_file($file))
> >   {
> >   copy($from_path.$file, $to_path.$file);
> >   }else{
> > #  echo "error copy($from_path.$file, $to_path.$file)";
> >   }
> >  }#end (($file != ".")
> > }#end while (($file
> >
> > closedir($handle);
> >  }# end if (is_dir
> >  else{
> > # echo "if (is_dir($from_path))";
> >  }
> > }# end function
> >
> > ?>
> >
> >

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] Re: [PHP] Weird?

2002-03-16 Thread jtjohnston

Dave,

That's just the problem with the code. See the snippet,
http://www.php.net/manual/en/function.copy.php

The function should MKDIR for me one level at a time as
the function calls itself. It should MKDIR and copy *.*
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
   chdir($from_path);
  }

Somehow, some place the code fails.
:) I've been going nuts trying to make it work.

>David Robley wrote:

> > >Scott Furt wrote:
> > > I meant, have you created a physical directory
> > > named $date?
> > > That's your problem.  There's no directory named $date on your
> computer, and
> > > you're trying to write files into a non-existent directory.
> I think what is being suggested is that you may not have a directory
> named whatever "c:\\ccl_www\\".$date."\\ccl_www\\" expands to;
> frinstance
> if $date were 0203 you would need to have an existing directory
> "c:\\ccl_www\\0203\\ccl_www\\"
> Of course, I could be misunderstanding...

snip-
";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)";
  }
 }#end (($file != ".")
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))";
 }
}# end function

?>



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




[PHP] Copy *.*

2002-03-16 Thread jtjohnston

Does anyone know of another snippet any place where I can copy *.*
(files and all sub-directories) from one drive to another? In other
words, a "backing-up" function. The snippet I got from
http://www.php.net/manual/en/function.copy.php has been a disaster.

John


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




[PHP] Re: Invalid Argument ??? Not sure how to debug this

2002-03-17 Thread jtjohnston

Daniel,

$myrow["artist"] and $myrow["title"]
might be a good place to start. It looks like all your ; are in place.
I don't think you can place " inside [] like that:

echo "".$myrow["artist"]."".$myrow["title"];


> I have been struggling with this code:  I was wondering if someone could
> lend me a hand.
> Line 12 happens to be the WHILE statement.  I am not sure if it is the
> while statement or the results its looking for.
>
> TIA  So far, i havent been able to sleep atleast until I get this.
>
> 
>  if (isset($searchstring))
>  {
>
>  $db = mysql_connect("localhost","webuser","");
>  mysql_select_db("cd_collection",$db);
>  $sql= "SELECT * FROM cd_list WHERE $searchstring LIKE '%searchstring%'
> ORDER BY artist ASC";
>  $result = mysql_query($sql,$db);
>  echo "";
>  echo "ArtistTitleOptions";
>  while ($myrow = mysql_fetch_array($result))
>  {
>echo "".$myrow["artist"]."".$myrow["title"];
>echo " \">View";
>   }
>   echo "";
>  }
> else
>  {
>   ?>
>   
>   
>   Insert Your Search String Here.
>   Search Type
>   
>   
>   
>Artist
>Title
>Category
>   
>   
>   
>   
>   
>   
> }
>  ?>
>
>  
>
> **DAN**

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




  1   2   >