Re: [PHP] Weird problem with is_file()

2010-04-26 Thread Peter Lind
On 25 April 2010 22:14, Michelle Konzack linux4miche...@tamay-dogan.net wrote:
 Hi,

 I have a code sniplet which does not work and I do not know why:

 8--
  $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . 
 $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head 
 -n1);

  if (is_file($isfile)) {
 snip
 8--

 nothing special, and the file  is there, but the stuff with

    is_file($isfile)

 is not working...  If I enter the file in place of $isfile, then  it  is
 working.   Quoting of $isfile does not work too.

 What have a overseen?

var_dump($isfile);

Don't make assumptions of what the value is, just check it.

Regards
Peter


-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] Weird problem with is_file()

2010-04-26 Thread Jan G.B.
2010/4/25 Michelle Konzack linux4miche...@tamay-dogan.net:
 Hi,

 I have a code sniplet which does not work and I do not know why:

 8--
  $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . 
 $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head 
 -n1);


Hi Michelle,
I would recommend not to let any user input to your shell. This piece
of code is very insecure as any client may manipulate the shell
command at will.
You don't want people to take over your server that easily.

See http://www.php.net/escapeshellcmd and alike.

Regards

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



Re: [PHP] Weird problem with is_file()

2010-04-25 Thread Karl DeSaulniers

Hi Michelle,
Maybe try adding an error catch to see what you get.

if(is_file($isFile)) or die(mysql_error());

On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote:


 if (is_file($isfile)) {


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Weird problem with is_file()

2010-04-25 Thread Karl DeSaulniers

Oops, my apologies. That is a PHP MySQL solution. Wrong list.
Please disregard that solution.
Maybe find a way to get an error response from your session to see  
what the problem is.


Karl


On Apr 25, 2010, at 3:24 PM, Karl DeSaulniers wrote:


Hi Michelle,
Maybe try adding an error catch to see what you get.

if(is_file($isFile)) or die(mysql_error());

On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote:


 if (is_file($isfile)) {


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Weird problem with T_gettext()

2009-04-04 Thread Per Jessen
Michelle Konzack wrote:

 Now selecting de as prefered language is  working,  but  if  I 
 select de_DE in  Firefox,  the  second  term  About Us  is 
 something like Über Uns insteed Über Uns because the Website is
 UTF-8. 

Indeed.  I'll venture a guess and say it's because your dictionary file
is bad or not actually UTF8.

 This is realy weird, since the MO file  is  the  same  for  both 
 locale versions.

Ah. Very weird, yes.  Are you doing a setlocale() anywhere? 

 Also it is weird, that php-gettext does not do a fallback, if  I 
 have only de and not de_DE.

Fallback to what?  I only have 'de' in my browser language preferences,
and your site came up fine in German.


/Per


-- 
Per Jessen, Zürich (11.7°C)


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



Re: [PHP] Weird problem with HTML form and $_POST

2008-11-05 Thread Oscar Gosdinski
On Wed, Nov 5, 2008 at 8:47 AM, Oscar Gosdinski [EMAIL PROTECTED] wrote:
 Name the select tag as sub_projects[], then in PHP you can read the
 $sub_project variable as an array.

Oops, my error... you have to use the $_POST['sub_projects'] variable
as an array.

-- 
Saludos
Oscar

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



Re: [PHP] Weird problem with HTML form and $_POST

2008-11-05 Thread Oscar Gosdinski
On Sat, Nov 1, 2008 at 6:20 PM, Michelle Konzack
[EMAIL PROTECTED] wrote:
select class=setupProjectAddSelect name=sub_projects 
 multiple=multiple size=10
   option value=6 selectedATX 120/option
   option value=4ATX 60/option
   option value=5ATX 90/option
   option value=11Device 2/option
   option value=12Device 4/option
   option value=13Lowvoltage/option
   option value=7P4 Module/option
   option value=8SATA 2/option
   option value=9 selectedSATA 4/option
   option value=10 selectedSATA 8/option
/select

 Hell, why is $_POST['sub_projects'] eating the  other  three  items  and
 take only the last one?

Name the select tag as sub_projects[], then in PHP you can read the
$sub_project variable as an array.

-- 
Saludos
Oscar

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



Re: [PHP] weird problem in php

2006-06-12 Thread Dave Goodchild

On 12/06/06, weetat [EMAIL PROTECTED] wrote:


Hi all ,

  I have using php 4.3.2 and mysql database.

  I have a form which have select tag which have the value for example
-New York.

  When use submit the form , i need to find the first occurence of - ,
i use strpos function as shown below :

$country = $_POST['country'];
$findme  = '-';
$pos = strpos($country, $findme);

if ($pos === false) {
   $_logger-logdebug(starting searchChassisTblDB() not found);
} else {
   $_logger-logdebug(starting searchChassisTblDB() found);
}

however it always give false . I did not know why.
Then i did a testing , added below code in the php file without form
submission, it give true value which what i wanted. Anybody have ideas
or suggestion what happening ? Any difference when value submitted from
form ? Thanks

$mystring = '-New York';
$findme  = '-';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo The string '$findme' was not found in the string '$mystring';
} else {
echo The string '$findme' was found in the string '$mystring';
echo  and exists at position $pos;
}



why don't you echo $_POST['country'] to see  what you get?




--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] weird problem in php

