php-general Digest 19 Aug 2002 01:31:13 -0000 Issue 1533

Topics (messages 113133 through 113168):

Sort multidimensional array using Natural-Order
        113133 by: Hessu
        113135 by: Hessu

Re: Help needed about queries with MySQL, thanks.
        113134 by: Craig Vincent
        113136 by: Carsten Mohr
        113137 by: Chris Knipe

Secure connection with MySQL database
        113138 by: Chris Schoeman
        113141 by: Edwin .
        113147 by: Edwin .

problems with php.ini
        113139 by: Andy

Re: array's
        113140 by: Pafo

xml and a big script
        113142 by: Pafo
        113143 by: Pafo

XP home install question
        113144 by: Jonathan Goulding
        113146 by: Jonathan Goulding

newbie php image importing problems
        113145 by: Brian & Shannon Windsor
        113159 by: hugh danaher

Web Based Mail
        113148 by: Chill
        113149 by: MET
        113150 by: Andy
        113151 by: The Doctor
        113152 by: Dan Hardiker

Re: hyperlink parser - a bit new view :)
        113153 by: Roman
        113154 by: MET
        113157 by: Roman
        113163 by: DL Neil

sorting multiple-dimensional arrays
        113155 by: Evan Nemerson
        113156 by: Rasmus Lerdorf
        113162 by: Evan Nemerson

save all vars in a url to a var?
        113158 by: Hawk
        113160 by: Evan Nemerson
        113161 by: Joachim Krebs

Find rows by 1st letter in MySQL
        113164 by: Tony Harrison
        113165 by: DL Neil
        113166 by: Chris Kay

mail/variable help needed..
        113167 by: eriol

XML XSL Issue
        113168 by: karthikeyan

Administrivia:

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

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

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


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

I have following filename/date array
Array ( [0] => Array ( [0] => 1.jpg [1] => 10.jpg [2] => 11.jpg [3] =>
12.jpg [4] => 2.jpg [5] => 3.jpg [6] => 4.jpg [7] => 5.jpg [8] => 6.jpg [9]
=> 7.jpg [10] => 8.jpg [11] => 9.jpg ) [1] => Array ( [0] => 1026502301 [1]
=> 1026502312 [2] => 1026502313 [3] => 1026502550 [4] => 1026502302 [5] =>
1026502304 [6] => 1026502305 [7] => 1026502619 [8] => 1026502585 [9] =>
1026502308 [10] => 1026502310 [11] => 1026502311 ) )

I'm trying to sort the array by filename in Natural-Order.
Array_multisort(filelist[0]),SORT_ASC,$filelist[1])
don't sort in Natural-Order

usort($filelist[0],"strnatcmp");
Sorts only filenames, any ideas how to get dates also sorted?

-Hessu-


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

I have following filename/date array 
Array ( [0] => Array ( [0] => 1.jpg [1] => 10.jpg [2] => 11.jpg [3] =>
12.jpg [4] => 2.jpg [5] => 3.jpg [6] => 4.jpg [7] => 5.jpg [8] =>
6.jpg [9] => 7.jpg [10] => 8.jpg [11] => 9.jpg ) [1] => Array ( [0] =>
1026502301 [1] => 1026502312 [2] => 1026502313 [3] => 1026502550 [4]
=> 1026502302 [5] => 1026502304 [6] => 1026502305 [7] => 1026502619
[8] => 1026502585 [9] => 1026502308 [10] => 1026502310 [11] =>
1026502311 ) )

I'm trying to sort the array by filename in Natural-Order.
Array_multisort(filelist[0]),SORT_ASC,$filelist[1]) 
don't sort in Natural-Order

usort($filelist[0],"strnatcmp");
Sorts only filenames, any ideas how to get dates also sorted?

-Hessu-
--- End Message ---
--- Begin Message ---
> I have a MySQL database (called "sessions") with a auto-increment
> INT field called "sessionID". I try to check if there is already
> a record in this database with a given sessionID, which is called
> $sessionID in PHP. I use this query, which must be wrong (but I
> cannot find out why !!!) :
>
>    SELECT * FROM sessions WHERE sessionID = $sessionID

