Re: [PHP] translations for PHP app

2008-09-08 Thread Shawn McKenzie

Per Jessen wrote:

Shawn McKenzie wrote:


I need translations from English into the most common languages of my
users: Spanish, French, Italian, Chinese, Indian, Russian.  Also,
anyone having expertise in other languages, I would love to have them,
please contact me.


Maybe it's worth trying http://www.elance.com ?  (btw, Indian covers
several different languages). 



/Per Jessen, Zürich



I'll check it out thanks.  I probably want Hindi as that seems to be the 
official and predominant one.


-Shawn

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



Re: [PHP] translations for PHP app

2008-09-09 Thread Shawn McKenzie

tedd wrote:

At 9:12 PM -0500 9/7/08, Shawn McKenzie wrote:

Hi All,

I'm looking for professional translations from English of the following:
- admin.php lang file just under 150 PHP defines
- user.php lang file just under 30 PHP defines
- a javascript file with about 25 single word defines
- about 19 PHP files with 2 defines in each

Most defines are 1 or 2 words with a few being sentences.

I need translations from English into the most common languages of my 
users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, 
anyone having expertise in other languages, I would love to have 
them, please contact me.


I also have a 30+ page user guide for using my software.  Many pages 
contain large graphics, but the English text I woul love to have 
translated.


Of course I will pay.  PayPal only.

Thanks!
-Shawn



I can do the English to UK translations.  :-)

Cheers,

tedd


Haha.  I can do that dude!  I mean, I can do that mate!

Cheers,
-Shawn

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



Re: [PHP] Recommendation

2008-09-09 Thread Shawn McKenzie
I don't understand the question.  It is an email account that I check 
and I get mail from that address all the time.  Of course it's late/much 
wine and there may be some humor here that is totally escaping me.


-Shawn

tedd wrote:

At 10:15 AM -0500 9/2/08, Shawn McKenzie wrote:

Eric Butera wrote:

I'm on there too.

http://www.linkedin.com/in/ericbutera


Me too...

http://www.linkedin.com/in/rsmckenzie

-Shawn


-Shawn:

How do I get an email to you at: Shawn McKenzie [EMAIL PROTECTED] ?

Cheers,

tedd



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



Re: [PHP] tedd's back from vacation

2008-09-10 Thread Shawn McKenzie

tedd wrote:

At 10:05 PM -0400 9/9/08, Dan Joseph wrote:


Look, just because we let you out of your cage, doesn't mean you have 
to go

breaking your bones!  No more vacations!

BTW, was that dance in response to MSU winning 2 games in a row?

--
-Dan Joseph


Dan:

I only root for two schools: One is MSU and the other is any school who 
plays against U of M.


However, when I go on vacation there is no communication with the 
outside world whatsoever. No radio, no TV, no Internet, no email, no 
cell phone, absolutely nothing. I vacation on Beaver Island in the 
middle of Lake Michigan -- yes really, Beaver Island. :-)




No phones? No lights?  No motorcars?  Not a single luxury!?!?

The only thing I do is sit back and read php books. I finished two of 
them, namely Wicked Cool PHP and Webbots, Spiders, and Screen 
Scrapers -- that's my entertainment and relaxation.


However, I wasn't aware that MSU won anything -- but no matter if they 
did or not. If they win, everyone goes wild -- if not, then that's 
expected. So in both cases if you're a MSU fan, you win.  :-)


Cheers,

tedd




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



Re: [PHP] tedd's back from vacation

2008-09-10 Thread Shawn McKenzie

Wolf wrote:
 Shawn McKenzie [EMAIL PROTECTED] wrote: 

tedd wrote:

At 10:05 PM -0400 9/9/08, Dan Joseph wrote:
Look, just because we let you out of your cage, doesn't mean you have 
to go

breaking your bones!  No more vacations!

BTW, was that dance in response to MSU winning 2 games in a row?

--
-Dan Joseph

Dan:

I only root for two schools: One is MSU and the other is any school who 
plays against U of M.


However, when I go on vacation there is no communication with the 
outside world whatsoever. No radio, no TV, no Internet, no email, no 
cell phone, absolutely nothing. I vacation on Beaver Island in the 
middle of Lake Michigan -- yes really, Beaver Island. :-)



No phones? No lights?  No motorcars?  Not a single luxury!?!?


He said Beaver Island, so there were lots of DAMs to check out and sites to 
see!  :-D

Wolf


I guess i dream of a different beaver island.

-Shawn

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



Re: [PHP] Re: Recommendation

2008-09-10 Thread Shawn McKenzie

tedd wrote:

At 9:16 AM +0100 9/10/08, Colin Guthrie wrote:

Shawn McKenzie wrote:
I don't understand the question.  It is an email account that I check 
and I get mail from that address all the time.  Of course it's 
late/much wine and there may be some humor here that is totally 
escaping me.


I think it's just the accepted convention that nospam@anything 
usually points to an email black hole rather than a real account.


Col




That's it exactly.

Usually people use configurations like teddnospam@sperling.com where 
the nospam is to be removed.


However, with:

Shawn McKenzie [EMAIL PROTECTED]

I can't remove the nospam.

Cheers,

tedd

OK, gotcha.  I set this up a long time ago just to have an alias that I 
use for registrations etc, so that I can filter it at my email client 
and know that most are not important.  Also, I could probably delete it 
at anytime if I received too much spam. :-)


-Shawn

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



[PHP] Re: New Server Install

2008-09-10 Thread Shawn McKenzie

Robbert van Andel wrote:

I am working on a new webserver running Fedora 9.  I installed php-mysql and
php-mssql via yum.  When I try to connect to our mysql server using php, I
get the following error: Can't connect to MySQL server on 'mysqlservername'
(13)

 


Here's the weird part, I can connect to the mysql database server just fine
from the web server's command line so I'm pretty confident that it's not a
firewall issue.  While trying to connect using PHP, I see no packets leaving
the webserver. 

 


Any thoughts?

 


Thanks,

Robbert




Well, for MySQL there are multiple user perms.  In the user table you 
may see multiple entries for, let's say root.


mysql use mysql;
mysql select host,user,password from user;

hostuserpassword
*   root*22669F8A96AC3CE42B3E5E8087893840412E035F
localhost   root

So, root, if accessing from localhost, requires NO paswword.  But root, 
accessing from any other host requires a password.  Also, this could 
have more host entries, but probably not by default.


If your db server is on a different host from your web server, this or 
similar is most likely your problem.


-Shawn

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



[PHP] Re: New Server Install

2008-09-10 Thread Shawn McKenzie

Shawn McKenzie wrote:

Robbert van Andel wrote:
I am working on a new webserver running Fedora 9.  I installed 
php-mysql and
php-mssql via yum.  When I try to connect to our mysql server using 
php, I
get the following error: Can't connect to MySQL server on 
'mysqlservername'

(13)

 

Here's the weird part, I can connect to the mysql database server just 
fine
from the web server's command line so I'm pretty confident that it's 
not a
firewall issue.  While trying to connect using PHP, I see no packets 
leaving

the webserver.
 


Any thoughts?

 


Thanks,

Robbert




Well, for MySQL there are multiple user perms.  In the user table you 
may see multiple entries for, let's say root.


mysql use mysql;
mysql select host,user,password from user;

hostuserpassword
*root*22669F8A96AC3CE42B3E5E8087893840412E035F
localhostroot

So, root, if accessing from localhost, requires NO paswword.  But root, 
accessing from any other host requires a password.  Also, this could 
have more host entries, but probably not by default.


If your db server is on a different host from your web server, this or 
similar is most likely your problem.


-Shawn


Or, there is no * entry (all hosts).  In which case you should add a 
specific entry for your web server.


-Shawn

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



Re: [PHP] Re: New Server Install

2008-09-11 Thread Shawn McKenzie



Tom Chubb wrote:



2008/9/11 Ashley Sheridan [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]


I believe that MySQL uses a particular port when connecting over a
network such as you're doing. I can't remember the exact port number,
but you can Google it. Just check that there's nothing blocking this
port either on your computer, the server, or the router/switch or
whatever else you are using to connect the computers on the network


Ash
www.ashleysheridan.co.uk http://www.ashleysheridan.co.uk