2006-06-12 Thread Rabin Vincent

On 6/12/06, weetat [EMAIL PROTECTED] wrote:

  I have a form which have select tag which have the value for example
-New York.

  When use submit the form , i need to find the first occurence of - ,
i use strpos function as shown below :

$country = $_POST['country'];
$findme  = '-';
$pos = strpos($country, $findme);

if ($pos === false) {
   $_logger-logdebug(starting searchChassisTblDB() not found);
} else {
   $_logger-logdebug(starting searchChassisTblDB() found);
}

however it always give false . I did not know why.
Then i did a testing , added below code in the php file without form
submission, it give true value which what i wanted. Anybody have ideas
or suggestion what happening ?


Perhaps there is a problem with the HTML for your select box.
var_dump($_POST) in your PHP code to check if the value is
being sent correctly.

Rabin

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



Re: [PHP] weird problem with index page

2004-05-16 Thread BAO RuiXian

loll wrote:
Hi,
I am not sure if this is a PHP or Apache problem, but I am hoping 
someone can tellme what is wrong.

When I go to www.domain.com on my server it shows the page as text 
instead of parsing the php code.

If I go to www.domain.com/index.php (same page) it runs as it should.
if I go to www.domain.com/subdir it sya s page not found even though 
there is a index.php file in that directory. I am at a loss as to what 
is wrong. index.php is listed inthe directoryindex for apache so I 
dont understand why it is doing all this.

Interesting. Do you use virtual hosts? How many DirectoryIndex 
directives in your configuration file? What are their contexts? Got any 
error in your log file?

Best
Bao
If anyone can help me it would be appreciated.
Thanks
Loll
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] weird problem with index page

2004-05-16 Thread loll
Well,
I managed to part fix the problem, now I have a problem where there is a 
page that all it does is redirect to another page, it wont redirect unless 
I hit the refresh button.

When I go to index.php it redirects to login.php, this is an old page that 
I just added a header(Location: blah); to so it would go to the new page. 
now it seems to jsut show a blank page instead of doing the second 
redirect, if I hit refresh on the blank page it will redirect correctly.

I wondered if there was some restriction somewhere on only allowing 1 
redirect where this page needs to be able to do more than one? is htis 
something that would be in the httpd.conf or php.ini file?

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


Re: [PHP] Weird Problem with INPUT tag

2004-02-29 Thread Richard Davey
Hello Ahbaid,

Sunday, February 29, 2004, 6:33:45 AM, you wrote:

AG this uses a FORM with INPUT tags, what is weird is that under IE6 some
AG of the INPUT fields are showing up with yellow
AG backgrounds