Although this may or may not help depending on your code (please post it if
you still haven't found a solution...it's the best way for us to help.

Try

SELECT * FROM sessions WHERE sessionID = '$sessionID'

Although if $sessionID contains an integer (which I assume is would) the
quotes aren't needed, you never know. Some OSes are quirky.

Also you may want to add an

echo mysql_error();

line after your initial mysql_query to see if perhaps there's a problem with
PHP communicating with MySQL.

Sincerely,

Craig Vincent

--- End Message ---
--- Begin Message ---
Hallo,

I don't know if it helps you, but normally you have to quote the 
variable in the SQL-Statement like:
SELECT * FROM sessions WHERE sessionID = '$sessionID'
Otherwise I always get an SQL-Error

Jean-Marc Godart wrote:
> Hello everyone,
> 
> I am a new PHP user, from Belgium. I am trying to manage a MySQL database with PHP, 
>and I kindly request your help to solve a little (probably very stupid) problem I 
>have been dealing with for a while already ...
> 
> I have a MySQL database (called "sessions") with a auto-increment INT field called 
>"sessionID". I try to check if there is already a record in this database with a 
>given sessionID, which is called $sessionID in PHP. I use this query, which must be 
>wrong (but I cannot find out why !!!) :
> 
>    SELECT * FROM sessions WHERE sessionID = $sessionID
> 
> Even though there is already a record with the right sessionID, my program does not 
>find it (I always get 0 when using mysql_num_rows() after the query). Though, if I 
>replace "$sessionID" by, for example 4, then that works and it says there is already 
>a record with that ID.
> 
> I guess the problem comes from comparing two different kinds of variables, but I 
>can't fix it ... Could anyone please help ? By advance, thank you !!!
> 
> Best regards from Belgium,
> 
> 
>                     Jean-marc
> 
> 
>  
> 

--- End Message ---
--- Begin Message ---
Same here... Even though allot of people say it's not necessary...

----- Original Message -----
From: "Carsten Mohr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 18, 2002 5:22 PM
Subject: [PHP] Re: Help needed about queries with MySQL, thanks.


> Hallo,
>
> I don't know if it helps you, but normally you have to quote the
> variable in the SQL-Statement like:
> SELECT * FROM sessions WHERE sessionID = '$sessionID'
> Otherwise I always get an SQL-Error
>
> Jean-Marc Godart wrote:
> > Hello everyone,
> >
> > I am a new PHP user, from Belgium. I am trying to manage a MySQL
database with PHP, and I kindly request your help to solve a little
(probably very stupid) problem I have been dealing with for a while already
...
> >
> > I have a MySQL database (called "sessions") with a auto-increment INT
field called "sessionID". I try to check if there is already a record in
this database with a given sessionID, which is called $sessionID in PHP. I
use this query, which must be wrong (but I cannot find out why !!!) :
> >
> >    SELECT * FROM sessions WHERE sessionID = $sessionID
> >
> > Even though there is already a record with the right sessionID, my
program does not find it (I always get 0 when using mysql_num_rows() after
the query). Though, if I replace "$sessionID" by, for example 4, then that
works and it says there is already a record with that ID.
> >
> > I guess the problem comes from comparing two different kinds of
variables, but I can't fix it ... Could anyone please help ? By advance,
thank you !!!
> >
> > Best regards from Belgium,
> >
> >
> >                     Jean-marc
> >
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
How can I protect my username and password for my connection
with a mysql server. I can't place a file outside the root by the
provider I use.

Thankx
--- End Message ---
--- Begin Message ---
Well, I'm not sure if this is what you're looking for but... if you name the 
file with a .php extension (instead of .txt or .inc) then your password is 
"protected".

For example, you have a password declared like this:

  $my_db_username = 'MyUserName';
  $my_db_password = 'MyPassWord';

And it's inside a file named "myfile.inc.php", then, even if somebody try to 
access the file using their browser like this:

  http://aaa.bbb.ccc/myfile.inc.php

Nothing will appear...

- E

>
>How can I protect my username and password for my connection
>with a mysql server. I can't place a file outside the root by the
>provider I use.
>
>Thankx
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




_________________________________________________________________
Charle con sus amigos online usando MSN Messenger: http://messenger.msn.com

--- End Message ---
--- Begin Message ---
True. But I think you missed the point of the original question--there's no 
"non-web directory"...

- E

>
>To take it to another level, place the PHP file you
>are including in a non-web directory. That way, just
>in case the web server mucks up, there's no chance of
>PHP outputting the contents of the script, since the
>directory you place it in would not be readable by the
>web server.
>
>--- "Edwin @" <[EMAIL PROTECTED]> wrote:
> > Well, I'm not sure if this is what you're looking
> > for but... if you name the
> > file with a .php extension (instead of .txt or .inc)
> > then your password is
> > "protected".
> >
> > For example, you have a password declared like this:
> >
> >   $my_db_username = 'MyUserName';
> >   $my_db_password = 'MyPassWord';
> >
> > And it's inside a file named "myfile.inc.php", then,
> > even if somebody try to
> > access the file using their browser like this:
> >
> >   http://aaa.bbb.ccc/myfile.inc.php
> >
> > Nothing will appear...
> >
> > - E
> >
> > >
> > >How can I protect my username and password for my
> > connection
> > >with a mysql server. I can't place a file outside
> > the root by the
> > >provider I use.
> > >
> > >Thankx
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> >
>_________________________________________________________________
> > Charle con sus amigos online usando MSN Messenger:
> > http://messenger.msn.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>__________________________________________________
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com




_________________________________________________________________
$B:G?7$N%U%!%$%J%s%9>pJs$H%i%$%U%W%i%s$N%"%I%P%$%9(B MSN $B%^%M!<(B 
http://money.msn.co.jp/
--- End Message ---
--- Begin Message ---
Hi everybody:

I am trying to switch register_argc_argv to on. So I did edit php.ini
located where phpinfo() told me. I switched it to on and uncommented the
line. Then I restarted apache.

phpinfo() still tells me that the fallue is off.

What am I doing wrong? Can anybody give me a hint on how to tern this on?

Thanx,

Andy


--- End Message ---
--- Begin Message ---
now it works, thx alot  :)

regards
patrick

"Jason Wong" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sunday 18 August 2002 12:25, Pafo wrote:
> > anyone that can find the problem..?
> > description below.
>
>
>
> >  function PrintInfo() {
> >    for ($this->i = 0; $this->i < count($this->RelicName); $this->i++) {
> >    print "$this->RelicName[$this->i]  :  $this->RelicType[$this->i]  :
> > $this->RelicRealm[$this->i]  :  $this->RelicOwner[$this->i]<br>";
> >    }
> >  }
>
> Not sure why you're defining your counter as $this->i. I would just use
$i.
> Your problem is that inside double quotes the expression:
>
>   $this->RelicName[$this->i]
>
> is ambiguous. In this case what the interpreter has done is to print
> $this->RelicName, which is an array, so your output contains 'Array'. It
then
> prints a literal bracket '[', then the value of $this-i, then another
literal
> bracket ']', and thus that is what you see.
>
> To remove the ambiguity to need to state exactly what you mean and enclose
> your expression in {} :
>
> print "{$this->RelicName[$this->i]} ..."
>
>
> > the function PrintInfo prints out this:
> > '***************************************' OUTPUT
> > '**************************************'
> >
> > Array[0] : Array[0] : Array[0] : Array[0]
> > Array[1] : Array[1] : Array[1] : Array[1]
> > Array[2] : Array[2] : Array[2] : Array[2]
> >
> > heh,, not exacly what i wanted  :/
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Argue for your limitations, and sure enough, they're yours.
> -- Messiah's Handbook : Reminders for the Advanced Soul
> */
>


--- End Message ---
--- Begin Message ---
i was almost done with everything  :)  and ofcourse i find a problem with
the xml parser...
the parser is not collection some vital information, and i dont know why...
the xmlsite is: http://www.camelotherald.com/xml/servers.xml

the problem is market with a <-------------- :
<server name="Guinevere" type="Roleplay" lastguildupdate="2002-08-18
12:28:53" lastcharupdate="2002-08-16 18:09:06">
  <population>1707</population>
  <status>Up</status>
- <relic name="Scabbard of Excalibur" type="Melee" realm="Albion">
<----------------------, the parser dosent retrive this line,, it gets every
line except this.
  <owner>Midgard</owner>
  </relic>