-- Forwarded message --
From: Shawn McKenzie [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
To: php-general@lists.php.net mailto:php-general@lists.php.net
Date: Wed, 10 Sep 2008 21:31:41 -0500
Subject: [PHP] Re: New Server Install
Shawn McKenzie wrote:

Robbert van Andel wrote:

I am working on a new webserver running Fedora 9.  I
installed php-mysql and
php-mssql via yum.  When I try to connect to our mysql
server using php, I
get the following error: Can't connect to MySQL server on
'mysqlservername'
(13)

 
Here's the weird part, I can connect to the mysql database

server just fine
from the web server's command line so I'm pretty confident
that it's not a
firewall issue.  While trying to connect using PHP, I see
no packets leaving
the webserver.
 
Any thoughts?


 
Thanks,


Robbert



Well, for MySQL there are multiple user perms.  In the user
table you may see multiple entries for, let's say root.

mysql use mysql;
mysql select host,user,password from user;

hostuserpassword
*root*22669F8A96AC3CE42B3E5E8087893840412E035F
localhostroot

So, root, if accessing from localhost, requires NO paswword.
 But root, accessing from any other host requires a password.
 Also, this could have more host entries, but probably not by
default.

If your db server is on a different host from your web server,
this or similar is most likely your problem.

-Shawn


Or, there is no * entry (all hosts).  In which case you should add
a specific entry for your web server.

-Shawn

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


I was trying to access MySQL on a remote server from an Excel 
spreadsheet and I think it was port 3306 but I still haven't got it 
working yet!

HTH


Install MyODBC and setup an ODBC connection on your PC.

-Shawn

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



Re: [PHP] Error message

2008-09-20 Thread Shawn McKenzie

Terry J Daichendt wrote:
The  error message told it all. Jochem was correct albiet not in the 
style I prefer. I had the code in an HTML page after the header. I've 
been a programmer for 15 years but I'm brand new to PHP. Anyone can make 
a rookie mistake. Thanks everyone for the help. Everyone was partially 
correct in assessing the problem.


Terry



Eric Gorr [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote:

I'm pasting this code from the example at php.net and getting these 
errors. Can anyone determine what I'm doing wrong?


?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';
?


Well, this is weird. When I copied your text and tried it myself, the 
error I got was:


Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/ 
Sites/page1.php on line 9


Now, of course, there is nothing visibly wrong with line 9 
($_SESSION['animal'] = 'cat';). But, when I had my text editor show 
invisible characters, there were some on that line and line 10.


Do you have a text editor that can show invisible characters?

On the Mac, the one I really like (and is free) is TextWrangler 
(http://www.barebones.com/products/textwrangler/ ) and has this 
capability. This may be part of your problem. Once I  got rid of the 
invisible characters, the example worked without any  problems.


Also, are you certain there are no spaces or anything (even invisible 
characters) before ?php?


Whenever I've gotten a similar error in the past, that was nearly  
always the problem. You are welcome to compress the text file and 
send  it to me directly so I can see exactly what it contains.




Since you're a PHP rookie, to sum it up:  there can not be any output 
before you start a session.


When PHP interprets a file (include or otherwise) it considers anything 
before ?php as HTML, so it outputs it as HTML (newlines, spaces, 
whatever).  So if you have whitespace before the ?php, then the PHP 
interpreter outputs it, thus the output before the session_start() error.


-Shawn

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



[PHP] Re: Just testing IGNORE!!!

2008-09-24 Thread Shawn McKenzie

uaca man wrote:




Did IGNORE!!!  pass or fail the testing?

-Shawn

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



Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-27 Thread Shawn McKenzie
Ashley Sheridan wrote:
 On Sat, 2008-09-27 at 23:10 +0400, ANR Daemon wrote:
 Greetings, Richard Heyes.
 In reply to Your message dated Friday, September 26, 2008, 12:41:32,

 Please don't top post any more. thank you.
 Because it's such a cardinal sin and will result in you being sent
 straight to hell. I've heard that it's not so nice there at this time
 of year, though the heat is more bearable.
 to the bottom !
 from the top
 to read
 it's easier
 Because


 -- 
 Sincerely Yours, ANR Daemon [EMAIL PROTECTED]


 ¡ǝɹǝɥʇ pıp noʎ ʇɐɥʍ ǝǝs ı `ǝɥǝɥ
 
 
 Ash
 www.ashleysheridan.co.uk
 
Haha.  How did you do that?

-Shawn

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



Re: [PHP] PHP + Cron jobs

2008-09-29 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Waynn Lue wrote:
 Yup, you're completely right.  I checked the cronjob and got this:

 PHP 5.2.6 (cgi) (built: Aug 11 2008 13:39:32)
 Copyright (c) 1997-2008 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Advanced PHP Debugger (APD) v0.9, , by George Schlossnagle

 Turns out there's /usr/bin/php, which is the cgi version, and
 /usr/local/bin/php, which is the cli version.  So I see three possiblities.
 1. Change the shebang on the php script itself, 2. change the crontab to
 reflect to path I care about, or 3. replace /usr/bin/php.  I'd prefer the
 3rd, but does that cause problems for me in my actual web pages?

 Thanks,
 Waynn

 Depends upon whether your webserver is using the PHP CGI binary or the
 apache module.  I thought common convention was that the CGI was named
 php-cgi?
 
 I would rename '/usr/bin/php' to '/usr/bin/php-cgi', grep your web
 server conf file(s) for /usr/bin/php and if found then change it to
 /usr/bin/php-cgi.
 
 -Shawn
 
Along with that, I would opt for always using the full path in the cron job.

-Shawn

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



Re: [PHP] PHP + Cron jobs

2008-09-29 Thread Shawn McKenzie
Waynn Lue wrote:
 Yup, you're completely right.  I checked the cronjob and got this:
 
 PHP 5.2.6 (cgi) (built: Aug 11 2008 13:39:32)
 Copyright (c) 1997-2008 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Advanced PHP Debugger (APD) v0.9, , by George Schlossnagle
 
 Turns out there's /usr/bin/php, which is the cgi version, and
 /usr/local/bin/php, which is the cli version.  So I see three possiblities.
 1. Change the shebang on the php script itself, 2. change the crontab to
 reflect to path I care about, or 3. replace /usr/bin/php.  I'd prefer the
 3rd, but does that cause problems for me in my actual web pages?
 
 Thanks,
 Waynn
 
Depends upon whether your webserver is using the PHP CGI binary or the
apache module.  I thought common convention was that the CGI was named
php-cgi?

I would rename '/usr/bin/php' to '/usr/bin/php-cgi', grep your web
server conf file(s) for /usr/bin/php and if found then change it to
/usr/bin/php-cgi.

-Shawn


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



Re: [PHP] How to submit form via PHP

2008-09-29 Thread Shawn McKenzie
Lupus Michaelis wrote:
 Ashley Sheridan a écrit :
 
   From the link you gave, we stick on
 http://www.w3.org/TR/html401/types.html#type-uri, so it references an
 IETF RFC http://www.ietf.org/rfc/rfc1808.txt that describes what is an
 URI.
 
   The fourth section describes how we have to determine the resolution
 of an URI. The point that are in our scope is the next I quote :
 
 «
 a) If the embedded URL is entirely empty, it inherits the
   entire base URL (i.e., is set equal to the base URL)
   and we are done.
 »
 
   If you have any doubt, just enjoy reading the full document ;)
 
   But for me, it is quite clear that an empty string is a valid URI
 *into* a document served by HTTP.
 

I almost got used to the schreefing and now the a écriting!

-Shawn

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



[PHP] Re: SESSION array problems

2008-10-01 Thread Shawn McKenzie
tedd wrote:
 Hi gang:
 
 Apparently, there's something going on here that I don't understand --
 this happens far too often these days.
 
 Here's a print_r($_SESSION); of the session arrays I'm using:
 
 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )
 
 [first_name] = Array
 (
 [0] = Diane
 [1] = Fred
 [2] = Helen
 )
 
 [last_name] = Array
 (
 [0] = Cable
 [1] = Cago
 [2] = Cahalan
 
 
 The following is how I tried to access the data contained in the
 $_SESSION arrays:
 
 $num_users = count($_SESSION['user_id']);
 
 for ($i = 0; $i  $num_users; $i++)
 {
 $last_name = $_SESSION['last_name'][$i];
 $first_name = $_SESSION['first_name'][$i];
 echo(p$last_name, $first_name/p);
 }
 
 The only thing that came out correct was the first echo. The remaining
 echos had no values for $first_name or $last_name.
 
 What's happening here?
 
 Cheers,
 
 tedd
 
 
 PS: I'm open to other suggestions as to how to do this.

What do you get if you do a print_r($_SESSION) just before this loop?

-Shawn

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



[PHP] Re: SESSION array problems

2008-10-01 Thread Shawn McKenzie
Shawn McKenzie wrote:
 tedd wrote:
 Hi gang:

 Apparently, there's something going on here that I don't understand --
 this happens far too often these days.

 Here's a print_r($_SESSION); of the session arrays I'm using:

 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )

 [first_name] = Array
 (
 [0] = Diane
 [1] = Fred
 [2] = Helen
 )

 [last_name] = Array
 (
 [0] = Cable
 [1] = Cago
 [2] = Cahalan


 The following is how I tried to access the data contained in the
 $_SESSION arrays:

 $num_users = count($_SESSION['user_id']);

 for ($i = 0; $i  $num_users; $i++)
 {
 $last_name = $_SESSION['last_name'][$i];
 $first_name = $_SESSION['first_name'][$i];
 echo(p$last_name, $first_name/p);
 }

 The only thing that came out correct was the first echo. The remaining
 echos had no values for $first_name or $last_name.

 What's happening here?

 Cheers,

 tedd


 PS: I'm open to other suggestions as to how to do this.
 
 What do you get if you do a print_r($_SESSION) just before this loop?
 
 -Shawn

Also, echo $num_users;

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



Re: [PHP] SESSION array problems

2008-10-01 Thread Shawn McKenzie
tedd wrote:
 At 2:43 PM -0500 10/1/08, Afan Pasalic wrote:
 just tested. works fine



 $_SESSION = array(
 '6156' = array(
 'first_name'= 'Diane',
 'last_name' = 'Cable'),
 '7030' = array(
 'first_name'= 'Fred',
 'last_name' = 'Cago'),
 '656' = array(
 'first_name'= 'Helen',
 'last_name' = 'Cahalan')
 );

 echo 'pre';
 print_r($_SESSION);

 foreach ($_SESSION as $key = $value)
 {
 echo $_SESSION[$key]['last_name'].',
 '.$_SESSION[$key]['first_name'].'br';
 }

 -afan
 
 -afan:
 
 That's fine, but that's not the problem.
 
 The problem is:
 
  $_SESSION['user_id'][] = '6156';
  $_SESSION['first_name'][]  = 'Diane';
  $_SESSION['last_name'][]= 'Cable';
 
  $_SESSION['user_id'][] = '1234';
  $_SESSION['first_name'][]  = 'Big';
  $_SESSION['last_name'][]= 'Ron';
 
  $_SESSION['user_id'][] = '8867';
  $_SESSION['first_name'][]  = 'Joe';
  $_SESSION['last_name'][]= 'Dirt';
 
 Now, how do you retrieve it?
 
 Cheers,
 
 tedd
 

Must be something else in your code or some bad server config, because
this works great for me:

?php

session_start();

$_SESSION['user_id'][] = '6156';
$_SESSION['first_name'][]  = 'Diane';
$_SESSION['last_name'][]= 'Cable';

$_SESSION['user_id'][] = '1234';
$_SESSION['first_name'][]  = 'Big';
$_SESSION['last_name'][]= 'Ron';

$_SESSION['user_id'][] = '8867';
$_SESSION['first_name'][]  = 'Joe';
$_SESSION['last_name'][]= 'Dirt';

$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++)
{
$last_name = $_SESSION['last_name'][$i];
$first_name = $_SESSION['first_name'][$i];
echo(p$last_name, $first_name/p);
}

?

Outputs this:

Cable, Diane

Ron, Big

Dirt, Joe

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



[PHP] Re: Yeah I'm sortof a noob

2008-10-09 Thread Shawn McKenzie
Frank Stanovcak wrote:
 I'm trying to follow the three precepts of accepting user entries...
 1. never trust it.
 2. never trust it.
 3. never trust it ever!
 
 I have one entry that may equal 0 on submission, and if it does is tripping 
 a bool false result, so I came up with this work around.  However when I put 
 this in my code the page fails to load.  What did I do wrong, and please be 
 specific.  I already know I'm stupid, and to answer the question.  The extra 
 ';' are for my clarity to know that is the end of the if or foreach 
 statement.  Plus it carried over from java script and keeps me out of 
 trouble as I flip between the two.
 
 I am looking for the instance when the key is 'ExtraCases' as that is the 
 field that will possibly be zero on submission.
 
 //check to make sure all the entries passed
 foreach($Filtered as $ThisKey = $ThisVar) {
  if($ThisVar == FALSE) {
   if(($ThisKey == 'ExtraCases') and 
 (filter_has_var(INPUT_POST,'ExtraCases'))) {
if($_POST['ExtraCases'] == 0) {
 $noProb = TRUE;
} else {
 $Continue = FALSE;
 $WrongData[$ThisKey] = TRUE;
};
   } else {
$Continue = FALSE;
$WrongData[$ThisKey] = TRUE;
   };
  };
 }; 
 
 

Well, I haven't studied your code to see the problem, but I'm replying
to your workaround.  You should be able to code this without the
workaround if you use the correct comparison operators.

== is untyped value comparison
=== is a strict comparison (must be same value AND same type, boolean,
string, int, etc...)

These are correct:
0 == false
'' == false
null == false
69 == true
'false' == true

These are not:
0 === false
'' === false
null === false
69 === true
'false' === true

-Shawn




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



Re: [PHP] Login

2008-10-09 Thread Shawn McKenzie
Richard Heyes wrote:
 Unless that was the business you were in ;)
 
 True enough, but what kind of business would that be...? :-)
 

Rating poo, of course...

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



[PHP] Re: Remove index.php from url

2008-10-11 Thread Shawn McKenzie
OOzy Pal wrote:
 Hello,
 
 I expect that this question been beaten to death. I googled for many hours
 and all what I found is related to one CMS or another. I want to do is to
 make a very very very simple index.php that when is it called it
 automatically detect the page and load it. For example, when I call
 
 www.xyz.com/index.php/company, it calls for company.html. I have made that
 index.php. Now I need to remove this index.php from the url.
 
 Can you help?
 
mod_rewite if you use Apache.  In the simplest form (not tested):

.htaccess

RewriteRule ^index\.php\/(.*)$ $1 [L,NC,NS]

HTH
-Shawn

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



[PHP] Re: Remove index.php from url

2008-10-11 Thread Shawn McKenzie
Shawn McKenzie wrote:
 OOzy Pal wrote:
 Hello,

 I expect that this question been beaten to death. I googled for many hours
 and all what I found is related to one CMS or another. I want to do is to
 make a very very very simple index.php that when is it called it
 automatically detect the page and load it. For example, when I call

 www.xyz.com/index.php/company, it calls for company.html. I have made that
 index.php. Now I need to remove this index.php from the url.

 Can you help?

 mod_rewite if you use Apache.  In the simplest form (not tested):
 
 .htaccess
 
 RewriteRule ^index\.php\/(.*)$ $1 [L,NC,NS]
 
 HTH
 -Shawn
Scrub that.  The rule is backwards.  But mod_rewrite is the answer.

-Shawn

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



[PHP] Re: How to know what current system is?

2008-10-13 Thread Shawn McKenzie
Jiang Miao wrote:
 Is there any function do that?
 when php in Linux it returns linux
 in windows it returns windows
 
 I found phpinfo(INFO_GENERAL); output the string System = Linux ubuntu
 2.6.24-19-server. but I have no idea to get that info.
 
 Thanks
 Jiang Miao
 

PHP_OS constant.

-Shawn

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



[PHP] Re: Csv issue

2008-10-13 Thread Shawn McKenzie
[EMAIL PROTECTED] wrote:
 I am using a form to select a csv file and then import it into mysql and 
 maybe im just drawling a blank here. But why is it blowing up.
 This thing loads like 14 million records into the database and I am clue less 
 how it can do that with a 2 record csv file.
 
 form enctype='multipart/form-data' action=? method=post
 Upload:input type=file name=filename
 input type=submit value='Upload'/form
 
 
 $row = 1;
 $filename = $_POST['filename'];
 $handle = fopen($filename, r);
 while (($data = fgetcsv($handle, 1000, ,)) !== FALSE)
 {
 $num = count($data);
 echo p $num fields in line $row: br //p\n;
 $row++;
 }
 fclose($handle);
 print Import done;
 
 This will produce millions of lines until i go in and stop the process on the 
 server. I know its stupid but im drawling a blank as to why its doing this. 
 The csv file has 2 lines in period. 
 p 0 fields in line 1: br //p
 p 0 fields in line 2: br //p
 ect for millions of records.
Try:

print_r(file($_POST['filename']));

And see if you get what you expect.  You might also want to have
error_reporting at its highest and display_errors also.

-Shawn

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



Re: [PHP] Re: Csv issue

2008-10-14 Thread Shawn McKenzie


[EMAIL PROTECTED] wrote:
 OKay now i am really stumped.
 Notice: Undefined index: filename
 When clearly I have it being set in the form with the file.
 Any suggestions?



 [EMAIL PROTECTED] wrote:
   
 I am using a form to select a csv file and then import it into mysql and 
 
 maybe im just drawling a blank here. But why is it blowing up.
   
 This thing loads like 14 million records into the database and I am clue 
 less 
 
 how it can do that with a 2 record csv file.
   
 form enctype='multipart/form-data' action=? method=post
 Upload:input type=file name=filename
 input type=submit value='Upload'/form


 $row = 1;
 $filename = $_POST['filename'];
 $handle = fopen($filename, r);
 while (($data = fgetcsv($handle, 1000, ,)) !== FALSE)
 {
 $num = count($data);
 echo p $num fields in line $row: br //p\n;
 $row++;
 }
 fclose($handle);
 print Import done;

 This will produce millions of lines until i go in and stop the process on 
 the 
 
 server. I know its stupid but im drawling a blank as to why its doing this. 
 The 
 csv file has 2 lines in period. 
   
 p 0 fields in line 1: br //p
 p 0 fields in line 2: br //p
 ect for millions of records.
 
 Try:

 print_r(file($_POST['filename']));

 And see if you get what you expect.  You might also want to have
 error_reporting at its highest and display_errors also.

 -Shawn

   

Please reply to the list.  I missed it the first time around, but you
need to use the $_FILES array: 
http://php.net/manual/features.file-upload.php

-Shawn

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



[PHP] Re: Output to matrix printer

2008-10-14 Thread Shawn McKenzie
Dušan Novaković wrote:
 I have some request to sent text to matrix printer to print ticket for
 theater. Is it possible to do that whit some php functions? Main point
 is how to control length of paper that will be drawn inside and to
 print text on a specific place. It would be nice if somebody can write
 the code about this as example.
 
 Thnx, Dusan
 

Matrix printer?  Is this an awesomely powerful matrix of multiple
printers high output printers?

-Shawn


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



Re: [PHP] Re: Output to matrix printer

2008-10-15 Thread Shawn McKenzie
Per Jessen wrote:
 Shawn McKenzie wrote:
 
 Matrix printer?  Is this an awesomely powerful matrix of multiple
 printers high output printers?

 -Shawn
 
 http://en.wikipedia.org/wiki/Matrix_printer
 
 
 /Per Jessen, Zürich
 
Ha,ha, yes I know.  My first printer was a
http://en.wikipedia.org/wiki/Daisy_wheel
after which I have owned several http://en.wikipedia.org/wiki/Matrix_printer

-Shawn

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Shawn McKenzie
Nathan Rixham wrote:
 Evening All,
 
 I'd be /really/ interested to know who uses what!
 
 *Procedural or OOP?*
Procedural for small stuff - OOP for larger stuff when using framework

 *Dev OS*
Kubuntu Hardy Heron

 
 *Dev PHP Version*
5.2.4

 
 *Live Server OS*
FC 6

 
 *Live Server PHP Version*
5.1.6

 
 *Which HTTP Server Software (+version)?*
Apache 2

 
 *IDE / Dev Environment*
Aptana for large projects / Kate for files, etc...

 
 *Preferred Framework(s)?*
CakePHP

 
 *Do you Unit Test?*
Huh?

 
 *Most Used Internal PHP Class*
None

 
 *Preferred OS CMS*
PostNuke, mainly because it's what I'm used to

 
 *Anything else you use frequently in you're PHP'ing that's worth
 mentioning:*
 
 ps: I'm not asking for any kind of research project, just interested and
 interested to know what's most common + might learn something/find some
 new tools/toys!
 
 pps: will reply myself as well but if I do here it'll make your
 intertwined replies messy!
 
 Many Regards
 
 Nathan

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Nathan Rixham wrote:
 Evening All,

 I'd be /really/ interested to know who uses what!

 *Procedural or OOP?*
 Procedural for small stuff - OOP for larger stuff when using framework
 
 *Dev OS*
 Kubuntu Hardy Heron
 
 *Dev PHP Version*
 5.2.4
currently (whatever is current for os)
 
 *Live Server OS*
 FC 6
 
 *Live Server PHP Version*
 5.1.6
 
 *Which HTTP Server Software (+version)?*
 Apache 2
2.2 actually
 
 *IDE / Dev Environment*
 Aptana for large projects / Kate for files, etc...
 
 *Preferred Framework(s)?*
 CakePHP
 
 *Do you Unit Test?*
 Huh?
 
 *Most Used Internal PHP Class*
 None
 
 *Preferred OS CMS*
 PostNuke, mainly because it's what I'm used to
 
 *Anything else you use frequently in you're PHP'ing that's worth
 mentioning:*
As I saw other posts, it triggered SVN.  I even use it locally.  Never
know when you'll do something stupid that doesn't show up for a while
and you need to go back in time.

 ps: I'm not asking for any kind of research project, just interested and
 interested to know what's most common + might learn something/find some
 new tools/toys!

 pps: will reply myself as well but if I do here it'll make your
 intertwined replies messy!

 Many Regards

 Nathan

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



[PHP] Re: Form Loop

2008-10-18 Thread Shawn McKenzie
Terry J Daichendt wrote:
 I'm trying to create a form with a loop. I need to append a value to a
 field name each time through the loop. For Instance:
 
 while ($row = mysql_fetch_assoc($result)) {
 $x=1;
 echo tr;echo tdinput type='text' id='qty'
 name='quantity_'  size='2' value='$row[qty]' //td;
 echo /tr;
 $x++;
 }
 
 the name value quantity needs the value of x appended to it. quantity_1,
 quantity_2 etc. What is the correct syntax to achieve this, especially
 the parsing to get it to work. I suspect the dot operator to append it
 but I can't get the parsing down.
 
 Terry Daichendt

echo 'tdinput type=text id=qty name=quantity_' . $x . '
size=2 value=' . $row['qty']. ' //td';

However, I would use an array:

echo 'tdinput type=text id=qty name=quantity[' . $x . ']
size=2 value=' . $row['qty']. ' //td';

Depending upon your use, you can even leave out the index and let it
increment.

echo 'tdinput type=text id=qty name=quantity[] size=2
value=' . $row['qty']. ' //td';

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Form Loop

2008-10-19 Thread Shawn McKenzie
Rick Pasotto wrote:
 On Sat, Oct 18, 2008 at 08:07:26PM -0500, Shawn McKenzie wrote:
 Terry J Daichendt wrote:
 I'm trying to create a form with a loop. I need to append a value to a
 field name each time through the loop. For Instance:

 while ($row = mysql_fetch_assoc($result)) {
 $x=1;
 echo tr;echo tdinput type='text' id='qty'
 name='quantity_'  size='2' value='$row[qty]' //td;
 echo /tr;
 $x++;
 }

 the name value quantity needs the value of x appended to it. quantity_1,
 quantity_2 etc. What is the correct syntax to achieve this, especially
 the parsing to get it to work. I suspect the dot operator to append it
 but I can't get the parsing down.

 Terry Daichendt
 echo 'tdinput type=text id=qty name=quantity_' . $x . '
 size=2 value=' . $row['qty']. ' //td';

 However, I would use an array:

 echo 'tdinput type=text id=qty name=quantity[' . $x . ']
 size=2 value=' . $row['qty']. ' //td';

 Depending upon your use, you can even leave out the index and let it
 increment.

 echo 'tdinput type=text id=qty name=quantity[] size=2
 value=' . $row['qty']. ' //td';
 
 Ids must be unique within a document.
 
Yeah, I just copied and pasted and was concentrating on the name.

echo 'tdinput type=text id=qty' . $x . ' name=quantity[]
size=2 value=' . $row['qty']. ' //td';

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Remote Developer Wanted

2008-10-20 Thread Shawn McKenzie
Jochem Maas wrote:
 Andy Dyble schreef:
 Hi

 I am looking for a remote developer for small add hoc jobs.  Usually
 only a few hours at a time. Basic stuff, listing data from SQL and text
 files. Mainly work on existing systems.
 
 personally I'd run in the other direction based on that description,
 I mean who decides what's simple, how long something should take, etc.
 
 my experience of working on 'existing systems' is usually akin to wading
 neckdeep through crap you wouldn't wish on your worst enemy. really well
 thought out, well written code usually has competent people working on it
 already ... code that stinks generally gets no attention because nobody
 wants to work on/with it which is people end up scouring the net looking
 for someone desperate enough to take a shot at it.
 
 $10-$15 per hour depending on location.
 
 Im sure there is an indian outsourcing solution to fit your needs, your from
 the UK and quoting dollars ... your low-end is just over 5 pound sterling an 
 hour,
 I can flip burgers at Macdonalds for more.
 
 there are plenty of market places on the net where tenders can be placed for 
 this
 kind of thing.
 
 just so you know ... at lot of the regular people doling out free advice on 
 this
 list command somewhere in the region of 8 to 10 times what your willing to 
 pay ...
 if not more.

Here, here.  Even with the worst economy since the great depression
(ehem), I still wouldn't accept less than $60 an hour and I'm not even a
professional (not my profession) programmer.  It seems to still be
working out for me :-)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Difficulty navigating symlinks

2008-10-22 Thread Shawn McKenzie
Seth Foss wrote:
 Hi everyone,
 
 I am trying to run multiple sites on the same server, that have mostly
 identical code - a pre-built application.
 
 Anyway, I would like to save  disk space by specifying independent
 configuration files for each site, then using symbolic links to access
 the rest of the code for the application.
 
 I have managed to configure apache so one such directory is accessed via
 a symlink, which is ok. However, a file within the linked directory
 attempts to include the configuration file (../config.php) from the
 actual parent directory instead of the directory containing the symlink.
 
 Is there any way to configure apache or php to trace back the symlink
 when using '..', or can that only go one direction?
 
 Thanks,
 Seth
Haven't read the entire thread, but you might also look at
http://php.net/manual/en/function.realpath.php

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Politics

2008-10-22 Thread Shawn McKenzie
David Robley wrote:
 Jim Lucas wrote:
 
 Chrome wrote:
 -Original Message-
 From: Amy [mailto:[EMAIL PROTECTED]
 Sent: 21 October 2008 11:58
 To: php-general@lists.php.net
 Subject: [PHP] Politics


 representations emphasizing leksr matching thirds painfully wakesleep
 ekswiezeezeewie accompanied
 Have you tried restarting Apache? :)
 no, no, no, she said painfully, she must be using IIS... :)

 Try upgrading all your drivers and then restarting...
 
 No - reboot, reinstall, reinstall Windows.
 
 
 
 Cheers
No - scandisk, defrag, reboot, reinstall

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: E_STUPID

2008-10-22 Thread Shawn McKenzie
[EMAIL PROTECTED] wrote:
 I think we need a new error reporting constant E_STUPID.
 
 This should catch stupid things I do like trying to embed an array into a 
 string such as:
 
 $foo = array('a', 'b', 'c');
 $query = select * from foo where foo in ('$foo');
 
 It's been one of those days...
 
That's my new t-shirt idea I'm with E_STUPID

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Interactive canvas example

2008-10-26 Thread Shawn McKenzie
Richard Heyes wrote:
 Hi,
 
 Had to show this off - I'm so proud. READ: full of myself... I've
 tried it in Firefox 3, Opera 9.6, Chrome and Safari, all on Windows.
 
 http://dev.rgraph.org/examples/interactive.html
 
Very nice.  Looks good on Kubuntu FF3.  The only issue I see is that no
matter which bar I click on, it says January 2007 Sales: 80%, which
may just be your example, but I would think each bar should be different.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: clean data

2008-10-28 Thread Shawn McKenzie
blackwater dev wrote:
 I have a project now where we would like to properly remove unwanted data
 before it goes into the db such as ` and of course slashes.  The problem is
 I have tons of pages.  Is there an easy way to add in a clean up routine on
 the db side to clean it going in and coming out without having to touch each
 page that inserts it into the db and each page that presents it?
 
 I'm using a MySQL db.
 
 
 Thanks!
 

Just do a global search/replace on all of your files replacing
mysql_query with to mysafe_query.  Then in one of your always included
files create a mysafe_query() function to do the sanitizing that you
want.  There are lots of free tools to do this.  I use kfilereplace on
kubuntu.  I wrote a simple one for windows in C# which you can have.

If needed, you could also extend this to mysql_fetch_row() etc...

-Shawn

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Mailing lists

2008-10-30 Thread Shawn McKenzie
Richard Heyes wrote:
 It's
 exceedingly easy to configure and use.
 
 Not as easy as setting up a Google group, which I've just done... :-)
 For anyone whose interested: http://groups.google.com/group/rgraph
 

OH GOD MY EYES ARE BLEEDING!  Is that a breast cancer awareness group?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Mailing lists

2008-10-30 Thread Shawn McKenzie
Robert Cummings wrote:
 On Thu, 2008-10-30 at 15:48 -0500, Daniel P. Brown wrote:
 On Thu, Oct 30, 2008 at 3:44 PM, Ashley Sheridan
 [EMAIL PROTECTED] wrote:
 Called English for a reason you Yank ;)
 Hey, my forefathers, foremothers, fore-aunts and -uncles, et
 cetera, didn't spend the last two-hundred-thirty-two years butchering
 the language just for you to correct us, Sheridan!  If you guys had
 gotten it right in the first place, we wouldn't have had to improve
 it!  ;-P
 
 Says the guy who's ancenstors also threw a King's ransom in tea into a
 harbour... most people in the world call that idiocy... but then, didn't
 your government just recently hand out a King's ransom to shoddy
 businesses that got themselves into a spot of trouble over questionable
 lending practices... some descendents never learn from their
 forefathers' and mothers' mistakes.
 
 ;D
 
 Cheers,
 Rob.

Yeah, at least we elected them...  Oh wait...

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Mailing lists

2008-10-31 Thread Shawn McKenzie
Robert Cummings wrote:
 On Fri, 2008-10-31 at 09:02 -0500, Daniel P. Brown wrote:
 On Fri, Oct 31, 2008 at 4:06 AM, Richard Heyes [EMAIL PROTECTED] wrote:
 Improuve? Thaut's nout whaut Iu'd caull iut...
 And while we're on the subject, who gave that Canadian the right
 to say anything about OUR English down here?  We drop the 'U', but
 they replace it with another 'O' in speech!  It's aboot time yoo folks
 spoke properly, Cummings!  ;-P
 
 I think you're confusing us witht he Scotts.
 
 Cheers,
 Rob.

No doot aboot it.  No, he's not confused.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Mailing lists

2008-11-01 Thread Shawn McKenzie
Dotan Cohen wrote:
 2008/10/30 Shawn McKenzie [EMAIL PROTECTED]:
   
 Richard Heyes wrote:
 
 It's
 exceedingly easy to configure and use.
 
 Not as easy as setting up a Google group, which I've just done... :-)
 For anyone whose interested: http://groups.google.com/group/rgraph

   
 OH GOD MY EYES ARE BLEEDING!  Is that a breast cancer awareness group?

 

 OMG Pwnies!
   
Fixed that for you.

-Shawn

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



Re: [PHP] object persistence within a session

2008-11-07 Thread Shawn McKenzie
tedd wrote:
 At 7:08 PM +0100 11/7/08, Jochem Maas wrote:
 Stan schreef:
  If this is the wrong forum, please point me at the correct forum.

  I am new to PHP but have 40 years experience programming.

 cool. we're you around when they programmed with Rocks[tm]? :-)
 (stick around a while and you'll get to know that inside joke)
 
 
 Rocks?! Did someone say Rocks? Did I ever tell you about programming
 with rocks
 
 Egads, not another old fart.  :-)
 
 Well, welcome to the group oldster and get ready to learn from these
 up-starts. I don't know when these youngsters passed me, but they did.
 
 Cheers,
 
 ted
 
Stan is a young whipper - snapper.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] while-question

2008-11-19 Thread Shawn McKenzie
bruce wrote:
 interesting points regarding college and programming..
 
 my degrees bsee/msee covered alot more than pure programing.. as a double 
 ee/cs, the ability to articulate an issue/problem, and bring to mind a cogent 
 thought process was valuable. the ability to understand how different 
 algorithms worked, and how code actually played with the lower intracacies of 
 the processor where quite valuable. 
 
 and no.. i'm no longer the engineer i was a time ago..
 
 so.. interesting...
 

They must have been case-insensitive languages, unlike English.  :-)

