[PHP] File Repository / Managment Software

2006-11-03 Thread Prathaban Mookiah
Hello,

Is there a open source file repository / managment software written in PHP ?

I need to setup a file repository where everyone working in my group can 
share their files in an organized manner. I am talking about something like 
phpBB, but with file handling capabilities.

Thanks in advance.

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



Re: [PHP] Remote Robot Control with PHP

2006-11-01 Thread Prathaban Mookiah
I totally agree with your view. PHP does not bring in any added value into 
this project. The primary impetus behind me using PHP was my personal liking 
towards PHP. But this is a good point to ponder upon - what benefits does PHP 
offer to the academic community over traditional cgi tools. 

One thing is the ease of configuration and deployment of PHP. As someone 
doing research, I do not want to get bogged up with the overwhelming 
intricacies involved with installing and configuring a servlet or 
configurting a .net environment. At least I find them too complex. PHP on the 
other hand saves so much time, that I can just concentrate on writing the 
scirpt and generating the result instead of googling on how to troubleshoot a 
misbehaving cgi program.

And I kind of disagree with you about the overhead issue. I did try a servlet 
running on a TomCat and I could say PHP on a Apache was not too bad at all. 
And applets are a big security headache.

Besides I am not sure if there are any licensing issues involved with Java.

Any other inputs for the list? I can use some ideas for my papers. ha ha..

Cheers,

Prathap

