Re: [PHP] Newman and sessions.
on 24/07/02 4:04 PM, Philip J. Newman ([EMAIL PROTECTED]) wrote: so how would i get the $username and $password into the session session_register('$username','$password'); READ THE MANUAL php.net/session_register tells you EVERYTHING you need to know, including examples and user contributed notes. please try and research stuff before posting Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Banner Ad Serving...
Here's the URL for mod_layout if anybody's interested... http://software.tangent.org/projects.pl?view=mod_layout It's powerful, but just a little heftier than what I want. Since all I need is .html and .htm support, I think I'm just going to end up modifying my http.conf - I'd rather mess with Apache a little versus giving PHP another mod to stress over. PHP makes a good pipe. :D Thanks again, everybody. I love this list! Dave -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 11:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Banner Ad Serving... On Wednesday 24 July 2002 12:07, Dave at Sinewaves.net wrote: I think you may have it on that one! You get the gold star! :) Thanks for the help -- I probably would have banged my head against my keyboard for another week or so before I thought of that! Or you can use something called mod_layout. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* I'm not even going to *__bother* comparing C to BASIC or FORTRAN. -- L. Zolman, creator of BDS C */ -- 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] probelm : delete files using PHP
Hi Gurus, I am using PHP 4.1.1, Postgresql 7.2 and Perl 5.6.0 on Linux. I want to delete files in a directory,which were created 15 days back. I can not do it, with PHP filesystem and directory functions, as PHP runs as "nobody" user. Can anybody pls. help me ? Thanking you all in anticipation. Regards Umesh. * Umesh A. Deshmukh. Manas Solutions Pvt. Ltd. [EMAIL PROTECTED] http://www.manas-solutions.com Ph. : 91+020+4006358,4223991/92 *
[PHP] Inserting Processed Data from One Table 2 Another!
Ok i have simple issue, i'm stuck at one point. I have a table Clientdetails which contains ClientID. I have created another table Authentication with 2 fields, ClientID and Password. I want to pick up the ClientID from table Clientdetails and insert ClientID and a Password i have generated using a code, into Authentication. So if there are 13000 ClientID's in Clientdetails, as, many rows with the ClientID it's corresponding password should be Inserted into table Authentication. I'm using the following code which i know is wrong, what would be correct? ? $db = mysql_connect(localhost,user,pwd); mysql_select_db(myDB,$db); $result = mysql_query(SELECT * FROM clientdetails,$db); if ($myrow = mysql_fetch_array($result)) { do { $some = $myrow[clientid] $newid = eregi_replace('100', '', $myrow[clientid]); $date = date(dn); $stuff = $newid.def.$date; $sql = INSERT INTO authentication VALUES('$some','$stuff'); $result = mysql_query($sql); echo All Done!; } while ($myrow = mysql_fetch_array($result)); } ? Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about using if elseif ...
Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OO Programming - get practical
Thanks Richard, actually your comments really help. As I said to a few others who replied directly, I feel like it is something I ought to be doing. But most of my development is small-scale and I work alone. There is no external pressure to do so. Furthermore, I fear that if I were to use OO methods that someone who might no be so skilled would come in behind me and make a mess. Hey, it feels good to feel stupid...today is a good day grin. Paul Richard Lynch wrote: I want to point something out to aspiring authors. The truth is, that few books and web pages out there show examples using OO methods. For example, the book I use as my primary reference has one chapter on OO PHP and that is it. The rest of the examples in the book are in regular functions. And the one example they give is used to create a web page, with the Title , KeyWords, Styles, Header, Menu... as the objects. So, I guess my point is that if people want to encourage use of OO programming, they need to use more examples in their books instead of what is easy. Otherwise, if the reader doesn't get the one example, they don't have other examples to try. Furthermore, one cannot encourage people to think about how they can program using OO methods if they don't use such methods in their teaching of the subject matter. Basically, a Simple OO Example is an oxymoron, or a Bad Example (apologies to Ralph Covert). OO really only shows its strength when you have a certain set of pre-conditions: 1. Multiple programmers working on large-scale project -- OO safely sub-divides functionality so that they can code with less risk of screwing each other up. 2. Library release code (eg PHPLib) -- OO allows you to have minimal impact on the main application's variables/constants etc by providing a separate name-space 3. Real-World Object being modeled in complex/interesting ways -- OO provides a more natural coding style for this in some cases. None of these pre-conditions is met in a Simple Example That said, there are a zillion PHP OO applications/solutions out there for you to look at. Some even have comments. A few even have *GOOD* comments. :-) It is entirely possible, however, that you don't even *NEED* OO for anything you're doing. If your project doesn't meet any of the above three pre-conditions, chances are Really Good that OO would be like swatting a fly with a cannon. You can do it. And if a cannon is all you know how to work properly, maybe that's the best answer. But it's usually not the best answer in a general sense. NOTE: I'm an old-school Lisp hacker. I *LOVE* Object-Oriented systems. Yet I rarely feel a need for OO in my PHP scripts. YMMV. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Inserting Processed Data from One Table 2 Another!
I don't see why your code is so wrong but neither do I see what it reall does. YOu are changing the clientID with some simple function into a password? As in everybody can do that trick by himself and login as whoever he wants .. What I'll mostly do for such things, is use this self written function to generate a random string and use this as generated password. it takes an integer as argument, and gives back a random code with only [A-Z][a-z] characters of a length of the given argument. And then, I'd just use the loop to roll through the ID's and insert a random code password. function generateRandomString($length) { srand ((float) microtime() * 100); for ($i=65;$i91;$i++) { $chars[] = chr($i); }; for ($i=97;$i122;$i++) { $chars[] = chr($i); }; $chrs = count($chars) - 1; for ($i=0; $i$length; $i++) { $asc = rand(0, $chrs); $code .= $chars[$asc]; }; return $code; }; $result = mysql_query(SELECT clientid FROM Clientdetails); while ($myrow = mysql_fetch_assoc($result)) { $code = generateRandomString(8); mysql_query(INSERT INTO authentication (id, pass) VALUES ($myrow[clientid], '.$code.'); }; Hope this helped you ! Greetz, Wouter -Oorspronkelijk bericht- Van: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Verzonden: woensdag 24 juli 2002 9:02 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Inserting Processed Data from One Table 2 Another! Ok i have simple issue, i'm stuck at one point. I have a table Clientdetails which contains ClientID. I have created another table Authentication with 2 fields, ClientID and Password. I want to pick up the ClientID from table Clientdetails and insert ClientID and a Password i have generated using a code, into Authentication. So if there are 13000 ClientID's in Clientdetails, as, many rows with the ClientID it's corresponding password should be Inserted into table Authentication. I'm using the following code which i know is wrong, what would be correct? ? $db = mysql_connect(localhost,user,pwd); mysql_select_db(myDB,$db); $result = mysql_query(SELECT * FROM clientdetails,$db); if ($myrow = mysql_fetch_array($result)) { do { $some = $myrow[clientid] $newid = eregi_replace('100', '', $myrow[clientid]); $date = date(dn); $stuff = $newid.def.$date; $sql = INSERT INTO authentication VALUES('$some','$stuff'); $result = mysql_query($sql); echo All Done!; } while ($myrow = mysql_fetch_array($result)); } ? Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- 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] Quick Question
I'm currently developing a Remote CMS for a site. I'm working on the image upload and want to create a smaller thumbnail type image (thought 200x180 instead of 50x50) I know I'm going to need either imagecopyresize() or imagecopyresample(). I don't know which would be better for this purpose or what the main difference is in terms of quality and run time. Any comments or assistance is gladly welcome. Thank you in advance for your time, Nicholas D. Mercier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick Question
On Wednesday 24 July 2002 15:48, Nicholas Mercier wrote: I'm currently developing a Remote CMS for a site. I'm working on the image upload and want to create a smaller thumbnail type image (thought 200x180 instead of 50x50) I know I'm going to need either imagecopyresize() or imagecopyresample(). I don't know which would be better for this purpose or what the main difference is in terms of quality and run time. Any comments or assistance is gladly welcome. imagecopyresample() gives better results but probably takes a tad longer to perform. Presumably your thumbnails will be produced on a one-off basis (ie not generated on-the-fly each time it is needed) so the extra time taken by using imagecopyresample() is more than made up for by the better quality. Of course the best thing is to try both and see which is better for your needs. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Did you know that if you took all the economists in the world and lined them up end to end, they'd still point in the wrong direction? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating a calender / diary
i am using dreamweaver mx and want to acheive the following 9:00 task 1 9:30 task 2 10:00 task 3 task 4 task 5 10:30 task 6 i have a recordset that displays the tasks ordered by the time but what i dont want is to display the time for every item, or if an entry is at 10:15 for example. Any ideas??? Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authentication session problem (php/server implementation?)
I have a user authentication system using sessions it checks username and password against a database. if correct it sets a variable in the session cookie (via $_SESSION) and redirects to the protected page which checks for that variable. if the user/pass is wrong it redirects to an error page. if it gets to the protected page and the variable isnt set it redirects back to the login page. it works when uploaded to a server Linux, Apache/1.3.24, PHP 4.1.2. register_globals=on but on my local server Windows NT, Apache/2.0.39, PHP 4.2.1 using a patched Apache 2.0 Filter, register_globals=on. It seems to redirect back to the login page. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trim away x 1 number of spaces from a strin
Hi! Could someone help me with a replace that takes all occurances of , that is space more than one, and replaces them with ? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trim away x 1 number of spaces from a strin
$new = preg_replace('/[ ]{2,}/',$old); HTH Andrey - Original Message - From: Victor Spång Arthursson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 12:05 PM Subject: [PHP] trim away x 1 number of spaces from a strin Hi! Could someone help me with a replace that takes all occurances of , that is space more than one, and replaces them with ? Sincerely Victor -- 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] trim away x 1 number of spaces from a strin
php.net/str_replace On Wednesday 24 July 2002 02:05 am, Victor Spång Arthursson wrote: Hi! Could someone help me with a replace that takes all occurances of , that is space more than one, and replaces them with ? Sincerely Victor -- Go to Heaven for the climate, Hell for the company. Samuel Clemens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Deleteing Something???
I've currently made a signature uploader. I know the code that shows a drectory's contents but whats the code to delete something? - Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to add new user to the domain
At 09:35 PM 7/23/02 -0500, Richard Lynch wrote: Any one please let me know how to use PHP to add new user to a domain for using mail (sendmail). Remember what Richard said... mucking around with real users is DANGEROUS! I solved the problem with Qmail, vchkpw and qmailadmin. No coding on my part at all, just install a few packages. http://inter7.com/freesoftware/ http://www.qmail.org Some people have hundreds of domains and tens of thousands of users on a small cluster of servers. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Deleteing Something???
unlink() Dale wrote: I've currently made a signature uploader. I know the code that shows a drectory's contents but whats the code to delete something? - Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
Hmmm, interesting I didn't know about this and didn't see it in the docs. So now I know for my next upgrade. Anyway, my upgrade is in, and through the mails it should be clear to those who thought how terribly difficult and time consuming it is/was to do the upgrades that it was in fact not difficult at all, and seemingly even easier that the way I did it. Ian On Wednesday 24 July 2002 01:03, Andrew Chase wrote: If all you're doing is applying the patch (not adding/removing any extensions), you should be able to use ./config.nice which will use all of the configuration commands from your last compile (This is an extremely handy thing if your GD/Freetype setup was particularly ornery the first time around! ;) ) -Andy -Original Message- From: Ricky Dhatt [mailto:[EMAIL PROTECTED]] ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --with-ldap make make install /usr/local/apache/bin/apachectl restart Hmm...is the configure step really necessary? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] probelm : delete files using PHP
I am using PHP 4.1.1, Postgresql 7.2 and Perl 5.6.0 on Linux. I want to delete files in a directory,which were created 15 days back. I can not do it, with PHP filesystem and directory functions, as PHP runs as nobody user. To delete a file the user running the web server needs to be able to write to the directory containing the file. Either the directory should be owned by the user nobody and writable by its owner, or in the group nobody and writable by group, or (the most dangerous choice) writable by any user. To change the ownership, you need to be able to log in as the user root. Simon Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Script Testing Portal Connections...
Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... #!/usr/local/bin/php -q ? // don't timeout! set_time_limit(0); // set some variables $host = 1.2.3.4...; $port = 1234; $command = /usr/games/fortune; # I must be missing something, cuz I don't see where this $command is used... $command is used further down in the script I din't post the whole thing coz it dies when it reaches the statement: $result = listen($socket, 3) or die(Set up Failed!); i.e. output: Setup Failed! // create socket $socket = socket(AF_INET, SOCK_STREAM, 0) or die(Could not create socket\n); // bind socket to port $result = bind($socket, $host, $port) or die(Could not bind to socket\n); /* start listening for connections * My Script Fails here... * Any suggestions why it fails the Socket SetUp... * Should I screw around with the port numbers? */ $result = listen($socket, 3) or die(Set up Failed!); echo Waiting for connections...\n; You do realize that it's *SUPPOSED* to just sit there waiting for somebody to connect at this point, right?... It it saying Set up Failed!? I mean, it may *LOOK* like it hangs but it's really just waiting... You'll need to open another shell window and poke at the port it's listening to to get any action. Oh, and you probably need to use socket_listen, and not just listen, I think... Or are these the old function names?... I tested the Script on PHP 4.1.2 it does not have a definition for the functions socket_listen or socket_create hence you can only use socket() and listen() Thanks for the response... Spike... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Formating datevariables...
Hi, i dont know if im always going to use mysql, thow your solution to my problem will be something like this: SELECT DATE_FORMAT( endret_dato, \%d%m%Y\ ) as endret_dato , headline , news from rnr_news order by endret_dato desc limit . $index . , . ($index+10)); Thanx for your help! -R John Holmes [EMAIL PROTECTED] wrote in message 01c232b4$11419d10$b402a8c0@mango">news:01c232b4$11419d10$b402a8c0@mango... Thanx for the help.. I ended up with this solution ;) $dag = substr ( $row['endret_dato'], 7, 2 ); $mnd = substr ( $row['endret_dato'], 4, 2 ); $aar = substr ( $row['endret_dato'], 0, 4 ); date (dmY, mktime(0,0,0,$mnd,$dag,$aar) ) Did you even read the replies? Why are you going to do a bunch of string manipulation, mktime, and date calls in PHP when you can just use DATE_FORMAT() in your query and get exactly what you want without any additional work by PHP? Take a little time and Read Chapter 6 of the MySQL manual. It will save you a ton of work later on... ---John Holmes... -R Ragnar [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- 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] Newbie needs help
Whats the difference between 'mysql_db_query' and 'mysql_query'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie needs help
mysql_db_query has been depreciated since PHP 4.0.6 ctan wrote: ** This Message Was Virus Checked With : SAVI 3.59 May 2002 Last Updated 8th July 2002 ** Whats the difference between 'mysql_db_query' and 'mysql_query'? -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so
On Tue, 2002-07-23 at 21:35, David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I tried to upgrade from PHP 4.2.1 to 4.2.2 due to the security bug announce in the web site. When I do make install, it stopped with errors. The following are the last few lines from the output: [activating module `php4' in /usr/local/apache/conf/httpd.conf] cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so cp: cannot stat `libs/libphp4.so': No such file or directory apxs:Break: Command failed with rc=1 make[1]: *** [install-sapi] Error 1 make[1]: Leaving directory `/usr/src/php-4.2.2' make: *** [install-recursive] Error 1 Did you do 'make install' as root? yes, I did everything (from configure to make install) as root. Rdb -- David Robley Temporary Kiwi! Quod subigo farinam -- 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] Newbie needs help
Neil Freeman wrote: mysql_db_query has been depreciated since PHP 4.0.6 Yep.. but thats not the only different... mysql_db_query() have an extra parameter that is what Database you want to execute your query in... mysql_query() just use the database you have selected with f.ex. mysql_select_db() But do NOT use mysql_db_query... Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions don't work?
Hewwo all, (please be so kind as to CC me in replies as I am not a subscriber to this mailing list (yet)) The following code snippet always outputs You have visited this page 1 times!. What am I doing wrong? ?php session_start(); if (!isset($HTTP_SESSION_VARS['counter'])) { $HTTP_SESSION_VARS['counter'] = 1; } else { $HTTP_SESSION_VARS['counter']++; } echo(sprintf(You have visited this page %d times!, $HTTP_SESSION_VARS['counter'])); ? I realise I could use $_SESSION, and I actually prefer it, but I have to write code that will run on 4.0.6. Versions and the like: PHP 4.2.2 Apache/1.3.26 (Unix) Debian GNU/Linux All this on Linux ppc (benh kernel) 2.4.19 Thanks in advance, -- Alexander Deruwe AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so
Assuming you are installing from your php-4.2.2 directory, it would appear the libphp4.so hasn't actually been made, which would point to a possible error in the configuration parameters. I am also assuming your php 4.2.1 made OK which would mean all necessary libraries etc are available on your system. What are you using for the configure? On my system it was ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs I did have ldap in there too, but for most people this is not necessary. If a fresh run from the start fails, then without further information, my best suggestion is to completely delete the php-4.2.2 directory and ocntents, and start again with the tar -zxf php-4.2.2.whatever, ./configure.. Ian On Wednesday 24 July 2002 14:13, Reuben D. Budiardja wrote: On Tue, 2002-07-23 at 21:35, David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I tried to upgrade from PHP 4.2.1 to 4.2.2 due to the security bug announce in the web site. When I do make install, it stopped with errors. The following are the last few lines from the output: [activating module `php4' in /usr/local/apache/conf/httpd.conf] cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so cp: cannot stat `libs/libphp4.so': No such file or directory apxs:Break: Command failed with rc=1 make[1]: *** [install-sapi] Error 1 make[1]: Leaving directory `/usr/src/php-4.2.2' make: *** [install-recursive] Error 1 Did you do 'make install' as root? yes, I did everything (from configure to make install) as root. Rdb -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newman and his session management.
On 7/24/02 1:33 AM, Philip J. Newman [EMAIL PROTECTED] wrote: I have started a session on the server, and now would like to add a user name and password, and some other information to the session to carry it across all the other pages that are in this session. Any hints on where to start? $_SESSION['username'] = philipn; $_SESSION['password'] = $password; Etc. -- Ed Marczak [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] After PHP-Apache wont Start
Hello Newbie here that can't seem to find a workaround for the following problem. I am running Apache on a Mac OS X.1 When I try to start up, I receive the following error: Multiple definitions of symbol _XML_DefaultCurrent All of this started right after I installed php4. I have installed php on a windows machine and it's running fine, so I know it has to be something that I have screwed up somewhere. I have checked the error log finding it empty. I have tried to start from the sharing control in the system preferences and it still won't start. Any help would be appreciated. Steve Campbell OU Physicians -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so
On Wed, 2002-07-24 at 08:29, Ian Ball wrote: Assuming you are installing from your php-4.2.2 directory, it would appear the libphp4.so hasn't actually been made, which would point to a possible error in the configuration parameters. I am also assuming your php 4.2.1 made OK which would mean all necessary libraries etc are available on your system. What are you using for the configure? On my system it was ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs I did have ldap in there too, but for most people this is not necessary. Here is my configure line. Yes, my prev php 4.2.1 made and install fine with the same configure line. I did exactly the same steps as when I install 4.2.1 /configure --with-mysql --enable-track-var --disable-debug --prefix=/usr/local/apache/php --with-config-file-path=/usr/local/apache/lib --with-apxs=/usr/local/apache/bin/apxs --with-gd --with-zlib If a fresh run from the start fails, then without further information, my best suggestion is to completely delete the php-4.2.2 directory and ocntents, and start again with the tar -zxf php-4.2.2.whatever, ./configure.. I did that already, deleting the php-4.2.2 and start with un-tar the download. Many times. But still no luck. Thanks. Rdb Ian On Wednesday 24 July 2002 14:13, Reuben D. Budiardja wrote: On Tue, 2002-07-23 at 21:35, David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I tried to upgrade from PHP 4.2.1 to 4.2.2 due to the security bug announce in the web site. When I do make install, it stopped with errors. The following are the last few lines from the output: [activating module `php4' in /usr/local/apache/conf/httpd.conf] cp libs/libphp4.so /usr/local/apache/libexec/libphp4.so cp: cannot stat `libs/libphp4.so': No such file or directory apxs:Break: Command failed with rc=1 make[1]: *** [install-sapi] Error 1 make[1]: Leaving directory `/usr/src/php-4.2.2' make: *** [install-recursive] Error 1 Did you do 'make install' as root? yes, I did everything (from configure to make install) as root. Rdb -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compiling PHP on Linux
Here's how to get it to work (thanks to somebody on Google Groups)... 1. Open up the file php_functions.c in /sapi/apache2filter/ 2. Change MODULE_MAGIC_AT_LEAST to AP_MODULE_MAGIC_AT_LEAST (Note the addition of AP_) 3. Save the php_functions.c file and try running configure again Keep in mind this is experimental and thus should not be used on production web sites (even though we've been using Apache 2.0.39+PHP 4.2.1/4.2.2 for a few weeks without issues on two of our servers). -- Aaron Gould [EMAIL PROTECTED] Web Developer - Original Message - From: Osman Omar [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Tuesday, July 23, 2002 8:35 PM Subject: [PHP] Compiling PHP on Linux Hi I try to compile php and got error message any idea? system: Redhat 7.2 Apache 2.0.39 (for redhat 7.0 from apache website) php 4.2.2 error messages --- /bin/sh /usr/tmp/php-4.2.2/libtool --silent --mode=compile gcc -I. -I/usr/tmp/php-4.2.2/sapi/apache2filter -I/usr/tmp/php-4.2.2/main -I/usr/tmp/php-4.2.2 -I/usr/local/apache2-39/include -I/usr/tmp/php-4.2.2/Zend -I/usr/include/freetype2/freetype -I/usr/tmp/gd-2.0.1/ -I/usr/tmp/php-4.2.2/ext/mysql/libmysql -I/usr/tmp/php-4.2.2/ext/xml/expat -D_REENTRANT -I/usr/tmp/php-4.2.2/TSRM -DTHREAD=1 -g -O2 -pthread -DZTS -prefer-pic -c php_functions.c php_functions.c:93:27: missing binary operator before '!' make[3]: *** [php_functions.lo] Error 1 make[3]: Leaving directory `/var/tmp/php-4.2.2/sapi/apache2filter' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/tmp/php-4.2.2/sapi/apache2filter' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/php-4.2.2/sapi' make: *** [all-recursive] Error 1 -- 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] create object from variable class.
Is it possible to create an object from a clas which name is in a variable. Example: (doesn't work) $object = new ${$classname}; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: create object from variable class.
Thx for quick reply, If I use the following: $object = new {classname}; I get this a parse error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in /home/sites/projects.virtuosys.nl/web/cm/includes/class_crm.inc.php on line 29 From that I conclude that with this method its not possible to create an object from a variable class name Michiel ten Hagen [EMAIL PROTECTED] 06-54673863 -Oorspronkelijk bericht- Van: Mathieu Dumoulin [mailto:[EMAIL PROTECTED]] Verzonden: Wednesday, July 24, 2002 3:11 PM Aan: [EMAIL PROTECTED] Onderwerp: Re: create object from variable class. Simple, you made an error here You are telling the new operator to look into a variable to get the classname, to specify the class name as a string do this: $object = new {$classname}; InsaneCoder Ps: I never tried this, but I think it is actually going to work, you got nthing to lose anyway I guess, takes two seconds to try. Karel De Groot [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Is it possible to create an object from a clas which name is in a variable. Example: (doesn't work) $object = new ${$classname}; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: MySQL - PHP combined log
clipped how about this curve... getting PHP to append a line to the apache log. How about reading the documentation? Deserved that for not being clear enough... see below. My apologies if I missed the word access log or even assumed you meant error log when you just said log.I shouldn't have. RTFM never hurt anyone :) You're right, you can't do that, without opening up security more than you want to. *ACTUALLY*... There *probably* is an Apache function for access logs just like the error logging one that PHP is using, and you could *PROBABLY* patch PHP with some dead-easy copypaste to use it, and you could even submit that worthy patch to the PHP Group. I suspect it's not there only because nobody really saw a need for it. I've never had a use for it untill now, wanting to charge a customer for massive uploads via file_upload forms... transfer that is not recorded in the apache logs and therefor not collected for billable bandwidth (while still preserving IP addresses and avoiding a ipfw counting per IP). Probably a requirement with limited scope. It's kinda icky that you'd almost have to use 4 (the next unused number) for Apache access log with 0 being Apache error log and 1,2,3 being other stuff between... Maybe -1 for access log? Ew. That's not 'right' either, but maybe it's 'less wrong' than 4. icky, I agree Damn things shouldn't have been magic numbers in the first place. Should be constants. Hey, while you're in there, make up some decent constant names and let's migrate to them and then deprecate the magic numbers and fix it right :-) :) Another option might involve some sort of nasty named pipe stuff and redirection and whatnot, and you *MIGHT* be able to have a file that you error_log into, but it really just ends up going into the Apache log... There may be some risk of corrupting your access log, however, if any incredibly *HUGE* entry over-steps the atomicity threshold for file appending in Linux... sounds like a nest of potential problems Not so sure it's a Good Idea anyway to have two programs trying to write to the same file at once if it can be avoided. thus the interim solution of having PHP write to a seperate log file, then doing a merge/sort during rotation time. Will look into it to see if something can be presented without creating more problems than the solution is worth. Cheers, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] www.php.net/docs.php
whats the reason why www.php.net/docs.php has been down for days? why is it still saying this error? Warning: main(geoip.inc) - No such file or directory in /local/Web/sites/phpweb/include/prepend.inc on line 6 Fatal error: Failed opening required 'geoip.inc' (include_path='.:/local/Web/sites/phpweb/include') in /local/Web/sites/phpweb/include/prepend.inc on line 6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL - PHP combined log
Well, I think the solutions or ideas are maybe a bit too involved. I was hoping that the errors I am interested in were already logged by default to some obscure location, and I *could* if needed just go and scrutinize them by hand. But, it seems like a detailed (specially mysql) error log does not exist and thus cannot be scrutinized. Reading some of the possible solutions regarding adding error_log() functions to existing code leads me to believe that it could be easier to maybe incorporate those functions into PHP by means of a switch in php.ini, one could theoretically have two sets of functions, a mysql_query() for normal use that acts as we all know it, and another mysql_query() (yes, with the same name), that has the error_log() function call built into it, and the one that gets used is determined by the (lets call it) mysql_error_log = on in php.ini. This way, the entire thing will be transparent to both users and existing/future code. Granted, I have no idea how PHP is coded behind the scenes and if something like this is even possible, it's simply an idea, and hopefully some of the more learned people on this list will be able to comment on the feasability of something like that. Dave wrote: clipped how about this curve... getting PHP to append a line to the apache log. How about reading the documentation? Deserved that for not being clear enough... see below. My apologies if I missed the word access log or even assumed you meant error log when you just said log.I shouldn't have. RTFM never hurt anyone :) You're right, you can't do that, without opening up security more than you want to. *ACTUALLY*... There *probably* is an Apache function for access logs just like the error logging one that PHP is using, and you could *PROBABLY* patch PHP with some dead-easy copypaste to use it, and you could even submit that worthy patch to the PHP Group. I suspect it's not there only because nobody really saw a need for it. I've never had a use for it untill now, wanting to charge a customer for massive uploads via file_upload forms... transfer that is not recorded in the apache logs and therefor not collected for billable bandwidth (while still preserving IP addresses and avoiding a ipfw counting per IP). Probably a requirement with limited scope. It's kinda icky that you'd almost have to use 4 (the next unused number) for Apache access log with 0 being Apache error log and 1,2,3 being other stuff between... Maybe -1 for access log? Ew. That's not 'right' either, but maybe it's 'less wrong' than 4. icky, I agree Damn things shouldn't have been magic numbers in the first place. Should be constants. Hey, while you're in there, make up some decent constant names and let's migrate to them and then deprecate the magic numbers and fix it right :-) :) Another option might involve some sort of nasty named pipe stuff and redirection and whatnot, and you *MIGHT* be able to have a file that you error_log into, but it really just ends up going into the Apache log... There may be some risk of corrupting your access log, however, if any incredibly *HUGE* entry over-steps the atomicity threshold for file appending in Linux... sounds like a nest of potential problems Not so sure it's a Good Idea anyway to have two programs trying to write to the same file at once if it can be avoided. thus the interim solution of having PHP write to a seperate log file, then doing a merge/sort during rotation time. Will look into it to see if something can be presented without creating more problems than the solution is worth. Cheers, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload memory usage.
Hi, I'm currently locked in a battle with PHP and file uploads. I've searched the list to no avail. I actually found a guy with the same problem who ended up using perl to make this work. I'm trying to avoid that. The problem is, I'm dealing with huge POST uploads (100+ mb). And everytime you upload a file it stores it in RAM and then dumps the file to the drive. Is there any way around this? This is extremely dangerous. Since this customer may have multiple people uploading at the same time, it could result in a massive memory hit over a long period of time. Now I figured PHP would pipe the POST stream into a temporary file instead of holding it in RAM. This is how it should work right? _Any_ help would be appreciated before I have to recode this section in perl. Thank you greatly in advance! If you live close to me, drinks are on me! :) Take care everyone, -reid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ldap_connect()
I am new to using PHP on RedHat 7.3 and am running into a problem with ldap_connect(). When I attempt to run ldap_connect, I get the error: Call to undefined function: ldap_connect() The system I am working on has the default install of Redhat 7.3 with Apache version Apache/1.3.23. It has been suggested to me that I need to recompile either PHP and/or Apache and am still quite new to this. The PHP configure command is: './configure' 'i386-redhat-linux' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--enable-force-cgi-redirect' '--disable-debug' '--enable-dbg=shared' '--with-dbg-profiler' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs' I am sure that I will eventually figure this out, but in the interim was hoping to gain the advice of others who have previously solved this problem and/or might be able to point me in the right direction. Thanks -Mike Gladden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Certificate information using php?
I will find out about the phpinfo(). I have looked at the options in cURL and I haven't seen one that would enable it to get the certificate from the credit bureau. I will keep checking. Um, I have used cURL with the credit bureau #2 and they send the encryption packages over and all I had to do is to put it on the PHP webserver and have cURL use it. This make it possible to authenticate to the credit bureau #2. Alright, I'm going to give it a call to the credit bureau #1 to request an encryption packages. Hopefully, they won't say, what. :-) Thanks, FletchSOD Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... I have a challenging part to this project. Let's say the PHP webserver establish a connection to a different website and received the ssl connection from there. How do I get the certificate information from that website and display it? I can use print_r($GLOBALS) but it only display the certificate from this PHP webserver. So, how do I get the certificate information from that website?? I don't really know the answer, but... Check the output of ?php phpinfo();? to see if there are any leads. Maybe cURL has a way to request the certificate information. You can't get like their whole certificate, though, right? I mean, there's definitely a part of that which is private like the private half of a PGP key, right?... It may not be possible to access what you think you want to access. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions don't work?
I'd like to post a follow-up to my previous message on this subject. Please still CC me when replying, thanks. New test code: ?php session_start(); if (!isset($HTTP_SESSION_VARS['counter'])) { $HTTP_SESSION_VARS['counter'] = 1; } else { $HTTP_SESSION_VARS['counter']++; } if (!isset($counter2)) { session_register('counter2'); $counter2 = 1; } else { $counter2++; } if (!isset($_SESSION['counter3'])) { $_SESSION['counter3'] = 1; } else { $_SESSION['counter3']++; } echo(sprintf(You have visited this page %d times!, $HTTP_SESSION_VARS['counter']) . br); echo(sprintf(You have visited this page %d times!, $counter2) . br); echo(sprintf(You have visited this page %d times!, $_SESSION['counter3']) . br); ? Tried these on PHP 4.0.6 (register_globals = On): - counter: doesn't work - counter1: works - counter2: doesn't work (to be expected) PHP 4.2.2 (register_globals = Off): None of the counters work; same when register_globals = On I'm really puzzled by this; could someone please point me in the right direction? -- Alexander Deruwe AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs. PHP manual???
I alway knew there is an easier way to do that. Problem is just don't know it. I like your example and it is an wonderful example. I can use it. One quick question. The function, posttofunction(), is that a make-believe function? I check PHP.net and it doesn't have this function, so I assume you just put it there to make a point about the whole script. Thanks, FletchSOD Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... I read the useful document about XML in PHP on http://www.analysisandsolutions.com/code/phpxml.html. I still haven't made much progress on XML. I'm still confuse about XML. I had to write XML stuffs on the client-side with the build-in XML request and it doesn't make sense that the client brower should be communicating to credit bureau network without going to my company's PHP webserver to that credit bureau. So, it meant I have to use the post request that would send the data to my company's PHP webserver and somehow convert it into xml and send it to that credit bureau by cURL. Is there a way to do that?? As I recall, only the DOM model can easily add/alter nodes to an XML document. SAX would be not useful... (Or was it the other way around...?) Anyway, you may be trying too hard :-) Unless your credit bureau is incredibly different from all the rest, it will *PROBABLY* be easiest to just do something not unlike: ?php # import expected $_POST variables if register_globals is off. $xml = ENDOFXML XML NAME$name/NAME ADDRESS$address/ADDRESS . . . /XML ENDOFXML; $result = posttohost('http://yourcreditbureau.com', $xml); ? I mean, really, do you want to make life all complicated by trying to create some giant XML data structure when all you really need is one stupid little never-changing string with the data in it? If you're building a complex application to *TRADE* tons of info with your credit bureau, you'd want to scale up and generalize your XML-creation with complex data structures so you can easily alter it when they change the DTD out from under you or whatever. But if you are just sending the one kind of XML request off to the credit bureau, don't make your life complicated for no real reason. Just my opinion. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
Doing that right now! Just like a basic upgrade. Thanks, FletchSOD Matt Schroebel [EMAIL PROTECTED] wrote in message 4B08FD7DB3CBD4119F560002A508C453015B38DA@hsus3">news:4B08FD7DB3CBD4119F560002A508C453015B38DA@hsus3... From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 12:43 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0 I don't know how to appy patches to the PHP software. I just finish upgrading the website to work with PHP 4.2.1 from PHP 4.0.6. And now this So, just patched it then configure openssl, mycrypt, curl, modssl then do the usual stuff for PHP then apache, right?? Rebuilding from source: 1. download the new php source, extract it to whereever you do. 2. cd to php-4.2.2 copy config.nice from your existing php compile dir (this has your previous complies config command). 3. Run it: ./config.nice 4. make 5. apachectl stop 6. make install 7a. i. If php is a DSO: ii. apachectl start (you're done) 7b. i. If php is compiled into apache: ii. cd to apache compile dir iii. make clean iv. ./config.status v. make vi. make install vii. apachectl start (you're done) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
It work very nicely The whole process take 30 to 45 minutes for just one server. I wonder how does someone did 12 computers in 10 minutes. Cool! Matt Schroebel [EMAIL PROTECTED] wrote in message 4B08FD7DB3CBD4119F560002A508C453015B38DA@hsus3">news:4B08FD7DB3CBD4119F560002A508C453015B38DA@hsus3... From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 12:43 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0 I don't know how to appy patches to the PHP software. I just finish upgrading the website to work with PHP 4.2.1 from PHP 4.0.6. And now this So, just patched it then configure openssl, mycrypt, curl, modssl then do the usual stuff for PHP then apache, right?? Rebuilding from source: 1. download the new php source, extract it to whereever you do. 2. cd to php-4.2.2 copy config.nice from your existing php compile dir (this has your previous complies config command). 3. Run it: ./config.nice 4. make 5. apachectl stop 6. make install 7a. i. If php is a DSO: ii. apachectl start (you're done) 7b. i. If php is compiled into apache: ii. cd to apache compile dir iii. make clean iv. ./config.status v. make vi. make install vii. apachectl start (you're done) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] When to destroy sessions that iterate
Prolly a silly question, but I have a session process that never really ends as it is supposed to allow the user to carry on submitting etc. So I don't know where and when to end the session, and if it is really nescessary to end a session? Obviously a logout button will do the trick, but what about aborting users that don't bother to logout? I presume a session will have a timeout value? If so, how does this work? Surely there can't be a physical time allowed for a session to stay alive? What about if I want to have an intranet application that could ( and preferably should) be able to be open indefinately? Ta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re-directing
Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED]
Re: [PHP] Re-directing
Check under header() in the docs... .: B i g D o g :. - Original Message - From: Roberts, Mark [EMAIL PROTECTED] To: PHP Mailing list (E-mail) [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 8:28 AM Subject: [PHP] Re-directing Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-directing
Use header() function.. Header('Location: script name'); Best Regards Balaji -Original Message- From: Roberts, Mark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 7:58 PM To: PHP Mailing list (E-mail) Subject: [PHP] Re-directing Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When to destroy sessions that iterate
Hi, Thursday, July 25, 2002, 12:20:47 AM, you wrote: P Prolly a silly question, but I have a session process that never really P ends as it is supposed to allow the user to carry on submitting etc. P So I don't know where and when to end the session, and if it is really P nescessary to end a session? P Obviously a logout button will do the trick, but what about aborting P users that don't bother to logout? I presume a session will have a P timeout value? If so, how does this work? Surely there can't be a P physical time allowed for a session to stay alive? What about if I want P to have an intranet application that could ( and preferably should) be P able to be open indefinately? P Ta Just checkout the session section of the manual and you will find you can set the timeout to what you want. -- Best regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-GD and JPEG+PNG - Which versions is required?
Hi, which version of libpng and libjpeg is needed to use the bundled libgd in the current php tree. I using libpng 1.2.3 and php crashes with a segfault and with libjpeg62 (6b Mandrake RPM) in apache logs: gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter struct mismatch: library thinks size is 372, caller expects 376 Hmmm, maybe the bundled gd has more bugs as the 'normal' 2.0.1 (Beta) Version?! Regards, Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. ?php header(Location: index.php); ? That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object problem
Hi, Wednesday, July 24, 2002, 5:04:06 AM, you wrote: MD I just wrote this message in the wrong list so i'll be short... MD I have two classes: MD - mysql_connection MD - data_collection MD data_collection REQUIRES a mysql_connection object to work. So i decided to MD pass this object in the constructor for the data_collection, but when i do MD so it seems it creates a copy of this object and doesn't use the object i MD had previously created... MD I tried to do function data_collection($mysql_server){ MD ... MD } MD But even the sign like they say to use on the php.net web site doesn't MD work, it creates a copy of the object. The only way i found to bypass this MD problem is to do: my_collection-mysql_server = $mysql_server; MD which will assign a reference of the mysql_collection object to my MD collection, but this means i need to modify something like 45 files of my MD web site and also i have to add some init settings because they where done MD in the constructor where you needed the connection... MD please help me out!!! MD InsaneCoder what I do is to create a global array of class objects to provide inter class communication. class a { var $test; function a(){ global $class; $class['a'] = $this; $this-test = 'Opened'; } } class b { function b(){ global $class; echo 'Class a value = '.$class['a']-test.'br'; } } $a = new a(); $b = new b(); -- Best regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
Well you can actually, If you start your script IMMEDIATELY (well before you output anything) with: ?php ob_start(); This will buffer output so you can use your header anywhere in your script eg header(location.php); exit; and then if you weren't redirected then you send the output with ob_end_flush(); Chris. - Original Message - From: Martin Clifford [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 12:47 AM Subject: Re: [PHP] Re-directing PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. ?php header(Location: index.php); ? That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- 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-directing
Awesome! Learn something new everyday! That's why I love this list :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Chris Sharkey [EMAIL PROTECTED] 07/24/02 11:01AM Well you can actually, If you start your script IMMEDIATELY (well before you output anything) with: ?php ob_start(); This will buffer output so you can use your header anywhere in your script eg header(location.php); exit; and then if you weren't redirected then you send the output with ob_end_flush(); Chris. - Original Message - From: Martin Clifford [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 12:47 AM Subject: Re: [PHP] Re-directing PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. ?php header(Location: index.php); ? That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies
Say it is not so. I hear the PHP 4.2.2 will only set the last cookie delivered by a browser to a variable in the PHP environment. Is this true? ** John Huggins VANet [EMAIL PROTECTED] http://www.va.net/ ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Running ./configure multiple times
Well my RedHat system got hosed, so I reinstalled everything. I'm back to installing PHP now, and I'm wondering if it's safe for me to run ./configure multiple times. Here's the situation: I want to compile with gd support, and pdflib, and a bunch of other options. Instead of running a whole huge 5 line ./configure, can I run one at a time to make sure they all work, then run the whole thing? Also, just noticed this: I have gd installed, and libgd.so in /usr/lib, so I tried ./configure --with-apxs --with-gd=/usr/lib/ (also tried without the trailing /), but it gives: configure: error: Unable to find libgd.(a|so) anywhere under /usr/lib/ What gives? (in this ouptut, the stuff that's not important is cut out -- dates, etc) [root@saturn php-4.2.2]# ls -l /usr/lib/libgd.* lrwxrwxrwx /usr/lib/libgd.so - libgd.so.1.8.3 lrwxrwxrwx /usr/lib/libgd.so.1 - libgd.so.1.8.3 lrwxrwxrwx /usr/lib/libgd.so.1.8 - libgd.so.1.8.3 lrwxrwxrwx /usr/lib/libgd.so.1.8.3 [root@saturn php-4.2.2]# TIA, c. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running ./configure multiple times
Hi, Thursday, July 25, 2002, 1:41:25 AM, you wrote: CG Well my RedHat system got hosed, so I reinstalled everything. I'm back to CG installing PHP now, and I'm wondering if it's safe for me to run ./configure CG multiple times. Here's the situation: CG I want to compile with gd support, and pdflib, and a bunch of other options. CG Instead of running a whole huge 5 line ./configure, can I run one at a time CG to make sure they all work, then run the whole thing? CG Also, just noticed this: I have gd installed, and libgd.so in /usr/lib, so I CG tried ./configure --with-apxs --with-gd=/usr/lib/ (also tried without the CG trailing /), but it gives: configure: error: Unable to find libgd.(a|so) CG anywhere under /usr/lib/ CG What gives? CG (in this ouptut, the stuff that's not important is cut out -- dates, etc) CG [root@saturn php-4.2.2]# ls -l /usr/lib/libgd.* CG lrwxrwxrwx /usr/lib/libgd.so - libgd.so.1.8.3 CG lrwxrwxrwx /usr/lib/libgd.so.1 - libgd.so.1.8.3 CG lrwxrwxrwx /usr/lib/libgd.so.1.8 - libgd.so.1.8.3 CG lrwxrwxrwx /usr/lib/libgd.so.1.8.3 CG [root@saturn php-4.2.2]# CG TIA, CG c. CG -- CG PHP General Mailing List (http://www.php.net/) CG To unsubscribe, visit: http://www.php.net/unsub.php it may be looking for libgd.a in the gd directory do a make libgd.a then copy it to /usr/lib -- Best regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oh man!!!
I now understand why I'm having trouble communicating with the credit bureau. I did sucessfully get through to them the first time, unfortunately, I was able to get through, through security breach at the credit bureau. The credit bureau there was not design to work with cURL, so the encryption and other stuffs doesn't work. The bad thing is I had sucessfully made it through at 5 different places. I want to thank you all for your best, your help and support on why I have difficultiles with XML and PHP. I'm still learning. :-) Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions don't work?
Your problem is very simple. You're beginning a new session every execution, without checking if a session is already going. So every time it comes back around it's looking for the variables in the current session, which every time just began. Check for an existing session first like: if(!(session_id())) session_start(); Mike Mannakee Alexander Deruwe [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'd like to post a follow-up to my previous message on this subject. Please still CC me when replying, thanks. New test code: ?php session_start(); if (!isset($HTTP_SESSION_VARS['counter'])) { $HTTP_SESSION_VARS['counter'] = 1; } else { $HTTP_SESSION_VARS['counter']++; } if (!isset($counter2)) { session_register('counter2'); $counter2 = 1; } else { $counter2++; } if (!isset($_SESSION['counter3'])) { $_SESSION['counter3'] = 1; } else { $_SESSION['counter3']++; } echo(sprintf(You have visited this page %d times!, $HTTP_SESSION_VARS['counter']) . br); echo(sprintf(You have visited this page %d times!, $counter2) . br); echo(sprintf(You have visited this page %d times!, $_SESSION['counter3']) . br); ? Tried these on PHP 4.0.6 (register_globals = On): - counter: doesn't work - counter1: works - counter2: doesn't work (to be expected) PHP 4.2.2 (register_globals = Off): None of the counters work; same when register_globals = On I'm really puzzled by this; could someone please point me in the right direction? -- Alexander Deruwe AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPMyAdmin interface
I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHPMyAdmin interface
Why don't you just install a copy on the server? If the only access you have is through the mysql monitor program then you must have shell access so installing your own copy of phpMyAdmin should not be an issue. But, if your going to access it remotely from a win machine I would use MySQL-Front instead. -B -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 12:47 PM To: [EMAIL PROTECTED] Subject: [PHP] PHPMyAdmin interface I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- 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] PHPMyAdmin interface
It's not normal that I've come across. Any hosting company I've ever dealt with (albeit not many, still three different ones), have all offered phpMyAdmin for interfacing with MySQL. And honestly, if the host REQUIRES you to do it, then they aren't worth hosting with. You'll find that will transcend into other areas of how they do business (i.e. technical support tickets, etc). Currently I'm hosting with http://www.websytz.com, and they have good prices. Another of my sites is on http://www.dzones.com, and they're very good as well. WebSytz' control panel flat out sucks, but it's usable. DZones has an incredible control panel, but they just didn't have the price I wanted for my current website. There's plenty out there, and since you pay monthly, you lose nothing by switching to another company. The choice is yours. BTW, I hadn't intended this to become a chapter, but it did... sorry for the length :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ [EMAIL PROTECTED] 07/24/02 12:46PM I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- 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] PHPMyAdmin interface
PHPMyAdmin must be run a server, or alteast a workstation with PHP's MySQL extension installed on it, so are you sure he didn't mean, install PHPMyAdmin yourself on there server (the one with the account your paying for), in like your webdirectory (which is incredibly easy and simple to do)? Adam Voigt [EMAIL PROTECTED] On Wed, 2002-07-24 at 12:46, [EMAIL PROTECTED] wrote: I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- 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] PHPMyAdmin interface
When they say, install it on your workstation are you sure they mean your desktop computer? phpMyAdmin is not a normal install on your desktop (unless you run a server with PHP and MySQL on your desktop, which you may do) It's very straight-forward to install phpMyAdmin on your web site. And yes, there are severe security implications to consider. You should protect the phpMyAdmin install with either an .htaccess file, or using the authentication method to http of phpMyAdmin (I'm not sure that's exactly what it's called... but it's close) If you leave the install of phpMyAdmin unprotected, your database is completely vulnerable. Does this help? -Mark I have just recently just signed up for virtual hosting with a MySQL database. They do not have a PHPMyAdmin interface too access the database. All they have given me is my username and password and the server too login too. They suggested that I install PHPMyAdmin on my workstation and access my database that way. Is there major security risks too my database doing this? Is this normal, where service providers request that I install PHPMyAdmin on my workstation or should I be looking for a new internet service provider who supplies the interface on the server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with msql_fetch_array()
I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!!
Re: [PHP] MySQL Backup and Restore
I've never had any luck using PHPMyAdmin for dumping databases. They always time out over the 30 second limit. I know if it was my installation, I could fix it, but these are usually with hosting companies, where that's the only access they provide. It's very much a pain in the butt... ---John Holmes... - Original Message - From: Justin French [EMAIL PROTECTED] To: Peter [EMAIL PROTECTED]; kip [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 23, 2002 11:29 PM Subject: Re: [PHP] MySQL Backup and Restore Can highly recommend doing it (and a whole lot more) with phpMyAdmin (http://phpMyAdmin.net) Justin French on 24/07/02 1:04 PM, Peter ([EMAIL PROTECTED]) wrote: grab ur self a copy of myphpadmin or use mysqldump or just simply make a copy of the data dir or grab ur self a copy of mysql_front -Original Message- From: kip [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 24 July 2002 12:58 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL Backup and Restore Hi, Can you tell me the steps of backup and restore the databases in Mysql? And can i specific a path for the backup file? Futhermore, i have installed the MySQL in Win2000 but i don't know how to restore the database of MySQL from a Linux server to Win2000 MySQL. Thanks -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting Processed Data from One Table 2 Another!
You might want to consider a slightly different approach - that being to use your php code to generate a delimited file of your data and use either mysqlimport from the command line if you can, or the LOAD DATA INFILE sql statement to load the file into your database. That's going to be a lot faster than running 13000 queries through your php script. ..mike.. On Wed, 2002-07-24 at 00:01, Thomas Edison Jr. wrote: Ok i have simple issue, i'm stuck at one point. I have a table Clientdetails which contains ClientID. I have created another table Authentication with 2 fields, ClientID and Password. I want to pick up the ClientID from table Clientdetails and insert ClientID and a Password i have generated using a code, into Authentication. So if there are 13000 ClientID's in Clientdetails, as, many rows with the ClientID it's corresponding password should be Inserted into table Authentication. I'm using the following code which i know is wrong, what would be correct? ? $db = mysql_connect(localhost,user,pwd); mysql_select_db(myDB,$db); $result = mysql_query(SELECT * FROM clientdetails,$db); if ($myrow = mysql_fetch_array($result)) { do { $some = $myrow[clientid] $newid = eregi_replace('100', '', $myrow[clientid]); $date = date(dn); $stuff = $newid.def.$date; $sql = INSERT INTO authentication VALUES('$some','$stuff'); $result = mysql_query($sql); echo All Done!; } while ($myrow = mysql_fetch_array($result)); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = mysql_connect(localhost,$username,$password) or die ('Could not connect!'); // suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
Try using mysql_query(); instead of mysql_db_query(); The SQL query is the first parameter in this function. The second parameter is a pointer connecting to the mysql server. The pointer is generated by mysql_connect() and you'll also need to select the database with mysql_select_db(). But it's the standard way.. $db = mysql_connect(localhost, username, password);// connect to mysql server mysql_select_db(mytable, $db); // select database by name $query = SELECT * FROM mytable ORDER BY id; // define query to submit $result = mysql_query($query, $db); // submit query if (mysql_num_rows($result) 0) // skip if no rows were found { while ($row = mysql_fetch_array($result)) { // .. do whtever.. } } mysql_close($db); It's also a common practice to put the first couple of lines in a file to include() back into your main script so that you can protect your useranme and password. Good luck. -Kevin - Original Message - From: Matthew Bielecki [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 10:34 AM Subject: [PHP] Help with msql_fetch_array() I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL Backup and Restore
I encountered that same timeout problem once, and I wound up just installing my own copy of PhpMyAdmin in an .htaccess protected directory on the server, and extending the time limit there. It only took about 10 minutes to set up, and as an added bonus it was a more recent version of PhpMyAdmin than the one the host provided. :) -Andy -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] I've never had any luck using PHPMyAdmin for dumping databases. They always time out over the 30 second limit. I know if it was my installation, I could fix it, but these are usually with hosting companies, where that's the only access they provide. It's very much a pain in the butt... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Backup and Restore
With phpMyAdmin, just scroll down until you see the dumping section. Select the appropriate information, tick the save as file box, then Go. It'll prompt you to save the file. You just use that file, then, as a query to your next database. Martin 1LT John W. Holmes [EMAIL PROTECTED] 07/24/02 01:38PM I've never had any luck using PHPMyAdmin for dumping databases. They always time out over the 30 second limit. I know if it was my installation, I could fix it, but these are usually with hosting companies, where that's the only access they provide. It's very much a pain in the butt... ---John Holmes... - Original Message - From: Justin French [EMAIL PROTECTED] To: Peter [EMAIL PROTECTED]; kip [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 23, 2002 11:29 PM Subject: Re: [PHP] MySQL Backup and Restore Can highly recommend doing it (and a whole lot more) with phpMyAdmin (http://phpMyAdmin.net) Justin French on 24/07/02 1:04 PM, Peter ([EMAIL PROTECTED]) wrote: grab ur self a copy of myphpadmin or use mysqldump or just simply make a copy of the data dir or grab ur self a copy of mysql_front -Original Message- From: kip [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 24 July 2002 12:58 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL Backup and Restore Hi, Can you tell me the steps of backup and restore the databases in Mysql? And can i specific a path for the backup file? Futhermore, i have installed the MySQL in Win2000 but i don't know how to restore the database of MySQL from a Linux server to Win2000 MySQL. Thanks -- 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 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] Help with msql_fetch_array()
You beat me too the punch and I think you explained it better than me, but just one minor little thing to note. Where you said.. if ( $result = mysql_query($sql)) This is not a valid way to check if the query has returned anything. mysql_query() returns FALSE on error. So if there was no error but there also wasn't anything returned then the object stored in $result wiill more than likely evaluate to TRUE. For the determining factor you should count the number of rows with mysql_num_rows($result). If the returned value is zero then you know it hasn't returned anything. -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: Matthew Bielecki [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 11:50 AM Subject: Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- 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] Help with msql_fetch_array()
Yes, what on earth was I thinking! should be: ... $result = mysql_query($sql); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); } else { echo whatever; } ... Kevin Stone wrote: You beat me too the punch and I think you explained it better than me, but just one minor little thing to note. Where you said.. if ( $result = mysql_query($sql)) This is not a valid way to check if the query has returned anything. mysql_query() returns FALSE on error. So if there was no error but there also wasn't anything returned then the object stored in $result wiill more than likely evaluate to TRUE. For the determining factor you should count the number of rows with mysql_num_rows($result). If the returned value is zero then you know it hasn't returned anything. -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: Matthew Bielecki [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 11:50 AM Subject: Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- 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] Hitting return in a textarea box...
I'm putting together a message board, and I'm having problems with hitting the return(enter) key within my textarea. I've looked around for a solution, I tried wrap=hard, wrap=soft and wrap=vitual and none of them worked (should they? I may have done it wrong?) and I also tried nohardbreaks and nosoftbreaks, but I think they may be no longer supported. Is this a case for regex? If so, can someone perhaps point me to an article on how to accomplish this? Thanks very much for any help. Jesse __ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
Shouldn't it be: $result = mysql_query($sql, $link_id); PHP will be quick to tell you that there is a missing link identifier in the mysql_query() call. It's happened to me plenty of times. HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ PHPCoder [EMAIL PROTECTED] 07/24/02 02:16PM Yes, what on earth was I thinking! should be: ... $result = mysql_query($sql); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); } else { echo whatever; } ... Kevin Stone wrote: You beat me too the punch and I think you explained it better than me, but just one minor little thing to note. Where you said.. if ( $result = mysql_query($sql)) This is not a valid way to check if the query has returned anything. mysql_query() returns FALSE on error. So if there was no error but there also wasn't anything returned then the object stored in $result wiill more than likely evaluate to TRUE. For the determining factor you should count the number of rows with mysql_num_rows($result). If the returned value is zero then you know it hasn't returned anything. -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: Matthew Bielecki [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 11:50 AM Subject: Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hitting return in a textarea box...
I've never had a problem with this. Even using a textbox with only the required parameters works fine as far as hitting the return key to get a newline. If you're talking about hitting the return key to submit, that's something else entirely, hehe. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ Jesse Lawrence [EMAIL PROTECTED] 07/24/02 02:26PM I'm putting together a message board, and I'm having problems with hitting the return(enter) key within my textarea. I've looked around for a solution, I tried wrap=hard, wrap=soft and wrap=vitual and none of them worked (should they? I may have done it wrong?) and I also tried nohardbreaks and nosoftbreaks, but I think they may be no longer supported. Is this a case for regex? If so, can someone perhaps point me to an article on how to accomplish this? Thanks very much for any help. Jesse __ Post your ad for free now! http://personals.yahoo.ca -- 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] Help with msql_fetch_array()
At 11:26 AM 7/24/2002 Wednesday, Martin Clifford wrote: Shouldn't it be: $result = mysql_query($sql, $link_id); Actually mysql_query should default to the last database connection opened if no link identifier has been specified. So the link identifier to not absolutely required. Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running ./configure multiple times
Yes, it is pretty safe to run ./configure more than once. The 1st time, it create the config.cache and so on. The 2nd time, it use the config.cache and other stuffs instead of starting from scratch. To redo everything from scratch. I believe one of those config.* files need to be removed so you can start again from scratch, not sure which files that need to be delete. But don't delete the original file, config or configure. Second of all, the list you provided to me. I noticed it is a link file, not a source file because of hte L before rwx. The first three links that point to the 4th file. The fouth file is a link that aren't pointed to anything, so it meant it is a link without a file. That may be why you got the error. FletchSOD Tom Rogers [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Thursday, July 25, 2002, 1:41:25 AM, you wrote: CG Well my RedHat system got hosed, so I reinstalled everything. I'm back to CG installing PHP now, and I'm wondering if it's safe for me to run ./configure CG multiple times. Here's the situation: CG I want to compile with gd support, and pdflib, and a bunch of other options. CG Instead of running a whole huge 5 line ./configure, can I run one at a time CG to make sure they all work, then run the whole thing? CG Also, just noticed this: I have gd installed, and libgd.so in /usr/lib, so I CG tried ./configure --with-apxs --with-gd=/usr/lib/ (also tried without the CG trailing /), but it gives: configure: error: Unable to find libgd.(a|so) CG anywhere under /usr/lib/ CG What gives? CG (in this ouptut, the stuff that's not important is cut out -- dates, etc) CG [root@saturn php-4.2.2]# ls -l /usr/lib/libgd.* CG lrwxrwxrwx S /usr/lib/libgd.so - libgd.so.1.8.3 CG lrwxrwxrwx S /usr/lib/libgd.so.1 - libgd.so.1.8.3 CG lrwxrwxrwx S /usr/lib/libgd.so.1.8 - libgd.so.1.8.3 CG lrwxrwxrwx S /usr/lib/libgd.so.1.8.3 CG [root@saturn php-4.2.2]# CG TIA, CG c. CG -- CG PHP General Mailing List (http://www.php.net/) CG To unsubscribe, visit: http://www.php.net/unsub.php it may be looking for libgd.a in the gd directory do a make libgd.a then copy it to /usr/lib -- Best regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
On Thursday 25 July 2002 00:34, Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); It's a very good idea to add some error checking code it'll save you a lot of grief. See examples in manual for details. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Nine years of ballet, asshole. -- Shelly Long, to the bad guy after making a jump over a gorge that he couldn't quite, in Outrageous Fortune */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running ./configure multiple times
On Wednesday 24 July 2002 23:41, Chris Garaffa wrote: Well my RedHat system got hosed, so I reinstalled everything. I'm back to installing PHP now, and I'm wondering if it's safe for me to run ./configure multiple times. Here's the situation: I want to compile with gd support, and pdflib, and a bunch of other options. Instead of running a whole huge 5 line ./configure, can I run one at a time to make sure they all work, then run the whole thing? Also, just noticed this: I have gd installed, and libgd.so in /usr/lib, so I tried ./configure --with-apxs --with-gd=/usr/lib/ (also tried without the trailing /), but it gives: configure: error: Unable to find libgd.(a|so) anywhere under /usr/lib/ What gives? Use: --with-gd=/usr -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* There can be no daily democracy without daily citizenship. -- Ralph Nader */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
On Wednesday 24 July 2002 22:22, Scott Fletcher wrote: It work very nicely The whole process take 30 to 45 minutes for just one server. You've got a slow computer and/or you type too slow ;-) I wonder how does someone did 12 computers in 10 minutes. Cool! For me it was a case of 'typing' in 6 commands: 1) download php 2) untar it 3) cd 4) configure 5) make 6) make install Actually I just copy and pasted those commands which took me all of 5 seconds to do. So unless you count the download and compilation time, 12 systems in 10 minutes is in the ballpark. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Yow! I just went below the poverty line! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload memory usage.
On Wednesday 24 July 2002 21:48, Reid Sutherland wrote: Hi, I'm currently locked in a battle with PHP and file uploads. I've searched the list to no avail. I actually found a guy with the same problem who ended up using perl to make this work. I'm trying to avoid that. The problem is, I'm dealing with huge POST uploads (100+ mb). And everytime you upload a file it stores it in RAM and then dumps the file to the drive. Is there any way around this? This is extremely dangerous. Since this customer may have multiple people uploading at the same time, it could result in a massive memory hit over a long period of time. Now I figured PHP would pipe the POST stream into a temporary file instead of holding it in RAM. This is how it should work right? Apparently that is how it will work in a _future_ version of PHP. But for now it's all stuffed in RAM until the complete file is received. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Yow! Did something bad happen or am I in a drive-in movie?? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload memory usage.
Jason Wong wrote: Apparently that is how it will work in a _future_ version of PHP. But for now it's all stuffed in RAM until the complete file is received. That's crazy. Maybe I don't understand enough of how PHP deals with various web servers and maybe that's why this is the way it is. But man... the way it's done is _very_ silly. Anyway, thanks for the update Jason. -reid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
Well I think you were correct about not connecting to the db, but I don't understand why. I wrote another little script just to test the connection. ?php $link = mysql_connect(servername,username,password) or die(Couldn't make connection.); $diditwork = mysql_select_db(news, $link); if ($diditwork FALSE) { echo got the db..yea!; echo $link; } else { echo didnt get db...bo; echo $link; } ? This returns didnt get db...booResource id #1 I don't understand how I can get a resource ID but then not be able to use the news database. Like I described earlier, this happens with my other db as well. I can connect to the db through the console or any other client I have on the physical server and do whatever I want with the db's, I'm just having problems with php. Thanks again for your help!! PHPCoder [EMAIL PROTECTED] 07/24/02 01:50 PM To: Matthew Bielecki [EMAIL PROTECTED] cc: php-general [EMAIL PROTECTED] Subject:Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!!
[PHP] Re: Windows installation help.
(This was from an email sent to Gabor, and the site said this address was for help) This is not a definition of the $blah variable. $blah = 1; would be a definition. I've never had any problems using just $blah; before, it never errored on me once, is there any reason it does this? (by the way the version I use on Nadrew.com is 4.2.1 and it works fine.) -Nadrew
RE: [PHP] Running ./configure multiple times
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 2:53 PM Subject: Re: [PHP] Running ./configure multiple times Yes, it is pretty safe to run ./configure more than once. The 1st time, it create the config.cache and so on. The 2nd time, it use the config.cache and other stuffs instead of starting from scratch. To redo everything from scratch. I believe one of those config.* files need to be removed so you can start again from scratch, not sure which files that need to be delete. I always rm config.cache before rebuilding with new options so the configure script will pick up the right libraries and new options. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best template class
I would recommend Smarty (http://smarty.php.net). Smarty is unique (?) in that it compiles templates into PHP code -- making it one of the faster templating engines out there. I use Smarty love it. Cheers, Hans On Wed, 2002-07-24 at 15:02, Remy Dufour wrote: Hi, Im currently working with phplib template and im wondering if PEAR template class can give me more... Anyone got an idea ? Rémy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date
I have a column in one of my mysql tables which holds the date time that the record was inserted. When I run a query later on I want to display the date, but if the date is today or yesterday I want to display today or yesterday instead .. how do i compare to stored date with todays date? todays date -1? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with msql_fetch_array()
That should definitely be working. Only thing I can think of is that you're database name isn't correct. You're certain news is the full name of the database.. I mean it's not news_com or something like that? The $link must be valid becuase the script isn't ending with Couldn't make connection. So that just leaves the mysql_select_db() function. And the only thing that will make that function return FALSE is if it can't find the database name for that user on the specified server. -Kevin - Original Message - From: Matthew Bielecki [EMAIL PROTECTED] To: PHPCoder [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 2:07 PM Subject: Re: [PHP] Help with msql_fetch_array() Well I think you were correct about not connecting to the db, but I don't understand why. I wrote another little script just to test the connection. ?php $link = mysql_connect(servername,username,password) or die(Couldn't make connection.); $diditwork = mysql_select_db(news, $link); if ($diditwork FALSE) { echo got the db..yea!; echo $link; } else { echo didnt get db...bo; echo $link; } ? This returns didnt get db...booResource id #1 I don't understand how I can get a resource ID but then not be able to use the news database. Like I described earlier, this happens with my other db as well. I can connect to the db through the console or any other client I have on the physical server and do whatever I want with the db's, I'm just having problems with php. Thanks again for your help!! PHPCoder [EMAIL PROTECTED] 07/24/02 01:50 PM To: Matthew Bielecki [EMAIL PROTECTED] cc: php-general [EMAIL PROTECTED] Subject:Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is failing, the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table tablename is not there. I use the following format as my standard MySQL connect and query snippet: $link = @mysql_connect(localhost,$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the or die() bit kills the script right then and there should it not be able to connect. mysql_select_db(YOUR_DB_NAME,$link); $sql = select * from your_table_name; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo Empty result set!; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id); $row = mysql_fetch_array($result); Thanks for your help in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Removing \ From a String?
I'm trying to remove all \'s from a string before printing it, but strtr still treats it as an escape character. How do I remove them? Anyone? -- The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing \ From a String?
RTM. stripslashes() ---John Holmes... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 5:21 PM Subject: [PHP] Removing \ From a String? I'm trying to remove all \'s from a string before printing it, but strtr still treats it as an escape character. How do I remove them? Anyone? -- The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Web: www.healthtvchannel.org -- 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] Free WEB Hosting with PHP and MySQL support
Unfortunatelly I changed my ADLS setting from IP static to IP dynamic and now nobody, me too, can access to my data. My question is if exist a Free WEB Server where I can place my data using PHP and MySQL support? Thank you and have a nice day Tiziano Crimella - Switzerland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free WEB Hosting with PHP and MySQL support
easyDNS.com provide a dynamic dns solution to your problem Zac - Original Message - From: crimix [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 24, 2002 10:03 PM Subject: [PHP] Free WEB Hosting with PHP and MySQL support Unfortunatelly I changed my ADLS setting from IP static to IP dynamic and now nobody, me too, can access to my data. My question is if exist a Free WEB Server where I can place my data using PHP and MySQL support? Thank you and have a nice day Tiziano Crimella - Switzerland -- 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] Re: Free WEB Hosting with PHP and MySQL support
If you want to continue to host it yourself, and simply want a stable address, try this: http://www.dynip.com/. I've used it for FTP serving before, and it works very well. Wm Crimix [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Unfortunatelly I changed my ADLS setting from IP static to IP dynamic and now nobody, me too, can access to my data. My question is if exist a Free WEB Server where I can place my data using PHP and MySQL support? Thank you and have a nice day Tiziano Crimella - Switzerland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Free WEB Hosting with PHP and MySQL support
As I written to zac, I tried avoid this problem with Dns2Go but the Client application send the Ip of my router and not that of my computer. Tiz Wm wrote: If you want to continue to host it yourself, and simply want a stable address, try this: http://www.dynip.com/. I've used it for FTP serving before, and it works very well. Wm Crimix [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Unfortunatelly I changed my ADLS setting from IP static to IP dynamic and now nobody, me too, can access to my data. My question is if exist a Free WEB Server where I can place my data using PHP and MySQL support? Thank you and have a nice day Tiziano Crimella - Switzerland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need some help on stratagy... (php/mysql/javascript)
..and how poor would the performance be if there were 813 shots in the movie? Thanks for your help How fast/big is the surfer's computer? It's the work on THEIR side that matters. PHP can spew out 813 shots pretty quickly. For that matter, if the movie itself is static, you can use PHP to just prepare the 813 shots off-line and paste it in. How fast will JavaScript handle the 813-element array is entirely up to the browser/JavaScript computer, not your web-server or PHP. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Banner Ad Serving...
You can also checkout OASIS http://oasis.sourceforge.net/ It's pretty good software, but i'm unable to use it here because it doesn't have as man features as OAS from RealMedia which my manager is used to. http://www.realmedia.com It's expensive and doesn't really integrate into PHP. but it's very indepth. On Tue, 2002-07-23 at 23:47, Dave at Sinewaves.net wrote: Is there any way of automatically adding a certain bit of code to every page on a web server (or within a given directory)? As in, is there any kind of Apache-specific PHP stuff that will add a banner ad or copyright notice to pages (without editing the actual pages themselves and without changing their file names)? I've looked around a bit, and I can't seem to brainstorm how it could be done. Any help will be greatly appreciated (with good karma to boot). :) Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com 2002 EPpy Award Winner, Best Newspaper Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble with \
Anyway, with asides to the snooty RTFM reply I got, I thought I'd share. Turns out the \'s that I was having problems getting rid of were written there from a form post that was used to collect the data. I still haven't found a way to remove them after reading them from the file, but I did manage to change them before they were posted by doing a strtr. If someone has a way to clearn \'s out of a string brought in from a file, I'm all ears, but it's working now. -- The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Speeding up PHP or MySQL
Is there anyways to speed up MySQL queries? Or showing the results through PHP? I have several queries that have about 8 left joins or so.. Yes very huge and when you have lots of people using these functions at once it really slows down.. Are there any practices that you can think of that would speed up any sql queries? I was thinking of using stored procedures, but after a bit of research I found ou= t that MySQL doesn=B9t have that yet so that's a no go :( Or is there a way of storing common query results? I am looking for _anything_ that will speed up showing results to large queries.. I do use the ob_gzhandler and that helps a bit... Help! :) Cheers and Thanks! Rick Let us live as people who are prepared to die, and die as people who are prepared to live. - James S. Stewart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Speeding up PHP or MySQL
Mysql 4 can cache queries. You can try using temporary tables, so you can break up joins. Also, perhaps making a rawdata table placeholder. Put a timestamp field on your columns. Make the query and store somewhere the query itself, the results and the time they were last modified. Then when the next query comes, compare if one already exists on the database. If so, only grab the rawdata, ie, the previous results. And read Mysql's manual section about optimization if you haven't done so already, since it has important tips. -- Julio Nobrega Pode acessar: http://www.inerciasensorial.com.br Richard Baskett [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there anyways to speed up MySQL queries? Or showing the results through PHP? I have several queries that have about 8 left joins or so.. Yes very huge and when you have lots of people using these functions at once it really slows down.. Are there any practices that you can think of that would speed up any sql queries? I was thinking of using stored procedures, but after a bit of research I found ou= t that MySQL doesn=B9t have that yet so that's a no go :( Or is there a way of storing common query results? I am looking for _anything_ that will speed up showing results to large queries.. I do use the ob_gzhandler and that helps a bit... Help! :) Cheers and Thanks! Rick Let us live as people who are prepared to die, and die as people who are prepared to live. - James S. Stewart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date
i use seconds in place of time alot. using the PHP time() function and Date() functions u can do a lot. instead of a time / date TIMESTAMP field type i use an INT type i then call the $the_time = Time(); and insert that. then u can manipulate the hell outta that INT value from the DB with php's Date() function. allows u to compare lengths between times and perform much simplier numeric math on the values rather then the 'calender' math. somethings can be trickier like Leaps and stuff, but i found more pors for most of my application needs. Same data sizes : INT or TIMESTAMP in mysql are 4 bytes and they both give u down to the second. then to find out today, u just run Date('m-d-Y'); compare those vals to Date('m-d-Y', $DB_VALUE); there u go it is today or it isnt ! out put data accordingly. Joel Alexander Ross [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a column in one of my mysql tables which holds the date time that the record was inserted. When I run a query later on I want to display the date, but if the date is today or yesterday I want to display today or yesterday instead .. how do i compare to stored date with todays date? todays date -1? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php