-Shawn

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



Re: [PHP] Form Input Type=File

2008-11-22 Thread Shawn McKenzie
Stan wrote:
 Ashley,
 If you go back to the original append you will see the URLs.  IE 6 SP1
 returns exactly the string that appears in the input name=\SELECTEDFILE\
 type=\file\ / text box, FireFox does not.  I would assume that anyone
 using the dialog would expect the behaviour that IE demonstrates.
 
 www.w3.org doesn't say anything about the return value.
 
 These are the only 2 browsers that I have available.
 
 What I need to know is: Which is behaving as all browsers will behave going
 forward?
 
 

If I remember correctly, when you POST a form the values are urlencoded
automagically.  But your form method is GET so you should probably
urlencode the values, especially the ones with non-alphanumeric
characters like {, }, etc...

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Some kind of Popup

2008-11-22 Thread Shawn McKenzie
Patrick Moloney wrote:
 I have web pages that display multiple physical products. I'd like to be
 able to include a button near each one to display certain
 characteristics (eg: height, length, depth, weight etc).
 These characteristics will be in a single table record in Mysql for each
 product, so I can retrieve the record for that product. The question is,
 how to display them. I'd like a small display window to appear in front
 of the web page.
 If possible, I'd like the user to be able to move it or request the
 specs for another product, and then have both displayed.
 I realize that can get messy, and is not absolutely necessary.
 I have considered locating an invisible display box near each product,
 but I think some kind of floating window would be better.
 The web page uses CSS.
 Any ideas on how to proceed?

Two options that come to mind:

1. Have a little link to details.php?product_id=X with target=_blank,
then in details.php query for the details using the product_id and display.

2. Same as 1 except use a javascript popup via onclick() so that you can
control the look of the window (no toolbars, menu, etc...)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Some kind of Popup

2008-11-22 Thread Shawn McKenzie
Patrick Moloney wrote:
 
 Would #2 be blocked by user popup blocker?

I guess it depends on the popup blocker, but I would say no since it
requires user action to open the window.  I think most popup blockers
block automatic popups.  This popup technique works for me with firefox
when I have it set to block popups.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Form Input Type=File

2008-11-23 Thread Shawn McKenzie
Stan wrote:
 I surrender.
 
 My web site is too complex to explain here.
 


Yes, I poked around on it from the link in your previous email.  I must
say that it appears that you have made things much more complex than
they need to be.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Voting methodology

2008-12-01 Thread Shawn McKenzie
tedd wrote:
 Hi gang:
 
 What methodology would be the best for online voting?
 
 I have a client who is a Union and they want members to vote online, but
 don't want someone to stuff the voting box.
 
 I have some ideas of my own, but would like to hear what you people
 would recommend.
 
 Cheers,
 
 tedd
 

Being a union I would expect that they want some way to control the
stuffing to their advantage.  :-)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-04 Thread Shawn McKenzie
Jim Lucas wrote:
 Boyd, Todd M. wrote:
 -Original Message-
 From: Jagdeep Singh [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 04, 2008 8:39 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to fetch .DOC or .DOCX file in php
 Importance: Low

 Hi !

 I want to fetch text from .doc / .docx file and save it into database
 file.
 But when  I tried to fetch text with fopen/fgets etc ... It gave me
 special
 characters with text.

 (With .txt files everything is fine)
 Only problem is with doc/docx files.
 I dont know whow to remove SPECIAL CHARACTERS from this text ...
 A.) This has been handled on this list several times. Please search the
 archives before posting a question.
 B.) Did you even TRY to Google for this? In the first 5 matches for php
 open ms word I found this:

 http://www.developertutorials.com/blog/php/extracting-text-from-word-doc
 uments-via-php-and-com-81/

 You will need an MS Windows machine for this solution to work. If you're
 using *nix... well... good luck.


 // Todd

 
 Ah, not true about the MS requirement.  If all you want is the clear/clean
 text (without any formatting), then I can do it with php on any platform.
 
 If this is what is needed, here is the code to do it.
 
 ?php
 
 $filename = './12345.doc';
 if ( file_exists($filename) ) {
 
   if ( ($fh = fopen($filename, 'r')) !== false ) {
 
   $headers = fread($fh, 0xA00);
 
   # 1 = (ord(n)*1) ; Document has from 0 to 255 characters
   $n1 = ( ord($headers[0x21C]) - 1 );
 
   # 1 = ((ord(n)-8)*256) ; Document has from 256 to 63743 
 characters
   $n2 =   ( ( ord($headers[0x21D]) - 8 ) * 256 );
 
   # 1 = ((ord(n)*256)*256) ; Document has from 63744 to 16775423 
 characters
   $n3 =   ( ( ord($headers[0x21E]) * 256 ) * 256 );
 
   # (((ord(n)*256)*256)*256) ; Document has from 16775424 to 
 4294965504 characters
   $n4 = ( ( ( ord($headers[0x21F]) * 256 ) * 256 ) * 256 );
 
   # Total length of text in the document
   $textLength = ($n1 + $n2 + $n3 + $n4);
   
   $extracted_plaintext = fread($fh, $textLength);
   
   # if you want the plain text with no formatting, do this
   echo $extracted_plaintext;
   
   # if you want to see your paragraphs in a web page, do this
   echo nl2br($extracted_plaintext);
 
   }
 
 }
 
 ?
 
 Hope this helps.
 
 I am working on a set of php classes that will be able to read the text with 
 the formatting included and convert it to a standard document format.
 The standard format that it will end up in has yet
 
