Re: [PHP] Quick question - Warnings

2003-08-14 Thread Shena Delian O'Brien
Try using in your PHP page:

error_reporting (E_ALL ^ E_NOTICE);

Ryan A wrote:

Hi John,
Thanks for replying, I already tried that and thought i might be mistaken
because i am still getting stuff like this:
Notice: Undefined index: facility24 in
/home/bestweb/public_html/add_co_location.php on line 12
Plenty of notices
I tried:
php_value error_reporting 0 (and)
php_value error_reporting 0;
but am still getting those damn notices
any other ideas?
Thanks,
-Ryan
We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com



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


[PHP] Re: funcky parse error message due to { } or not sure what else mightcause

2003-08-09 Thread Shena Delian O'Brien
Can you post the entire error?

Is that a  or a '' ? if a , you need a closing  to go with it.

Jim M Gronquist wrote:
I added one term to a listing
-
if ( $follow_up == ) {
$error=true;
}

and now I'm getting a parse error
Ugh

I can't see anything that is causing this.

The script worked before.

Any idea where I might start to debug?

When I had this problem before it was because I had
Added a } which messed up the {  }  agreement but I only added
These 3 lines which shouldn't mess up the { } I don't think...



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


[PHP] Re: convert mysql datetime to unix timestamp

2003-07-28 Thread Shena Delian O'Brien
Look into mktime()
http://us3.php.net/manual/en/function.mktime.php
Chris Hayes wrote:
hi,
i have to move data from a table with a datetime (2003-05-14 13:36:04) 
to a unix timestamp (e.g. 2147483647) . Any ideas?

Chris



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


[PHP] Re: changing the name of a variable by another variable.

2003-07-22 Thread Shena Delian O'Brien
What I do is:

$var = variable.$increment;
echo $$var;
Tony Crockford wrote:
I really am having a difficult day.

I want to do an incrementing while loop that will echo out the values of
$variable1 , $variable2, $variable3 which exist previously.
so how do I get the incrementing number onto the word variable? to make
a new variable that matches thename of the existing ones..
I tried echo $variable$increment ; but $variable doesn't exist alone so
all I get is $increment.
I'm not sure what I should be looking for in the manual - google's not
much help either.
anyone give me a clue?

TIA

Tony



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


[PHP] Odd Error (PHP4 IIS)

2003-07-16 Thread Shena Delian O'Brien
Hi -

Got PHP4 running on IIS as a testing server (only used internally for my 
own testing purposes). It suddenly just flurbed on pages it worked fine 
on minutes ago. Now suddenly it gives me this error (with popups telling 
me about the missing files):

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This 
means that a page will only be served up if the REDIRECT_STATUS CGI 
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual 
page for CGI security.

For more information about changing this behaviour or re-enabling this 
webserver, consult the installation file that came with this 
distribution, or visit the manual page.
PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\imap.so' - The specified module could not be found. in 
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\ldap.so' - The specified module could not be found. in 
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\pgsql.so' - The specified module could not be found. in 
Unknown on line 0

I don't know why it's looking in /usr/lib - I'm running WinXP and IIS, 
not apache, and not linux. I looked in php.ini and there's no pointers 
to directories like that there! Ugh.. furthermore cgi.force_redirect is 
set to 0 like it should!

Any assistance is appreciated.

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


Re: [PHP] Odd Error (PHP4 IIS)

2003-07-16 Thread Shena Delian O'Brien
Tried. Didn't work then, isn't working now.

Johnny Martinez wrote:
I see this randomly on my little server. Just hit the refresh button :P

J

-Original Message-
From: Shena Delian O'Brien [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 10:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Odd Error (PHP4  IIS)
Hi -

Got PHP4 running on IIS as a testing server (only used internally for my 
own testing purposes). It suddenly just flurbed on pages it worked fine 
on minutes ago. Now suddenly it gives me this error (with popups telling 
me about the missing files):

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This 
means that a page will only be served up if the REDIRECT_STATUS CGI 
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual 
page for CGI security.

For more information about changing this behaviour or re-enabling this 
webserver, consult the installation file that came with this 
distribution, or visit the manual page.
PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\imap.so' - The specified module could not be found. in 
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\ldap.so' - The specified module could not be found. in 
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library 
'/usr/lib/php4\pgsql.so' - The specified module could not be found. in 
Unknown on line 0

I don't know why it's looking in /usr/lib - I'm running WinXP and IIS, 
not apache, and not linux. I looked in php.ini and there's no pointers 
to directories like that there! Ugh.. furthermore cgi.force_redirect is 
set to 0 like it should!