- <relic name="Merlin's Staff" type="Magic" realm="Albion">
  <owner>Hibernia</owner>
  </relic>
- <relic name="Thor's Hammer" type="Melee" realm="Midgard">
  <owner>Midgard</owner>
  </relic>
- <relic name="Horn of Valhalla" type="Magic" realm="Midgard">
  <owner>Hibernia</owner>
  </relic>
- <relic name="Lug's Spear of Lightning" type="Melee" realm="Hibernia">
  <owner>Midgard</owner>
  </relic>
- <relic name="Cauldron of Dagda" type="Magic" realm="Hibernia">
  <owner>Hibernia</owner>
  </relic>
.......

if u run this script, it prints out everything except that.
<?php

//  ******************  Settings  ********************************
$ServerToPrint = "Guinevere";

// ***************************************************************
//////////////////////////////////////////////////////////////////
// START OF THE CODE
$printedserver = false;
$printedrelic = false;
$printedkeep = false;
$depth = array();
$insideitem = false;
$insidekeep = false;
$tag = "";
$server = false;
$crelic = new RelicInfo;
$cserver = new ServerInfo;
$ckeep = new KeepInfo;

class KeepInfo {
  var $KeepName = Array();
  var $KeepOwner = Array();
  var $KeepRealm = Array();
  var $KeepClaimant = Array();


 function PrintInfo() {
   for ($i = 0; $i < count($this->KeepName); $i++) {
     print "<TR><TD><b>{$this->KeepName[$i]}</b>";
     print "<TD>{$this->KeepRealm[$i]}</TD>";
     print "<TD>{$this->KeepOwner[$i]}</TD>";
     print "<TD>{$this->KeepClaimant[$i]}</TD></TR>\n";

   }
 }

 function SetName($name) {
     $this->KeepName[] = $name;
 }

 function SetOwner($owner) {
   $this->KeepOwner[] = $owner;
 }

 function SetRealm($realm) {
   $this->KeepRealm[] = $realm;
 }

 function SetClaimant($claim) {
   $this->KeepClaimant[] = $claim;
 }
}

class RelicInfo {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();

 function PrintInfo() {
   for ($i = 0; $i < count($this->RelicName); $i++) {
     print "<TR><TD><b>{$this->RelicName[$i]}</b>";
     print "<TD>{$this->RelicType[$i]}</TD>";
     print "<TD>{$this->RelicRealm[$i]}</TD>";
     print "<TD>{$this->RelicOwner[$i]}</TD></TR>\n";
   }
 }

 function SetName($name) {
     $this->RelicName[] = $name;
 }

 function SetType($type) {
   $this->RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this->RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this->RelicOwner[] = $owner;
 }

}

class ServerInfo {
  var $ServerName = Array();
  var $ServerPopulation = Array();
  var $ServerType = Array();
  var $ServerStatus = Array();
  var $Totalpop = 0;
 function PrintInfo() {
   for ($i = 0; $i < count($this->ServerName); $i++) {
     print "<TR><TD><b>{$this->ServerName[$i]}</b>";
     if ($this->ServerType[$i]) { print
"(<i>{$this->ServerType[$i]}</i>)"; }
     print "</TD>";
     print "<TD>{$this->ServerStatus[$i]}</TD>";
     print "<TD>{$this->ServerPopulation[$i]}</TD></TR>\n";
   }
 }

 function PrintTotal() {
   print $this->Totalpop;
 }

 function SetServer($server) {
     $this->ServerName[] = $server;
 }

 function SetType($type) {
   $this->ServerType[] = $type;
 }

 function SetStatus($status) {
   $this->ServerStatus[] = $status;
 }

 function SetPopulation($pop) {
   $this->ServerPopulation[] = $pop;
   $this->Totalpop += $pop;
 }

}

function startElement($parser, $tagName, $attrs) {
global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag,
$da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm,
$da_keepname, $da_keeprealm;
 if ($insideitem) {
  $tag = $tagName;
 } elseif ($tagName == "RELIC")   {
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
  case "NAME": $da_relicname=$val;print $val;break;
  case "TYPE": $da_relictype=$val;break;
  case "REALM": $da_relicrealm=$val;break;
  } // end case
 } // end while

 } elseif($tagName == "SERVER")  {
       $depth[$parser]++;
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  if ($key == "NAME") { $da_server=$val; if($val == $ServerToPrint) {
$server = true; } else { $server = false; } }
  if ($key == "TYPE") { $da_type=$val; }
 } // end while
 } elseif($tagName == "KEEP")  {
 $insideitem = true;
 $insidekeep = true;
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
  case "NAME": $da_keepname=$val;break;
  case "REALM": $da_keeprealm=$val;break;
  } // end case
 } // end while
 }
}


function characterData($parser, $data) {
global $insideitem, $insidekeep, $tag, $da_server, $da_population, $da_type,
$da_status,$da_totalpop, $da_relicowner, $da_keepowner, $da_keepclaimant;
 if ($insideitem) {
 if ($insidekeep) {
  switch($tag) {
   case "OWNER" : $da_keepowner .= $data; break;
   case "CLAIMANT" : $da_keepclaimant .= $data; break;
  }
 } else {
    switch ($tag) {
  case "POPULATION": $da_population .= $data; $da_totalpop += $data; break;
  case "STATUS":  $da_status .= $data; break;
  case "OWNER":  $da_relicowner .= $data; break;
  }

 }
 }

}


function endElement($parser, $tagName) {
global $cserver, $ckeep, $crelic, $printedserver, $server, $depth,
$insideitem, $insidekeep, $tag, $da_server, $da_population, $da_type,
$da_status, $da_relicname, $da_relictype, $da_relicrealm, $da_relicowner,
$da_keepowner, $da_keepclaimant, $da_keepname, $da_keeprealm;
        $depth[$parser]--;

 if ($tagName == "SERVER") {
  if ($server) {
  //if (!$printedserver) { print
"<TD><B>Server</B></TD><TD><B>Status</B></TD><TD><B>Users</B></TD></TR>\n";
$printedserver=true; }
  $cserver->SetServer($da_server);
  $cserver->SetType($da_type);
  $cserver->SetStatus($da_status);
  $cserver->SetPopulation($da_population);
  }
   $da_server = "";
  $da_population = "";
  $da_status = "";
  $da_type = "";
  $insideitem = false;
 } elseif ($tagName == "RELIC") {
  if ($server) {
  $crelic->SetName($da_relicname);
  $crelic->SetType($da_relictype);
  $crelic->SetRealm($da_relicrealm);
  $crelic->SetRelicOwner($da_relicowner);
  }
  $da_relicname = "";
  $da_relictype = "";
  $da_relicrealm = "";
  $da_relicowner = "";
  $insideitem = false;
 } elseif ($tagName == "KEEP") {
  if ($server) {
  $ckeep->SetName($da_keepname);
  $ckeep->SetRealm($da_keeprealm);
  $ckeep->SetOwner($da_keepowner);
  $ckeep->SetClaimant($da_keepclaimant);
  }
  $da_keepname = "";
  $da_keeprealm = "";
  $da_keepowner = "";
  $da_keepclaimant = "";
  $insideitem = false;
  $insidekeep = false;
 }

}