has yet...  what?

Are you O.K. Jim?  Did you die while writing this?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: SV: [PHP] Sending files via POST

2009-01-06 Thread Shawn McKenzie
Anders Norrbring wrote:
 On Fri, Jan 2, 2009 at 14:14, Anders Norrbring li...@norrbring.se
 wrote:
 *bump*
 Please don't bump threads, Anders.  This is not a traditional
 web-based user forum.  You've provided no additional data, so there is
 no need to bring this thread up again.  If you want to get more
 attention to it, you will need to send a reply to the list with
 updated information.  The last response in this thread was from Nathan
 Rixham.  If you didn't receive that message, you can find it in the
 archives, or I'll be glad to forward it to you.  If it didn't solve
 your problem, you can say so and folks here will be happy to help you
 further.
 
 
 I provided some additional data at 2009-01-01 09:33.. (That would be GMT+1
 hour)
 But after that.. I didn't get *anything* at all, not from Nathan, not from
 anybody else.
 
 And I'm fully aware of the distinctions between a mailing list and a web
 based forum. After all, I've been in this business (computers and
 communications) since 1979 (Yeah, I'm that old...). But I didn't get any
 replies whatsoever, neither in private nor in the list, therefore I felt an
 urge to do something to draw some attention to this matter.
 
 And yes Daniel, I'm fully aware that my specific question isn't a PHP
 general issue, but a PEAR related issue, more specific it's related to
 PEAR:HTTP_Request, nevertheless I firmly believe it's of common interest.
 
 If you don't share my view, I'll be happy to be flamed in private, not on
 list.

Oh, you may not be happy, but you may well be flamed on list :-)

 
 Best regards, and wishes for a happy 2009,
 Anders.
 


-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: [PHP-DB] data from db to a page and then to another page

2009-01-07 Thread Shawn McKenzie
Dan Shirah wrote:
 On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi mika.jaa...@gmail.com wrote:
 
 I already can get the data from database to a page. Now I want to make link
 from that data to next page and on that new page it should show all the
 data
 that is related.

 example:

 data from database
 --
 page1 where listed:

 band1 (a href)
 band2 (a href)
 band3 (a href)
 ...

 and when clicking for example band3
 --
 page2 where listed band info:

 bandname
 bandhistory
 bandmembers
 ...

 So, how should I do this? Should I somehow use $_POST method to
 send/deliver
 band_id to the next page?

 
 You could do several things.
 
 1) Use javascript to make a link using the band3 value within the Javascript
 to pass the ID to the next page.
 
 Example:
 
 Have a Javascript function -
 
 script language=JavaScript
 !--
 function openWin(band_id) {
  var link
  link = my/directory/display.php?band_id=' + band_id;
  MyWin = window.open(link,OpenPage);
  MyWin.focus();
 }
 //--
 /script
 
 And then call that function when you click on the band you want.
 
 a href=javascript:openWin('?php echo $band_id; ?')?php echo $band;
 ?/a
 
 2) You could use form objects (radio buttons/check boxes/dropdown box etc)
 to pass the band_id value via POST
 
 Then on your second page all you would have to do is get the value.
 
 Example:
 input type=radio tabindex=1 name=band value=?php echo $band_id;
 ?
 input type=radio tabindex=2 name=band value=?php echo $band_id;
 ?
 input type=radio tabindex=3 name=band value=?php echo $band_id;
 ?
 
 On the second page you would simply check the posted value of you band
 radio input:
 
 $band_id = $_POST['band'];
 
 Hope that helps.
 
 Dan
 

Maybe too simple, but just use a get var in the link of page1:

a href=page2.php?band=1Band1/a
a href=page2.php?band=2Band2/a

Then in page2 use $_GET['band'] and do your query. (of course checked
and sanitized, yadayada...)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Remote File Variable Injection Safety?

2009-01-07 Thread Shawn McKenzie
Daniel Kolbo wrote:
 Hello,
 
 suppose there is a file at http://otherhost.com/remote.php that looks
 like this:
 
 ?php
 if (!isset($safe_flag))
 {
die(hacking attempt);
 }
 echo You are in;
 ?
 
 Suppose i executed the following php file at http://myhost.com/local.php
 
 ?php
 require_once(http://otherhost.com/remote.php;);
 ?
 
 Is there any way to get local.php to display You are in, by only
 modifying local.php?  That is, is there a way to set $safe_flag on the
 remote host as one requests a file from the remote host from within
 local.php?
 
 I have genuine, academic, non-belligerent intentions when asking this
 question.
 
 Thanks,
 dK
 
 
 

local.php

?php

$safe_flag = 1;
require_once(http://otherhost.com/remote.php;);

?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Cannot Install mysql extension

2009-01-08 Thread Shawn McKenzie
Gary wrote:
 Ok...so the error log is riddled with messages like this
 
 PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\Program 
 Files\\PHP\\ext\\php_mysql.dll' - The specified procedure could not be 
 found.\r\n in Unknown on line 0
 
 The php_mysl.dll is located at C:\Program Files\PHP\ext\php.ini
 
 Not sure if the extra \ is a product of the error log or the cause of the 
 issue...
 
 Any suggestions?
 
 Thanks for all your help.
 
 Gary
 
 Nathan Rixham nrix...@gmail.com wrote in message 
 news:49665c45.2080...@gmail.com...
 Gary wrote:
 Nathan

 Thanks for all your help, but it is not working.  The files were/are 
 named php_mysql.dllso I replace them.

 I did the advanced install, choosing only those extensions I wanted, 
 including mywsql and mysqli

 I have already reinstalled the php5.2.8

 Again, thanks, but Im getting frustrated at spending all day on this...
 ko - you'll find the exact answer to you're problems in you're apache 
 error log - it'll tell you exactly what wasn't loaded and why.

 also verify that the location of you're php.ini stated in the phpinfo 
 output is actually where you're php.ini is stored. 
 
 
Try moving C:\Program Files\PHP\libmysql.dll to c:\Windows

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Convert CMYK values to RGB values?

2009-01-09 Thread Shawn McKenzie
c...@l-i-e.com wrote:
 Short Answer:
 
 You can't.
 :-)
 
 http://en.wikipedia.org/wiki/CMYK
 
 Long Answer:
 You probably can, but not in some way that makes sense to discuss here on 
 PHP-general.
 
 The external links in the above article should get you started.
 

May not always come out with the best colors, but the rough formula is:

Black   = minimum(1-Red,1-Green,1-Blue)
Cyan= (1-Red-Black)/(1-Black)
Magenta = (1-Green-Black)/(1-Black)
Yellow  = (1-Blue-Black)/(1-Black)

Write your own little functions to convert.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Adding extension to an existing PHP install

2009-01-12 Thread Shawn McKenzie
Tim Donnelly wrote:
 I seem to recall reading something about Apache modules that you can do
 a configure, then make, but not the make install and just move the newly
 compiled module by hand.
 
 Is that possible with PHP? If so, where would the newly complied
 extension be, and where would it need to be moved?
 
 Thanks
 
 I always just do a phpinfo on the box I'm upgrading, grab the
 .configure 
 line and re-use it adding in or changing what I need; that way it's
 sure 
 to be the same?
 
 
 
 
 Hello list,

  

 I have a PHP (5.2.1) installation on an openSUSE 10.1 server.  PHP was
 initially compiled from source and I have the original config.nice
 file,
 so I know what options were used.  l need to add an extension to this
 running installation, specifically I need to add LDAP support.

  

 How is the best way to do this?  I know I can recompile and reinstall,
 but I am worried that some extensions may have been added after the
 initial install and my new installation would overwrite those.  

  
 
 
 
The binary should be in the dir where you ran make (I think) and you
should put it in the dir specified in your php.ini for extensions.


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] PHP unlink Permission Error

2009-01-13 Thread Shawn McKenzie
Alice Wei wrote:
 Hi, Ashley:
  
   I thought about it and edited my script to check what permission I had, and 
 it appears I do have the permission rights, and it actually changed to 0777. 
 Here is the code:
 ?php
  
 ini_set('display_errors', 1); error_reporting(E_ALL);
 $curDir = getcwd();
 chmod($curDir,0777) or die (Failed to change permission);
 echo substr(sprintf('%o', fileperms($curDir)), -4); 
 unlink(testFile.txt);
 echo unlink(testFile.txt);  
  
 ? 
  
 The output:
  
 0777Warning: unlink(testFile.txt) [function.unlink]: Permission denied in 
 C:\Inetpub\wwwroot\project\file_write.php on line 10Warning: 
 unlink(testFile.txt) [function.unlink]: Permission denied in 
 C:\Inetpub\wwwroot\project\file_write.php n line 11If this is the case, how 
 come I don't have the permissions to delete the file?
 Thanks again.
  
 Alice Subject: Re: [PHP] PHP unlink Permission Error From: 
 a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: 
 php-general@lists.php.net Date: Tue, 13 Jan 2009 14:53:32 +  On Tue, 
 2009-01-13 at 09:42 -0500, Alice Wei wrote:  Hi, I have a snippet 
 of code as follows:?phpini_set('display_errors', 1); 
 error_reporting(E_ALL);  $curDir = getcwd();  echo $curDir;  
 chmod($curDir,0777);  unlink(testFile.txt);  echo 
 unlink(testFile.txt);   chmod ($curDir,0755);  ? The problem 
 is that I do not seem to have the correct permissions, even though I seem to 
 have changed the permissions of the folder to 777 already upon the file 
 deletion time. This is the output I got:
 C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: 
 Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 
 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in 
 C:\Inetpub\wwwrootproject\file_write.
php on line 10Could anyone give me some tips on how to resolve this 
error? Thanks in advance.Alice  
_  All-in-one 
security and maintenance for your PC. Get a free 90-day trial!  
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail  You're 
using chmod to modify the permissions of the directory, but do you actually 
have permissions to modify the permissions? If not, the chmod will fail 
without giving an error, and then your unlink will fail with an error.   
Ash www.ashleysheridan.co.uk 
 _
 Search from any Web page with powerful protection. Get the FREE Windows Live 
 Toolbar Today!
 http://get.live.com/toolbar/overview

Just because you have perms to change the dir and have set the dir to
777 doesn't mean you have perms to delete the file?  Who is the owner of
the file and what are the perms?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php session GC error

2009-01-13 Thread Shawn McKenzie
Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following
 
 session.gc_probability = 1
 session.gc_divisor = 1
 
 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30
 
 I am now getting this error
 
 PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: 
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in 
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2
 
 What do I have to do to make this work right?
 
 Frank 
 
 

Does C:\WINDOWS\TEMP\ exist?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] switch vs elseif

2009-01-13 Thread Shawn McKenzie
Micah Gersten wrote:
 Jochem Maas wrote:
 switch (true) {
  case ($x === $y):
  // something
  break;

  case ($a != $b):
  // something
  break;

  case (myFunc()):
  // something
  break;

  case ($my-getChild()-hasEatenBeans()):
  // something
  break;
 }

 evil ... but it works.


   
   
 This is a misuse of the switch statement.  Switch is meant to compare
 values to a single variable as stated on the manual page:
 http://us2.php.net/switch
 
 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com
 

Actually, if you read the link you posted, the first paragraph: In many
occasions, you may want to compare the same variable (or expression)
with many different values, and execute a different piece of code
depending on which value it equals to. This is exactly what the switch
statement is for.

Notice the (or expression), which I believe true is one.

Also, down the page: The case expression may be any expression that
evaluates to a simple type, that is, integer or floating-point numbers
and strings. Arrays or objects cannot be used here unless they are
dereferenced to a simple type.

I believe boolean is also one.

I would point out however that the switch does a loose comparison, so
this would be different:

switch (true) {
case (strpos(shawn, s)):
//actually returns 0 so is false
break;

case (strpos(shawn, s) !== false):
//returns true
break;
}

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php session GC error

2009-01-13 Thread Shawn McKenzie
Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message 
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' 
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case 
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case 
 matters? :)
 ok...let me try it like this.
 
 how do I explicitly tell PHP in the ini what directory to use for session 
 storage and cleanup.  I've been googling for about an hour now, and am just 
 getting more frustrated.  :(
 
 The server is a single purpose server, and it will remain that way, so I 
 don't want to have to code ini settings into each page.  :)
 
 Frank 
 
 
Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Basic Authentication

2009-01-14 Thread Shawn McKenzie
tedd wrote:
 What it is depends on what encryption routines you have installed.

 The algorithm to authenticate detects the algorithm based on the hash.

 32-char : MD5
 $1$ : SHA-1
 $2$ : SHA-2
 etc.
 (Apologies if I got my tokens/algorithms wrong)

 If you just toss MD5s in there, it should work, I think, if you have
 MD5 installed and available.

 It picks the best available when it adds a new entry.

 So an old file might look like:

 #your box came with MD5 installed
 joe:MD5
 alice:MD5
 #you installed SHA-2
 bob:SHA-2
 lee:SHA-2

 At least, that's been my experience so far...
 
 
 The problem I have is that the sever I'm working on is not mine, thus no
 way for me to get shell access.
 
 I assumed that the server used a different encoding than MD5 because the
 string it generates is very short, such as:
 
 jYYjNLrifgUxk
 
 Clearly this is not MD5 encoding and thus the reason for my original post.
 
 I do have before and after examples I could use to identify what
 algorithm was used. I just need to know what algorithms could have been
 used and (if it's not too much to ask) working example of each.
 
 Cheers,
 
 tedd
 
 

As others have said, use crypt().
http://php.net/manual/function.crypt.php has Example #2 Using crypt()
with htpasswd.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] PHP Javascript header

2009-01-15 Thread Shawn McKenzie
Applejus wrote:
 Hello there,
 
 Kind of newbie to PHP and javascript... I have this problem:
 
 I want to pass a javascript variable to a PHP code.
 I am inside a javascript function that is creating HTML elements
 dynamically. After creating a select tag, I want to populate it with a
 list of variable names from $_SESSION['subgroupcolumn'] .
 Here is part of the code:
 
 .
 .
 .
 location.href=subgroup.php?m= + m;
 var linner= for ($c=1; $c  $_SESSION['rows']; $c++){ echo( 'option
 value=' . $c . '' . $_SESSION['subgroupcolumn'][$c][0] . '/option\n' );
 } ;
 document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner
 ;
 .
 .
 .
 Since we cannot pass a javascript var to PHP directly, I am redirecting to
 subgroup.php and sending the variable (m) and getting it there using a
 $_GET. Now the question: 
 In subgroup.php, after I get the variable m, I create the
 $_SESSION['subgroupcolumn'] array then I redirect to the initial page.
 Obviously it's not working because the code after
 location.href=subgroup.php?m= + m; is not executing after coming back to
 the initial page
 
 How do I make it to continue executing the javascript code?
 
 I hope it's clear...
 
 Thanks for your help.
 
 

The problem is that you are changing the location of the page and then
chaning the location back.  Really you need an AJAX call using
XMLHttpRequest.  There are probably easier examples, but here is one:

http://www.w3schools.com/PHP/php_ajax_suggest.asp

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Looking for an app...

2009-01-15 Thread Shawn McKenzie
bruce wrote:
 Hi List!
 
 
 I know this is somewhat basic.. and I am searching google as I type! I'm
 looking for a client/server app that allows me to have a quick/dirty client
 that can upload/download a file to a server app, with the server app copying
 the file to a given dir...
 
 Code samples, or pointers to a site where I can download this would be
 great!! I don't want a straight FTP, as I want to do more things with the
 server piece...
 
 And yes, a php/apache kind of app would be cool..
 
 thanks!!
 
 -g
 

I remember opendocman, owl and philer, though I've never used them.
Depending upon the features you need you can easily write your own.

HTML form with an input type=file
PHP file to acept and move the file
PHP file to view files in certain directory

http://us3.php.net/manual/en/features.file-upload.post-method.php

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] how to display new icon for news posted within 2 days?

2009-01-15 Thread Shawn McKenzie
paragasu wrote:
 is it possible to do it like
SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl
 
$post = mysqli_fetch_object($sql);
if($post-is_new)
echo 'img src=new.gif';

From what I can tell, you'll just have a timestamp 2 days earlier than
the actual post date in the is_new var.  So unless the post date is
172800 or earlier it will eval to true.  How about:

SELECT *, UNIX_TIMESTAMP(post_date) as ts FROM tbl

if($post-ts  (time()-172800)) {
echo 'img src=new.gif';
}


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] how to display new icon for news posted within 2 days?