Sounds to me like you have the Google toolbar installed with the
AutoFill option enabled. See the preferences to turn the yellow
background off.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] (WEIRD problem) Not following directories!!! (0t)

2004-01-28 Thread Ryan A
Hey Andrew,

 First, note that that is an apache problem, not PHP.

Yep, thats why I put the Ot in the subject line but since you cant
have PHP
without a webserver and apache is the most popular on the list or the
net...I was
hopeing someone else had this problem and could guide me

 In httpd.conf add Option Indexes to the folder (root for whole site).
 That will produce a file list of the directory.

Thanks, will try that right now.

 Or, put in a 'default' document (ie: index.html) that will produce the
 output when people browse to the directory.

Will try that too.

 Directory browsing is normaly disabled in web servers (from experience,
 apache and IIS).

See? didnt know that. Learned something new.

 HTH

Sure did. Thanks.

Cheers,
-Ryan



 Andrew

Hi,
  Heres a totally weird problem, I created some folders on our server
 (which
  we are accessing only via ip as the domain has not been resolved) but I
  get
  an error when i try to access the folder(s)!
 
  eg:
  (I created this folder)
  ryan
 
  and i try to access it like this:
  http://208.234.29.220/ryan/
 
  and it gives me this error:
 You don't have permission to access /ryan/ on
  this server.
 
  Which is totally weird coz I have NOTHING in that folder right now...
 not
  even a .htaccess file
 
  What could be wrong? I have looked in my httpd.conf file and on google
 but
  cant seem to

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



Re: [PHP] Weird problem with objects

2004-01-23 Thread Stuart
Mark Cubitt wrote:
$this-$database = new database();
$this-$accessory = new accessory();
$this-$order = new order();
These should be...

$this-database = new database();
$this-accessory = new accessory();
$this-order = new order();
You don't want the $ unless $database, $accessory and $order are strings 
containing the class attribute names.

Additionally, you might want to assign the reference of the new objects 
otherwise PHP will create a new object and then make a copy of it - not 
very efficient. Like so...

$this-database =  new database();
$this-accessory =  new accessory();
$this-order =  new order();
--
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: RE : [PHP] Weird problem with objects

2004-01-23 Thread Stuart
Vincent DUPONT wrote:
what do you mean by this :Additionally, you might want to assign the reference of the 
new objects
otherwise PHP will create a new object and then make a copy of it - not
very efficient. Like so...
$this-database =  new database();
$this-accessory =  new accessory();
$this-order =  new order();
The = operator makes a copy of the right side and puts it into the left 
side. So the new database() bit will create a new object of type 
database. The = operator will then make a copy of that object and put it 
into $this-database. So it's actually creating 2 database objects one 
of which will get deleted at the end of the function.

By assigning the reference (that's what the  gets) only one object is 
created. Does that make sense now?

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


Re: [PHP] Weird problem when creating a db connection and trying to reference it in a function

2003-10-24 Thread Burhan Khalid
Matt Babineau wrote:

I found another strange problem. I am creating a mysql database
connection like this:
@ $db = mysql_pconnect(host, user, pass);
mysql_select_db(dbname);
you forgot the $ ... should be mysql_select_db($dbname);
If you had turned up your php error reporting level 
(error_reporting(E_ALL); for example) it whould have given you a notice 
about undeclared constant for that line.

A php-aware syntax highlighting editor would have also given you a 
visual cue about the possible error on that mysql_select_db() line.

Also, I don't see where you are setting $dbname to something. You might 
have just not included it in your excerpt, but it may also be missing 
from your script :)

Now, I have a function that inside uses mysql_list_fields()

function getFields($table, $dbname) {
 $fields = mysql_list_fields($dbname, $table);
 return $fields;
}
you can just do this return mysql_list_fields($dbname, $table);

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Weird Problem

2003-07-29 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
20:40, lines prefixed by '' were originally written by you.
 I have the following chunk of code:
   $sql = SELECT setting from settings where