// Create an XML parser
$xml_parser = xml_parser_create();

// Set the functions to handle opening and closing tags
xml_set_element_handler($xml_parser, "startElement", "endElement");

// Set the function to handle blocks of character data
xml_set_character_data_handler($xml_parser, "characterData");


// print "<hr>\n";
print "<TABLE BORDER=0 WIDTH=0%>\n<TR>\n";

// Open the XML file for reading
$fp = fopen("http://www.camelotherald.com/xml/servers.xml","r";)  or
die("Error reading RSS data.");

// Read the XML file 4KB at a time
while ($data = fread($fp, 4096))
// Parse each 4KB chunk with the XML parser created above
xml_parse($xml_parser, $data, feof($fp))
  or die(sprintf("XML error: %s at line %d",
   xml_error_string(xml_get_error_code($xml_parser)),
    xml_get_current_line_number($xml_parser)));
// Close the XML filef
fclose($fp);

$cserver->PrintInfo();
$crelic->PrintInfo();
$ckeep->PrintInfo();
print "</TABLE>\n";


// Free up memory used by the XML parser
xml_parser_free($xml_parser);



// end of file

?>


anyone got any idea why it misses one line of xml code?

regards
patrick


--- End Message ---
--- Begin Message ---
this line is only for debugging: print $val
located within these tags in startElement

  case "NAME": $da_relicname=$val;print $val;break;
  case "TYPE": $da_relictype=$val;break;