2009-01-15 Thread Shawn McKenzie
Shawn McKenzie wrote:
 paragasu wrote:
 is it possible to do it like
 SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl
 $post = mysqli_fetch_object($sql);
 if($post-is_new)
 echo 'img src=new.gif';
 
 From what I can tell, you'll just have a timestamp 2 days earlier than
 the actual post date in the is_new var.  So unless the post date is
 172800 or earlier it will eval to true.  How about:
 
 SELECT *, UNIX_TIMESTAMP(post_date) as ts FROM tbl
 
 if($post-ts  (time()-172800)) {
   echo 'img src=new.gif';
 }
 
 
In MySQL 5+ something like this may work with your code:

SELECT *, IF(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) -
UNIX_TIMESTAMP(post_date)  172800, 1, 0)
AS is_new FROM tbl

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] To check for existing user in database

2009-01-16 Thread Shawn McKenzie
Lars Torben Wilson wrote:
 2009/1/15 tedd tedd.sperl...@gmail.com:
 At 9:46 AM -0800 1/15/09, Chris Carter wrote:

 Chris:

 That's not the way I would do it. After establishing a connection with the
 database, I would use the query:

 $query SELECT email FROM owners WHERE email = '$emailAddress' :
 $result = mysql_query($query) or die(mysql_error());

 if(mysql_affected_rows())
   {
   // then report a duplicate email/record.
   }
 else
   {
  // else insert a new record in the dB.
   }

 HTH's

 tedd
 
 You want to use mysql_num_rows() there instead of
 mysql_affected_rows(). (Just a typo in this case, I suspect, but for
 the benefit of the less experienced it's worth pointing out.)
 
 For the newer PHP users, mysql_num_rows() tells you the number of rows
 you found with a SELECT query, while mysql_affected_rows() tells you
 how many rows you affected with an INSERT, UPDATE, REPLACE INTO, or
 DELETE query.
 
 
 Regards,
 
 Torben

mysql_num_rows() may make more sense, however mysql_affected_rows() will
work the same with a select.  The PHP mysql_affected_rows() calls the
MySQL mysql_affected_rows(), which states:

For SELECT statements, mysql_affected_rows() works like mysql_num_rows().

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Shawn McKenzie
Boyd, Todd M. wrote:
 -Original Message-
 From: farn...@googlemail.com [mailto:farn...@googlemail.com] On Behalf
 Of Edmund Hertle
 Sent: Thursday, January 15, 2009 4:13 PM
 To: PHP - General
 Subject: [PHP] Parsing HTML href-Attribute

 Hey,
 I want to parse a href-attribute in a given String to check if there
 is a
 relative link and then adding an absolute path.
 Example:
 $string  = 'a class=sample [...additional attributes...]
 href=/foo/bar.php ';

 I tried using regular expressions but my knowledge of RegEx is very
 limited.
 Things to consider:
 - $string could be quite long but my concern are only those href
 attributes
 (so working with explode() would be not very handy)
 - Should also work if href= is not using quotes or using single quotes
 - link could already be an absolute path, so just searching for href=
 and
 then inserting absolute path could mess up the link

 Any ideas? Or can someone create a RegEx to use?
 
 Just spitballing here, but this is probably how I would start:
 
 RegEx pattern: /a.*? href=(.+?)/ig
 
 Then, using the capture group, determine if the href attribute uses quotes 
 (single or double, doesn't matter). If it does, you don't need to worry about 
 splitting the capture group at the first white space. If it doesn't, then you 
 must assume the first whitespace is the end of the URL and the beginning of 
 additional attributes, and just grab the URL up to (but not including) the 
 first whitespace.
 
 So...
 
 ?php
 
 # here is where $anchorText (text for the a tag) would be assigned
 # here is where $curDir (text for the current directory) would be assigned
 
 # find the href attribute
 $matches = Array();
 preg_match('#a.*? href=(.+?)#ig', $anchorText, $matches);
 
 # determine if it has surrounding quotes
 if($matches[1][0] == '\'' || $matches[1][0] == '')
 {
   # pull everything but the first and last character
   $anchorText = substr($anchorText, 1, strlen($anchorText) - 3);
 }
 else
 {
   # pull up to the first space (if there is one)
   $spacePos = strpos($anchorText, ' ');   
   if($spacePos !== false) 
   $anchorText = substr($anchorText, 0, strpos($anchorText, ' '))
 }
 
 # now, check to see if it is relative or absolute
 # (regex pattern searches for protocol spec (i.e., http://), which will be
 # treated as an absolute path for the purpose of this algorithm)
 if($anchorText[0] != '/'  preg_match('#^\w+://#', $anchorText) == 0)
 {
   # add current directory to the beginning of the relative path
   # (nothing is done to absolute paths or URLs with protocol spec)
   $anchorText = $curDir . '/' . $anchorText;
 }
 
 echo $anchorText;
 
 ?
 
 ...UNTESTED.
 
 HTH,
 
 
 // Todd

Wow, that's alot!  This should work with or without quotes and assumes
no spaces in the URL:

$prefix = http://example.com/;;
$html = preg_replace(|(href=['\]?)(?!$prefix)([^'\\s]+)(\s)?|,
$1$prefix$2$3, $html);


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Boyd, Todd M. wrote:
 -Original Message-
 From: farn...@googlemail.com [mailto:farn...@googlemail.com] On Behalf
 Of Edmund Hertle
 Sent: Thursday, January 15, 2009 4:13 PM
 To: PHP - General
 Subject: [PHP] Parsing HTML href-Attribute

 Hey,
 I want to parse a href-attribute in a given String to check if there
 is a
 relative link and then adding an absolute path.
 Example:
 $string  = 'a class=sample [...additional attributes...]
 href=/foo/bar.php ';

 I tried using regular expressions but my knowledge of RegEx is very
 limited.
 Things to consider:
 - $string could be quite long but my concern are only those href
 attributes
 (so working with explode() would be not very handy)
 - Should also work if href= is not using quotes or using single quotes
 - link could already be an absolute path, so just searching for href=
 and
 then inserting absolute path could mess up the link

 Any ideas? Or can someone create a RegEx to use?
 Just spitballing here, but this is probably how I would start:

 RegEx pattern: /a.*? href=(.+?)/ig

 Then, using the capture group, determine if the href attribute uses quotes 
 (single or double, doesn't matter). If it does, you don't need to worry 
 about splitting the capture group at the first white space. If it doesn't, 
 then you must assume the first whitespace is the end of the URL and the 
 beginning of additional attributes, and just grab the URL up to (but not 
 including) the first whitespace.

 So...

 ?php

 # here is where $anchorText (text for the a tag) would be assigned
 # here is where $curDir (text for the current directory) would be assigned

 # find the href attribute
 $matches = Array();
 preg_match('#a.*? href=(.+?)#ig', $anchorText, $matches);

 # determine if it has surrounding quotes
 if($matches[1][0] == '\'' || $matches[1][0] == '')
 {
  # pull everything but the first and last character
  $anchorText = substr($anchorText, 1, strlen($anchorText) - 3);
 }
 else
 {
  # pull up to the first space (if there is one)
  $spacePos = strpos($anchorText, ' ');   
  if($spacePos !== false) 
  $anchorText = substr($anchorText, 0, strpos($anchorText, ' '))
 }

 # now, check to see if it is relative or absolute
 # (regex pattern searches for protocol spec (i.e., http://), which will be
 # treated as an absolute path for the purpose of this algorithm)
 if($anchorText[0] != '/'  preg_match('#^\w+://#', $anchorText) == 0)
 {
  # add current directory to the beginning of the relative path
  # (nothing is done to absolute paths or URLs with protocol spec)
  $anchorText = $curDir . '/' . $anchorText;
 }

 echo $anchorText;

 ?

 ...UNTESTED.

 HTH,


 // Todd
 
 Wow, that's alot!  This should work with or without quotes and assumes
 no spaces in the URL:
 
 $prefix = http://example.com/;;
 $html = preg_replace(|(href=['\]?)(?!$prefix)([^'\\s]+)(\s)?|,
 $1$prefix$2$3, $html);
 
 
Might need to keep a preceding slash out of there:

$html = preg_replace(|(href=['\]?)(?!$prefix)[/]?([^'\\s]+)(\s)?|,
$1$prefix$2$3, $html);

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Shawn McKenzie
Boyd, Todd M. wrote:
 -Original Message- From: Shawn McKenzie 
 [mailto:nos...@mckenzies.net] Sent: Friday, January 16, 2009 1:08 
 PM To: php-general@lists.php.net Subject: Re: [PHP] Parsing HTML 
 href-Attribute
 
 Shawn McKenzie wrote:
 Boyd, Todd M. wrote:
 -Original Message- From: farn...@googlemail.com 
 [mailto:farn...@googlemail.com] On
 Behalf
 Of Edmund Hertle Sent: Thursday, January 15, 2009 4:13 PM To:
  PHP - General Subject: [PHP] Parsing HTML href-Attribute
 
 Hey, I want to parse a href-attribute in a given String to 
 check if
 there
 is a relative link and then adding an absolute path. Example:
  $string  = 'a class=sample [...additional attributes...]
  href=/foo/bar.php ';
 
 I tried using regular expressions but my knowledge of RegEx 
 is very limited. Things to consider: - $string could be quite
  long but my concern are only those href attributes (so 
 working with explode() would be not very handy) - Should also
  work if href= is not using quotes or using single
 quotes
 - link could already be an absolute path, so just searching 
 for
 href=
 and then inserting absolute path could mess up the link
 
 Any ideas? Or can someone create a RegEx to use?
 Just spitballing here, but this is probably how I would start:
 
 RegEx pattern: /a.*? href=(.+?)/ig
 
 Then, using the capture group, determine if the href attribute 
 uses
 quotes (single or double, doesn't matter). If it does, you don't 
 need to worry about splitting the capture group at the first white 
 space. If it doesn't, then you must assume the first whitespace is 
 the end of the URL and the beginning of additional attributes, and 
 just grab the URL up to (but not including) the first whitespace.
 So...
 
 ?php
 
 # here is where $anchorText (text for the a tag) would be 
 assigned # here is where $curDir (text for the current 
 directory) would be
 assigned
 # find the href attribute $matches = Array(); 
 preg_match('#a.*? href=(.+?)#ig', $anchorText, $matches);
 
 # determine if it has surrounding quotes if($matches[1][0] == 
 '\'' || $matches[1][0] == '') { # pull everything but the 
 first and last character $anchorText = substr($anchorText, 1, 
 strlen($anchorText) - 3); } else { # pull up to the first space
  (if there is one) $spacePos = strpos($anchorText, ' '); 
 if($spacePos !== false) $anchorText = substr($anchorText, 0, 
 strpos($anchorText, '
 '))
 }
 
 # now, check to see if it is relative or absolute # (regex 
 pattern searches for protocol spec (i.e., http://), which
 will be
 # treated as an absolute path for the purpose of this 
 algorithm) if($anchorText[0] != '/'  preg_match('#^\w+://#', 
 $anchorText) ==
 0)
 { # add current directory to the beginning of the relative path
  # (nothing is done to absolute paths or URLs with protocol 
 spec) $anchorText = $curDir . '/' . $anchorText; }
 
 echo $anchorText;
 
 ?
 
 ...UNTESTED.
 
 HTH,
 
 
 // Todd
 Wow, that's alot!  This should work with or without quotes and
 assumes
 no spaces in the URL:
 
 $prefix = http://example.com/;; $html = 
 preg_replace(|(href=['\]?)(?!$prefix)([^'\\s]+)(\s)?|, 
 $1$prefix$2$3, $html);
 
 
 Might need to keep a preceding slash out of there:
 
 $html = 
 preg_replace(|(href=['\]?)(?!$prefix)[/]?([^'\\s]+)(\s)?|, 
 $1$prefix$2$3, $html);
 
 I believe the OP wanted to leave already-absolute paths alone (i.e., 
 only convert relative paths). The regex does not take into account 
 fully-qualified URLs (i.e., http://www.google.com/search?q=php) and 
 it does not determine if a given path is relative or absolute. He was
  wanting to take the href attribute of an anchor tag and, **IF** it 
 was a relative path, turn it into an absolute path (meaning to append
  the relative path to the absolute path of the current script).

That's exactly what this regex does :-)  The (?!$prefix) negative
lookahead assertion fails the match if it's already an absolute URL.

 That was my understanding. Perhaps you saw it differently, but I 
 don't believe your pattern is enough to accomplish what the OP was 
 asking for--hence a lot of code was in my reply. ;)
 
 Believe me, I'm the first guy to hop on the do it with a regex! 
 bandwagon... but there are just some circumstances where regex can't 
 do what you need to do (such as more-than-superficial contextual 
 logic).
 
 HTH,
 
 
 // Todd


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Shawn McKenzie
 I believe the OP wanted to leave already-absolute paths alone
 (i.e., only convert relative paths). The regex does not take into
 account fully-qualified URLs (i.e.,
 http://www.google.com/search?q=php) and it does not determine if a
 given path is relative or absolute. He was wanting to take the href
 attribute of an anchor tag and, **IF** it was a relative path, turn
 it into an absolute path (meaning to append the relative path to
 the absolute path of the current script).
 
 That's exactly what this regex does :-)  The (?!$prefix) negative 
 lookahead assertion fails the match if it's already an absolute URL.
 
 That was my understanding. Perhaps you saw it differently, but I 
 don't believe your pattern is enough to accomplish what the OP was
  asking for--hence a lot of code was in my reply. ;)
 
 Believe me, I'm the first guy to hop on the do it with a regex! 
 bandwagon... but there are just some circumstances where regex
 can't do what you need to do (such as more-than-superficial
 contextual logic).
 
 HTH,
 
 
 // Todd
 
Ahh, but you uncovered a problem for me if the href contains an
absolute URL that doesn't contain the prefix.  Here's the fix:

$html =
preg_replace(|(href=['\]?)(?!http(?:s)?://)[/]?([^'\\s]+)(\s)?|,
$1http://www.example.com/2$3;, $html);

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: function_exists question

2009-01-16 Thread Shawn McKenzie
Matt Pagel wrote:
 Is there a way to check not only if a function exists, but also to check
 that the number and types of parameters desired match a function
 definition?
 
 The reason being that additional options have been added in php 4 and 5
 to various standard function calls, but I'm still running a php3 and
 php4 server in addition to a php5 server.  I would like to make sure
 that certain extended function calls still work in all versions (or
 I'll perform the tasks manually, albeit less efficiently).
 
 One example I can think of is the round() function.  The $precision
 parameter was added in php4, so will not work in php3.  However,
 function_exists would return TRUE for both 3 and 4, but round itself
 would fail if I tried to send a precision level to the php3 server.
 
 Thanks much,
 Matt
 
 P.S. Of course the modified function_exists would unfortunately have
 to be a recognized function/method in php3 in order for me to call it to
 check parameter counts on a php3 server :(

Unless I misunderstand you, why not just execute based upon the version
or some similar approach?  Actually, I can't even find any version 3
docs, so maybe I should bow out?

// Only needed if PHP_VERSION is not included in version 3, I dunno
if (!defined('PHP_VERSION')) { define('PHP_VERSION', '3'); }

if (PHP_VERSION  4) {
$num = round(101.11);
} else {
$num = round(101.11, 0);
}

As I type this I think:  if you're going to use the script on v3, 4 and
5, then why would you use the second parameter?  You'll get a whole
number returned on v3 so why would you want a fractional returned on
other versions?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Shawn McKenzie
Edmund Hertle wrote:
 * http://www.google.com/search?q=php ... absolute path (yes, it's a URL,
 but treat it as absolute)
 * https://www.example.com/index.php ... absolute path (yes, it's a URL,
 but to the local server)
 * /index.php ... absolute path (no protocol given, true absolute path)
 * index.php ... relative path (relative to current directory on current
 server)
 * somefolder/index.php ... relative path (same reason)

 That is indeed a nifty use of look-ahead, though. That will work for any
 anchor tag that doesn't reference the server (or any other server) with a
 protocol spec preceding it. However, if you want to run it through an entire
 list of anchor tags with any spec (http://, https://, udp://, ftp://,
 aim://, rss://, etc.)--or lack of spec--and only mess with those that don't
 have a spec and don't use absolute paths, it needs to get a bit more
 complex. You've convinced me, however, that it can be done entirely with one
 regex pattern.

 // Todd
 
 
 Hey!
 Wow, I think that was exactly what I was looking for... thank all of you...
 although I've not tested it, will do that tomorrow, but sounds very nice
 
 But Todd just confused me quite a bit with the statement: Is /index.php a
 case where the RegEx will fail?
 
 To add some background: It is about dynamiclly creating pdf files out of
 html source code and then the links should also work in the pdf file. So
 other protocolls then http:// shouldn't be a problem
 
 -eddy
 
That regex should work on all hrefs. index.php and /index.php will be
replaced with http://www.example.com/index.php and somedir/index.php and
/somedir/index.php will be replaced with
http://www.example.com/somedir/index.php.  Any URL starting with http://
or https:// will be ignored.

Again, I say that it won't work on URLs with spaces, like my web
page.html.  When I get a minute I'll fix it.  I thought spaces in URLs
weren't valid markup, but it seems to validate.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Website crawler auto image downloader

2009-01-16 Thread Shawn McKenzie
Sam Smith wrote:
 I need a script that will crawl a list of websites and download all .jpg,
 .gif, .png files.
 
 I can think of some ways how to start like, fopen() or maybe curl(). And it
 downed on me I'd need to handle files writing over with the same name. And
 it would be cool to save the full URL to the file in a database with the
 path on the local server where I'm saving them.
 
 I was hoping someone might say, Dude, that's simple, just do this...
 before I spent hours guessing.
 
 Anyone?
 
 Thanks
 
 

Dude, that's simple, just do this...

- crawl the page extracting the src of images, regex or dom
- fopen and read it
- fput and save it, if it exists add an incremental number
- save url and local dir/filename in db

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Need List Advice

2009-01-19 Thread Shawn McKenzie
Robert Cummings wrote:
 On Mon, 2009-01-19 at 12:25 -0500, Daniel Brown wrote:
 On Mon, Jan 19, 2009 at 11:33,  c...@wizzyweb.com wrote:
 I have been looking but can't find which PHP list is best to post info
 regarding a new PHP tool. I have seen new product/service announcements on
 this list, but thought there might be a better list. Any suggestions?
 As long as it's an announcement and not a commercial
 advertisement, you'll be fine.  One thing that we generally consider
 bad etiquette as well would be only posting to this list to announce
 your product or project.  Being a helpful contributor to the list in
 general will buy you some Brownie Points[tm].
 
 We get brownie points for helping? Crap, who's keeping track of mine? I
 had no idea!! Can they be cashed in for treats? :B
 
 Cheers,
 Rob.

Somebody used to post a weekly summary that tallied our brownie points. ;-)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] maybe we could all?

2009-01-20 Thread Shawn McKenzie
Kyle Terry wrote:
 On Mon, Jan 19, 2009 at 6:31 PM, Nathan Rixham nrix...@gmail.com wrote:
 
 Eric Butera wrote:

 On Mon, Jan 19, 2009 at 9:13 PM, Kyle Terry k...@kyleterry.com wrote:

 On Mon, Jan 19, 2009 at 6:07 PM, Daniel Brown danbr...@php.net wrote:

  On Mon, Jan 19, 2009 at 19:58, Edmund Hertle
 edmund.her...@student.kit.edu wrote:

 Well, I think we should not go to fast... maybe we are setting up SVN,
 webspace, domain, mailing-list and in the end this is only used by 4-5
 people. Because than this can be discussed on this mailinglist. But if

 there

 are quite enough people interested, it would be indeed a good idea to

 start

 some other kind of communication...

I flat-out disagree with this, Ed.  Nothing at all against you,
 though.

   This is the General list for PHP, and while this project is
 PHP-related (and general in nature), if we allow even the regulars
 to do so here, how can we then tell others that we won't allow them to
 discuss their PHP-related projects on this list?

   Putting the code on a proper system to begin with means no
 screwing around later when the project is running at full steam.
 And even if there are only four or five people working on it, if those
 folks put in a good effort, they can work wonders.

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find
 out!

  I work on a development team of 3; me and 2 others. 1 of which only
 develops
 about a quarter of his time here. Even with my co worker sitting next to
 me,
 if we weren't using a repo, we would both be at a complete loss (right
 word?).

 --
 Kyle Terry | www.kyleterry.com


 I have been using svn for 3 years by myself.  Recently I talked my
 other co workers to play with it and they love it.  But even in an
 army of one it's amazing to be able to figure out what I messed up
 last week or why I decided to change something at 5:00.  People have
 wrote books on it though, so I'll hush.

 still up :p

 dan - great offer, I'd like to take you up on it [could we install any
 extra needed software, such as a wiki / list or something that allows
 discussion and document storage made website available]
 svn - a must imho

 consideration:
 been thinking 2 things
 1 - this could be a lot of noise on the list; perhaps an approach of rfc
 and publish every idea, post link to it here so anybody can contribute, then
 go from there.
 discuss [ wiki needed? ]
 
 wiki will definitely be needed.
 
 2 - actually that was both in one sentance

 maybe first rfc should be super class for all  (our) objects and if
 so what

 + a name, cos if we need to start prefixing.. and it can't be 4LC as can't
 start with a number :p
 
 The world's object?
 

 this will be massively interesting..

 
 
 
