[PHP] Re: Is it possible to create a global namespace alias?
I'm assuming there is no way to make a global alias. Can anyone confirm/deny this? Matt Palermo wrote in message news:5e7b8989448b45dbbeeb6fb89b3f3...@rachet... Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php ?php use \this\is\my\custom\namespace\Item as nsItem; ? file: index.php ?php require_once “main.php”; // Attempt to use namespace alias defined in main.php file nsItem::test(); ? The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is it possible to create a global namespace alias?
On Tue, Oct 5, 2010 at 8:41 AM, Matt Palermo palermom...@gmail.com wrote: I'm assuming there is no way to make a global alias. Can anyone confirm/deny this? I reread the documentation on namespaces, and from what I can tell this is no way to do it. Each file maintains its own active namespace *at compile time*. This means you can't even get around it with eval() or including another script to set it. I can't say I'm positive someone won't find a way around it, but short of an extension I don't see one. David
[PHP] Re: Is it possible to get the name of the top most calling script?
If the scripts are using a common file, [e.g., config, functions, etc.] you could define two constants. define(ORG_FILE, __FILE__); define(ORG_LINE, __LINE__); barophobia wrote: Hello, I know that __FILE__ and __LINE__ report on the file and line that they occur in. What I want is to be able to get the file name and line of the calling script. The only way I can do this so far is by passing the values through function arguments. Is there any way around this? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this possible with php
Mace Eliason wrote: Hi, I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. Thanks Scandog php can only do things on its server and send stuff for rendering to the client. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible with php
(Re-sending as I accidentally sent my original post directly to Al) Al wrote: Mace Eliason wrote: I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. php can only do things on its server and send stuff for rendering to the client. It also sounds like a MAJOR security issue to me. I sure don't want a 3rd party web site moving files around on MY system... Regards, Ozz. signature.asc Description: OpenPGP digital signature
[PHP] Re: Is this possible with php
PHP don't do this. The user must select a file to upload and then the PHP can work with this. PHP has no access to local files, think with me, how can PHP discover which machine in internet he has to access to get files. Mace Eliason wrote: Hi, I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. Thanks Scandog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible with php
PHP can do this, but you'd need it set up on each of the client computers and periodically run to check the temp folder and perform the upload. That's what any other application that can do similar does. Cheers, Rob. On Mon, 2006-03-06 at 15:30, João Cândido de Souza Neto wrote: PHP don't do this. The user must select a file to upload and then the PHP can work with this. PHP has no access to local files, think with me, how can PHP discover which machine in internet he has to access to get files. Mace Eliason wrote: Hi, I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. Thanks Scandog -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible with php
Ok, but you're telling that the client will be doing upload to server. Not the server doing a dounload from client. I was understood as a wrong way. I'm sorry. Robert Cummings wrote: PHP can do this, but you'd need it set up on each of the client computers and periodically run to check the temp folder and perform the upload. That's what any other application that can do similar does. Cheers, Rob. On Mon, 2006-03-06 at 15:30, João Cândido de Souza Neto wrote: PHP don't do this. The user must select a file to upload and then the PHP can work with this. PHP has no access to local files, think with me, how can PHP discover which machine in internet he has to access to get files. Mace Eliason wrote: Hi, I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. Thanks Scandog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible with php
Yeah, you can't do the local computer file moving and all that with the same script as your server side component, but if you'd rather not learn C# or another language like that, but you're comfortable with PHP, I'd highly recommend checking out Winbinder (http://www.winbinder.com). Assuming your clients are all windows machines. PHP is very powerful, it's just cumbersome to get a non-tech person to use a typically shell oriented language to do things on the client's machine. Winbinder provides a merging of PHP and Windows' native API. Takes a little getting used to at first, but works great. -TG = = = Original message = = = PHP can do this, but you'd need it set up on each of the client computers and periodically run to check the temp folder and perform the upload. That's what any other application that can do similar does. Cheers, Rob. On Mon, 2006-03-06 at 15:30, Jo~o C~ndido de Souza Neto wrote: PHP don't do this. The user must select a file to upload and then the PHP can work with this. PHP has no access to local files, think with me, how can PHP discover which machine in internet he has to access to get files. Mace Eliason wrote: Hi, I really don't think this is possible from what I know of php, but I thought I would as the experts. Is it possible to have php create directories and move files on a local machine. I have created a web portal for a client and now they would like it to upload files to an server, no a problem. But they would like it to also move temp files on the users computer to new directories and then upload the file to the server with no user interation other than clicking go. I have thought of doing this in vb or c# but I have done very little with these languages, and php just rocks. Thanks Scandog ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible to use header() to POST form data?
Hello. pw wrote: Does anyone know if it's possible to use the header() function to POST form data to a URL? If so what syntax needs to be used? I guess you cannot use the header() function in that way. Take a look at the header() documentation http://php.net/header. What do you need to do? Are you working with wrappers? If so, take a look at the 2nd example in the streams documentation http://php.net/stream. Cheers. -- Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP CLI - possible for mass mailing?
Hello, on 09/27/2005 02:44 AM Denis Gerasimov said the following: I was said that using Perl script is more suitable for such task since PHP scripts have problems with sending large amount of mail. Is that true or not? Any success/failure stories? It is a myth that Perl is better (or worse) than PHP for sending messages to many users. The truth is that usually you do not send messages directly to the users, but rather queue the messages in your MTA and it takes care of the actual delivery, retrying later, bounce handling etc.. I use this popular MIME message class for composing and sending messages to over 120,000 newsletter subscribers on a daily basis. The class provides means to employ some tricks to minimize the queue time and memory usage. It takes about 1 hour to queue individual messages to all the recipients. PHP CGI/CLI version are started from a cron job that calls set_time_limit(0); to let PHP run the script for a long time. The class comes with examples of optimize its use for bulk mailing. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible to get the whole address (including http:// ) ?
Labunski wrote: Hello, I know for example how to get http vars or basename, but this time I need to get the whole address, including http:// . Is it possible? Thanks in advance, Lab. http://php.net/reserved.variables ?php var_dump($_SERVER['REQUEST_URI']); ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: Is it Possible?
Sagar C Nannapaneni wrote: I'm calling a php script with img tag for ex: img src=http://localhost/test.php?img=asfd; and the test.php is as follows... test.php ? some server side validations readfile(abcd.gif); ? --- Theres no problem with this..its working fine. But i want to return some text(or Html) the browser along with the image. So is there anyway that i can send the text to the browser You seem to have a pretty good understanding of what's going on already. What you can do is have one script (main.php) that includes the img tag that links to the PHP generated gif (test.php). Then you can put whatever text / html you want in main.php ?php /** main.php */ echo pI am a super cool piece of text. Now check out this picture!/p\nimg src=\http://localhost/test.php?img=asdf\;; ? in this fashion. Even anyother solution other than the img is also Ok. Showing img is not a priority for me but sending the text is.. Any help will be greatly appreciated.. Thanks, /sagar -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: Is this possible ?
Do this: function MyFunc($num=NULL) { if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return $returnsomething; } $numrows=0; $res_arr=MyFunc($numrows); Notice the , that'll make the value of $numrows changed... I did not test this at all, but it should work.. If you only do MyFunc(); without any parameters, it'll just return the result of the SQL statement.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Dave Carrera [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi List, I have a function that makes a call to mysql based on certain vars. ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $returnsomething =blah blah; } return $returnsomething; } And that all works fine no probs here but. I want to use a result somewhere in my script that is not returned by return. Let me show you... ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return $returnsomething; } So $num contains a number that I want to use outside the function which is not covered by return. I know return stops a script and returns what I want it to return but how do I send out of the function the var I want. I have tried $GLOBAL[var]=$num; but that dont work, but I thought I would'nt anyway just tried it and yes I know I have to declare it inside my new function using global $var; to use it. So I ask is this achiveable or how can I do this. Thank you in advance Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php5 and possible oop features/questions
Not really what i was getting at dude, i dont see how defining a class variable will let me define a method outside of a given class, or to dynamically extend/implement other classes inside a general one? try again ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php5 and possible oop features/questions
On Mon, Oct 06, 2003 at 12:36:49PM +0200, Tit Black Petric wrote: : : Not really what i was getting at dude, i dont see how defining a class : variable will let me define a method outside of a given class, or to : dynamically extend/implement other classes inside a general one? Why the desire to define a method outside of a class definition besides the primary reason of syntactical sugar? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php5 and possible oop features/questions
if you want to use variable's in a function you need to give the function the paramaters..if you do not with to use it like that.. declare the vars in the beginning of the class class classname { var $1; var $2; } greetz -- -- It's Not God That Created Us, It's Us That Created God! Tit Black Petric [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] will something in the likes of this be possible in php5? /***/ class some_classname { function some_function(); } function some_classname::some_function($prefix, $text) { return $prefix.: .$text.\n; } $test = new some_classname; $test-some_function(Output,Hello World!); /***/ how about object/class aggregation from php4 (it was experimental and i imagine it still has a few bugs left, but it was a really usefull feature)..? i know the following is possible: class class_name implements class1, class2, class3 extends parent_class { ... } but, can you do something more dynamic, so you can tell which classes to implement at runtime? class class_name implemenets $vars extends parent_class ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Possible to store arrays in mySQL without explode()/implode()
- Original Message - From: Jakob Mund [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 9:04 AM Subject: [PHP-DB] Possible to store arrays in mySQL without explode()/implode() is it possible to store an array in mySQL without using implode() / explode(), like this: Serialize the array to make it a string and store that. Unserialize() to make it an array again. The column type you choose depends in the length of the values you might choose to put in the array. Serialize the array to a var and check it's length with strlen to get some ideas of what type you might need. http://www.php.net/serialize http://www.php.net/unserialize -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is this possible ...
Yes, it's possible. You concatenate the form variables with the html, transform it to a file and attach to the email. -- Julio Nobrega Pode acessar: http://www.inerciasensorial.com.br M.E. Suliman [EMAIL PROTECTED] escreveu na mensagem 000701c24097$044a1b00$9fb71fc4@b1s0n2">news:000701c24097$044a1b00$9fb71fc4@b1s0n2... Hi I need the contents of a form to be emailed as an attached Excel file or html file. Is this possible using PHP. I think comma delimited files open in Excel. Can anyone advise. Thanks in advance Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible...
You can't download a script when it is being parsed. If it is not going to be parsed you can download it as text. as for php.net , they have got a button on their site called: showsource click it and have the source of any page you want, Apollo [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is it possible download php scripts from webpages ? for example i need php.net scripts or others :-) If yes, how ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible...
No. Since PHP is executed on the server, the only thing that is sent to the browser is pure HTML (and client-sided scripts like JavaScript). This means you cannot just get the source code of a PHP page by just browsing it. /lasso ([EMAIL PROTECTED]) Apollo wrote: Is it possible download php scripts from webpages ? for example i need php.net scripts or others :-) If yes, how ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generate every possible combination
Evan Nemerson wrote: I need to generate every possible combination of the the values in an array. For example, if... $array = Array(A, B, C); I really have no idea where to begin. The best lead I can think of is that there are going to be n! elements in the output array, where n is the size of the input array. Correct, this also implies that using more than say 20 elements (20!) will take *loads* of CPU time and memory. Anyway, I did such a program once to test the performance of VB versus Java but alas I dont keep it around. It was recursive tho. A quick check on google came up with some code here: http://www.delphiforfun.org/Programs/Permutes_1.htm and som theory here: http://www.theory-of-evolution.org/Main/chap4/permutations_7.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generate every possible combination
Evan Nemerson wrote: I need to generate every possible combination of the the values in an array. For example, if... $array = Array(A, B, C); I want to be able to do something like print_r(magic_function($array)); which would output Array ( [0] = ABC [1] = ACB [2] = BAC [3] = BCA [4] = CAB [5] = CBA ) I really have no idea where to begin. The best lead I can think of is that there are going to be n! elements in the output array, where n is the size of the input array. Any help would be greatly appreciated. Evan for ($x=ord(A);$x=ord(Z);$x++) { for($y=ord(A);$y=ord(Z);$y++) { for($z=ord(A);$z=ord(Z);$z++) { $array[]=chr($x).chr($y).char($z); } } } is a quick suggestion. Haven't tested it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generate every possible combination
Austin Marshall wrote: Evan Nemerson wrote: I need to generate every possible combination of the the values in an array. For example, if... $array = Array(A, B, C); I want to be able to do something like print_r(magic_function($array)); which would output Array ( [0] = ABC [1] = ACB [2] = BAC [3] = BCA [4] = CAB [5] = CBA ) I really have no idea where to begin. The best lead I can think of is that there are going to be n! elements in the output array, where n is the size of the input array. Any help would be greatly appreciated. Evan for ($x=ord(A);$x=ord(Z);$x++) { for($y=ord(A);$y=ord(Z);$y++) { for($z=ord(A);$z=ord(Z);$z++) { $array[]=chr($x).chr($y).char($z); } } } is a quick suggestion. Haven't tested it. never mind, wasn't paying attention. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is This Possible? (Database - PHP)
Why don't you install Mysql on your local machine and do your testing ? Jochem R [EMAIL PROTECTED] schreef in bericht 000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn">news:000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn... Hey there guys, I have a slight problem which i could not solve via Java servlets and now that I am migrating to PHP I was wondering if its possible... I am hosting with a company that has given me a database (MySql) I am using the database for all my apps which are only being accessed via my servlets... I want to change that and convert all my servlets to PHP. Being new to PHP i am sure to make a lot of mistakes and instead of uploading my PHP page, getting errors/ redoing it, uploading etc I was kinda hoping i could connect to the remote database via my local machine? I already have PHP installed on my machine. on the remote host the details are Localhost jimmy*** (Username) gunsand* (Password) umace_com (Database name) Is this possible? Any help and comments appreciated. Cheers, -Ryan /* Whats the difference between the pope and your boss? The pope only wants you to kiss his ring! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is This Possible? (Database - PHP)
Yup, with local host you're not going to be able to access it from a remote machine (although it's worth asking your host). Just set up a test machine locally which is as close as possible to what your host runs (ie Unix, WinNT, whatever), with simular versions of PHP, Apache, MySQL, etc etc... run all your scripts locally, test, then upload. Use phpMyAdmin to create a dump of your database for copying between the local and live server, and you'll be happy. I'm running a cheap-ass P133 box with FreeBSD, Apache, PHP4.1, MySQL etc etc, bolted straight into my network... I was also able to install a simular set-up onto win 95 in about 2-3 hours from scratch for my laptop. Do your FTP in bulk amounts, and do your testing locally :) Justin on 13/05/02 11:25 PM, Jochem ([EMAIL PROTECTED]) wrote: Why don't you install Mysql on your local machine and do your testing ? Jochem R [EMAIL PROTECTED] schreef in bericht 000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn">news:000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn... Hey there guys, I have a slight problem which i could not solve via Java servlets and now that I am migrating to PHP I was wondering if its possible... I am hosting with a company that has given me a database (MySql) I am using the database for all my apps which are only being accessed via my servlets... I want to change that and convert all my servlets to PHP. Being new to PHP i am sure to make a lot of mistakes and instead of uploading my PHP page, getting errors/ redoing it, uploading etc I was kinda hoping i could connect to the remote database via my local machine? I already have PHP installed on my machine. on the remote host the details are Localhost jimmy*** (Username) gunsand* (Password) umace_com (Database name) Is this possible? Any help and comments appreciated. Cheers, -Ryan /* Whats the difference between the pope and your boss? The pope only wants you to kiss his ring! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is This Possible? (Database - PHP)
Justin French wrote: Yup, with local host you're not going to be able to access it from a remote machine (although it's worth asking your host). Actually you can connect to a mySQL database from a remote server. You just need to make sure that permissions are set up in the mysql table to give you access from another server. Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Is This Possible? (Database - PHP)
Or read the man page on mysql_pconnect/mysql_connect ? -Original Message- From: Jochem [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 9:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Is This Possible? (Database - PHP) Why don't you install Mysql on your local machine and do your testing ? Jochem R [EMAIL PROTECTED] schreef in bericht 000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn">news:000501c1fa4c$8fca8fc0$0a6da8c0@lgwezec83s94bn... Hey there guys, I have a slight problem which i could not solve via Java servlets and now that I am migrating to PHP I was wondering if its possible... I am hosting with a company that has given me a database (MySql) I am using the database for all my apps which are only being accessed via my servlets... I want to change that and convert all my servlets to PHP. Being new to PHP i am sure to make a lot of mistakes and instead of uploading my PHP page, getting errors/ redoing it, uploading etc I was kinda hoping i could connect to the remote database via my local machine? I already have PHP installed on my machine. on the remote host the details are Localhost jimmy*** (Username) gunsand* (Password) umace_com (Database name) Is this possible? Any help and comments appreciated. Cheers, -Ryan /* Whats the difference between the pope and your boss? The pope only wants you to kiss his ring! */ -- 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
Re: [PHP] Re: Is This Possible? (Database - PHP)
Robert Cummings wrote: Justin French wrote: Yup, with local host you're not going to be able to access it from a remote machine (although it's worth asking your host). Actually you can connect to a mySQL database from a remote server. You just need to make sure that permissions are set up in the mysql table to give you access from another server. I might have read the original statement wrong... you can connect to a remote mySQL database from your localhost, but not to the localhost from a remote server unless the localhost is also visible on the internet. Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this possible?
It's possible, but it might be easier to set up virtual hosts or something. If you're using apache, you can set this up in httpd.conf, using something like NameVirtualHost * VirtualHost * ServerName www.domain1.com Redirect permenent / http://www.domain.com/domain1 /VirtualHost VirtualHost * ServerName www.domain2.com Redirect permenent / http://www.domain.com/domain2 /VirtualHost Or you can use mod_rewrite and set up rules to act similarly. Of course, if you're not using Apache, go with the PHP solution someone else provided. Might be a bit easier to use the virtual hosts, though, 'cause then you don't have to worry about a bunch of PHP code and just let the web server itself handle everything. J Leif K-Brooks wrote: I would like to have multiple domains and have them forwarded to different folders, so I'd only need one hosting account. Example: www.domain1.com goes to www.domain.com/domain1 www.domain2.com goes to www.domain.com/domain2 I would like to do this in php. Of course, to do this, I'd need to get the url the user is requesting into the script. If this possible? Thanks in advance, Leif K-Brooks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this possible?
I believe you can do this using an INNER JOIN command. I have not done this in sometime, and I will give you a sample from my sql book. Inner joins extract rows that are common to both tables, based on values in the common column. For example, you could write a query that would extract a list of customer numbers (from the sales table) and the salesperson's first and last name (from the slspers table) who serves them. The common condition would be the salespersons REPID, which would exist in only certain rows in both tables. You would write such a query like this : SELECT custnum, fname, lname FROM sales INNER JOIN slspers on sales.repid = slspers.repid So to try and relate this to your solution assume the tables are called PRODUCTINFO and PRICES and the common value in both is PRODUCT_ID. PROD_DEC is in PRODUCTINFO and PROD_PRICE is in PRICES SELECT PROD_DESC, PROD_PRICE FROM PRODUCTINFO INNER JOIN PRICES on PRODUCTINFO.PRODUCT_ID = PRICE.PRODUCT_ID This SHOULD return a record set of product id's with descriptions and prices... I believe... I have not tested it... But I THINK this is what you are looking for... Dave Raymond Lilleodegard [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I have this tricky case, at lest for me : ) I'm trying to get some data out of two tables and listing the data in a product/price site. But. : I have one table with productinfo and one with prices. And it is several columns with the same id in the pricetable, because every product have several sizes. So... how do I get only one row from the product table and two rows from the price table in one line in a page? Is it possible? Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible?
Yes, it's entirely possible to abuse the PHP mailinglist by sending MySQL tutorials and useless complaints like this one. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php