"Pafo" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i was almost done with everything  :)  and ofcourse i find a problem with
> the xml parser...
> the parser is not collection some vital information, and i dont know
why...
> the xmlsite is: http://www.camelotherald.com/xml/servers.xml
>
> the problem is market with a <-------------- :
> <server name="Guinevere" type="Roleplay" lastguildupdate="2002-08-18
> 12:28:53" lastcharupdate="2002-08-16 18:09:06">
>   <population>1707</population>
>   <status>Up</status>
> - <relic name="Scabbard of Excalibur" type="Melee" realm="Albion">
> <----------------------, the parser dosent retrive this line,, it gets
every
> line except this.
>   <owner>Midgard</owner>
>   </relic>
> - <relic name="Merlin's Staff" type="Magic" realm="Albion">
>   <owner>Hibernia</owner>
>   </relic>
> - <relic name="Thor's Hammer" type="Melee" realm="Midgard">
>   <owner>Midgard</owner>
>   </relic>
> - <relic name="Horn of Valhalla" type="Magic" realm="Midgard">
>   <owner>Hibernia</owner>
>   </relic>
> - <relic name="Lug's Spear of Lightning" type="Melee" realm="Hibernia">
>   <owner>Midgard</owner>
>   </relic>
> - <relic name="Cauldron of Dagda" type="Magic" realm="Hibernia">
>   <owner>Hibernia</owner>
>   </relic>
> .......
>
> if u run this script, it prints out everything except that.
> <?php
>
> //  ******************  Settings  ********************************
> $ServerToPrint = "Guinevere";
>
> // ***************************************************************
> //////////////////////////////////////////////////////////////////
> // START OF THE CODE
> $printedserver = false;
> $printedrelic = false;
> $printedkeep = false;
> $depth = array();
> $insideitem = false;
> $insidekeep = false;
> $tag = "";
> $server = false;
> $crelic = new RelicInfo;
> $cserver = new ServerInfo;
> $ckeep = new KeepInfo;
>
> class KeepInfo {
>   var $KeepName = Array();
>   var $KeepOwner = Array();
>   var $KeepRealm = Array();
>   var $KeepClaimant = Array();
>
>
>  function PrintInfo() {
>    for ($i = 0; $i < count($this->KeepName); $i++) {
>      print "<TR><TD><b>{$this->KeepName[$i]}</b>";
>      print "<TD>{$this->KeepRealm[$i]}</TD>";
>      print "<TD>{$this->KeepOwner[$i]}</TD>";
>      print "<TD>{$this->KeepClaimant[$i]}</TD></TR>\n";
>
>    }
>  }
>
>  function SetName($name) {
>      $this->KeepName[] = $name;
>  }
>
>  function SetOwner($owner) {
>    $this->KeepOwner[] = $owner;
>  }
>
>  function SetRealm($realm) {
>    $this->KeepRealm[] = $realm;
>  }
>
>  function SetClaimant($claim) {
>    $this->KeepClaimant[] = $claim;
>  }
> }
>
> class RelicInfo {
>
>   var $RelicName = Array();
>   var $RelicType = Array();
>   var $RelicRealm = Array();
>   var $RelicOwner = Array();
>
>  function PrintInfo() {
>    for ($i = 0; $i < count($this->RelicName); $i++) {
>      print "<TR><TD><b>{$this->RelicName[$i]}</b>";
>      print "<TD>{$this->RelicType[$i]}</TD>";
>      print "<TD>{$this->RelicRealm[$i]}</TD>";
>      print "<TD>{$this->RelicOwner[$i]}</TD></TR>\n";
>    }
>  }
>
>  function SetName($name) {
>      $this->RelicName[] = $name;
>  }
>
>  function SetType($type) {
>    $this->RelicType[] = $type;
>  }
>
>  function SetRealm($realm) {
>    $this->RelicRealm[] = $realm;
>  }
>
>  function SetRelicOwner($owner) {
>    $this->RelicOwner[] = $owner;
>  }
>
> }
>
> class ServerInfo {
>   var $ServerName = Array();
>   var $ServerPopulation = Array();
>   var $ServerType = Array();
>   var $ServerStatus = Array();
>   var $Totalpop = 0;
>  function PrintInfo() {
>    for ($i = 0; $i < count($this->ServerName); $i++) {
>      print "<TR><TD><b>{$this->ServerName[$i]}</b>";
>      if ($this->ServerType[$i]) { print
> "(<i>{$this->ServerType[$i]}</i>)"; }
>      print "</TD>";
>      print "<TD>{$this->ServerStatus[$i]}</TD>";
>      print "<TD>{$this->ServerPopulation[$i]}</TD></TR>\n";
>    }
>  }
>
>  function PrintTotal() {
>    print $this->Totalpop;
>  }
>
>  function SetServer($server) {
>      $this->ServerName[] = $server;
>  }
>
>  function SetType($type) {
>    $this->ServerType[] = $type;
>  }
>
>  function SetStatus($status) {
>    $this->ServerStatus[] = $status;
>  }
>
>  function SetPopulation($pop) {
>    $this->ServerPopulation[] = $pop;
>    $this->Totalpop += $pop;
>  }
>
> }
>
> function startElement($parser, $tagName, $attrs) {
> global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag,
> $da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm,
> $da_keepname, $da_keeprealm;
>  if ($insideitem) {
>   $tag = $tagName;
>  } elseif ($tagName == "RELIC")   {
>  $insideitem = true;
>  while (list ($key, $val) = each ($attrs)) {
>   switch($key) {
>   case "NAME": $da_relicname=$val;print $val;break;
>   case "TYPE": $da_relictype=$val;break;
>   case "REALM": $da_relicrealm=$val;break;
>   } // end case
>  } // end while
>
>  } elseif($tagName == "SERVER")  {
>        $depth[$parser]++;
>  $insideitem = true;
>  while (list ($key, $val) = each ($attrs)) {
>   if ($key == "NAME") { $da_server=$val; if($val == $ServerToPrint) {
> $server = true; } else { $server = false; } }
>   if ($key == "TYPE") { $da_type=$val; }
>  } // end while
>  } elseif($tagName == "KEEP")  {
>  $insideitem = true;
>  $insidekeep = true;
>  while (list ($key, $val) = each ($attrs)) {
>   switch($key) {
>   case "NAME": $da_keepname=$val;break;
>   case "REALM": $da_keeprealm=$val;break;
>   } // end case
>  } // end while
>  }
> }
>
>
> function characterData($parser, $data) {
> global $insideitem, $insidekeep, $tag, $da_server, $da_population,
$da_type,
> $da_status,$da_totalpop, $da_relicowner, $da_keepowner, $da_keepclaimant;
>  if ($insideitem) {
>  if ($insidekeep) {
>   switch($tag) {
>    case "OWNER" : $da_keepowner .= $data; break;
>    case "CLAIMANT" : $da_keepclaimant .= $data; break;
>   }
>  } else {
>     switch ($tag) {
>   case "POPULATION": $da_population .= $data; $da_totalpop += $data;
break;
>   case "STATUS":  $da_status .= $data; break;
>   case "OWNER":  $da_relicowner .= $data; break;
>   }
>
>  }
>  }
>
> }
>
>
> function endElement($parser, $tagName) {
> global $cserver, $ckeep, $crelic, $printedserver, $server, $depth,
> $insideitem, $insidekeep, $tag, $da_server, $da_population, $da_type,
> $da_status, $da_relicname, $da_relictype, $da_relicrealm, $da_relicowner,
> $da_keepowner, $da_keepclaimant, $da_keepname, $da_keeprealm;
>         $depth[$parser]--;
>
>  if ($tagName == "SERVER") {
>   if ($server) {
>   //if (!$printedserver) { print
>
"<TD><B>Server</B></TD><TD><B>Status</B></TD><TD><B>Users</B></TD></TR>\n";
> $printedserver=true; }
>   $cserver->SetServer($da_server);
>   $cserver->SetType($da_type);
>   $cserver->SetStatus($da_status);
>   $cserver->SetPopulation($da_population);
>   }
>    $da_server = "";
>   $da_population = "";
>   $da_status = "";
>   $da_type = "";
>   $insideitem = false;
>  } elseif ($tagName == "RELIC") {
>   if ($server) {
>   $crelic->SetName($da_relicname);
>   $crelic->SetType($da_relictype);
>   $crelic->SetRealm($da_relicrealm);
>   $crelic->SetRelicOwner($da_relicowner);
>   }
>   $da_relicname = "";
>   $da_relictype = "";
>   $da_relicrealm = "";
>   $da_relicowner = "";
>   $insideitem = false;
>  } elseif ($tagName == "KEEP") {
>   if ($server) {
>   $ckeep->SetName($da_keepname);
>   $ckeep->SetRealm($da_keeprealm);
>   $ckeep->SetOwner($da_keepowner);
>   $ckeep->SetClaimant($da_keepclaimant);
>   }
>   $da_keepname = "";
>   $da_keeprealm = "";
>   $da_keepowner = "";
>   $da_keepclaimant = "";
>   $insideitem = false;
>   $insidekeep = false;
>  }
>
> }
>
> // Create an XML parser
> $xml_parser = xml_parser_create();
>
> // Set the functions to handle opening and closing tags
> xml_set_element_handler($xml_parser, "startElement", "endElement");
>
> // Set the function to handle blocks of character data
> xml_set_character_data_handler($xml_parser, "characterData");
>
>
> // print "<hr>\n";
> print "<TABLE BORDER=0 WIDTH=0%>\n<TR>\n";
>
> // Open the XML file for reading
> $fp = fopen("http://www.camelotherald.com/xml/servers.xml","r";)  or
> die("Error reading RSS data.");
>
> // Read the XML file 4KB at a time
> while ($data = fread($fp, 4096))
> // Parse each 4KB chunk with the XML parser created above
> xml_parse($xml_parser, $data, feof($fp))
>   or die(sprintf("XML error: %s at line %d",
>    xml_error_string(xml_get_error_code($xml_parser)),
>     xml_get_current_line_number($xml_parser)));
> // Close the XML filef
> fclose($fp);
>
> $cserver->PrintInfo();
> $crelic->PrintInfo();
> $ckeep->PrintInfo();
> print "</TABLE>\n";
>
>
> // Free up memory used by the XML parser
> xml_parser_free($xml_parser);
>
>
>
> // end of file
>
> ?>
>
>
> anyone got any idea why it misses one line of xml code?
>
> regards
> patrick
>
>