Given Common Objects and Datatypes, has anyone proposed COD Pieces?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: ANNOUNCEMENT: ModBox - Open Platform as a Service

2009-01-20 Thread Shawn McKenzie
c...@wizzyweb.com wrote:
 After posting to this list to see if it is appropriate and getting good 
 feedback, I'm posting an announcement I think is very relative to this list 
 as I have been using PHP ever since it was a Perl script (PHP/FI) and have 
 been heavily influenced by it's concept and evolution when creating what I 
 am announcing. So the announcement is the launch of something I have been 
 working on in my spare time for a long time and what I believe will be a 
 logical next step in Internet development - ModBox an Open Platform as a 
 Service (OPaaS). Ok, what the #...@#$ is OPaaS? OPaaS is PaaS, but open. 
 Think 
 Force.com/Google App Engine/Amazon EC2 - but open. Really open. Not fake 
 open like so much other BS services that try to lock you in. In a nutshell, 
 ModBox is a Web-based distributed development environment that is completely 
 neutral in every way. So, you can use any infrastructure you want, any 
 programming language, any server, any OS, any database, etc. to 
 create/distribute applications. Also, because ModBox works over standard 
 HTTP, you can incorporate existing applications or web services into the 
 applications you create. ModBox brings all the pieces together seemlessly 
 for programmers and users. I hope I have borrowed the best ideas from IDE's, 
 RAD, frameworks, Web services grid/cloud computing and Open Source to make a 
 logical ecosystem which puts a much needed front-end/face on all of it. This 
 list is the first place I have announced ModBox and I welcome you to Rock 
 the Box and let me know if it makes as much sense to you as it does to me. I 
 would, of course greatly appreciate any feedback as I am not so bold to 
 think I have cracked the code on the 1.0. The URL is below.
 
 ModBox - Open Platform as a Service:
 http://www.sullivansoftwaresystems.com/modbox
 
 Thanks for your time.
 
 Brian Sullivan
 Sullivan Software Systems
 ModBox - Rock the Box.
 

I looked through the site and I don't get it.  Am I just a dumb ass
(well duh), or am I missing the point.  I'm not familiar with force.com etc.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Installation problems on Vista

2009-01-20 Thread Shawn McKenzie
Nathan Rixham wrote:
 lucson pierre-charles wrote:
 Dear Nathan,
  The short_tags is sure off but when I changed the
 scripts, they're still being output to the browser.  
 These are the lines I added to the modules section:
 #LoadModule php5_module c:/php5/php5apache2.dll
 #AddType application/x-httpd-php .php
 #PHPIniDir c:/php5
  

 remove the #'s
 
 Yes,

and then...
make sure php and your php.ini are actually in c:\php5,

and then...
make sure to restart apache.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Installation problems on Vista

2009-01-20 Thread Shawn McKenzie
lucson pierre-charles wrote:
 Nathan,
  
   When I remove the #'s, I can't have Apache to restart. I keep 
 receiving error messages.
  
 Lucson Date: Tue, 20 Jan 2009 22:41:44 + From: nrix...@gmail.com To: 
 lucsonpie...@hotmail.com CC: php-general@lists.php.net Subject: [PHP] Re: 
 Installation problems on Vista  lucson pierre-charles wrote:  Dear 
 Nathan,  The short_tags is sure off but when I changed the   scripts, 
 they're still being output to the browser. These are the lines I 
 added to the modules section:  #LoadModule php5_module 
 c:/php5/php5apache2.dll  #AddType application/x-httpd-php .php  
 #PHPIniDir c:/php5remove the #'s   --  PHP General Mailing 
 List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php 

What is the error message from the windows event viewer?  Most likely it
can't find a file.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Installation problems on Vista

2009-01-20 Thread Shawn McKenzie
lucson pierre-charles wrote:
 Yes. It can't find a file. To: php-general@lists.php.net Date: Tue, 20 Jan 
 2009 17:14:14 -0600 From: nos...@mckenzies.net Subject: Re: [PHP] Re: 
 Installation problems on Vista  lucson pierre-charles wrote:  Nathan,  
   When I remove the #'s, I can't have Apache to restart. I keep receiving 
 error messages.Lucson Date: Tue, 20 Jan 2009 22:41:44 + From: 
 nrix...@gmail.com To: lucsonpie...@hotmail.com CC: 
 php-general@lists.php.net Subject: [PHP] Re: Installation problems on Vista 
  lucson pierre-charles wrote:  Dear Nathan,  The short_tags is sure 
 off but when I changed the   scripts, they're still being output to the 
 browser. These are the lines I added to the modules section:  
 #LoadModule php5_module c:/php5/php5apache2.dll  #AddType 
 application/x-httpd-php .php  #PHPIniDir c:/php5remove the #'s 
   --  PHP General Mailing List (http://www.php.net/) To unsubscribe, 
 visit: http://www.php.net/unsub.php   What is
 the error message from the windows event viewer? Most likely it can't find a 
file.  --  Thanks! -Shawn http://www.spidean.com  --  PHP General 
Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 

Three probabilities:

1. It can't find a file that Apache need to load PHP
2. It can't find a file that PHP needs (an extension)
3. It can't find a library that an extension needs

Solutions:

1. Add c:\php5 to your path environment variable
2. Make sure you have the correct extensions dir set in php.ini
(probably c:\php5\ext)
3. Number 1 probably fixes this or copy all .dll from c:\php5 to
c:\windows (this hasn't been needed in a while) try commenting out (add
a ; to the beginning of) each extension in php.ini

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] how to simplify my code - I will have tooo many lines -please help

2009-01-21 Thread Shawn McKenzie
= //agreement cost * 2
}
elseif ( $selectedProdCode=agreem2  ($errorArray['agr1expdate'] 
$Today || $errorArray['agr2expdate']  $Today) )
{   
if ( $errorArray['agr1expdate']  $Today  $errorArray['agr2expdate']
 $Today )
{
$selectedProdCode= //(agreement cost * 2) + (late fee *2)
} else {
$selectedProdCode= //(agreement cost * 2) + late fee
}   
}

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] how to simplify my code - I will have tooo many lines -pleasehelp

2009-01-21 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Wow!  Yes, there are a lot of ways to do it.  This is a quick stab (not
 tested):
 
 $Today = date('m/d/y');
 
 if ( $selectedProdCode == agreem  $errorArray['agr1expdate']  $Today)
 {
   $selectedProdCode= //agreement cost + late fee
 } else {
   $selectedProdCode= //agreement cost
 }
 if ( $selectedProdCode == agreem2  $errorArray['agr1expdate'] = $Today
  $errorArray['agr2expdate'] = $Today )
 { 
   $selectedProdCode= //agreement cost * 2
 }
 elseif ( $selectedProdCode == agreem2  ($errorArray['agr1expdate'] 
 $Today || $errorArray['agr2expdate']  $Today) )
 { 
   if ( $errorArray['agr1expdate']  $Today  $errorArray['agr2expdate']
  $Today )
   {
   $selectedProdCode= //(agreement cost * 2) + (late fee *2)
   } else {
   $selectedProdCode= //(agreement cost * 2) + late fee
   }   
 }
 
Here's another stab (not tested).  Also, in my previous post I just
copied your code, there should be == instead of = in the if expressions.

$Today = date('m/d/y');
$Agreements = 0;
$lateFees = 0;

if ( $selectedProdCode == agreem )
{
$Agreements = 1;
}
elseif ( $selectedProdCode == agreem2 )
{
$Agreements = 2;

if ( $errorArray['agr2expdate']  $Today )
{
$lateFees++;
}
}
if ( $errorArray['agr1expdate']  $Today )
{
$lateFees++;
}
$selectedProdCode= //(agreement cost * $Agreements) + (late fee * $lateFees)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] distinguish between null variable and unset variable