name='display_rows';
   include(connect.inc.php);
   print $sql;
   $row = mysql_fetch_row($result);
   $path = $row[0];
   print $path;
 It always prints out 1
 But if I run the code at the sql command prompt, it prints out
25,
 which is the correct value.
 Does anyone have any ideas why im having this problem??
 - ---

Unless it is done within connect.inc.php you have not executed your
query.  Maybe the last query you executed has a row containing the
value 1 ready to be fetched?

Try adding $queryid = mysql_query($sql); before $row =
mysql_fetch_row($result);

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)

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



RE: [PHP] Weird Problem

2003-07-29 Thread Jennifer Goodie
 I have the following chunk of code:

   $sql = SELECT setting from settings where name='display_rows';
   include(connect.inc.php);
   print $sql;
   $row = mysql_fetch_row($result);
   $path = $row[0];
   print $path;

 It always prints out 1

 But if I run the code at the sql command prompt, it prints out 25,
 which is the correct value.

 Does anyone have any ideas why im having this problem??


Are you actually executing the query?  I don't see a mysql_query() anywhere
and it would be anti-intuituve to have that in your connection include.


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



RE: [PHP] Weird Problem

2003-07-29 Thread Jay Blanchard
[snip]
$sql = SELECT setting from settings where name='display_rows';
include(connect.inc.php);
print $sql;
$row = mysql_fetch_row($result);
$path = $row[0];
print $path;
[/snip]

Because $result is not being gotten properly...

$sql = SELECT setting from settings where name='display_rows';
include(connect.inc.php);
print $sql;
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
$path = $row[0];
print $path;
HTH!

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



RE: [PHP] Weird Problem

2003-07-29 Thread Aaron Axelsen
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yes, connect.inc.php does the following:

@$connect=mysql_connect(localhost,$dbuser,$dbpass);
if (!$connect) {
echo Could not connect to mysql!;
exit();
}

@$db=mysql_select_db($dbname);
if (!$db){
echo Could not connect to database;
exit ();
}

@$result=mysql_query($sql);
if (!$result){
echo Invalid Sql Command;
exit ();
}


- ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com
 
Web Dev/Design Community/Zine
www.developercube.com