--- End Message ---
--- Begin Message ---
Hello all,

I receive the following error msg when trying to load a php page after
installing php and a web server on XP home:

 "This PHP CGI binary was compiled with force-cgi-redirect enabled..."

So, I have changed the php.ini file in both c:\windows and c:\php to no
avail.  The same error msg is given after a reboot.

Any suggestions would be greatly appreciated!  I'm a novice at this stuff...

-Jonathan


--- End Message ---
--- Begin Message ---
I receive the following error msg when trying to load a php page:

 "This PHP CGI binary was compiled with force-cgi-redirect enabled..."

So, I have changed the php.ini file in both c:\windows and c:\php to no avail.  The 
same error msg is given.

Any suggestions would be greatly appreciated!

Jonathan Goulding
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hello,

I got some great help from this newsgroup a few days ago, and I'm 90%
complete with my project, but I have one snag.  I'm building a web page that
allows a business to import pictures of their products and then display them
on their page along ith other information.

My problem is getting in an image but displaying a thumbnail, and if
clicked, the original image.  The client only wants to load one image.  I'm
stuck at how to take the one image, copy it to the host server, and then
display a thumbnail of the image.  I can make the thumbnail linkable to the
larger image, and I can display the original image on my home PC, but that's
all local.

Please help.

Thanks,

Brian


--- End Message ---
--- Begin Message ---
>From reading your post, I believe you've successfully gotten the file upload
to work and now you're interested in using uploaded files (but with smaller
dimensions) on your webpage.  What you'll need to do is create a separate
file named resize.php which includes only the following code.

On your webpage you will call this file using the following:

<?
    print "<img src=resize.php title=\"small image\">";
?>

To see the error messages you'll need to substitute the above with:
<?
    print "<a href=resize.php>Click here</a>";
?>
Once you've deloused it you can revert to the img tag.

"resize.php" contains only the code below--with no blank line before the php
tag! "resize.php" will create a smaller image with a maximum dimension of
200 pixels.  Obviously, you can change this to some other method to get the
size you want.  Finally, the images generated aren't the best looking I've
seen, and if you've got a newer version of php than I've got access to, you
could change from imagecopyresized() to imagecopyresampled().

Hope this helps,
Hugh

<?php
    $picture="../photos/$userfile_name";  //or whatever you named your
uploaded files

    @$size=getimagesize($picture);
    $height=$size[1];
    $width=$size[0];


    $max=200;  // maximum dimension


    if ($height>$width)
     {
     $nheight=$max;
     $nwidth=$width/($height/$max);
     }
    else
     {
     $nwidth=$max;
     $nheight=$height/($width/$max);
     }

    $image=imagecreatefromjpeg($picture);
    $image1=imagecreate($nwidth,$nheight);

    imagecopyresized( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);

    header("content-type: image/jpeg");
    imagejpeg($image1);
    ImageDestroy($image);
    ImageDestroy($image1);
?>


----- Original Message -----
From: "Brian & Shannon Windsor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 18, 2002 10:48 AM
Subject: [PHP] newbie php image importing problems


> Hello,
>
> I got some great help from this newsgroup a few days ago, and I'm 90%
> complete with my project, but I have one snag.  I'm building a web page
that
> allows a business to import pictures of their products and then display
them
> on their page along ith other information.
>
> My problem is getting in an image but displaying a thumbnail, and if
> clicked, the original image.  The client only wants to load one image.
I'm
> stuck at how to take the one image, copy it to the host server, and then
> display a thumbnail of the image.  I can make the thumbnail linkable to
the
> larger image, and I can display the original image on my home PC, but
that's
> all local.
>
> Please help.
>
> Thanks,
>
> Brian
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Can anyone recommend a good Web-Based Mail System for php?  I know
that there are a few out there but I was wondering which was the best
(and easiest to setup)
--- End Message ---
--- Begin Message ---
IMP and SquirrelMail both do the job for me.

        IMP =   http://www.horde.org/imp/

        SquirrelMail =  http://www.squirrelmail.org/

~ Matthew