2009-01-22 Thread Shawn McKenzie
Daniel Brown wrote:
 On Wed, Jan 21, 2009 at 20:27, Jack Bates ms...@freezone.co.uk wrote:
 How can I tell the difference between a variable whose value is null and
 a variable which is not set?
 
 Unfortunately, in PHP - like other languages - you can't.
 
 A variable is considered to be null if:
 * it has been assigned the constant NULL.
 * it has not been set to any value yet.
 * it has been unset().
 

I'm not in a position to test right now, but using Dan's logic I would
turn it around and test for isset first and then is_null.  This makes
sense to me, but maybe it is flawed:

if (isset($var)  is_null($var)) {
echo $var is set and is null;
}

Or maybe a function to return is the $var === null:


function eq_null($var)
{
return (isset($var)  is_null($var)) ? true : false;
}

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] distinguish between null variable and unset variable

2009-01-22 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Daniel Brown wrote:
 On Wed, Jan 21, 2009 at 20:27, Jack Bates ms...@freezone.co.uk wrote:
 How can I tell the difference between a variable whose value is null and
 a variable which is not set?
 Unfortunately, in PHP - like other languages - you can't.

 A variable is considered to be null if:
 * it has been assigned the constant NULL.
 * it has not been set to any value yet.
 * it has been unset().

 
 I'm not in a position to test right now, but using Dan's logic I would
 turn it around and test for isset first and then is_null.  This makes
 sense to me, but maybe it is flawed:
 
 if (isset($var)  is_null($var)) {
   echo $var is set and is null;
 }
 
 Or maybe a function to return is the $var === null:
 
 
 function eq_null($var)
 {
   return (isset($var)  is_null($var)) ? true : false;
 }
 

Or something like this (dunno, just brainstorming):

function setornull($var)
{
if (!isset($var)) {
return false;
}
elseif (is_null($var)) {
return null;
}
return true;
}

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] distinguish between null variable and unset variable

2009-01-22 Thread Shawn McKenzie
Daniel Brown wrote:
 On Thu, Jan 22, 2009 at 15:11, Shawn McKenzie nos...@mckenzies.net wrote:
 Or something like this (dunno, just brainstorming):

 function setornull($var)
 {
if (!isset($var)) {
return false;
}
elseif (is_null($var)) {
return null;
}
return true;
 }
 
 Unfortunately, neither solution would work.  isset() will return
 FALSE even for an instantiated and explicitly-defined NULL variable.
 

Yes, damn it!

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] distinguish between null variable and unset variable

2009-01-22 Thread Shawn McKenzie
Daniel Brown wrote:
 On Thu, Jan 22, 2009 at 15:12, Daniel Brown danbr...@php.net wrote:
Unfortunately, neither solution would work.  isset() will return
 FALSE even for an instantiated and explicitly-defined NULL variable.
 
 Forgot to mention that, in addition, is_null() will return TRUE
 for both explicitly-set NULL variables and undefined variables alike.
 

That's why I was testing isset() fist, however as you pointed out, that
is crap also.  :-(

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Multiple queries in PHP

2009-01-25 Thread Shawn McKenzie
Ashley Sheridan wrote:
 Hi all,
 
 I've run into a bit of a problem. I put together a query using mysql
 variables in the form set @m:= 0; with the select that uses it directly
 after. For any wondering, the select was using it as an incremental
 value which can't be hard coded, as the value will depend on the
 ordering of the results of the query itself.
 
 The problem seems to be that while phpMyAdmin would execute this double
 query perfectly well, php using mysql_query() was having problems, as
 apparently it can't actually run multiple queries.
 
 Now the full query looks something like this:
 
 
 mysql_query(SELECT @m:=0;);
 
 $query = SELECT * FROM(
   SELECT profiles.id, ROUND(AVG(rated.score)) AS `rating`,
 COUNT(rated.score) AS `total`, @m:=...@m+1 AS rank FROM `rated` LEFT JOIN
 `profiles` ON (profiles.id = rated.profile_id) GROUP BY rated.profile_id
 ORDER BY rating DESC, total DESC) AS ranking WHERE ranking.id=$id;
 $result = mysql_query($query);
 
 
 which seems to be working OK so far, but does anyone know of any
 potential pitfalls I might face when doing something like this?
 
 Thanks,
 
 
 Ash
 www.ashleysheridan.co.uk
 

Might try the mysqli extension.  mysqli_multi_query()

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: tee function in PHP

2009-01-26 Thread Shawn McKenzie
Karyn Stump wrote:
 Hi all,
 
 Sequence:
 
 Form1: Display fields for user to input data and submit.
 
 Form2: Show user the information they input on form1 and allow them to
 print or email this form.
 
 I inherited the scripts above. The second script displays the results in
 the browser and also writes a file on the server in two steps. That file
 (html) is then emailed if the user chooses to do so.
 
 I would like to reduce this to one step by combining the writing of the
 browser data and the file. Is there something like tee in PHP ? 
 
 Or should I start learning about output buffering control ? If so examples
 would be great.
 
 TIA,
 
 

I don't think you can get away from two separate operations.  However,
if the data for the browser and the data for the file are being built
separately now, you can use output buffering to eliminate that:

ob_start();

//echo your HTML

$output = ob_get_contents();
file_put_contents('/path/to/file.html', $output);

But there's not that much difference between that and this (unless you
don't want to modify all of the echos):

$output = 'Your HTML';

echo $output;
file_put_contents('/path/to/file.html', $output);


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Coding for email response forms

2009-01-26 Thread Shawn McKenzie
Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise the form 
 won't work. I need to know where to include my email info to get this set up 
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message 
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com...
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the webpages. 
 The
 following page has my form but the submit button is not working properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? I thought 
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all client
 side (JavaScript and HTML).

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find 
 out! 
 
 

What you have now is a form that when submitted sends the data to
itself.  So you either need to include some php in this file to gather
up the data and email it when submitted, or submit to another file that
does that.


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Coding for email response forms

2009-01-26 Thread Shawn McKenzie
Tom wrote:
 Shawn McKenzie  wrote in message 
 news:a0.87.62571.3d92e...@pb1.pair.com...
 Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise the form
 won't work. I need to know where to include my email info to get this set 
 up
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com...
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the webpages.
 The
 following page has my form but the submit button is not working 
 properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? I 
 thought
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all client
 side (JavaScript and HTML).

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find
 out!

 What you have now is a form that when submitted sends the data to
 itself.  So you either need to include some php in this file to gather
 up the data and email it when submitted, or submit to another file that
 does that.


 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 
 Shawn,
 So would that look something like this:
 ?
 if ($_SERVER['REQUEST_METHOD'] == POST) {
 
 // Just to be safe, I strip out HTML tags
 $realname = strip_tags($realname);
 $email = strip_tags($email);
 $feedback = strip_tags($feedback);
 
 // set the variables
 // replace $...@mysite.com with your email
 $sendto = $...@mysite.com;
 $subject = Sending Email Feedback From My Website;
 $message = $realname, $email\n\n$feedback;
 
 // send the email
 mail($sendto, $subject, $message);
 
 }
 ?
 
 
 
That's a good start, however you should use $_POST['realname'] etc.
since they are coming from a post operation. $realname only exists if
register_globals is on, which is evil.

Also, you would probably do this before your form so that you can say
Thanks for your feedback. and then exit or redirect and not display
the form again.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Coding for email response forms

2009-01-26 Thread Shawn McKenzie
Tom wrote:
 Shawn McKenzie  wrote in message 
 news:a0.87.62571.3d92e...@pb1.pair.com...
 Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise the form
 won't work. I need to know where to include my email info to get this set 
 up
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com...
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the webpages.
 The
 following page has my form but the submit button is not working 
 properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? I 
 thought
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all client
 side (JavaScript and HTML).

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find
 out!

 What you have now is a form that when submitted sends the data to
 itself.  So you either need to include some php in this file to gather
 up the data and email it when submitted, or submit to another file that
 does that.


 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 
 Shawn,
 So would that look something like this:
 ?
 if ($_SERVER['REQUEST_METHOD'] == POST) {
 
 // Just to be safe, I strip out HTML tags
 $realname = strip_tags($realname);
 $email = strip_tags($email);
 $feedback = strip_tags($feedback);
 
 // set the variables
 // replace $...@mysite.com with your email
 $sendto = $...@mysite.com;
 $subject = Sending Email Feedback From My Website;
 $message = $realname, $email\n\n$feedback;
 
 // send the email
 mail($sendto, $subject, $message);
 
 }
 ?
 
 
 
Oh, you should also think about some other things, such as validation.
Is realname only alpha characters?  Is email in the form of a real email
address?  At a bare minimum, are they not empty:

if (empty($_POST['email']) ||
empty($_POST['realname']) ||
empty($_POST['feedback']))
{
echo 'You must complete all required fields!';
// show form again
}


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Coding for email response forms

2009-01-26 Thread Shawn McKenzie


Shawn McKenzie wrote:
 
 Tom Scott wrote:
 - Original Message - From: Shawn McKenzie
 nos...@mckenzies.net
 Newsgroups: php.general
 To: php-general@lists.php.net
 Sent: Monday, January 26, 2009 3:52 PM
 Subject: Re: [PHP] Coding for email response forms


 Tom wrote:
 Shawn McKenzie  wrote in message
 news:a0.87.62571.3d92e...@pb1.pair.com...
 Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise
 the form
 won't work. I need to know where to include my email info to get
 this set
 up
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com...
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the
 webpages.
 The
 following page has my form but the submit button is not working
 properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? I
 thought
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all client
 side (JavaScript and HTML).

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me
 to find
 out!
 What you have now is a form that when submitted sends the data to
 itself.  So you either need to include some php in this file to gather
 up the data and email it when submitted, or submit to another file
 that
 does that.


 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Shawn,
 So would that look something like this:
 ?
 if ($_SERVER['REQUEST_METHOD'] == POST) {

 // Just to be safe, I strip out HTML tags
 $realname = strip_tags($realname);
 $email = strip_tags($email);
 $feedback = strip_tags($feedback);

 // set the variables
 // replace $...@mysite.com with your email
 $sendto = $...@mysite.com;
 $subject = Sending Email Feedback From My Website;
 $message = $realname, $email\n\n$feedback;

 // send the email
 mail($sendto, $subject, $message);

 }
 ?



 Oh, you should also think about some other things, such as validation.
 Is realname only alpha characters?  Is email in the form of a real email
 address?  At a bare minimum, are they not empty:

 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))
 {
echo 'You must complete all required fields!';
 // show form again
 }


 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Ok. I have the validation part.
 http://www.richlandmtg.com/index-5.html still working on the Send button.

 T


 Please reply all so this stays on the list.
 
 1.  In the source for your link I see that the JS is doing some validation.
 2.  You have method=get in your form.  This will work, but you'll have
 to change the PHP code to use $_GET instead of $_POST vars.  Or change
 to method=post in the form.
 3.  If you want to keep the .html extension for the page, then you'll
 probably need to send the post to another script with a .php extension. 
 Normally a file with a .html extension won't execute the PHP code.
 
 Thanks!
 -Shawn
 
 
 

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



Re: [PHP] Coding for email response forms

2009-01-27 Thread Shawn McKenzie
Tom wrote:
 Edmund Hertle edmund.her...@student.kit.edu wrote in message 
 news:f7ed91b20901261644y125f71aer3e0b70735c949...@mail.gmail.com...
 2009/1/26 Tom obeli...@comcast.net

 Shawn McKenzie sh...@mckenzies.net wrote in message
 news:497e3ab9.2060...@mckenzies.net...

 Shawn McKenzie wrote:
 Tom Scott wrote:
 - Original Message - From: Shawn McKenzie
 nos...@mckenzies.net
 Newsgroups: php.general
 To: php-general@lists.php.net
 Sent: Monday, January 26, 2009 3:52 PM
 Subject: Re: [PHP] Coding for email response forms


 Tom wrote:
 Shawn McKenzie  wrote in message
 news:a0.87.62571.3d92e...@pb1.pair.com...
 Tom wrote:
 My Hosting site said that I needed to include the PHP otherwise
 the form
 won't work. I need to know where to include my email info to get
 this set
 up
 don't I? What do you suggest?
 T
 Daniel Brown danbr...@php.net wrote in message
 news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
 ..
 On Mon, Jan 26, 2009 at 15:57, Tom obeli...@comcast.net wrote:
 I am a new user of PHP, and am using Dreamweaver CS3 for the
 webpages.
 The
 following page has my form but the submit button is not working
 properly.
 http://www.richlandmtg.com/contacts.html
 What code is needed and where does it get placed in the page.? 
 I
 thought
 CS3
 took care of this.
Tom,

This issue has nothing at all to do with PHP.  This is all
 client
 side (JavaScript and HTML).

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me
 to find
 out!
 What you have now is a form that when submitted sends the data to
 itself.  So you either need to include some php in this file to
 gather
 up the data and email it when submitted, or submit to another file
 that
 does that.


 --
 Thanks!
 -Shawn
 http://www.spidean.com
 Shawn,
 So would that look something like this:
 ?
 if ($_SERVER['REQUEST_METHOD'] == POST) {

 // Just to be safe, I strip out HTML tags
 $realname = strip_tags($realname);
 $email = strip_tags($email);
 $feedback = strip_tags($feedback);

 // set the variables
 // replace $...@mysite.com with your email
 $sendto = $...@mysite.com;
 $subject = Sending Email Feedback From My Website;
 $message = $realname, $email\n\n$feedback;

 // send the email
 mail($sendto, $subject, $message);

 }
 ?



 Oh, you should also think about some other things, such as 
 validation.
 Is realname only alpha characters?  Is email in the form of a real
 email
 address?  At a bare minimum, are they not empty:

 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))
 {
echo 'You must complete all required fields!';
 // show form again
 }


 --
 Thanks!
 -Shawn
 http://www.spidean.com
 Ok. I have the validation part.
 http://www.richlandmtg.com/index-5.html still working on the Send
 button.

 T


 Please reply all so this stays on the list.

 1.  In the source for your link I see that the JS is doing some
 validation.
 2.  You have method=get in your form.  This will work, but you'll 
 have
 to change the PHP code to use $_GET instead of $_POST vars.  Or change
 to method=post in the form.
 3.  If you want to keep the .html extension for the page, then you'll
 probably need to send the post to another script with a .php 
 extension.
 Normally a file with a .html extension won't execute the PHP code.

 Thanks!
 -Shawn



 I was just looking at that. Someone told me to use GET instead of POST.
 Since JS is validating is it as easy replacing GET with POST ? Nothing 
 else
 needed? Is it better to remove the JS and just code using PHP as you 
 showed
 before?
 if (empty($_POST['email']) ||
 empty($_POST['realname']) ||
 empty($_POST['feedback']))

 Thanks,
 Tom

 Yes, I think it is better to just use PHP code and post is the better 
 method
 (in this case) because with get all your fields and values will show up in
 the url

 -eddy

 I don't seem to be getting he hang of this. Sounds so simple but Can 
 someone check this out and tell me where exactly I'm messing up? 
 http://www.richlandmtg.com/Contact_Us.html
 I removed the JS validation. Is the following code ok?
 
 a href=# onClick=document.getElementById('form').reset()clear/aimg 
 alt= src=images/ch_more_red.gif   style=margin:1px 0 0 3px; 
 vertical-align:text-bottom/bb style=margin-left:17px;a href=# 
 onClick=document.getElementById('form').submit()send/a
 
 I posted the PHP info at the top of the page before the html tag. Should 
 it be after html?
 
 Sorry please bear with me,
 Tom 
 
 
Re-read point #3 from my last email.