- -Original Message-
From: Jennifer Goodie [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 29, 2003 2:46 PM
To: Aaron Axelsen; [EMAIL PROTECTED]
Subject: RE: [PHP] Weird Problem


 I have the following chunk of code:

   $sql = SELECT setting from settings where name='display_rows';
   include(connect.inc.php);
   print $sql;
   $row = mysql_fetch_row($result);
   $path = $row[0];
   print $path;

 It always prints out 1

 But if I run the code at the sql command prompt, it prints out
 25,  which is the correct value.

 Does anyone have any ideas why im having this problem??


Are you actually executing the query?  I don't see a mysql_query()
anywhere and it would be anti-intuituve to have that in your
connection include.


-BEGIN PGP SIGNATURE-
Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com

iQA/AwUBPybRBrrnDjSLw9ADEQJrmACg70sEqN0efwGDg4o958tPx9s6K+0AoJKK
3WZTtCIVXsszKlGA/jOzrmMR
=LwnA
-END PGP SIGNATURE-



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



RE: [PHP] Weird Problem

2003-07-29 Thread Aaron Axelsen
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The only setting contained in that table is the one im calling for,
and its value is 25.

- ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com
 
Web Dev/Design Community/Zine
www.developercube.com



- -Original Message-
From: Aaron Axelsen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 29, 2003 2:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Weird Problem


 
- -BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have the following chunk of code:

$sql = SELECT setting from settings where name='display_rows';
include(connect.inc.php);
print $sql;
$row = mysql_fetch_row($result);
$path = $row[0];
print $path;

It always prints out 1

But if I run the code at the sql command prompt, it prints out 25,
which is the correct value.

Does anyone have any ideas why im having this problem??

- - ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com
 
Web Dev/Design Community/Zine
www.developercube.com


- -BEGIN PGP SIGNATURE-
Version: PGPfreeware 7.0.3 for non-commercial use
http://www.pgp.com

iQA/AwUBPybNTLrnDjSLw9ADEQI4LQCeP+vaCk+UtDJSeDU9H5yTt+r12JEAniaI
LVwLVog89WOCsXxzIHbGsIEb
=g4P4
- -END PGP SIGNATURE-



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


-BEGIN PGP SIGNATURE-
Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com

iQA/AwUBPybRWLrnDjSLw9ADEQJMrQCeIFkRzjnN2zoOhtS+JEO3tcVxiJ0AnR2v
JHRpp/8B2Gb581ntxzS+5OGL
=85R7
-END PGP SIGNATURE-



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



RE: [PHP] Weird Problem

2003-07-29 Thread Jennifer Goodie
 The only setting contained in that table is the one im calling for,
 and its value is 25.


see what print_r($row) outputs, then you'll at least know what is in the
array.


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



Re: [PHP] Weird Problem

2003-07-29 Thread DvDmanDT
Isn't there a known problem with variables and included files? Like you have
to create $result in the first file, or something... Just try to have it all
in one file... Also, change mysql_fetch_row($result); to
mysql_fetch_row($result) or print(mysql_error());... Something also tells
me you are using mysql_fetch_row... Why not array? You should try to just
switch between them and try once... I didn't notice it at first...
mysql_fetch_array($result) is what I would use... Will probably return same
thing, but who knows?

-- 
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
Aaron Axelsen [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Yes, connect.inc.php does the following:

 @$connect=mysql_connect(localhost,$dbuser,$dbpass);
 if (!$connect) {
 echo Could not connect to mysql!;
 exit();
 }

 @$db=mysql_select_db($dbname);
 if (!$db){
 echo Could not connect to database;
 exit ();
 }

 @$result=mysql_query($sql);
 if (!$result){
 echo Invalid Sql Command;
 exit ();
 }


 - ---
 Aaron Axelsen
 AIM: AAAK2
 Email: [EMAIL PROTECTED]

 Want reliable web hosting at affordable prices?
 www.modevia.com

 Web Dev/Design Community/Zine
 www.developercube.com



 - -Original Message-
 From: Jennifer Goodie [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 29, 2003 2:46 PM
 To: Aaron Axelsen; [EMAIL PROTECTED]
 Subject: RE: [PHP] Weird Problem


  I have the following chunk of code:
 
  $sql = SELECT setting from settings where name='display_rows';
  include(connect.inc.php);
  print $sql;
  $row = mysql_fetch_row($result);
  $path = $row[0];
  print $path;
 
  It always prints out 1
 
  But if I run the code at the sql command prompt, it prints out
  25,  which is the correct value.
 
  Does anyone have any ideas why im having this problem??
 

 Are you actually executing the query?  I don't see a mysql_query()
 anywhere and it would be anti-intuituve to have that in your
 connection include.


 -BEGIN PGP SIGNATURE-
 Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com

 iQA/AwUBPybRBrrnDjSLw9ADEQJrmACg70sEqN0efwGDg4o958tPx9s6K+0AoJKK
 3WZTtCIVXsszKlGA/jOzrmMR
 =LwnA
 -END PGP SIGNATURE-





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



Re: [PHP] Weird Problem

2003-07-29 Thread Curt Zirzow
* Thus wrote DvDmanDT ([EMAIL PROTECTED]):
 Isn't there a known problem with variables and included files? Like you have
 to create $result in the first file, or something... Just try to have it all
 in one file... Also, change mysql_fetch_row($result); to
 mysql_fetch_row($result) or print(mysql_error());... Something also tells
 me you are using mysql_fetch_row... Why not array? You should try to just
 switch between them and try once... I didn't notice it at first...
 mysql_fetch_array($result) is what I would use... Will probably return same
 thing, but who knows?

For the record, there are no problems with variables and include
files.

Include files are expanded into the parent file as if they file is
in the file that included it.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Weird Problem

2003-07-29 Thread Kevin Stone

Aaron Axelsen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Yes, connect.inc.php does the following:

 @$connect=mysql_connect(localhost,$dbuser,$dbpass);
 if (!$connect) {
 echo Could not connect to mysql!;
 exit();
 }

 @$db=mysql_select_db($dbname);
 if (!$db){
 echo Could not connect to database;
 exit ();
 }

 @$result=mysql_query($sql);
 if (!$result){
 echo Invalid Sql Command;
 exit ();
 }


 - ---
 Aaron Axelsen
 AIM: AAAK2
 Email: [EMAIL PROTECTED]

 Want reliable web hosting at affordable prices?
 www.modevia.com

 Web Dev/Design Community/Zine
 www.developercube.com


The resource identifier returned by mysql_connect() is an optional input to
the mysql_query() function.  You should test it out to see if your system
isn't passing the value automatically.

$result = mysql_query($sql, $connect); //-- like this

The reason you may be seeing 1 instead of the value you expected is that the
mysql_query() function can return True even if it doesn't succesfully
execute the query.  In that case you may see the output 1 becuase the
boolean True evaluates to 1 in the parser.

--
Kevin



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



Re: [PHP] Weird Problem

2003-07-29 Thread John W. Holmes
Curt Zirzow wrote:
Include files are expanded into the parent file as if they file is
in the file that included it.
Ah... clear as mud. heh... ;)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


Re: [PHP] Weird Problem

2001-02-26 Thread David Robley

On Tue, 27 Feb 2001 05:53, Steve Segarra wrote:
 Hi everyone,
   First, let me explain I am a very knowledgable php developer.  I'm not
 someone trying to write their first script.  I have been working on a
 very large and complex problem for some time now when it suddenly
 stopped working.  I did not change anything in any configurations or
 edit any code that would have affected how my database functionality
 class would function.  But, all of my connections started to bomb out.

 Follows are the entire contents of a file simp.php (minus the line
 numbers):

 1  ?
 2
 3  $db = mysql_connect("localhost", "web", "pw") || print "error
 connecting   ".mysql_error()." ".mysql_errno();
 4  mysql_select_db("surveys");
 5
 6  $result = mysql_query("select * from attract") || print "error
 querying   ".mysql_error()." ".mysql_errno();
 7
 8  $i = 0;
 9  while ($row = mysql_fetch_array(mysql_query("select * from
 attract"))){ //  ($i++  5)){
 10   echo $row[0]." ".$row[1]."br";
 11 }
 12 ?


 Please note that the user web@localhost identified by pw has
 permissions to select from the table attract.

 Here is what I have identified so far:

 A - If I use $result in mysql_fetch_array() line 9, I get the error:
 Warning: Supplied argument is not a valid MySQL result resource
 in simp.php3 on line 9

 But if I use the statement mysql_query("select * from attract")
 in its
 place, the loop (although infinite) will produce expected results, ie
 print out the first and second columns of the first row of the table
 infinitely.  So basically, I would conclude the life of the variable
 result is terminiating before I can use it.  Why, I don't have a clue.

 B - Being tired of an infinite loop in my investigation, I added line 8
 and I placed the statement  ($i++  5) inside the while loop
 condition.  Now, only the br and spaces from line 10 will print, not
 the actual values of the $row array.  The output is br br br br
 br, with no values from the table attract.

 This is where I stand now, completely flabberghasted and nearly insane.
 Can anyone shed any light on this before I have to commit to bringing
 down the webserver while I reinstall php4.  (oh, btw I am running
 Apache/1.3.14 (Unix) PHP/4.0.4pl1 on Red Hat 6.2 (I hate redhat, but
 the bossman says its better supported than slakware.  bah.))

 Thank you all for your help.
 steve

Is it possible that the || construct doesn't work in the way you are 
using it and thus you aren't seeing mysql_error? The most common examples 
I have seen use the actual string 'or'. Try with a query that you _know_ 
will trip an error.

-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

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