-----Original Message-----
From: Chill [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, August 18, 2002 2:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Web Based Mail


Can anyone recommend a good Web-Based Mail System for php?  I know that
there are a few out there but I was wondering which was the best (and
easiest to setup)

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

--- End Message ---
--- Begin Message ---
Horde is really great. I can definatelly recommend it to.

But why not stick with sendmail? It does a great job and is easier to
install with horde.

Andy


--
----------------------------------------------
http://www.globosapiens.net
Worldwide Travel Community



"Met" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000f01c246e7$ce853020$6901a8c0@SURVIVAL">news:000f01c246e7$ce853020$6901a8c0@SURVIVAL...
> IMP and SquirrelMail both do the job for me.
>
> IMP = http://www.horde.org/imp/
>
> SquirrelMail =  http://www.squirrelmail.org/
>
> ~ Matthew
>
>
> -----Original Message-----
> From: Chill [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, August 18, 2002 2:35 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Web Based Mail
>
>
> Can anyone recommend a good Web-Based Mail System for php?  I know that
> there are a few out there but I was wondering which was the best (and
> easiest to setup)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
On Sun, Aug 18, 2002 at 08:54:45PM +0200, Andy wrote:
> Horde is really great. I can definatelly recommend it to.
> 
> But why not stick with sendmail? It does a great job and is easier to
> install with horde.
> 
> Andy
>

Try http://www.openwebamil.org .

 
> 
> --
> ----------------------------------------------
> http://www.globosapiens.net
> Worldwide Travel Community
> 
> 
> 
> "Met" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> 000f01c246e7$ce853020$6901a8c0@SURVIVAL">news:000f01c246e7$ce853020$6901a8c0@SURVIVAL...
> > IMP and SquirrelMail both do the job for me.
> >
> > IMP = http://www.horde.org/imp/
> >
> > SquirrelMail =  http://www.squirrelmail.org/
> >
> > ~ Matthew
> >
> >
> > -----Original Message-----
> > From: Chill [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, August 18, 2002 2:35 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Web Based Mail
> >
> >
> > Can anyone recommend a good Web-Based Mail System for php?  I know that
> > there are a few out there but I was wondering which was the best (and
> > easiest to setup)
> >
> > --
> > 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
> 

-- 
Member - Liberal International  On 11 Sept 2001 the WORLD was violated.
This is [EMAIL PROTECTED]       Ici [EMAIL PROTECTED]
Society MUST be saved! Extremists must dissolve.  
Beware of defining as intelligent only those who share your opinions
--- End Message ---
--- Begin Message ---
www.squirrelmail.org

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
I think there is no message about the same idea.

I would need to parse html file and get all within href="" or href=''.
So I don't want to get all texts which could be links, but only content of
href variable within <a> tag.

Is there any easy way ? I have read hundreds of messages in this list today
but without any possitive idea found :(

Roman




--- End Message ---
--- Begin Message ---
Look up Regular Expressions.  Basically they allow you to search out
matches in strings such as <a> and any variable amount of letters
between the open and closed tags.  So you'd need to read in the entire
file into a string, chop out all the pesky page returns ('\n') and then
run your function using regular expressions inside of a loop of some
sort.

Check out these links:

        http://www.php.net/manual/en/ref.regex.php

        http://www.phpbuilder.com/columns/dario19990616.php3


~ Matthew

-----Original Message-----
From: Roman [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, August 18, 2002 4:20 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] hyperlink parser - a bit new view :)


I think there is no message about the same idea.

I would need to parse html file and get all within href="" or href=''.
So I don't want to get all texts which could be links, but only content
of href variable within <a> tag.

Is there any easy way ? I have read hundreds of messages in this list
today but without any possitive idea found :(

Roman





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

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

I would not please for help if I would not read those texts. Of course I've
read them both.

But on those phpbuilder's page there are also similar questions but answered
scripts don't work, for example:

$text="<a target=\"top\" href=\"http://aaa\";>ttrtert</a>";
preg_match_all("|href=\"?([^\"' >]+)|i(+[ >])", $text,$ar);
print_r($ar);

returns this:
Warning: Unknown modifier '(' in test.php on line 5     [line 5 is that line
with preg_match_all]
Array ( )


I really don't know :(

Roman

-----Original Message-----
From: MET [mailto:[EMAIL PROTECTED]]
Look up Regular Expressions.  Basically they allow you to search out
Check out these links:
        http://www.php.net/manual/en/ref.regex.php
        http://www.phpbuilder.com/columns/dario19990616.php3
~ Matthew


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

> But on those phpbuilder's page there are also similar questions but
answered
> scripts don't work, for example:
> ...
> preg_match_all("|href=\"?([^\"' >]+)|i(+[ >])", $text,$ar);
>...
> I really don't know :(


There's definitely something wrong with the RegEx above. The string
commences with |, so therefore the last characters of the string must be
|a - where "a" is a letter, in this case "i" meaning case-insensitive. For
some reason the |i is not at the end of the string - either you miscopied or
they misprinted.

However the RegEx doesn't strike me as correct HTML anyway, because there
can be spaces between elements, eg between "href" and "=", eg <href =
www.homepage.com, secondly if the URL is enclosed in quotation marks either
a single or double quotes may be used (' or ").

Unfortunately my RegEx skills are self-taught, so who knows how good/useless
my advice! Here is my current best attempt (abstracted from my web site
links checker routine):


$RegEx = "/(" . "href *" . "= *['\"]?)([^'\" >]*)(['\" >])/i";

if ( DEBUG ) echo "<br>RegEx=$RegEx~";

$bValidity = $iFound

            = preg_match_all( $RegEx, $HTML, $aRegExOut );

An improvement might be for the closing quotes to refer back to (any)
opening quotes. I am willing to watch, listen, and learn, if anyone can
offer improvements/wisdom.


Regards,
=dn


--- End Message ---
--- Begin Message ---
I have an array that looks like

$array = Array(
        Array($var1, $var2, $var3),
        Array($var1, $var2, $var3),
        Array($var1, $var2, $var3)
);

I want to sort the arrays within $array by $var3 (although if it helps i can 
easily change that to $var1). $var1 and $var2 are strings, $var3 is a number 
(in form of ([0-9]{3}\.[0-9]) )

I know i could put something together that would make a new, 
single-dimensional array that looks like Array(var3, var3, var3...), sort 
that, then use that as a reference point, but that's a really sloppy 
approach, and I'm thinking probably not the best way.

I have a feeling someone is just going to reply with only 
"php.net/somefunction" in the body of their message, and I'll feel stupid, 
but oh well. I can't find anything in the man.

Any input would be appreciated.


-Evan
--- End Message ---
--- Begin Message ---
usort(), uasort() or uksort().  uasort() has a nice little example in the
user comment.

On Sun, 18 Aug 2002, Evan Nemerson wrote:

> I have an array that looks like
>
> $array = Array(
>       Array($var1, $var2, $var3),
>       Array($var1, $var2, $var3),
>       Array($var1, $var2, $var3)
> );
>
> I want to sort the arrays within $array by $var3 (although if it helps i can
> easily change that to $var1). $var1 and $var2 are strings, $var3 is a number
> (in form of ([0-9]{3}\.[0-9]) )
>
> I know i could put something together that would make a new,
> single-dimensional array that looks like Array(var3, var3, var3...), sort
> that, then use that as a reference point, but that's a really sloppy
> approach, and I'm thinking probably not the best way.
>
> I have a feeling someone is just going to reply with only
> "php.net/somefunction" in the body of their message, and I'll feel stupid,
> but oh well. I can't find anything in the man.
>
> Any input would be appreciated.
>
>
> -Evan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Thanks Rasmus.



On Sunday 18 August 2002 02:37 pm, you wrote:
> usort(), uasort() or uksort().  uasort() has a nice little example in the
> user comment.
>
> On Sun, 18 Aug 2002, Evan Nemerson wrote:
> > I have an array that looks like
> >
> > $array = Array(
> >     Array($var1, $var2, $var3),
> >     Array($var1, $var2, $var3),
> >     Array($var1, $var2, $var3)
> > );
> >
> > I want to sort the arrays within $array by $var3 (although if it helps i
> > can easily change that to $var1). $var1 and $var2 are strings, $var3 is a
> > number (in form of ([0-9]{3}\.[0-9]) )
> >
> > I know i could put something together that would make a new,
> > single-dimensional array that looks like Array(var3, var3, var3...), sort
> > that, then use that as a reference point, but that's a really sloppy
> > approach, and I'm thinking probably not the best way.
> >
> > I have a feeling someone is just going to reply with only
> > "php.net/somefunction" in the body of their message, and I'll feel
> > stupid, but oh well. I can't find anything in the man.
> >
> > Any input would be appreciated.
> >
> >
> > -Evan
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
is there some way to save all the info that is after the .php? in a var?
need that for a function on my page, but I have no idea what to look for

Håkan


--- End Message ---
--- Begin Message ---
take a look at $QUERY_STRING. If that's not what you want, you should be able 
to find something in phpinfo();


On Sunday 18 August 2002 02:53 pm, you wrote:
> is there some way to save all the info that is after the .php? in a var?
> need that for a function on my page, but I have no idea what to look for
>
> Håkan
--- End Message ---
--- Begin Message ---
For a list of common system variables, refer to:
http://cs-people.bu.edu/stevec/cs101/02s/php5_system.html


--- End Message ---
--- Begin Message ---
How would I go about selecting rows from a MySQL table where the first
letter of a certain field is $letter ?

--
---------------------------------------------
[EMAIL PROTECTED]
http://www.cool-palace.com


--- End Message ---
--- Begin Message ---
Tony,

> How would I go about selecting rows from a MySQL table where the first
> letter of a certain field is $letter ?


Depends upon the MySQL tbl's schema.
The MySQL online manual discusses wildcards (full text).
Alternatively see LEFT() and other string functions that can be used in
SELECT and WHERE clauses.

Regards,
=dn


--- End Message ---
--- Begin Message ---

Try

Select blah from blah where blah like '$letter%'

% is wildcard after first letter

Regards.....

---------------------------------------------------------------------------
Chris Kay
Technical Support - Techex Communications 
Website: www.techex.com.au   Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 
Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 
Platinum Channel Partner of the Year - Request DSL - Broadband for Business
---------------------------------------------------------------------------

> -----Original Message-----
> From: DL Neil [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, 19 August 2002 8:43 AM
> To: Tony Harrison
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Find rows by 1st letter in MySQL
> 
> 
> Tony,
> 
> > How would I go about selecting rows from a MySQL table 
> where the first 
> > letter of a certain field is $letter ?
> 
> 
> Depends upon the MySQL tbl's schema.
> The MySQL online manual discusses wildcards (full text). 
> Alternatively see LEFT() and other string functions that can 
> be used in SELECT and WHERE clauses.
> 
> Regards,
> =dn
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
The following is the partial source for an upload form.. I'm having trouble with
the mail() function including the actual file name the user is sending instead
of "/tmp/phpIkRjHq"..

I understand that PHP will retain the file in a temporary directory (/tmp/)
until it is stored to the path I've specified (/uploaded/), but I don't
understand how to get it to print the new file name within the email it sends to
me.. Currently, it only prints the temporary file name as shown above..

As you can see, to the last $body variable, I've added both $info & $file as a
test, but $info returns null and $file returns the temp path/name only..
However, within the returned php/html page, the $file variable actually does
echo the actual file name the user chose to upload..

I'm a newbie, so hopefully I'm making sense.. Any ideas to help me fix this
problem would be appreciated.. Thanks in advance..

Take care.. peace..
eriol

====

<----SNIP---->

<?
$uppath = "/uploaded/";
$uptime = $uptime = date("mdy@his--");

$body = "The following information was submitted from $SERVER_NAME..\n\n";
$body .= $info ."\n\n". $file;

$info = NULL;

if(count($_FILES) > 0){
  $allowed_types = array("text/plain","text/html");
  $size_limit = "524288";
  $file = $_FILES["file"]["name"];
  $type = $_FILES["file"]["type"];
  $size = $_FILES["file"]["size"];
  $temp = $_FILES["file"]["tmp_name"];
  $path_info = pathinfo($PATH_TRANSLATED);
  $write_path = $path_info["dirname"] . "$uppath$uptime" . $file;
  if ($file){
    if ($size < $size_limit){
      if (in_array($type,$allowed_types)){
        if(move_uploaded_file($temp,$write_path)){
          $info = "<font class=\"s\"><tt>$file</tt> has been uploaded
successfully..</font>";
            if(!mail($email,$subject,$body,"Return-Path: <me@$SERVER_NAME>\r\n"
              ."From: me <me@$SERVER_NAME>\r\n"
              ."Reply-To: me@$SERVER_NAME\n"
              ."X-Mailer: $SERVER_NAME")){
              echo "uh..";
            }
.... a few else statements ...
  }
}
?>
<html>
  <body>
    <?php echo $info ?>
    <form enctype="multipart/form-data" action="<?php echo $PHP_SELF ?>"
method="POST">
      Upload:  <input name="file" type="file"> <input type="submit"
value="Upload">
    </form>
  </body>
</html>

<----/SNIP---->


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

  I have an XML file. I want to display a count of unique record(surname, forename) 
using XSL.  In the below example there are 3 records out of which 1 is duplicate in 
that case I want to display using XSL [Total = 2] 

  This is my xml file

----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="U:\karthikeyan\Report_Indi_PreAuthor.xsl"?>
<Recordset ReportName="Report Name" UserName="UserName" InsertedOn="InsertedOn">
  <row>
    <surname>Coates</surname>
    <forename>Arnold</forename>
    <ninumber>TL103080D</ninumber>
    <status>Applicant Active</status>
  </row>
  <row>
    <surname>Crowe</surname>
    <forename>Stephen</forename>
    <ninumber>NB305054C</ninumber>
    <status>Applicant Active</status>
  </row>
<row>
  <surname>Coates</surname>
  <forename>Arnold</forename>
  <ninumber>AB403869A</ninumber>
  <status>Confirmed Lead Active</status>
</row>
</Recordset>
---------

  Can anyone type a sample code of XSL for my requirement.

  Looking forward for yours response.

  Have a great day.

karthikeyan.
-------------------------------------------------------------------------------------------------------------
Judge not, that ye be not Judged - Abraham Lincoln's favorite quote
-------------------------------------------------------------------------------------------------------------
--- End Message ---

Reply via email to