-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Shawn McKenzie
Terion Miller wrote:
 Hello All,
 I am having problems resolving errors with some images causing the Undefined
 variable and getting property of non-object errors, I am trying to make a
 copy function so that an order can be viewed then resubmitted as a new order
 with minimal changes if needed.
 Here's my code: --could it be out of order as in the select should be above
 the insert?  I bolded where the errors are happening.
 ---
 
 if ($GO == Save) {

echo $AdminID;

 $sql = SELECT Name FROM admin WHERE AdminID='$AdminID';
 $result = mysql_query ($sql);

echo mysql_num_rows($result);  //if 0 then $result is empty

* $row = mysql_fetch_object($result);this is giving me problems and I
 tried changing the object to assoc
 *
 $Notes = ~. date(F j, Y g:i a) . - Planet Discover Enhanced Listing
 Submitted by . $row-Name .\n;  *This is the trying to get property of
 non object*
 
-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: unlink file rights problem

2009-01-28 Thread Shawn McKenzie
Merlin Morgenstern wrote:
 Hi there,
 
 I am trying to unlink a file which is inside a folder that is not
 writable to phps user www. Of course this failes, but I need to find a
 solution for it.
 
 Backgroud is following:
 I have pure-ftpd installed where user directories get created by
 pure-ftpd. Unfortunatelly there seems to be a bug and pure-ftpd does
 only create the homedirectory folder in 750 mod.
 My PHP-Script scans this directories every x minutes and processes those
 files. Upon completinon those files should get deleted, but as the dir
 is not writable by the user www this failes.
 
 The dir looks like this:
 drwxr-x--- 2 ftpuser ftpgroup 4096 Jan 28 10:18 merlin/
 
 files inside look like this:
 -rwxrwx--- 1 ftpuser ftpgroup 16868 Jan 28 10:20 test.xml*
 
 User www which executes php via cron is inside the group ftpgroup.
 
 Any ideas? I am kind of lost with this one. Thank you for any help!
 
 Best regards, Merlin

Why not run the cron as root, or ftpuser?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Coding for email response forms

2009-01-28 Thread Shawn McKenzie
Tom wrote:
 Clancy clanc...@cybec.com.au wrote in message 
 news:c77vn4pri9tsbaqg9avv3i7dnfb8nvk...@4ax.com...
 On Mon, 26 Jan 2009 17:57:29 -0600, obeli...@comcast.net (Tom) wrote:

 ..
 Also make sure there aren't line returns or any nonsense like that in
 the to  subjects.  Look up email header injection.  Your script might
 become quite popular at advertising p3n1s pills otherwise. :)
 Thanks I'll check it out. I tried including the above code but I still 
 can't
 seem to get it to work. Must be missing something.

 Thanks,
 David Powers books PHP for Dreamweaver xxx (Friends of Ed) give very 
 clear  instructions
 on installing PHP and implementing the essential items such as this.

 Thanks I'll check it out.
 
  I am no Coder and don't have a lot of time to devote to these things, to 
 busy running a business, but I do enjoy learning how things work which is 
 why I have taken this on. Website is just for informational display as they 
 don't produce much in the way of mortgage originations. I was hoping to get 
 something along the lines of the actually coding needed to pull this off. I 
 have spent every available moment over the last three  months on this 
 website (which is my first) with nothing more than an online beginners 
 course in CS3  CSS. I have appreciated everyones feedbackl. If anyone has 
 coding I can cut and paste with just a few adjustments on my end that would 
 be great.
 
 Thanks,
 Tom 
 
 
You have the code.  You just need to create a contact.php file and put
the email specific PHP in it and then modify your form to have
method=post action=contact.php.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Making a Variable from different tables with Matching Db fields?

2009-01-28 Thread Shawn McKenzie
Terion Miller wrote:
 Well I'm stuck I have the AdminID but now I can't seem to use it to pull
 workorders with that AdminID . I couldn't get your block to work Andrew :(
 
 I think I'm just not using it right now that I have it...lol
 
 
 On Wed, Jan 28, 2009 at 2:26 PM, Andrew Ballard aball...@gmail.com wrote:
 
 On Wed, Jan 28, 2009 at 3:18 PM, Terion Miller webdev.ter...@gmail.com
 wrote:
 Not sure if I'm wording this right, what I am trying to do is look in two
 tables, match the ID to use to pull information

 Here's my code but it's not right, although it is picking up the user
 from
 the session, I will also post what my variable debugging lists:

$query = SELECT  admin.AdminID, workorders.AdminID FROM admin,
 workorders WHERE admin.UserName =   '.$_SESSION['user'].' ;
$result = mysql_query ($query);
$row = mysql_fetch_assoc ($result);

echo $row['AdminID'];

if ($row['ViewMyOrders'] == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
 not have access to that page.);
}

 *Also tried this to pull just this persons orders:*

$sql = SELECT workorders.WorkOrderID , workorders.AdminID,
 admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
 admin.AdminID ;
$result = mysql_query ($sql);

 Thanks for looking, t.

 Your first version gives you a Cartesian product containing more rows
 than you are expecting. (All rows from the workorders table joined
 with the row in the admin table where the username matches.) The
 second version returns all rows where the AdminIDs match, but for all
 users. You need to combine them:

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders, admin
 WHERE workorders.AdminID = admin.AdminID
   AND admin.UserName = ' . mysql_real_escape_string($username) . ';


 Although I believe the preferred syntax (at least, I think it's the
 preferred) is

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders
  INNER JOIN
   admin
 ON  workorders.AdminID = admin.AdminID
 WHERE admin.UserName = ' . mysql_real_escape_string($username) . ';


 Andrew

 

I think I see what you're trying to do:

$query = SELECT AdminID FROM admin WHERE UserName = '
. mysql_real_escape_string($_SESSION['user']) . ';
$result = mysql_query($query);
$admins = mysql_fetch_assoc($result);

$query = SELECT * FROM workorders WHERE AdminID = '
. $admins['AdminID'] . ';
$result = mysql_query($query);
$workorders = mysql_fetch_assoc($result);

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Terion Miller wrote:
 Well I'm stuck I have the AdminID but now I can't seem to use it to pull
 workorders with that AdminID . I couldn't get your block to work Andrew :(

 I think I'm just not using it right now that I have it...lol


 On Wed, Jan 28, 2009 at 2:26 PM, Andrew Ballard aball...@gmail.com wrote:

 On Wed, Jan 28, 2009 at 3:18 PM, Terion Miller webdev.ter...@gmail.com
 wrote:
 Not sure if I'm wording this right, what I am trying to do is look in two
 tables, match the ID to use to pull information

 Here's my code but it's not right, although it is picking up the user
 from
 the session, I will also post what my variable debugging lists:

$query = SELECT  admin.AdminID, workorders.AdminID FROM admin,
 workorders WHERE admin.UserName =   '.$_SESSION['user'].' ;
$result = mysql_query ($query);
$row = mysql_fetch_assoc ($result);

echo $row['AdminID'];

if ($row['ViewMyOrders'] == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
 not have access to that page.);
}

 *Also tried this to pull just this persons orders:*

$sql = SELECT workorders.WorkOrderID , workorders.AdminID,
 admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
 admin.AdminID ;
$result = mysql_query ($sql);

 Thanks for looking, t.

 Your first version gives you a Cartesian product containing more rows
 than you are expecting. (All rows from the workorders table joined
 with the row in the admin table where the username matches.) The
 second version returns all rows where the AdminIDs match, but for all
 users. You need to combine them:

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders, admin
 WHERE workorders.AdminID = admin.AdminID
   AND admin.UserName = ' . mysql_real_escape_string($username) . ';


 Although I believe the preferred syntax (at least, I think it's the
 preferred) is

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders
  INNER JOIN
   admin
 ON  workorders.AdminID = admin.AdminID
 WHERE admin.UserName = ' . mysql_real_escape_string($username) . ';


 Andrew

 
 I think I see what you're trying to do:
 
 $query = SELECT AdminID FROM admin WHERE UserName = '
 . mysql_real_escape_string($_SESSION['user']) . ';
 $result = mysql_query($query);
 $admins = mysql_fetch_assoc($result);
 
 $query = SELECT * FROM workorders WHERE AdminID = '
 . $admins['AdminID'] . ';
 $result = mysql_query($query);
 $workorders = mysql_fetch_assoc($result);
 

Well maybe not.  Has anyone noticed that all the proposed selects
including the OPs are only returning AdminID and WorkOrderID?  But in
the OPs code he's trying to use $row['ViewMyOrders']!

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Terion Miller wrote:
 On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie nos...@mckenzies.netwrote:
 
 Shawn McKenzie wrote:
 Terion Miller wrote:
 Well I'm stuck I have the AdminID but now I can't seem to use it to pull
 workorders with that AdminID . I couldn't get your block to work Andrew
 :(
 I think I'm just not using it right now that I have it...lol


 On Wed, Jan 28, 2009 at 2:26 PM, Andrew Ballard aball...@gmail.com
 wrote:
 On Wed, Jan 28, 2009 at 3:18 PM, Terion Miller 
 webdev.ter...@gmail.com
 wrote:
 Not sure if I'm wording this right, what I am trying to do is look in
 two
 tables, match the ID to use to pull information

 Here's my code but it's not right, although it is picking up the user
 from
 the session, I will also post what my variable debugging lists:

$query = SELECT  admin.AdminID, workorders.AdminID FROM admin,
 workorders WHERE admin.UserName =   '.$_SESSION['user'].' ;
$result = mysql_query ($query);
$row = mysql_fetch_assoc ($result);

echo $row['AdminID'];

if ($row['ViewMyOrders'] == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you
 do
 not have access to that page.);
}

 *Also tried this to pull just this persons orders:*

$sql = SELECT workorders.WorkOrderID , workorders.AdminID,
 admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
 admin.AdminID ;
$result = mysql_query ($sql);

 Thanks for looking, t.

 Your first version gives you a Cartesian product containing more rows
 than you are expecting. (All rows from the workorders table joined
 with the row in the admin table where the username matches.) The
 second version returns all rows where the AdminIDs match, but for all
 users. You need to combine them:

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders, admin
 WHERE workorders.AdminID = admin.AdminID
   AND admin.UserName = ' . mysql_real_escape_string($username) . ';


 Although I believe the preferred syntax (at least, I think it's the
 preferred) is

 $sql =
 SELECT workorders.WorkOrderID , workorders.AdminID, admin.AdminID
 FROM workorders
  INNER JOIN
   admin
 ON  workorders.AdminID = admin.AdminID
 WHERE admin.UserName = ' . mysql_real_escape_string($username) . ';


 Andrew

 I think I see what you're trying to do:

 $query = SELECT AdminID FROM admin WHERE UserName = '
 . mysql_real_escape_string($_SESSION['user']) . ';
 $result = mysql_query($query);
 $admins = mysql_fetch_assoc($result);

 $query = SELECT * FROM workorders WHERE AdminID = '
 . $admins['AdminID'] . ';
 $result = mysql_query($query);
 $workorders = mysql_fetch_assoc($result);

 Well maybe not.  Has anyone noticed that all the proposed selects
 including the OPs are only returning AdminID and WorkOrderID?  But in
 the OPs code he's trying to use $row['ViewMyOrders']!

 --
 Thanks!
 -Shawn
 http://www.spidean.com

 
 I have to get only the work orders associated with the adminID, I get the
 pages but no orders.  and if I print my variables I am grabbing the right
 adminID but it's not then going and grabbing the work orders with it.  I'm
 not up on the correct phrasing, been doing this about 2 months.
 
Well, try what I posted (needs some error checking).  Where does
ViewMyOrders come from?  admin table?  It would be even easier if you
put the AdminID in the SESSION also :-)

There also seems to be some design flaws.  Why query the database for
orders if the user is not allowed to view their orders?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] New to PHP question

2009-01-28 Thread Shawn McKenzie
Boyd, Todd M. wrote:
 -Original Message-
 From: Stephen [mailto:stephe...@rogers.com]
 Sent: Wednesday, January 28, 2009 1:41 PM
 To: Paul M Foster
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] New to PHP question

 Paul M Foster wrote:
 If you want exact layout (columns
 lined up, etc.), the simplest solution is to use HTML tables.



 The horror.

 Do not use tables for layout.

 Use CSS.

 Especially now that Microsoft, just this week, is sending out IE 8
 which
 seems to be fully CCS standards compliant.
 
 Your high horse--get off of it.
 
 Are you not familiar with div-itis? If I need to represent data in a
 grid-style layout, I am going to use a table every time instead of
 making tons of div elements and tying them into the appropriate CSS.
 
 http://www.giveupandusetables.com
 
 Also... as far as I know, XHTML 1.0 Strict and XHTML 1.1 still include
 the table tags. I can understand wanting to separate style from
 structure, but I think that tables are more structural than stylish. You
 have to draw the line somewhere.
 
 If you're displaying tabular data, use a table. If you just want stuff
 to be in a grid and the structure has no bearing on the content, then
 it's time to weigh in. 
 
 Finally, just because IE8 is (supposed to be) fully CSS standards
 compliant doesn't mean anything for IE7, IE6, IE5, etc.
 
 
 // Todd

Or firefox for that matter.  I tried to do a completely css site and
when I got it looking great in ff/linux, it looked horrible in IE.  Then
when it looked better in IE and better in ff/linux, it had some issues
iin ff/windows.  I love tables and will use them for most layouts until
they are removed from (x)html :-)

-Shawn

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie


 Here are my variables when I reveal them, I am picking up the right
 adminID I can't figure out why it's returning random orders though:
 $querySELECT admin.AdminID, workorders.AdminID FROM admin,
 workorders WHERE admin.UserName = 'tmiller' 
 $result   Resource id #5
 $row  
 key   value
 [WorkOrderID] 44
 [AdminID] 7

 $SortBy   WorkOrderID DESC
 $Page 2
 $PerPage  30
 $StartPage30
 $sql  SELECT workorders.WorkOrderID, workorders.AdminID,
 admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
 admin.AdminID 
 $Total3


Because your queries are hosed.  You want to populate $row with what? 
If you want all the fields in workorders, then this works great:

SELECT * FROM workorders WHERE AdminID = 7

-Shawn

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



Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie


Terion Miller wrote:



 Your  post made perfect sense to me about the INNER JOIN , I
 looked it up but it is not returning the AdminID, maybe my
 syntax is wrong?

 $query =  SELECT admin.AdminID , workorders.AdminID
 FROM admin
 INNER JOIN
 workorders
 ON  AdminID(admin, workorders)
 WHERE admin.UserName =   '.$_SESSION['user'].' ;


 The syntax is wrong.

 inner join workorders using (adminid)
 ^^
 only works if both tables are using the same field name, the db
 will expand it into the syntax below. Here you just need to
 specify the fieldname to join on (ie the common one).

 or

 inner join workorders on (admin.adminID=workorders.adminID)
 ^^
 if the field names are not named the same, eg:

 select * from
 comments
 inner join users on (comments.user_id=users.id http://users.id)

 Well I tried both ways and still cannot get it to pick up the AdminID,

The main problem is that you've never explained what you want to get
from the query.  The replies have used your code as an example and I'm
pretty sure that's not what you want.  Unless I totally mis-understand
what you want, you have 2 options:

1. Use the 2 queries that I gave you in a previous post.
2. Use a subquery:

$sql = SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM admin 
WHERE UserName = ' 
. mysql_real_escape_string($_SESSION['user']) . ');

-Shawn





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



<    1   2   3   4   5   6   7   8   9   10   >