-- Original Message ---
From: Richard Lynch [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wed, 1 Nov 2006 14:50:11 -0600 (CST)
Subject: Re: [PHP] Remote Robot Control with PHP

 On Tue, October 31, 2006 2:54 pm, Prathaban Mookiah wrote:
  alone to do the entire job due the high delay it takes to connect to
  the
  telnet port on the robot, (I adopted the PHPTelnet class written by
  Antone
  Roundy - http://www.geckotribe.com/php-telnet/), I could not resist
  using it
  for some part of the application.
 
  So the model I used for my purpose is this:
 
  Browser - WebServer  - Java   Robot
AJAX  PHP
 
 As cool as this might be, and as much as I love PHP, I have to 
 suggest that PHP has little Added Value here, other than as an academic
 exercise, as you have presented it...
 
 I think you would want to express what your perceived added value of
 PHP in the process is, as I would expect that you'd just have AJAX
 talking to Java, or Java applets or whatever, with no PHP, and 
 achieve the same output with less overhead.
 
 So what's the compelling added value of PHP here?
 
 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Remote Robot Control with PHP

2006-10-31 Thread Prathaban Mookiah
Hello List,

I thought of sharing my experience of writing a controller to remotely 
control a robot through a webserver using PHP. Though I could not use PHP 
alone to do the entire job due the high delay it takes to connect to the 
telnet port on the robot, (I adopted the PHPTelnet class written by Antone 
Roundy - http://www.geckotribe.com/php-telnet/), I could not resist using it 
for some part of the application.

So the model I used for my purpose is this:

Browser - WebServer  - Java   Robot
  AJAX  PHP  

I used PHP to communicate between the Java program which I run in the 
background and the AJAX calls from the browser. This setup works fine for my 
purposes and satisifies the strict time constraints.

If someone has a better idea of implementing this thing in PHP, please do let 
me know your comments. 

There is a lot more to do in this project and I hope to make use of PHP a lot 
along the way. This is a NSF funded project and this work will be published 
in some leading journals. What I am excited about is the prospect of putting 
in a word about PHP in these journals, since as far as I know, it is not too 
well known in the academic circles.

Regards,

Prathap

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



[PHP] Running a Java Program

2006-10-26 Thread Prathaban Mookiah
Hello List,

I have a situation where, when the user logs into the system (Apache 2/PHP 
5.1/Win XP) the php script should activate a Java program to run in the 
background. This program will keep running in the background while everytime 
the user requests something, the subsequent php scripts communicates with 
this Java program on a preassigned port. (This is for controlling a robot I 
descibed in on of my earlier mails)

My questions are:

1. How do I make the Java program to keep running even after the PHP script 
terminates. In Linux I would have easily done using '' - how about windows?

2. What is the safest way to do it?


Thanks in advance.

Prathap

P.S - Richard  Tedd - I appreciate your comments on my previous issue.

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



Re: [PHP] Running a Java Program

2006-10-26 Thread Prathaban Mookiah
Ray,

Nope - I cannot have the program running all the time because the port that 
it this program will connect to will be accessed by other programs too. So it 
needs to run only when the user is online and logged into the system.

Any ideas?

Prathap


-- Original Message ---
From: Ray Hauge [EMAIL PROTECTED]
To: php-general@lists.php.net
Cc: Prathaban Mookiah [EMAIL PROTECTED]
Sent: Thu, 26 Oct 2006 18:39:26 -0500
Subject: Re: [PHP] Running a Java Program

 On Thursday 26 October 2006 6:48 pm, Prathaban Mookiah wrote:
  Hello List,
 
  I have a situation where, when the user logs into the system (Apache 2/PHP
  5.1/Win XP) the php script should activate a Java program to run in the
  background. This program will keep running in the background while
  everytime the user requests something, the subsequent php scripts
  communicates with this Java program on a preassigned port. (This is for
  controlling a robot I descibed in on of my earlier mails)
 
  My questions are:
 
  1. How do I make the Java program to keep running even after the PHP 
script
  terminates. In Linux I would have easily done using '' - how about
  windows?
 
  2. What is the safest way to do it?
 
 
  Thanks in advance.
 
  Prathap
 
  P.S - Richard  Tedd - I appreciate your comments on my previous issue.
 
 Does the Java program HAVE to be started by a script?  I've worked 
 in a few places that had desktop apps that would just run on startup,
  or a service, and then the webserver/php would communicate to it 
 since it's already running.  The downside to that is manual 
 intervention when the program stops.  Although... you could probably 
 to an exec() and if it was installed as a service you should be able 
 to run net start appname' (or something like that.
 
 I haven't kept up on your previous post so I may be completely wrong 
 ;)
 
 -- 
 Ray Hauge
 Application Development Lead
 American Student Loan Services
 www.americanstudentloan.com
 1.800.575.1099
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Active Connections

2006-10-23 Thread Prathaban Mookiah
Hello List,

I am trying to develop a web based controller for a robot. The robot has an 
embedded telnet deamon and it is controlled primarily through issuing 
commands on this port. I am planning to implement this system with PHP on the 
server side.

Ideally what I would like to do is have two persistent active connections: 
one between the browser and the webserver, and the other between the 
webserver and the robot controller. When the user opens the interface for the 
first time in his browser, the 2 connections are initiated and they have to 
remain active till the session is closed. In the simplest case, a single 
servers side PHP script would manage both these connections. I know there is 
no way I can keep an active connection between the browser and server using 
HTTP. I guess I will have to go for something like applets.

My question is, is there any other way this can be done in PHP. At least is 
there a way I can keep the web server - controller connection alive even 
after the script finishes executing and then use that connection the next 
time the user tries to access the controller through the webserver.

Plus the controller outputs have to be automatically updated in the browser 
window. Is an Applet-PHP Script combination a good choice for this system. Or 
are MS activex controls good choice in the browser side?

Please let me know your ideas and inputs.

Thanks in advance.

Prathap

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



Re: [PHP] Problems creating a user in MySQL

2006-10-01 Thread Prathaban Mookiah
I am not sure why you get this error message, but are you sure about the 
permsissions? i.e. does this user have permission to write to the MYSQL 
database and user table?

Prathap


-- Original Message ---
From: Deckard [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sun, 01 Oct 2006 21:48:21 +0100
Subject: [PHP] Problems creating a user in MySQL

 Hello,
 
 I have this code:
 ---
   // use mysql database
   mysql_select_db('mysql') or die('Cannot select MySQL database.' .
 mysql_error());
 
   // insert new user in mysql user table
   $sqlInsertUser = INSERT INTO user (Host, User , Password ,
 Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES 
 ('$hostname', '$mysql_username', '$mysql_password', 'N', 'N', 'N', 
 'N');
 
   if (mysql_query($sqlInsertUser, $conn))
$messagesqlInsertUser = 'Success...';
   else
$messagesqlInsertUser = 'Error: ' . mysql_error();
   $result = mysql_query($sqlInsertUser);
 ---
 
 that gives me the error:
 ---
 Error: Duplicate entry 'localhost-gamito' for key 1
 ---
 
 although the pair 'localhost-gamito' is not duplicated and i can be
 assured os this, because it works perfectly well in the MySQL prompt.
 
 Can someone help me, please ?
 
 Best Regards,
 Deckard
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Prathaban Mookiah
Let me rephrase it. Your color should be black or white to be the right 
colour. Is this correct?

In that case you should change it to

 if ($_REQUEST['id'] != black AND $_REQUEST['id'] != white) {

 echo wrong color;

 } else (

 echo right color;

 }

- Original Message - 
From: JD [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, September 08, 2006 5:03 PM
Subject: [PHP] if statement with or comparison (newbie)


 I'm trying to set up a simple conditional, something like this:

 If my_variable is NOT equal to (black or white)
echo wrong color
 else
echo right color

 Here is what I have tried:

 if ($_REQUEST['id'] != (black or white)) {

 echo wrong color;

 } else (

 echo right color;

 )

 However, no matter what I enter, I always get response right color.

 I should add that if I change the if statement to:

 if ($_REQUEST['id'] != (black))

 then I get right color when I enter black and wrong color for 
 everything else.

 Would you please point out what's the trivial thing I'm missing here...

 jd

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

 

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



[PHP] Problem With Cookies

2006-07-19 Thread Prathaban Mookiah

I have run into a wierd problem with cookies. I am trying to set a cookie as 
usual:

$COOKIE_EXPIRES = 3600;
$COOKIE_VALID_PATH = /mydirectory/;
$COOKIE_DOMAIN = .myhost.com

setcookie(mycookie1, somevalue, time()+$COOKIE_EXPIRES, 
$COOKIE_VALID_PATH, $COOKIE_DOMAIN, 0)

I want this cookie to be valid only for the directory /mydirectory in the 
server www.myhost.com. i.e. only for http://www.myhost.com/mydirectory/

The problem is that it works fine with IE 5.5  Opera 8.5  Firefox 1.5. But 
the cookies are not being accepted by IE 6  Opera 9.0. 

And this is the header I captured through ethreal:

Set-Cookie: mycookie1=somevalue; expires=Wed,19-Jul-2006 17:08:59 GMT; path=/
mydirectory/; domain=.myhost.com\r\n

I am sure I am not doing something totally wrong because it works well with 
some versions. Are there any known issues with the later versions of IE and 
Opera.

Thanks in advance.

Prathap

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



Re: [PHP] Problem With Cookies

2006-07-19 Thread Prathaban Mookiah
This is with regard to my earlier mail today morning.

In fact I found out that, that problem is due to the way the timestamp is 
handled.

Are there any safe ways to handle cookie expiry time regardless of the time 
system the client uses?

Prathap


-- Original Message ---
From: Prathaban Mookiah [EMAIL PROTECTED]
To: PHP Mailing Lists php-general@lists.php.net
Sent: Wed, 19 Jul 2006 23:01:29 +0600
Subject: [PHP] Problem With Cookies

 I have run into a wierd problem with cookies. I am trying to set a 
 cookie as usual:
 
 $COOKIE_EXPIRES = 3600;
 $COOKIE_VALID_PATH = /mydirectory/;
 $COOKIE_DOMAIN = .myhost.com
 
 setcookie(mycookie1, somevalue, time()+$COOKIE_EXPIRES, 
 $COOKIE_VALID_PATH, $COOKIE_DOMAIN, 0)
 
 I want this cookie to be valid only for the directory /mydirectory 
 in the server www.myhost.com. i.e. only for http://www.myhost.com/
mydirectory/
 
 The problem is that it works fine with IE 5.5  Opera 8.5  Firefox 
 1.5. But the cookies are not being accepted by IE 6  Opera 9.0.
 
 And this is the header I captured through ethreal:
 
 Set-Cookie: mycookie1=somevalue; expires=Wed,19-Jul-2006 17:08:59 
 GMT; path=/ mydirectory/; domain=.myhost.com\r\n
 
 I am sure I am not doing something totally wrong because it works 
 well with some versions. Are there any known issues with the later 
 versions of IE and Opera.
 
 Thanks in advance.
 
 Prathap
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Single quotes verses double quotes default behavior with DW -------- (Pretty much 0T )

2006-06-28 Thread Prathaban Mookiah
Yes, I got into trouble with magic quotes recently too.

Well I know that you can do the same thing with mysql_escape_string if you are 
using MySQL.

But if you are very peculiar about doing it in DW and so not want the script 
to handle it, then I guess you have wait till some DW guru in this mailing 
list.

Good luck.

Prathap


-- Original Message ---
From: Ryan A [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED], php php [EMAIL PROTECTED]
net
Sent: Wed, 28 Jun 2006 03:10:27 -0700 (PDT)
Subject: Re: [PHP] Single quotes verses double quotes default behavior with DW 
 (Pretty much 0T )

 --- Prathaban Mookiah [EMAIL PROTECTED] wrote:
 
  Are you trying to use PHP to write the HTML onto a
  database. If this is the 
  case you can simply use addslashes(). This way you
  can still preserve the 
  double quotes, but write into the database without
  any problems.
  
  Either way some processing will be involved at some
  point. So I guess there is 
  not much you can do about it.
  
  Prathap
  
  
 
 
 Hello,
 Yes, I want to write the HTML to the DB, and I know
 other than str_replace I have the option of
 addslashes, but with addslashes I have to take into
 account magic_quotes being on/off...and since this is
 going to be used on a few servers it just complicates
 matters a bit more, I am trying to take the guesswork
 and extra coding out of the scripts and solve the
 problem before it comes to the scripts...by changeing
 the default in DW.
 
 Thanks!
 Ryan
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Single quotes verses double quotes default behavior with DW -------- (Pretty much 0T )

2006-06-28 Thread Prathaban Mookiah
Are you trying to use PHP to write the HTML onto a database. If this is the 
case you can simply use addslashes(). This way you can still preserve the 
double quotes, but write into the database without any problems.

Either way some processing will be involved at some point. So I guess there is 
not much you can do about it.

Prathap




-- Original Message ---
From: Ryan A [EMAIL PROTECTED]
To: php php php-general@lists.php.net
Sent: Wed, 28 Jun 2006 02:29:45 -0700 (PDT)
Subject: [PHP] Single quotes verses double quotes default behavior with DW ---
- (Pretty much 0T )

 Hi,
 
 I have searched for this answer on google and even
 written on a few forums asking for an answer, am just
 trying my luck here as I am sure quite a few list
 users use DreamWeaver.
 
 By default dreamweaver outputs tags like this:
 
 img src=foo.gif class=blah
 
 As you can see from the above the values are always
 enclosed in double quotes by default, how can i change
 the default to be single quotes?
 
 eg:
 img src='foo.gif' class='blah'
 
 I am tired of everytime copying it into notepad and
 then running a replace all before inserting it into
 the db.
 
 I am doing this as I am putting the entire content of
 a html page into the DB and the double quotes are
 screwing things up for me.
 I have thought of doing a str_replace() for the double
 quotes but thats extra processing which can be a
 headache if its a large page.
 
 Or if I am barking up the wrong tree and this is not
 possible (changing DWs default behavior, just tell me
 and will stop searching.
 
 Thanks!
 Ryan
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] page redirecting

2006-06-28 Thread Prathaban Mookiah
Did you try using a Cookie? 

You could set the cookie first and then use 
meta http-equiv=refresh content=0;url=page2.php

Just one idea. I am sure there are better ways to do this.

Prathap


-- Original Message ---
From: kristianto adi widiatmoko [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Wed, 28 Jun 2006 11:17:33 +0100 (BST)
Subject: [PHP] page redirecting

 HI folks,
 
 i need to redirecting page, it could be done by using header 
 function like this
 
 header(Location : page2.php?var1=foo);
 
 but i need to hide variable from being displayed by browser since 
 the content of variable is secret.
 
 I guess i need POST method instead of GET for redirecting that page.
 
 Does any one have an idea??
  Send instant messages to your online friends 
 http://uk.messenger.yahoo.com
--- End of Original Message ---

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



Re: [PHP] Problem Displaying Images

2006-06-26 Thread Prathaban Mookiah
Yes, turning off the magic_quotes_runtime directive makes a difference. But 
the image is still distorted. All three magic_quotes directives are now set to 
the same value in both the servers.

Are there any other settings I should look out for?

Thanks.

Prathap


-- Original Message ---
From: Chris [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: php-general@lists.php.net php-general@lists.php.net
Sent: Mon, 26 Jun 2006 14:52:39 +1000
Subject: Re: [PHP] Problem Displaying Images

 Prathaban Mookiah wrote:
  I wish it would work. But id doesn't. But this time I do get a heavily 
  distorted image being displayed.
  
  But as I said earlier, in combination of MySQL 5 and PHP 5 works good. The 
  problem is with PHP4 and MySQL 5.
 
 I doubt the php5/php4 thing is an issue, I think it's a problem with 
 different settings on your servers.
 
 I think any of the magic_quotes_* stuff will make a difference. 
 Start there I guess.
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Problem Displaying Images

2006-06-25 Thread Prathaban Mookiah
I am trying to manage images with a web database application. It works fine 
with MySQL 5.0.17 and PHP 5.1.1.

But when I port it to another machine that runs MySQL 3.23.54 and PHP 4.2.2, I 
have problems viewing the images retrieved from the database in the browser. 

The relevant part of the code is:

$Result = mysql_fetch_array($Resource);

if (!empty($Result[data]))
{
header(Content-Type: {$Result['mime']});
echo $Result[data];
}

But I see that some binary data is being echoed on to the client. But I guess 
it is corrupted in some way such that the browser cannot display it as an 
image. In fact I tried to save it as an image file, and the image viewer 
reported it as invalid format.

Hope someone can shed light on this.

Thanks in advance.

Cheers,

Prathap

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



Re: [PHP] Problem Displaying Images

2006-06-25 Thread Prathaban Mookiah
Oh sorry. I use addslashes().


-- Original Message ---
From: Chris [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: php-general@lists.php.net php-general@lists.php.net
Sent: Mon, 26 Jun 2006 07:14:42 +1000
Subject: Re: [PHP] Problem Displaying Images

 Prathaban Mookiah wrote:
  I am trying to manage images with a web database application. It works 
fine 
  with MySQL 5.0.17 and PHP 5.1.1.
  
  But when I port it to another machine that runs MySQL 3.23.54 and PHP 4.2.
2, I 
  have problems viewing the images retrieved from the database in the 
browser. 
  
  The relevant part of the code is:
  
  $Result = mysql_fetch_array($Resource);
  
  if (!empty($Result[data]))
  {
  header(Content-Type: {$Result['mime']});
  echo $Result[data];
  }
  
  But I see that some binary data is being echoed on to the client. But I 
guess 
  it is corrupted in some way such that the browser cannot display it as an 
  image. In fact I tried to save it as an image file, and the image viewer 
  reported it as invalid format.
 
 How are you putting it into the database? Are you using 
 mysql_real_escape_string or mysql_escape_string, or are you using 
 addslashes or something else?
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Problem Displaying Images

2006-06-25 Thread Prathaban Mookiah
I wish it would work. But id doesn't. But this time I do get a heavily 
distorted image being displayed.

But as I said earlier, in combination of MySQL 5 and PHP 5 works good. The 
problem is with PHP4 and MySQL 5.

Thanks.

Prathap

-- Original Message ---
From: Chris [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: php-general@lists.php.net php-general@lists.php.net
Sent: Mon, 26 Jun 2006 11:56:31 +1000
Subject: Re: [PHP] Problem Displaying Images

 Prathaban Mookiah wrote:
  Oh sorry. I use addslashes().
 
 Then you'll probably need to use stripslashes before printing out 
 the data.
 
 echo stripslashes($Result[data]);
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] mysql_db_query INSERT

2006-06-20 Thread Prathaban Mookiah
No. I was looking for a way to do it.

mysql_insert_id did the job for me. I can't figure out how I missed out on 
this function. I browsed through the manual for 2 hours yesterday looking for 
such a function.

Anway, thank you Jay and Chris. And you too John, for your attention.

Cheers,

Prathap

-- Original Message ---
From: John Nichel [EMAIL PROTECTED]
To: 
Sent: Tue, 20 Jun 2006 00:19:20 -0400
Subject: Re: [PHP] mysql_db_query  INSERT

 Jay Blanchard wrote:
  [snip]
  How do I retrieve the auto generated primary key field 
  in the first table during the first insert operation.
  [/snip]
  
  http://www.php.net/mysql_insert_id
 
 
 You mean they have a manual for this stuff??
 
 Holy Toledo!
 
 -- 
 By-Tor.com
 ...it's all about the Rush
 http://www.by-tor.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Processing HTML in mail form

2006-06-20 Thread Prathaban Mookiah
Jonas:

I am not sure if I understood your problem correct. But the way I understood 
it, you want the mail to be displayed as:

F-namn: J
L-namn: R
Birth: 12
Address: 34
Zip: 56
City: 78
Phone: 90
Mail: [EMAIL PROTECTED]
Desc: N
Hair: hair
Make: makeup

Am I correct? If that is the case, I guess you should use '\n' instead of 
'BR'.

Cheers,

Prathap


-- Original Message ---
From: Jonas Rosling [EMAIL PROTECTED]
To: PHP Lists php-general@lists.php.net
Sent: Tue, 20 Jun 2006 23:56:47 +0200
Subject: [PHP] Processing HTML in mail form

 I've done the following code bellow for an e-mail form. But it 
 handles the HTML tags as text. Is there anyway to get the HTML tags 
 processed to form the mail?
 
 ?php
 
 @extract($_POST);
 
 $subject = 'Intresseanmalan';
 
 $forname = stripslashes($forname);
 
 $lastname = stripslashes($lastname);
 
 $date_of_birth = stripslashes($date_of_birth);
 
 $post_address = stripslashes($post_address);
 
 $zip_code = stripslashes($zip_code);
 
 $city = stripslashes($city);
 
 $phone = stripslashes($phone);
 
 $mail = stripslashes($mail);
 
 $description = stripslashes($description);
 
 $hairdresser = stripslashes($hairdresser);
 
 $makeup = stripslashes($makeup);
 
 $text = 'F-name: '.$forname.'br'.
 'L-name: '.$lastname.'br'.
 'Birth: '.$date_of_birth.'br'.
 'Address: '.$post_address.'br'.
 'Zip: '.$zip_code.'br'.
 'City: '.$city.'br'.
 'Phone: '.$phone.'br'.
 'Mail: '.$mail.'br'.
 'Desc: '.$description.'br'.
 'Hair: '.$hairdresser.'br'.
 'Make: '.$makeup;
 
 mail('[EMAIL PROTECTED]',$subject,$text,From: $forname 
 $lastname $mail);
 
 ?
 
 The mail looks like this when recived:
 
 F-namn: JbrL-namn: RbrBirth: 12brAddress: 34brZip: 
 56brCity: 78brPhone: 90brMail: [EMAIL PROTECTED]brDesc: NbrHair: 
 hairbrMake: makeup
 
 Thanks in advance // Jonas
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Stream download problem

2006-06-20 Thread Prathaban Mookiah
Micheal,

I ran into this problem too. A easy workaround is to right click and choose 
'save as' which worked for me.

For complete information on this you want to have a look at http://support.
microsoft.com/default.aspx/kb/279667

Cheers,

Prathap

-- Original Message ---
From: Michael Satterwhite [EMAIL PROTECTED]
To: PHP Users php-general@lists.php.net
Sent: Tue, 20 Jun 2006 19:32:17 -0500
Subject: [PHP] Stream download problem

 I have a site that generates a file to be streamed down. The 
 relevant code is:
 --
 header(Content-type: application/vnd.ms-excel);
 header(Content-disposition: attachment; filename=$EXPORT_TIME.txt);
 header(Content-disposition: attachment);
 header(Pragma: no-cache);
 header(Expires: 0);
 echo $filestring;
 die();
 ---
 
 $EXPORT_TIME has been set to a valid filename in earlier part of 
 script. The script has been called by the user clicking on a line 
 similar to   a href=easy.php?download=streamdltype=full.
 
 If the browser in use is Firefox, Mozilla, or almost anything, it 
 works correctly. If the browser is Internet Explorer, the download 
 fails. It appears in that case that the filename expected is the 
 full url used to call the page (e.g. 
 easy.php?download=streamdltype=full) which is an invalid filename,
  hence the failure.
 
 ...and before you suggest it, *NO*, I cannot tell my client that 
 they can't use Internet Explorer.
 
 Can anyone offer any help?
 ---Michael
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Stream download problem

2006-06-20 Thread Prathaban Mookiah
Micheal,

I ran into this problem too. A easy workaround is to right click and choose 
'save as' which worked for me.

For complete information on this you may want to have a look at http://
support.
microsoft.com/default.aspx/kb/279667

Cheers,

Prathap

-- Original Message ---
From: Michael Satterwhite [EMAIL PROTECTED]
To: PHP Users php-general@lists.php.net
Sent: Tue, 20 Jun 2006 19:32:17 -0500
Subject: [PHP] Stream download problem

 I have a site that generates a file to be streamed down. The 
 relevant code is:
 --
 header(Content-type: application/vnd.ms-excel);
 header(Content-disposition: attachment; filename=$EXPORT_TIME.txt);
 header(Content-disposition: attachment);
 header(Pragma: no-cache);
 header(Expires: 0);
 echo $filestring;
 die();
 ---
 
 $EXPORT_TIME has been set to a valid filename in earlier part of 
 script. The script has been called by the user clicking on a line 
 similar to   a href=easy.php?download=streamdltype=full.
 
 If the browser in use is Firefox, Mozilla, or almost anything, it 
 works correctly. If the browser is Internet Explorer, the download 
 fails. It appears in that case that the filename expected is the 
 full url used to call the page (e.g. 
 easy.php?download=streamdltype=full) which is an invalid filename,
  hence the failure.
 
 ...and before you suggest it, *NO*, I cannot tell my client that 
 they can't use Internet Explorer.
 
 Can anyone offer any help?
 ---Michael
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] mysql_db_query INSERT

2006-06-19 Thread Prathaban Mookiah
I have run into a tricky situation and need some help to work my way through 
the problem. I use MySQL.

I accept some data from the user and insert them into two tables.

1. I insert part of the data into the first table. I do not specify the 
primary key field. It is auto generated through auto_increment.  All the 
other fields can have duplicates.
2. Then I want to insert the other part of the data along with the primary 
key that was automatically generated during the previous insert operation 
into the second table.

My problem is this: How do I retrieve the auto generated primary key field 
in the first table during the first insert operation. I cannot go back to 
the table and query using the data I inserted since as I mentioned earlier 
there can be duplicates. I simply cannot retreive the maximum value since 
some other user could have inserted something during that time.

Any ideas?

Thanks in advance.

Cheers,

Prathap

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



Re: [PHP] Unknown column 'peterspeters' in 'where clause'

2005-05-18 Thread Prathaban Mookiah
If customer_username is a string (char, varchar, text etc.) then I guess it 
should be 

mysql_query(SELECT customer_id FROM Customers WHERE customer_username = 
\$username\ AND customer_password = \$password\)

Prathap



-- Original Message ---
From: Mark Sargent [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Wed, 18 May 2005 15:27:34 +0900
Subject: [PHP] Unknown column 'peterspeters' in 'where clause'

 Hi All,
 
 the below code generates this error,
 
 Unknown column 'peterspeters' in 'where clause'
 
 mysql_select_db(status, $db);
 $username = $_POST[username];
 $password = $_POST[password];
 $result = mysql_query(SELECT customer_id FROM Customers WHERE 
 customer_username = $username AND customer_password = $password) or 
 die 
 (mysql_error()); $myrow = mysql_fetch_row($result); $customer_id = $myrow[0
];
 $_SESSION['customer_id'] = $customer_id;
 ?
 /head
 body
 ?php
 echo 'SQL Query: '.$result.'br';
 echo CustomerID = $customer_id;
 ?
 
 Cheers.
 
 Mark Sargent.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] While and echoing HTML

2005-05-10 Thread Prathaban Mookiah
I guess it is the missing semicolon.


And you can write:

echo trtd? echo $product_type ?/td/tr

as simply

echo trtd$product_type/td/tr

Prathap


-- Original Message ---
From: Mark Sargent [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 10 May 2005 13:23:51 +0900
Subject: [PHP] While and echoing HTML

 Hi All,
 
 this page,
 
 http://www.freewebmasterhelp.com/tutorials/phpmysql/5
 
 has the below code,
 
 ?
 $i=0;
 while ($i  $num) {
 
 $first=mysql_result($result,$i,first);
 $last=mysql_result($result,$i,last);
 $phone=mysql_result($result,$i,phone);
 $mobile=mysql_result($result,$i,mobile);
 $fax=mysql_result($result,$i,fax);
 $email=mysql_result($result,$i,email);
 $web=mysql_result($result,$i,web);
 ?
 
 tr
 tdfont face=Arial, Helvetica, sans-serif? echo $first. 
 .$last; ?/font/td tdfont face=Arial, Helvetica, sans-
 serif? echo $phone; ?/font/td tdfont face=Arial, 
 Helvetica, sans-serif? echo $mobile; ?/font/td tdfont 
 face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td 
 tdfont face=Arial, Helvetica, sans-serifa href=mailto:? 
 echo $email; ?E-mail/a/font/td tdfont face=Arial, 
 Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td
 /tr
 
 ?
 $i++;
 }
 
 echo /table;
 
 which I basically understand, except the html generation. I am 
 trying to create something similiar, although, I think there are 
 some errors in even perhaps my logic..?
 
 html
 body
 h1centerJumbo Status/center/h1br
 ?php
 $db = mysql_connect(localhost, root, grunger);
 mysql_select_db(status,$db);
 $result = mysql_query(SELECT ProductTypes.product_type_detail FROM 
 ProductTypes,$db);
 $myrow = mysql_fetch_array($result);
 $num = mysql_num_rows($result);
 ?
 table aligh=center border=2
 tr
 tdProduct Type/td
 /tr
 ?
 $i=0;
 while ($i  $num){
 $product_type=mysql_result($result,$i,product_type_detail);
 echo trtd? echo $product_type ?/td/tr
 }
 $i++
 ?
 /table
 /body
 /html
 
 I get the folowing error,
 
 *Parse error*: parse error, unexpected '}', expecting ',' or ';' in 
 */var/www/html/products.php* on line *20
 *
 which is the $i++ section.
 
 Cheers.
 
 Mark Sargent.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Header location, redirection loses parameters,

2005-05-10 Thread Prathaban Mookiah
Are you trying to assign the value value1 to var1 or are you trying to 
assign the value of the variable value1 to var1?

Prathap

-- Original Message ---
From: Olav Draageset [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 10 May 2005 00:16:33 +0200
Subject: [PHP] Header location, redirection loses parameters, 

 I have several URLs that I want to point to the same site with a 
 different  parameter. I try to do this by redirecting all to the 
 same location, by
 
 ?
 hader (Location: 
 http://mysite.com/index.php?var1=value1var2=value2;); exit; ?
 
 The redirection is done properly, but variables are not sent. Can 
 anyone  say what should be done? (some init settings ??) Thanks
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Reducing size of htm output

2005-05-09 Thread Prathaban Mookiah
Oops. Sorry, you are correct. I did not look at the ob_gzhandler. I just 
thought of the ob_start function.

But I remember gz encoding works fine with IE 5. Shouldn't be a problem with 
5.5.

Cheers,

Prathap


-- Original Message ---
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: Kirsten [EMAIL PROTECTED], php-general@lists.php.net
Sent: Fri, 06 May 2005 14:31:04 -0700
Subject: Re: [PHP] Reducing size of htm output

 Prathaban Mookiah wrote:
  Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+?
  
  Since IE any-version is on the client side, it shouldn't cause any 
problems 
  to ob_start(), in that case any other PHP function.
 
 That's not true.  ob_gzhandler is extremely browser-dependant since 
 it needs to check to see if the browser sent an appropriate accept-encoding
 header.  Some of the early IE versions sent accept-encoding: gzip but
 didn't correctly implement it, so you can run into problems if you 
 use ob_gzhandler with certain older browsers.  It is fine for all 
 the recent releases though.
 
 -Rasmus
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Reducing size of htm output

2005-05-09 Thread Prathaban Mookiah
I just finished testing what you said. It comes from the cache during the 
second time. But this happens with all the other pages too (the non-
compressed) not only the ones that were returned using ob_gzhandler.

It is the same phenomena with Opera 8 too.

Prathap


-- Original Message ---
From: Rory Browne [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Cc: Rasmus Lerdorf [EMAIL PROTECTED], php-general@lists.php.net, 
[EMAIL PROTECTED]
Sent: Mon, 9 May 2005 10:42:52 +0100
Subject: Re: [PHP] Reducing size of htm output

  But I remember gz encoding works fine with IE 5. Shouldn't be a problem 
with
  5.5.
 
 Did you try downloading the same compressed page twice, and checking
 the server logs, to see if it loaded from cache the second time
 around?
 
  
  Cheers,
  
  Prathap
  
  
  -- Original Message ---
  From: Rasmus Lerdorf [EMAIL PROTECTED]
  To: Prathaban Mookiah [EMAIL PROTECTED]
  Cc: Kirsten [EMAIL PROTECTED], php-general@lists.php.net
  Sent: Fri, 06 May 2005 14:31:04 -0700
  Subject: Re: [PHP] Reducing size of htm output
  
   Prathaban Mookiah wrote:
Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.
5+?

Since IE any-version is on the client side, it shouldn't cause any
  problems
to ob_start(), in that case any other PHP function.
  
   That's not true.  ob_gzhandler is extremely browser-dependant since
   it needs to check to see if the browser sent an appropriate accept-
encoding
   header.  Some of the early IE versions sent accept-encoding: gzip but
   didn't correctly implement it, so you can run into problems if you
   use ob_gzhandler with certain older browsers.  It is fine for all
   the recent releases though.
  
   -Rasmus
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  --- End of Original Message ---
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
--- End of Original Message ---

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



Re: [PHP] Reducing size of htm output

2005-05-06 Thread Prathaban Mookiah
Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+?

Since IE any-version is on the client side, it shouldn't cause any problems 
to ob_start(), in that case any other PHP function.

In my experience output buffering functions can be bizzaire at times. 
Especially if you are using it with a register_shutdown_function. Be cautious 
and test your program thoroughly before moving it into any production site.

Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has 
already done it?
===
I guess it is a matter of string parsing using something like str_replace(). 
I'm not sure!

Cheers,

Prathap




-- Original Message ---
From: Kirsten [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Fri, 6 May 2005 14:59:15 -0300
Subject: [PHP] Reducing size of htm output

 I need to reduce the size of the HTM generated by a PHP script for faster
 transmission. I'm actually using ob_start(ob_gzhandler) but I also 
 need some function to reduce the size of javascript blocks, deletion 
 of unnecesary blanks, etc.
 
 For example, Code A:
 headscript
 
 function any(){
  somecode;
 }
 
 /script
 /head
 
 body
 /body
 
 can be converted to Code B:
 headscript function any(){  somecode; }/script/headbody/body
 
 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe 
 some user has already done it? 
 
 Thanks a lot,
 Kirsten
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] select statement

2005-05-05 Thread Prathaban Mookiah
Maybe the query should be

select user_balance FROM users WHERE user_id=$uname;

Prathap

-- Original Message ---
From: Anasta [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 16:10:35 +0800
Subject: [PHP] select statement

 Why doesnt this work, it shows the username but not the balance of 
 the users money.here is the mysql table:
 
 CREATE TABLE `users` (
   `user_id` int(11) NOT NULL auto_increment,
   `username` varchar(15) NOT NULL default '',
   `password` varchar(15) NOT NULL default '',
   `status` varchar(10) NOT NULL default '',
   `user_balance` bigint(5) NOT NULL default '0',
   PRIMARY KEY  (`user_id`)
 ) TYPE=MyISAM AUTO_INCREMENT=3 ;
 
 /
 ?php session_start();
 include(connect.php);
 $uname=$_SESSION['username'];
 $user_balance=mysql_query($sql);
 $sql = Select  FROM users ,user_balance WHERE user_id =$uname;
 $result = mysql_query();
 
 ?
 ?php echo $uname;?br
 ?php echo $user_balance;?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] insert not working

2005-05-05 Thread Prathaban Mookiah
Did you check for proper permissions in the user and db tables in the user 
database?

Prathap


-- Original Message ---
From: Ross [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 10:15:52 +0100
Subject: [PHP] insert not working

 $query = INSERT INTO sheet1 (title, fname, sname, job_title, 
 organisation, street, postcode, city, telephone, mobile, fax, email, 
 web, add_info) VALUES 
 ('$title', '$fname', '$sname', '$job_title', '$organisation',
  '$street', '$postcode', '$city', '$telephone', '$mobile', '$fax', 
 '$email', '$web', '$add_info');
 
$result= mysql_query($query);
   if($result){
   echo sucess;
   }
 
 why yould this not work? I can retrievethe data but not write any 
 data to the database??
 
 R.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] is this the correct syntax

2005-05-05 Thread Prathaban Mookiah
It should be $id.

Note that missing 


Prathap


-- Original Message ---
From: Ross [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 12:09:18 +0100
Subject: [PHP] is this the correct syntax

 Am trying to do an update of a record...
 
 Is this the correct syntax..
 
  $query= UPDATE $table_name SET fname='$fname', sname='$sname' 
 WHERE id= $id;
 
 R.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] problem connecting php and mysql

2005-04-26 Thread Prathaban Mookiah
Hi,

I had this same problem and I followed the the following instructions found in 
the online manual on installing PHP for windows:



If you've run other versions of PHP in the past and are having trouble 
upgrading to PHP5, particularly in loading the dynamic link library 
'php_mysql.dll' (despite following all the guidance in this documentation), 
try the following:

1.)  REMOVE old copies of 'libmysql.dll' from your WINDOWS and 
WINDOWS\system32 folders (check BOTH places).

2.)  Verify that your System Path is correctly configured to search the 'C:
\PHP5' and 'C:\PHP5\ext'.  To do this on WinXP, go to your Control Panel, open 
System, click Advanced tab, click on Environment Variables, under (lower pane) 
'System variables', select 'Path', and then click Edit.  Your system path 
should look something like:

%SystemRoot%\system32;%SystemRoot%; C:\Program Files\MySQL\MySQL Server 4.
1\bin;C:\PHP5;C:\PHP5\ext;

Because the system path checks the Windows and System32 folders for dll's 
*before* checking the PHP folder, old copies of php_mysql.dll will load up 
first and foul your PHP initialization if you don't remove them.

===

Hope this helps.

Prathap

-- Original Message ---
From: rahot man [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 26 Apr 2005 11:11:38 +0530
Subject: [PHP] problem connecting php and mysql

 I have windows server 2003, PHPv5.0.3, Mysql v4.1 and IIS 6 and i am
 working in Macromedia Dreamweaver MX2004
 
 i am unable to connect to the mysql server. but my php files are running
 fine and my mysql server is also running fine.
 
 i) i had changed the php.ini-dist file to php.ini.
 ii)i uncommented the extensions of php_mysql.dll in php.ini file
 iii)i set the extensions_dir to
   extension_dir = D:\PHP\php-5.0.3\ext\ in php.ini file
 iv)i had copied the libmysql.dll in windows\system32 and windows\system
 v)i also copied the php_mysql.dll to D:\PHP\
 
 i wrote the following code:
 ?php
 $dbhost = localhost;
 $dbusername = root;
 $dbpassword = admin;
 $dbname = test;
 $connect = @mysql_connect ( $dbhost,$dbusername,$dbpassword ) or
 die (Could not connect .mysql_error());
 mysql_select_db($dbname,$connect) or
 die(Could not select database.mysql_error());
 ?
 
 but after all these i am still getting the error
 Fatal error: Call to undefined function mysql_connect() in
 D:\PHP\teknohub\new.php on line 14
 
 please help me to solve this problem out
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Parse error: parse error, unexpected T_ELSE

2005-04-26 Thread Prathaban Mookiah
Mark,

Back to basics budy!!

  25 if ($myrow = mysql_fetch_array($result)); {

should be 

  25 if ($myrow = mysql_fetch_array($result)) {

Note that extra semicolon?


Prathap


-- Original Message ---
From: Mark Sargent [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 26 Apr 2005 16:01:24 +0900
Subject: [PHP] Parse error: parse error, unexpected T_ELSE

 Hi All,
 
 again, I'm following an example from webmonkey,
 
 http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programming
 
  and I'm changing only what's relevant to me. I haven't altered the 
 code basics, though. But I get the error regarding else. I don't 
 see what it is. Anyone..? Cheers.
 
 Mark Sargent.
 
 *Parse error*: parse error, unexpected T_ELSE in 
 */var/www/html/phpmysqltable.php* on line *41*
 
  25 if ($myrow = mysql_fetch_array($result)); {
  26
  27 echo table border=1\n;
  28
  29 echo trtdProduct Name/tdtdProduct Model 
 Number/tdtdProduct
  30 Serial Number/td/tr\n;
  31
  32 do {
  33
  34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n, 
 $myrow[product_name], $myrow[product_model_number],
  35 $myrow[product_serial_number]);
  36
  37 } while ($myrow = mysql_fetch_array($result));
  38
  39 echo /table\n;
  40
  41 } else {
  42
  43 echo Sorry, no data is available for that request;
  44
  45 }
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Tesing Gzip files

2005-04-23 Thread Prathaban Mookiah
Hello,

Is there a way to test if a .gz file is in a valid format. Functions like 
gzread, gzfile don't seem to care if the file is corrupt or not. 

gzeof also didn't work for me. I guess it is because it does not check for a 
valid .gz termination. Any ideas to go about doing this?

Thanks in advance.

Cheers,

Prathap

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



Re: [PHP] Can I use $_REQUEST for file uploads?

2005-04-21 Thread Prathaban Mookiah
$_REQUEST should work fine with 4.3.10 IF $_FILES does not have any problems 
since both depend more or less on the same php.ini directives. Take a look at 
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.files

Cheers,

Prathap


-- Original Message ---
From: Srinadh Sannidhanam [EMAIL PROTECTED]
To: 
Sent: Fri, 22 Apr 2005 01:18:19 +0530
Subject: [PHP] Can I use $_REQUEST for file uploads?

 Hi
   When I use $_REQUEST for accessing files uploaded, it is working
 fine in PHP PHP 4.3.10.
  But it is not working in PHP 4.3.4.
  $_FILES working in both the versions. Can I use $_REQUEST in PHP
 4.3.10 also? Do I need to change any configuration in php.ini?
 server is Apache/2.0.49 
 Please help me in this regard.
 
 Thanks,
 S.Srinadh.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] handling file upload (OT not exactly PHP)

2005-04-20 Thread Prathaban Mookiah
Did you try using the $_FILES superglobal?




-- Original Message ---
From: Saswat Praharaj [EMAIL PROTECTED]
To: 
Sent: Wed, 20 Apr 2005 18:26:14 +0530
Subject: [PHP] handling file upload (OT not exactly PHP)

 Hello ,
 
 Need to do handle a file upload done via http POST.
 
 I can read the content length and from POST and get the contents.
 But, how do I get the exact file ??
 
 Eg. suppose for  uploading a .doc file I could see that it sends the
 font type and other parameters also..
 
 I am not sure how does it will matter when I am extracting the exact
 file from the POST request .
 
 Again, how would I extract the exact file ??
 
 Would appreciate any pointers or someone giving me some headstart .
 
 Thanks and Regards,
 -Saswat
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Apache - IIS Migration

2005-04-19 Thread Prathaban Mookiah
Are there any external libraries that you used to compile PHP? Including 
support for certain functions may have to be done differently in Windows for 
e.g Cybercash. Else it shouldn't be a problem. You can even safely upgrade to 
PHP = 5.0.

Prathap


-- Original Message ---
From: Pablo D Marotta [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Mon, 18 Apr 2005 18:08:51 -0300
Subject: [PHP] Apache - IIS Migration

 Hi there..
 
 Im using Apace 1.3.31 and PHP 4.3.8 in a Windows 2000 enviroment.
 
 Ill have to migrate the whole site to Windows 2003 enviroment,
  using IIS 6.0.. Should there be any problem about that, or not?
 
 I mean, should it all go fine, or is it possible for the code to 
 fail in some parts? Just in case you need to know, Im using 
 register globals on, and Im also using some Pear functions 
 (Excel_Spreadsheet).
 
 The people Ive asked about this yet, have told me that it should go 
 fine as long as I keep the same PHP version.
 (I should install PHP in the IIS, configure it to recognize the php 
 files, and then copy the php files)
 
 Thank you all!
 Pablo
 
 American Express made the following
  annotations on 04/18/05 14:09:05
 
--
 
**
 
 This message and any attachments are solely for the intended 
 recipient and may contain confidential or privileged information. If 
 you are not the intended recipient, any disclosure, copying, use, or 
 distribution of the information included in this message and any 
 attachments is prohibited. If you have received this communication 
 in error, please notify us by reply e-mail and immediately and 
 permanently delete this message and any attachments. Thank you.
 
 
**
 
==
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Matching Number of Times a Word Occurs...

2005-04-19 Thread Prathaban Mookiah
substr_count() should be more easy, but limited in functionality.

Prathap

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



Re: [PHP] sql groups

2005-04-12 Thread Prathaban Mookiah
Try,

http://forums.mysql.com/list.php?10

Prathap

-- Original Message ---
From: William Stokes [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 12 Apr 2005 10:51:44 +0300
Subject: [PHP] sql groups

 Know any good sql discussion groups for mysql?
 
 Thanks
 -Will
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Split command problem

2005-04-11 Thread Prathaban Mookiah
I guess you are trying to create an array by the name 'name' and assign two 
elements to it by calling name($fname, $lname). Am I correct?

I think it does not work that way. Try list($fname, $lname) = ..
Then the variable $fname and $lname will contain the first and last names.

list($fname, $lname) = split('[/\s+/]', $_POST[username]);

Cheers,

Prathap


-- Original Message ---
From: Russ [EMAIL PROTECTED]
To: PHP General php-general@lists.php.net
Sent: Sun, 10 Apr 2005 18:27:34 -0700
Subject: [PHP] Split command problem

 I have been trying to get the following code working. I keep getting 
 an error on line nine. It looks simular to the example in the PHP 
 online manual. If I substitute a print command for line nine I get 
 the correct information from $_POST[username]. I must be missing or 
 have an extra a quote but I cannot figure out where.
 
 ?php
 //check for required fields from the form
 if ((!$_POST[username]) || (!$_POST[password])) {
   header(Location: memberlogin15.7.php);
   exit;
 } 
 if(preg_match(/[A-Z]/, substr($_POST[username], 0, 1)))
 {
 name($fname, $lname) = split('[/\s+/]', $_POST[username]);
 //echo First Name: $fname; Last Name: $lname\n;
 echo first letter is uppercase;
 }
 else
 {
 echo first letter is not uppercase;
 }
 
 Any help will be appreciated.
 -- 
 Russ
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Is there any other place to start php module?

2005-04-11 Thread Prathaban Mookiah
Might be under apache conf dir/modules.d/

Prathap


-- Original Message ---
From: Teng Wang [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Mon, 11 Apr 2005 20:57:58 -0400
Subject: [PHP] Is there any other place to start php module?

 I can't find any line in httpd.conf to load libphp4.so, so I
 added such a line to load it. But systems says
 [warn] module php4_module is already loaded, skipping
 
 So I guess there is some other place to start php4 already.
 Where can I find it?
 
 Thanks!
 
 eruisi
 04/11/2005
 20:55:49
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Re: Problem with ob_get_contents()

2005-04-10 Thread Prathaban Mookiah
Thanks Skrol for your reply.

But the problem is, the shutdown function will have to be executed from a lot 
of points whenever something goes wrong and I guess calling hello() everywhere 
manually is not elegant.

Maybe it should be reported to PHP bugs.

Prathap

-- Original Message ---
From: Skrol 29 [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sun, 10 Apr 2005 07:27:38 +0200
Subject: [PHP] Re: Problem with ob_get_contents()

 Hi,
 
 I've tested your code on PHP 4.3.3 and I have the same behavior has yours.
 
 Hello is output at the end of the PhpInfo data, followed by a PHP 
 notice :   Notice: ob_end_clean(): failed to delete buffer. No 
 buffer to delete. in ... And there is an empty logfile file 
 created in the Apache directory insteaf of the script's directory.
 
 If you change in your script:
 ***
   register_shutdown_function(hello);
   echo (HELLO br);
   die();
 ***
 by
 ***
   // register_shutdown_function(hello);
   echo (HELLO br);
   hello()
   die();
 ***
 then it runs as expected and the logfile file is created in the 
 script's directory.
 
 It seems that when calling the shutdown function, all the buffered 
 output is immedialty sent to the client and the buffer mode is 
 closed. You maybe have PHP bug here, or the manual is wrong about 
 the possibility to retrieve the contents. But we can notice that 
 this also happens at the end of a script when there is no shutdown function.
 
 ---
 Skrol29
 www.tinybutstrong.com
 ---
 
 Prathaban Mookiah [EMAIL PROTECTED] a crit dans le message 
 de news: [EMAIL PROTECTED]
  Hello,
 
  I've posted a miniature version of my code here to explain my problem.
 
  CODE
 
  ?
  phpinfo();
 
  ob_start();
 
  register_shutdown_function(hello);
 
  echo (HELLO);
 
  die();
 
  function hello()
  {
 
  $logfile = logfile;
 
  $error_string = ob_get_contents();
 
  if(!$handle = fopen($logfile, a))
  {
 echo(Could not open logfile for writing!);
 ob_end_flush();
 exit;
  }
 
  if(fwrite($handle, $error_string) === FALSE)
  {
 echo(Could not write to logfile!);
 ob_end_flush();
 exit;
  }
 
  fclose($handle);
 
  ob_end_clean();
 
  }
 
  ?
 
  /CODE
 
  This simply does not work the way it should. i.e ob_get_contents doen't 
  return
  any string and the buffer just gets flushed by itself at termination.
 
  Though the PHP manual says it is not possible to retrieve the contents of 
  any
  output buffers using ob_get_contents() with PHP  4.0.6. But I am using 
  PHP 5.
  x.x
 
  Thanks in advance for any help.
 
  Prathap
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Viewing a specific item within a php web-page?

2005-04-10 Thread Prathaban Mookiah
I think you have totally got it wrong. You pass on the value to a php script 
in the form on http://   /script.php?variable=value.

So to accomplish your need you may have to do something like call http://   
/script.php?articleid=post_040905.

Your program should be modified to maybe something like:

?

$post_041005 = article for April 10th 2005;
$post_040905 = text for April 9th 2005;

switch ($_HTTP_GET_VARS['articleid'])
{
   case post_041005: print($post_041005);
   break;
   case post_040905: print($post_040905);
   break;
   default: echo No articleid specified
}

If you still want to call it in the form domain.com/articles.php?post_040905, 
then you may do something like this:

$post_041005 = article for April 10th 2005;
if isset($_HTTP_GET_VARS['post_041005'])
print($post_041005);

$post_040905 = text for April 9th 2005;
if isset($_HTTP_GET_VARS['post_040905'])
print($post_post_040905);

?

There are more efficient ways to do it, but this should get the job done.

Prathap

-- Original Message ---
From: Carlos Palomino [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sat, 9 Apr 2005 21:23:06 -0400
Subject: [PHP] Viewing a specific item within a php web-page?

 I have a document entitled: articles.php
 Within this document, I want to store various written articles which 
 are headed by a string value - example:
 
 $post_040905 = text for April 9th 2005;
 print($post_040905);
 $post_041005 = article for April 10th 2005;
 print($post_041005);
 
 How can I view a specific string's text via the browser?  I thought 
 I could use domain.com/articles.php?post_040905  and only the 
 content written for that post would be shown.  However, all of the 
 posts are shown. I just began reading about PHP from limited 
 tutorials so I am at a loss as to how I can accomplish this.  I 
 would appreciate all assistance in this matter.
 
 Best Regards,
 
 Carlos
--- End of Original Message ---

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



Re: [PHP] Viewing a specific item within a php web-page?

2005-04-10 Thread Prathaban Mookiah
I guess I had some 'spelling mistakes' in my suggested code.

Try the one below. It should be $HTTP_GET_VARS not $_HTTP_GET_VARS.

?

 $post_041005 = article for April 10th 2005;
 $post_040905 = text for April 9th 2005;

 switch ($HTTP_GET_VARS['articleid'])
 {
case post_041005: print($post_041005);
break;
case post_040905: print($post_040905);
break;
default: echo No article was specified.;
 }

?

And you can name the script in any way you want to. It need not be script.php. 
Say if you put this code into a script call getarticle.php, you should call it 
as youdomain/getarticle.php?articleid=post_x where  is the appropriate 
article number.

As someone else suggested, putting them into a database is the best way to do 
it. But since I guess you are a beginner you might as well keep it very simple 
like this for the time being. But ultimately you should consider databases.

Cheers,

Prathap

-- Original Message ---
From: Carlos Palomino [EMAIL PROTECTED]
To: Prathaban Mookiah [EMAIL PROTECTED]
Sent: Sun, 10 Apr 2005 06:09:53 -0400
Subject: Re: [PHP] Viewing a specific item within a php web-page?

 Hi,
 
 I tried the following but can not view the specified article but 
 receive the default message when attempting to view either of the 
 posts.  I used the proper URL as suggested 
 (script.php?read=post_041005).
 
 $post_041005 = article for April 10th 2005;
 $post_040905 = text for April 9th 2005;
 switch ($_HTTP_GET_VARS['read'])
 {
case post_041005: print($post_041005);
break;
case post_040905: print($post_040905);
break;
default: echo No article was specified.;
 }
 
 Any ideas on why I am receiving only the default message even though 
 I go to the proper article URL?
 
 Best Wishes,
 
 Carlos
   - Original Message - 
   From: Prathaban Mookiah
   To: php-general@lists.php.net
   Sent: Sunday, April 10, 2005 4:23 AM
   Subject: Re: [PHP] Viewing a specific item within a php web-page?
 
   I think you have totally got it wrong. You pass on the value to a 
 php script  in the form on http://   /script.php?variable=value.
 
   So to accomplish your need you may have to do something like call http://
   /script.php?articleid=post_040905.
 
   Your program should be modified to maybe something like:
 
   ?
 
   $post_041005 = article for April 10th 2005;
   $post_040905 = text for April 9th 2005;
 
   switch ($_HTTP_GET_VARS['articleid'])
   {
  case post_041005: print($post_041005);
  break;
  case post_040905: print($post_040905);
  break;
  default: echo No articleid specified
   }
 
   If you still want to call it in the form 
 domain.com/articles.php?post_040905,  then you may do something like 
 this:
 
   $post_041005 = article for April 10th 2005;
   if isset($_HTTP_GET_VARS['post_041005'])
   print($post_041005);
 
   $post_040905 = text for April 9th 2005;
   if isset($_HTTP_GET_VARS['post_040905'])
   print($post_post_040905);
 
   ?
 
   There are more efficient ways to do it, but this should get the 
 job done.
 
   Prathap
 
   -- Original Message ---
   From: Carlos Palomino [EMAIL PROTECTED]
   To: php-general@lists.php.net
   Sent: Sat, 9 Apr 2005 21:23:06 -0400
   Subject: [PHP] Viewing a specific item within a php web-page?
 
I have a document entitled: articles.php
Within this document, I want to store various written articles which
are headed by a string value - example:
   
$post_040905 = text for April 9th 2005;
print($post_040905);
$post_041005 = article for April 10th 2005;
print($post_041005);
   
How can I view a specific string's text via the browser?  I thought
I could use domain.com/articles.php?post_040905  and only the
content written for that post would be shown.  However, all of 
 the   posts are shown. I just began reading about PHP from limited  
  tutorials so I am at a loss as to how I can accomplish this.  I   
 would appreciate all assistance in this matter. Best Regards,  
Carlos
   --- End of Original Message ---
 
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Problem with ob_get_contents()

2005-04-09 Thread Prathaban Mookiah
Hello,

I've posted a miniature version of my code here to explain my problem.

CODE

?
phpinfo();

ob_start();

register_shutdown_function(hello);

echo (HELLO);

die();

function hello()
{

$logfile = logfile;

$error_string = ob_get_contents();

if(!$handle = fopen($logfile, a))
{
echo(Could not open logfile for writing!);
ob_end_flush();
exit;
}

if(fwrite($handle, $error_string) === FALSE)
{
echo(Could not write to logfile!);
ob_end_flush();
exit;
}

fclose($handle);

ob_end_clean();

}

?

/CODE

This simply does not work the way it should. i.e ob_get_contents doen't return 
any string and the buffer just gets flushed by itself at termination.

Though the PHP manual says it is not possible to retrieve the contents of any 
output buffers using ob_get_contents() with PHP  4.0.6. But I am using PHP 5.
x.x

Thanks in advance for any help.

Prathap

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