Any assistance is appreciated.




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


[PHP] Re: How can I display an image within a script?

2003-07-15 Thread Shena Delian O'Brien
That's a very good question. I'd like to know the answer to that as well.

Dan Anderson wrote:
Because of restrictive safe mode settings I cannot display images from
their folder.  Is there a way to embed them within a web page?
i.e.

?php
print IMAGE START\n;
readfile('image.jpeg');
print /IMAGE END\n;
?
Thanks in advance,

Dan Anderson



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


[PHP] Re: How can I display an image within a script?

2003-07-15 Thread Shena Delian O'Brien
I think here would be a good place to start looking:
http://www.php.net/manual/en/ref.image.php
Dan Anderson wrote:
Because of restrictive safe mode settings I cannot display images from
their folder.  Is there a way to embed them within a web page?
i.e.

?php
print IMAGE START\n;
readfile('image.jpeg');
print /IMAGE END\n;
?
Thanks in advance,

Dan Anderson



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


[PHP] Re: Problem getting phpMyAdmin to work on localhost

2003-07-14 Thread Shena Delian O'Brien
What's your:

$cfg['PmaAbsoluteUri']
$cfg['Servers'][$i]['host']
? Should be something like :

$cfg['Servers'][$i]['host'] = 'http://localhost/phpMyAdmin';
$cfg['Servers'][$i]['host'] = 'localhost';
Post other config entries that you've changed...? What authentication 
method are you using, etc? Sounds like maybe just maybe your 
authentication isn't working...

Richard White wrote:
I have a couple of problems with newish MySQL database.

I am running WinXP-Pro, MySQL V 4.0.12-nt, Apache etc.  I previously got
this all working, but today (after a break of a couple of weeks) I can't get
phpMyAdmin-2.5.0-rc1 to work.
I have configured {config.inc.php} exactly as per documentation, but when I
try to run the {index.php} file in IE6, I get a pause (nothing new
displayed) and then the address bar reverts to the currently displayed page.
(ie the page displayed in IE just before I tried {index.php})
I don't see any errors???   Is this a known/common problem, with a solution?
If not, how can I find out what the problem is?
** Please also see my Notes below. **

NOTES:
1. I have a web site, with MySQL and I can run that copy of phpMyAdmin
2. I do have PHP working *locally* in IE ok.
3. I do have MySQL working and can administer is from the windows program
MySQL Control Center v0.9.1.



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


[PHP] Re: HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!! can someone tell me whats wronghere? (newbie)

2003-07-10 Thread Shena Delian O'Brien
Well for one thing, you've misspelled one of your variables...

the if ($instal==0) should be, if I'm not incorrect,
if ($install==0)
Mark Clarkstone wrote:
Can anyone help me with this code I just get someting about $end  help me fix it 



Thanks

Parse error: parse error, unexpected $end in C:/apache/htdocs/test.php on line 73

title Control Panel/title
font face=\Tahoma\ size=\2\
?
require(cpconf.php);
if ($instal==0) {

print pfont size=\2\ face=\Tahoma\bWelcome to The Control Panel Installerbr
br
/bThis will install the control Panel/font/p
form method=\POST\ action=\?action=check\
  font face=\Tahoma\ size=\2\Please enter your site domain e.g. 
  freesite.cjb.com (without a www or a dot please) leave as localhost if you are 
  using it as a local testing server./fontbr
  input type=\text\ name=\csiteex\ size=\20\ value=\localhost\br
  br
  font size=\2\ face=\Tahoma\Please enter a Username amp; password to access the 
  areabr
  Usernamebr
  input type=\text\ name=\user\ size=\20\br
  Passwordbr
  input type=\text\ name=\pass\ size=\20\/fontbr
  input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($action == check) {

if (!$csiteex) {
echo Please enter your domain;
}
else if (!$user) {
echo Please enter a username;
}
else if (!$pass) {
echo Please enter a password;
}
else if ($csiteex  $user  $pass) {
$data = ?
\$l33t = \C:/miniserve/Apache/conf/l33t.conf\;
\$syspath = \C:\;
\$install = \1\;
\$siteex = \$csiteex\;
\$admin = \$user\;
\$adpw = \$pass\; 

?;
$fp = fopen(cpconf.php,'w');
$fw = fwrite($fp,$data);
fclose($fp);
}
}
else if ($install ==1) {
echo pfont size=\2\ face=\Tahoma\bWelcome to The Control Panel/b/font/p
form method=\POST\ action=\?login=check\
  font size=\2\ face=\Tahoma\Please enter a Username amp; password to access the 
  areabr
  Usernamebr
  input type=\text\ name=\userlogin\ size=\20\br
  Passwordbr
  input type=\text\ name=\passlogin\ size=\20\/fontbr
  input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($login==check) {

if (!$userlogin  !$passlogin) {
echo Sorry but No Username or password was found;
}
else if ($userlogin  $userpass == $admin  $adpw) {
include(admin.php);
}
?



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


[PHP] Re: Continuing with HELP can someone tell me whats wrong here? (newbie)

2003-07-10 Thread Shena Delian O'Brien
Where are you passing the variable install? I can't see it in your 
form. Perhaps look for $check instead of $install?

Mark Clarkstone wrote:
now the script works but won't write to the file just returns to the form.

title Control Panel/title
font face=\Tahoma\ size=\2\
?
require(cpconf.php);
if ($install==0) {

print pfont size=\2\ face=\Tahoma\bWelcome to The Control Panel
Installerbr
br
/bThis will install the control Panel/font/p
form method=\POST\ action=\?action=check\
  font face=\Tahoma\ size=\2\Please enter your site domain e.g.
  freesite.cjb.com (without a www or a dot please) leave as localhost if you
are
  using it as a local testing server./fontbr
  input type=\text\ name=\csiteex\ size=\20\ value=\localhost\br
  br
  font size=\2\ face=\Tahoma\Please enter a Username amp; password to
access the
  areabr
  Usernamebr
  input type=\text\ name=\user\ size=\20\br
  Passwordbr
  input type=\text\ name=\pass\ size=\20\/fontbr
  input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($action==check) {
if (!$csiteex) {
echo Please enter your domain;
}
else if (!$user) {
echo Please enter a username;
}
else if (!$pass) {
echo Please enter a password;
}
else {
$data = ?
\$l33t = \C:/miniserve/Apache/conf/l33t.conf\;
\$syspath = \C:\;
\$install = \1\;
\$siteex = \$csiteex\;
\$admin = \$user\;
\$adpw = \$pass\;
?;
$fp = fopen(cpconf.php,'w');
$fw = fwrite($fp,$data);
fclose($fp);
echo Done!;
}
}
else if ($install ==1) {
echo pfont size=\2\ face=\Tahoma\bWelcome to The Control
Panel/b/font/p
form method=\POST\ action=\?login=check\
  font size=\2\ face=\Tahoma\Please enter a Username amp; password to
access the
  areabr
  Usernamebr
  input type=\text\ name=\userlogin\ size=\20\br
  Passwordbr
  input type=\text\ name=\passlogin\ size=\20\/fontbr
  input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($login==check) {
if (!$userlogin  !$passlogin) {
echo Sorry but No Username or password was found;
}
else if ($userlogin  $userpass == $admin  $adpw) {
include(admin.php);
}
}
?




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


[PHP] Re: Continuing with HELP can someone tell me whats wrong here? (newbie)

2003-07-10 Thread Shena Delian O'Brien
Well you realize don't you that unless, on submit, install changes to 1, 
whenever you submit your form it's going to go right back to the initial 
page.

Mark Clarkstone wrote:
Its in cpconf.php

?
$l33t = C:/miniserve/Apache/conf/l33t.conf;
$syspath = C:;
$install = 0;
$siteex = MySite.Org;
$admin = mini;
$adpw = serve;
?



Shena Delian O'Brien [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Where are you passing the variable install? I can't see it in your
form. Perhaps look for $check instead of $install?
Mark Clarkstone wrote:

now the script works but won't write to the file just returns to the

form.

title Control Panel/title
font face=\Tahoma\ size=\2\
?
require(cpconf.php);
if ($install==0) {

print pfont size=\2\ face=\Tahoma\bWelcome to The Control

Panel

Installerbr
br
/bThis will install the control Panel/font/p
form method=\POST\ action=\?action=check\
 font face=\Tahoma\ size=\2\Please enter your site domain e.g.
 freesite.cjb.com (without a www or a dot please) leave as localhost if

you

are
 using it as a local testing server./fontbr
 input type=\text\ name=\csiteex\ size=\20\

value=\localhost\br

 br
 font size=\2\ face=\Tahoma\Please enter a Username amp;

password to

access the
 areabr
 Usernamebr
 input type=\text\ name=\user\ size=\20\br
 Passwordbr
 input type=\text\ name=\pass\ size=\20\/fontbr
 input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($action==check) {
if (!$csiteex) {
echo Please enter your domain;
}
else if (!$user) {
echo Please enter a username;
}
else if (!$pass) {
echo Please enter a password;
}
else {
$data = ?
\$l33t = \C:/miniserve/Apache/conf/l33t.conf\;
\$syspath = \C:\;
\$install = \1\;
\$siteex = \$csiteex\;
\$admin = \$user\;
\$adpw = \$pass\;
?;
$fp = fopen(cpconf.php,'w');
$fw = fwrite($fp,$data);
fclose($fp);
echo Done!;
}
}
else if ($install ==1) {
echo pfont size=\2\ face=\Tahoma\bWelcome to The Control
Panel/b/font/p
form method=\POST\ action=\?login=check\
 font size=\2\ face=\Tahoma\Please enter a Username amp;

password to

access the
 areabr
 Usernamebr
 input type=\text\ name=\userlogin\ size=\20\br
 Passwordbr
 input type=\text\ name=\passlogin\ size=\20\/fontbr
 input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($login==check) {
if (!$userlogin  !$passlogin) {
echo Sorry but No Username or password was found;
}
else if ($userlogin  $userpass == $admin  $adpw) {
include(admin.php);
}
}
?






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


[PHP] Re: Continuing with HELP can someone tell me whats wrong here? (newbie)

2003-07-10 Thread Shena Delian O'Brien


Mark Clarkstone wrote:
yes

Well since that's what you said happens, isn't that where you should 
look for the problem? My guess is that install isn't changing to 1. I 
would change your line to:

if ( ($install == 0)  (!$check) ) {

instead of just:

if ($install==0) {


Shena Delian O'Brien [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Well you realize don't you that unless, on submit, install changes to 1,
whenever you submit your form it's going to go right back to the initial
page.
Mark Clarkstone wrote:

Its in cpconf.php

?
$l33t = C:/miniserve/Apache/conf/l33t.conf;
$syspath = C:;
$install = 0;
$siteex = MySite.Org;
$admin = mini;
$adpw = serve;
?



Shena Delian O'Brien [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Where are you passing the variable install? I can't see it in your
form. Perhaps look for $check instead of $install?
Mark Clarkstone wrote:


now the script works but won't write to the file just returns to the

form.


title Control Panel/title
font face=\Tahoma\ size=\2\
?
require(cpconf.php);
if ($install==0) {

print pfont size=\2\ face=\Tahoma\bWelcome to The Control

Panel


Installerbr
br
/bThis will install the control Panel/font/p
form method=\POST\ action=\?action=check\
font face=\Tahoma\ size=\2\Please enter your site domain e.g.
freesite.cjb.com (without a www or a dot please) leave as localhost

if

you


are
using it as a local testing server./fontbr
input type=\text\ name=\csiteex\ size=\20\

value=\localhost\br

br
font size=\2\ face=\Tahoma\Please enter a Username amp;

password to


access the
areabr
Usernamebr
input type=\text\ name=\user\ size=\20\br
Passwordbr
input type=\text\ name=\pass\ size=\20\/fontbr
input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($action==check) {
if (!$csiteex) {
echo Please enter your domain;
}
else if (!$user) {
echo Please enter a username;
}
else if (!$pass) {
echo Please enter a password;
}
else {
$data = ?
\$l33t = \C:/miniserve/Apache/conf/l33t.conf\;
\$syspath = \C:\;
\$install = \1\;
\$siteex = \$csiteex\;
\$admin = \$user\;
\$adpw = \$pass\;
?;
$fp = fopen(cpconf.php,'w');
$fw = fwrite($fp,$data);
fclose($fp);
echo Done!;
}
}
else if ($install ==1) {
echo pfont size=\2\ face=\Tahoma\bWelcome to The Control
Panel/b/font/p
form method=\POST\ action=\?login=check\
font size=\2\ face=\Tahoma\Please enter a Username amp;

password to


access the
areabr
Usernamebr
input type=\text\ name=\userlogin\ size=\20\br
Passwordbr
input type=\text\ name=\passlogin\ size=\20\/fontbr
input type=\submit\ value=\Submit\ name=\B1\/p
/form;
}
else if ($login==check) {
if (!$userlogin  !$passlogin) {
echo Sorry but No Username or password was found;
}
else if ($userlogin  $userpass == $admin  $adpw) {
include(admin.php);
}
}
?







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


[PHP] Re: How to hide url on a php link NOT post...

2003-07-10 Thread Shena Delian O'Brien
http://www.tinyurl.com

Joey wrote:
How can I hide this link so value can't be changed?
I don't want to change anything at the server level, and its not from a 
form so I cant do a post -vs- a get.

http://www.abcd.com/popup_SearchRepSet.php?searchby=cust_nosearch=1value=WOR032 

Thanks !



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


[PHP] date frustrations

2003-07-08 Thread Shena Delian O'Brien
Ok so on a web application I needed to list the files in a directory, 
ordered by last modified date.

I was pulling them out in an array, fetching the filemtime() for each 
file, and trying to order them by that date. I was using asort() to sort 
the files in an array so they'd list chronologically.

Well that wasn't working as planned. Files were getting out of order. I 
figured asort() could have been having trouble ordering dates 
numerically, so I tried strtotime() on the dates first, and ordered the 
files by unix timestamp.

That didn't work either. I did a date() on the unix timestamp fetched by 
strtotime() and found that the dates were coming out inaccurately. 2003 
was being changed to 2013, etc.

Well I gradually figured out that the date format output by filemtime() 
was not an acceptable natural language date format. filemtime() was 
fetching dates with a dash - ex. 07-08-2003. strtotime() was making 
incorrect timestamps because it doesn't read dates with dashes formatted 
that way. Apparently asort() reads dates the same way strtotime does.

I think this is kind of perverse... in order to fix it I had to do an 
ereg_replace(-,/,$date) in order to change the filemtime() date 
format to one properly readable by strtotime and asort.

*sigh*

Am I the only one who has noticed this? Is this something that can be 
corrected in PHP? (Perhaps the dates fetched by filemtime() etc can be 
changes to be formatted in a way that is acceptable to other date() 
functions??)

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


Re: [PHP] date frustrations

2003-07-08 Thread Shena Delian O'Brien
Ahh, you're right! I had a rogue:

$date = date(m-d-Y, filemtime($fn));

in there. :) Thought I got rid of all of those in testing... my 
organization has a standard date format and it must be dashes instead of 
slashes, and of course it has to be month, day, year!

Jason Wong wrote:
On Wednesday 09 July 2003 01:51, Shena Delian O'Brien wrote:

[snip]


Well I gradually figured out that the date format output by filemtime()
was not an acceptable natural language date format. filemtime() was
fetching dates with a dash - ex. 07-08-2003. strtotime() was making
incorrect timestamps because it doesn't read dates with dashes formatted
that way. 


What version of PHP are you using? And what exactly is the code that you're 
using?

filemtime() returns a _unix timestamp_ and will asort() as is.



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


Re: [PHP] PDF on the fly:::Addition

2003-07-03 Thread Shena Delian O'Brien
[-^-!-%- wrote:
I just found out that the generated file, though with .pdf extension, is
actually an HTML file. The file was never encoded to PDF.
What am I missing?
You need a PDF file library...

http://www.php.net/manual/en/ref.cpdf.php
http://www.php.net/manual/en/ref.pdf.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Red Hat 9, Apache 2, and PHP

2003-07-03 Thread Shena Delian O'Brien
Does anyone know why Red Hat would switch to Apache 2.x.x when it is 
well known that 2.x.x is NOT a production version?

Brad Pauly wrote:
Just thought I would share my experience with RH9. I have been running 
Apache 1.3.27 and PHP 4.3.2 on RH9 for a couple weeks (since 4.3.2 came 
out anyway, and 4.3.1 prior to that) on a test server. All are compiled 
from source. The only problem I have had was a bug with the version of 
mogrify that is bundled with RH9. That was fixed by 'upgrading' to an 
older version. Other than that it has been fine.

Brad






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


[PHP] comparing two arrays

2003-07-02 Thread Shena Delian O'Brien
Hi -

I have two arrays that need to be compared. I need to know if their 
values match or not.

Currently I have:

$array1 = array(a, b, c, d);
$array2 = array(c, d, e, f, g);
$intersect = array_intersect($array1,$array2);

$num1 = count($array1);
$num2 = count($intersect);
Then I can compare $num1 to $num2 to see where I stand on the 
comparison. Less than, greater than, or equal.

Only there's a problem with this if there are identical values in an array:

$array1 = array(e, e);
$array2 = array(c, d, e, f, g);
The intersect for this returns e twice instead of the once that I need 
for my code. It's true that in array1 there was indeed two matches, but 
 in array2 there was only 1 match, and that is the match that matters 
in my code. Does this make sense?

Is there a way to do this that I'm missing...?

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


Re: [PHP] comparing two arrays

2003-07-02 Thread Shena Delian O'Brien
Michael A Smith wrote:
Look at array_diff() (http://php.net/array_diff). That ought to do what
you want.
Yes! Thank you :)


-Michael
On Wed, 2003-07-02 at 10:15, Shena Delian O'Brien wrote:
Hi -

I have two arrays that need to be compared. I need to know if their 
values match or not.

Currently I have:

$array1 = array(a, b, c, d);
$array2 = array(c, d, e, f, g);
$intersect = array_intersect($array1,$array2);

$num1 = count($array1);
$num2 = count($intersect);
Then I can compare $num1 to $num2 to see where I stand on the 
comparison. Less than, greater than, or equal.

Only there's a problem with this if there are identical values in an array:

$array1 = array(e, e);
$array2 = array(c, d, e, f, g);
The intersect for this returns e twice instead of the once that I need 
for my code. It's true that in array1 there was indeed two matches, but 
 in array2 there was only 1 match, and that is the match that matters 
in my code. Does this make sense?

Is there a way to do this that I'm missing...?





--
Give to a good cause! * http://www.modestneeds.org/
Shena Delian O'Brien  * http://www.darklock.com/shena/
The Graphics Kitty!   * http://www.darklock.com/abstract/
Fantasy Age   * http://www.fantasyage.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] array_intersect()

2003-07-01 Thread Shena Delian O'Brien
Is this function still broken in php 4.3.0+?

The manual says it was broken in PHP 4.0.4.

Thanks.

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


[PHP] Re: Nested mysql_query()'s

2003-07-01 Thread Shena Delian O'Brien
Sparky Kopetzky wrote:
Hi!

I've got two nested queries where one looks up data based on values returned from the first.

$lot_query = SELECT * FROM LOT WHERE lot_category_id= . $lot_category .
 AND lot_close_time . time();
$lot_result = mysql_query($lot_query, $CONNECT_ID);
if ($lot_result)
{
while ($row = mysql_fetch_array($lot_result))
{
blah-blah-blah...
$bid_query = select * from bids where bid_lot_id= . $lot_id .
 order by bid_amount;
$bid_result = mysql_query($bid_query, $CONNECT_ID);
$bid_count = mysql_num_rows($bid_result);

blah-blah-blah...

I get this error message: Warning: mysql_num_rows(): supplied 
 argument is not a valid MySQL result resource  from the second
 query. Do I need a second $CONNECT_ID for a second link to 
mysql_query #2??

No... you don't even need to use a connect ID. It should work fine if 
you just use mysql_query($bid_query)

The problem is likely that the query is failing for some reason and thus 
not generating a proper result. Do an echo mysql_error($CONNECT_ID) to 
figure out if there's an error in your syntax, etc.

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


Re: [PHP] have some free time?

2003-07-01 Thread Shena Delian O'Brien
You need to return $x out of the function.

So do this:

function hello() {
print 'hello ' . $name;
$x = 1;
return ($x);
}
etc

Then call it assigned to a variable:

$x = hello();
echo $x;
bye();
Kyle Babich wrote:
I think this is short example of my problem...

?php

$name = 'kyle';

function hello() {
print 'hello ' . $name;
$x = 1;
}
function bye() {
if ($x == 1) print 'x = 1';
else print 'x != 1';
}
hello();
bye();
?

Right now this returns:  hello x != 1
What do I have to do to get bye() to return 'x = 1'? I tried declaring
the x = 1 in hello() global and I tried declaring it static.


On Tue, 01 Jul 2003 17:27:48 -0500, Kyle Babich [EMAIL PROTECTED]
said:
Any php programmers out there have a little free time?  I've been trying
to find the bug in my logging system forever and I've all but given up. 
If anyone else wants to try their luck then...

http://babich.us/log/source/log.php.txt
http://babich.us/log/source/config.inc.php.txt
http://babich.us/log/source/test.php.txt
http://babich.us/log/source/clearLogs.inc.php.txt
http://babich.us/log/source/logIpData.inc.php.txt
http://babich.us/log/source/logAgentData.inc.php.txt
http://babich.us/log/source/logLangData.inc.php.txt
I have a feeling that it is an obvious, simple error that I am missing.
Anyway, back to the bug hunting...
--
Kyle
--
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