Re: [PHP-DB] postgresql and php
On Sat, 2005-04-23 at 20:31 -0500, Tate wrote: I have php and postgresql installed on my laptop with linux fedora core 3. Everything is working fine, but I have created a survey and want the entries automatically inserted into the database. I know what my SQL should be, but I'm not sure if my other coding is correct. In my form, I have radio buttons. Any and all help is appreciated. Might you consider showing us some code and/or trying it out yourself and coming to us when you hit a problem? -Robby -- /** * Robby Russell, Owner.Developer.Geek * PLANET ARGON, Open Source Solutions Web Hosting * Portland, Oregon | p: 503.351.4730 | f: 815.642.4068 * www.planetargon.com | www.robbyonrails.com ***/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] big data base
On Wed, 2005-03-09 at 11:54 -0800, luis medrano wrote: Hi All, I need you help. I need to design a very big data base, around 900GB or more of information but I never had design or manage this magnitude of information before. I really appreciate if you can point me to documentation to how can do this properly or you can help me with some experiance you have doing this. Thanks, Luis Your best bet for an opensource db, is to use PostgreSQL. There are companies that are using PostgreSQL for DBs over a terabyte in size. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP-PostgreSQL Hosting Development * open source solutions - web hosting / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] password in md5 to connect to mysql instead of clear password
On Thu, 2005-02-24 at 02:37 -0800, Gael Lams wrote: Hi all I use the classic following rows to connect to a mysql database. I always put $passsword in clear in the php connection file and I wonder whether there is a way to have it in md5 so that someone reading the file could not use it to connect to the db. I googled a bit but find only threads explaining how to have password saved in md5 inside a mysql table which is not I would like to do Regards, Gal function SQLConnect() { $server_name = 'localhost'; $db_name = 'cmsdb'; $user_name = 'user'; $password = 'clearpassword'; if (!$dbconnect = mysql_connect($server_name, $user_name, $password)) { echo Connection failed to the host 'localhost'.; exit; } if (!mysql_select_db($db_name)) { echo Cannot connect to database '.$db_name.'; exit; } } You could probably do this if you managed to take the mysql source code and changed the login functions. ..but if someone can see your password in MD5 format..could they then not login with the same privileges as with your plain text? -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting Ruby on Rails Apps --- / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQLPHP decrypt(password)
On Fri, 2005-02-25 at 10:20 +, moses Woldeselassie wrote: hi all I am using password() to crypt a user password online. but how do i decrypt a user password, when user forgot his/her password? kind regards m You don't. You make them reset their password. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting Ruby on Rails Apps --- / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php/other language (perl)
On Wed, 2005-02-23 at 10:54 +, mel list_php wrote: Hi, I'm used to work with php/MySQL, and have developped a web app in php. As I'm working on biological applications, I would like to use some of the BioPerl features. My first idea was calling perl through php (system command). But I'm wondering about the security issues, as some data (for example sequences) will be entered by my users, and I don't really know if safe_mode can help me here. My second idea was to make a kind of hybrid application, keeping the php structure that is already implemented and adding just some pages in perl. I don't know if this is possible, first to use the both at the same time, then they both will have to connect to the database. Does anybody here has any experience of that kind of thing or could point me to a doc? Thanks a lot. Try this perhaps: http://pecl.php.net/package/perl -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting Ruby on Rails Apps --- / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] boolean values in postgresql
On Mon, 2005-02-21 at 20:54 -0600, Bret Hughes wrote: I am adding some functionality to a php/postgres based system and have a value that I want to be a boolean. digging around the pg doc I see the boolean datatype. Cool I say. So I happily alter the table and add the boolean column notify all is good until I retrieve it using pg_fetch_object and get a t or f back in myobject-notify Rats says I. a simple if ($myobject-notify) { blah } contruct won't work. So.. after reading a lot of stuff from both the php and pg doc and STFW until my eyes are tired, I am coming to you guys for advice. Assumption: There is no easy way to map a pg boolean data type to a value that will evaluate simply in php. I know I can code it but I would really like to keep this as simple as possible Couldn't you just check on 't' or 'f'? Question: Assuming the above assumption is correct, what is the most efficient way to define a column that will take only two values who's values will evaluate as intended in php? I am going to punt an go with a smallint unlet there is a way to store a bit. I am trying to get my head around bytea right now but thought I would ask while I am reading. Bret -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting Ruby on Rails Apps --- / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL PHP hosting
On Tue, 2005-02-08 at 16:07 -0500, J. Connolly wrote: Is there a site that someone could recommend that does PHP, Mysql hosting? If they do .NET that would be good also. This is for practice and development not for a company so I am looking to keep the costs down. There are so many sites, I thought maybe someone here might have a good solution. jzf http://www.planetargon.com/hosting/ -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting Ruby on Rails Apps --- / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-HTML-select deny
On Wed, 2004-12-01 at 12:50 +, PHPDiscuss - PHP Newsgroups and mailing lists wrote: Hi, what can i do, where users can't select and copy my text from web-page. Thanks render the text to an image. -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] PHP vs ASP
On Mon, 2004-11-15 at 10:20 -0600, Perry, Matthew (Fire Marshal's Office) wrote: I need some ammo to convince my boss not to use ASP but use PHP instead. Anyone have some info I can give him? - Matthew PHP = free ASP = not PHP = most widely used scripting language online PHP5 is out PHP = tons of open source libraries..free to download -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Please point me in the right direction.......
On Wed, 2004-11-10 at 14:12 -0500, Michael Cortes wrote: I have a question about contracts or agreements. I am considering hiring a local company to do some coding for us in LAMP to augment what we have done already. I have a problem with the standard we own the code and copyright clause in thier service agreement. Can someone point me to the correct mailing list as I don't wish to start an inapropriate thread. We have had clients who had us sign NDAs with some of our clients. Outlined in the NDAs would state that any work that was specifically for the client that was part of their unique business model (say they have a site that handles X very uniquely, i cannot take the code and use it for another client who wants to do the same thing that X did). Often times, you will find that a development company wants to retain the rights to the code that they develop (in terms of re-usage), but if they have any clauses that says that you cannot continue to use the code should you and the developers end up not getting along..then keep looking. Since you mentioned that you have an existing code base..it sounds like they are doing addons/changes/etc, correct? If that is the case, I would have them fill out a contract that says that anything that isn't generic (like some libraries) would be under your ownership, not theirs..as per 'work for hire' -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] can i display an image _directly_ from postgres db storage?
On Mon, 2004-11-01 at 21:36 -0600, P. George wrote: i know that postgres has a raw binary datatype called bytea for storing pictures and whatnot, but i'm having trouble finding an example of displaying an image on a web page with php that is pulled directly from the database? is this possible? This example uses large objects, you can try to use the same logic and use the bytea field. http://blog.planetargon.com/index.php?/archives/27_Displaying_image_from_PostgreSQL_large_object_with_PHP.html -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Problem with script
On Tue, 2004-11-02 at 10:41 -0600, [EMAIL PROTECTED] wrote: Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 't read card','1099413551')' at line 1 My initial guess is that you do not have magic quotes on. You might want to validate your data before inserting it into the database. Try: http://us2.php.net/manual/en/function.mysql-escape-string.php Any instances of ' will break your INSERT query the way you have it..so you need to insert them all with \' (which escapes the single quotes) hth, Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] printer dialouge box
On Sat, 2004-10-30 at 18:03 +0530, balwantsingh wrote: how i can open the printer dialouge box of browser in PHP. pls. help. with best wishes balwant by using javascript. PHP doesn't do client-side stuff. -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] I can't seem to get Max() to work
On Thu, 2004-10-28 at 01:05 -0400, Chris Payne wrote: Hi there everyone, I cant seem to get the below to work with PHP and MySQL: $sql = SELECT MAX(FoodItemNumber) FROM menuitemsubs; What am I doing wrong? I need the highest number from the column FoodItemNumber, but it doesnt return anything unless I change the MAX() to a * and I dont want that I need it to be the MAX() number as it isnt an auto-increment field. Is this an integer field? -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now supporting PHP5 and PHP4 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Finding the highest number in a column?
On Wed, 2004-10-27 at 23:33 -0400, Chris Payne wrote: Hi there everyone, I am working with a very complex system where not all numbers are assigned 1, 2, 3 etc so there could be a row with the number 1 and then the next row could be 40 and so on Is there a way with PHP and MySQL to find out what the highest number is in a particular column easily when the numbers are auto-incremented so arent necessarily one after the other? SELECT * FROM table ORDER BY colname DESC LIMIT 1; ? assuming all your column values are unique... -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now supporting PHP5 and PHP4 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Finding the highest number in a column?
On Wed, 2004-10-27 at 20:46 -0700, Robby Russell wrote: On Wed, 2004-10-27 at 23:33 -0400, Chris Payne wrote: Hi there everyone, I am working with a very complex system where not all numbers are assigned 1, 2, 3 etc so there could be a row with the number 1 and then the next row could be 40 and so on Is there a way with PHP and MySQL to find out what the highest number is in a particular column easily when the numbers are auto-incremented so arent necessarily one after the other? SELECT * FROM table ORDER BY colname DESC LIMIT 1; ? oops, you're looking for the max() now the whole row. MAX() should work for you.. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now supporting PHP5 and PHP4 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Implementing search in a database driven website
On Wed, 2004-10-27 at 00:33 +0530, Vinayakam Murugan wrote: Hi I have a PHP-mysql website in which I want to implement search functionality. Through the content management section, the user can enter data into the database. Here he can enter HTML tags and embedded CSS stylesheets also. Now the problem is while searching the table, I want to show couple of lines of the relevant text. This gets displayed along with the HTML tags and CSS entries. Is there anyway I can display only the text ? I have tried strip_tags but it does not strip the CSS entries. -- Warm Regards Vinayak You're going to have replace all the css tags when you pull the data out...or rethink how you handle this sort of stuff in your CMS. (html/css inside the content isn't fun to deal with) -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Implementing search in a database driven website
On Tue, 2004-10-26 at 16:57 -0700, Robby Russell wrote: On Wed, 2004-10-27 at 00:33 +0530, Vinayakam Murugan wrote: Hi I have a PHP-mysql website in which I want to implement search functionality. Through the content management section, the user can enter data into the database. Here he can enter HTML tags and embedded CSS stylesheets also. Now the problem is while searching the table, I want to show couple of lines of the relevant text. This gets displayed along with the HTML tags and CSS entries. Is there anyway I can display only the text ? I have tried strip_tags but it does not strip the CSS entries. -- Warm Regards Vinayak You're going to have replace all the css tags when you pull the data out...or rethink how you handle this sort of stuff in your CMS. (html/css inside the content isn't fun to deal with) -Robby found on php.net,http://us2.php.net/strip_tags (bottom) $string= preg_replace('style[^]*.*/style'siU,'',$string); -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Logging Into A MySQL (Web) Database
On Thu, 2004-10-21 at 17:50 -0400, Ron Piggott wrote: Any ideas on how to log into a mySQL database through a web form and creating user sessions? Ron That's a loaded question... Can you be just a bit more specific? We're here to answer specific questions... so I will answer your question as you have stated it. There are many ideas and ways to log into a mysql database. PHP can create user sessions to. You just have to make the code do that. ;-) Ask more specific questions and we can try to help...but it seems like you aren't sure what you're looking for quite yet. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] sending e-mails
On Thu, 2004-10-21 at 16:19 -0600, 'Miguel Guirao' wrote: Hi!! I have a script in PHP that should send an e-mail from a specific e-mail account, let's say mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] to a customer's e-mail account, using the smtp_mail.inc class of PHP. But, Do I need to authenticate first in order to send the e-mail? If so, how? It really depends on the web hosting server that you are on. You can typically get away with using the mail() function which by default sends through sendmail and doesn't bother checking for authentication. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Logging Into A MySQL (Web) Database
On Thu, 2004-10-21 at 22:20 -0400, Ron Piggott wrote: Hi Robby I knew clearly what I was trying to say in my mind but didn't do a good job expressing it. The web site address Alex sent me is what I am looking at creating. Ron Ok, who is Alex? If you are following to a thread, you should stay in it. You started a new thread and can't assume that we know where your train of thought is coming from. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] PHP versions - Development server live server...
On Wed, 2004-10-13 at 21:04 +0100, Peter Borcherds wrote: Hi all, First of all, apologies if this is posted more than once...I'm having trouble with my newsreader!! I am running Win XP Pro as my development machine - at present I have PHP 4.3.4 installed on this machine. My question is...my two web hosts for my PHP hosting have PHP 4.3.2 PHP 4.3.4 installed respectively...what happens if I install the latest production release of PHP, namely 4.3.9, on my Win XP Pro machine and then develop using that? Will I be able to use pages coded on my dev machine on the live servers, even though the servers are running older versions of PHP? What do I need to be looking out for with regard to conflicts? Thanks! Peter Shouldn't cause any major issue. 4.3.x changes are typically bug fixes. So, if anything, you'll see a bug on the live servers that was fixed in your version, but most bugs are not so easy to produce. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
RE: [PHP-DB] PHP versions - Development server live server...
On Wed, 2004-10-13 at 22:06 +0100, Peter Borcherds wrote: Hi Robby, Thanks for the swift reply! Okay, so it should be fine to install the 4.3.9 version then - okay...now I assume I should hold-off on the 5.0.2 release then...? Peter, Yes, if you build PHP5 code, it's very possible it will not work on 4.x hosting servers...especially object oriented programming. As a rule of thumb, keep your development and live environments as close as possible. :-) Cheers -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] How to create a new Table in prostgresql from a Webinterface
On Sat, 2004-08-14 at 08:31, Michelle Konzack wrote: Hello, Never I have done this before (no need) but now I need to create a new table with some colums from a Webinterface and do not know how to do that. Please can anyone point me into the right direction ? Well, CREATE TABLE is the type of sql command that you would issue. You can do $query = CREATE TABLE foo (id SERIAL PRIMARY KEY, name TEXT);; Then run this query through your php command of choice (pg_query, PEAR, etc) -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] How to forward a POSTed form to another server and catch the return for further processing
On Sat, 2004-08-14 at 17:41, Yanglong Zhu wrote: How to forward a POSTed form to another server and catch the return for further processing. I think I did this before. But now I have completely forgot how that was done. The posted form data is processed on the other server, the results should be returned or captured by the first server. Obviously my brain is not working. Thanks for your help. Curl can do this for you. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Lock Record on Postgresql
On Fri, 2004-08-13 at 07:30, Norma Ramirez wrote: I need to lock a record in a postgresql table, how can I send the lock query in a script and after in other script send the unlock instruction? Is this possible? Thanks Norma R What kind of queries are you running. Often times I find people misusing LOCKS. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
RE: [PHP-DB] Intellectual property rights
would not be an acceptable language and mysql is not a proper database to run an application on. I informed them I could rewrite this in asp.net and place it on a mssql database. The IT director said they will be having the 3rd party company just take what I have made, convert it to asp and build off of it. I approached my supervisor about compensation for the work that was done since they are using my design. I was told you gave it to IT, there is nothing I can do about it I explained that this was given on the condition that it would be shown to the VP and in hopes that I would either gain a transfer to IT, be awarded a contract to provide the solution and maintenance, or maintain my current position with a slight raise and I will maintain and built onto the application. I went up the chain to my supervisors boss and explained to them what had happened and that since they are using my design and altering it to another language that I would like to be compensated for my work. I was told that I did nothing but give them an idea and they were really doing all the work since what I did was not good enough and their computers could not understand what I wrote. The IT dept refuses to run anything besides Win Servers using IIS. They will not install PHP ( too many hacker problems they say). Did I just screw myself? Do I have any protection of my design? Can I do anything? Thanks, Vinny -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and mysql script error in webhosting
On Mon, 2004-08-09 at 20:45, Sukanto Kho wrote: Hi all, My php files run well in my local PC but some of PHP and mysql script just getting error when running in webhosting server. I found out that the problem is in the way webhosting server handling global variable. for example : In my local PC : $_GET['var'] is different with $var but in webhosting server : $GET['var'] is the same with $var... I don't need to declare $var=$_GET['var'] 'cause $var is the same with $_GET['var']... Anyone have such a problem before? Thanx By regard; Flame Yes, you will need to turn off global variables. You can do this (if using Apache), add a file to your main web directory called, .htaccess. An example .htaccess entry: php_flag register_globals on. Then try then find another webhost as that's a lame/insecure setting to have set to On. ;-) -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] plPHP and php mail() example
Here is a simple function that takes 4 arguments ($arg0-3) and utilizes the php mail() function. I added the headers for an example of how easy it is to utilize plPHP in PostgreSQL. CREATE OR REPLACE FUNCTION phpmail(text,text,text,text) RETURNS integer AS ' # Argument list $email_address = $arg0; $email_from = $arg1; $subject = $arg2; $body = $arg3; # # ..Typically, you would validate arguments here # Build email headers $headers = From: $email_from\r\n; $headers .= Reply-To: $email_from\r\n; $headers .= X-Mailer: plPHP; # Send email if (mail($email_address, $subject, $body, $headers)) { return 1; } else { return 0; } ' LANGUAGE 'plphp'; # # Usage # plphp_test=# SELECT phpmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'Subject Line', 'This is the email body\n\nMore body. Testing email. Test!\n\n\n-Robby') as email; INFO: ret_val(long): 1 email --- 1 (1 row) # # Output # [EMAIL PROTECTED] typed this on 01/30/2004 08:34 AM: This is a body More body. Testing email. Test! -Robby Feel free to join the plPHP mailing list as well. http://mail.commandprompt.com/mailman/listinfo/plphp Cheers, Robby Russell -- #--- # Robby Russell, | Sr. Administrator / Lead Programmer # Command Prompt, Inc. | http://www.commandprompt.com # [EMAIL PROTECTED] | Telephone: (503) 667.4564 #--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting a value
js typed this on 01/30/2004 10:07 AM: i want to know what i can use to count the number of times a value appears in a column listing where different values are listed. for example, say in the column of Favorite Number we have 100 students, and for each student his or her own row. and each student can pick a number from 1-10. So, we have a column of 100 rows and each field can contain either 1-10.Now, i want to know how can i count the number of times lets say the #2 appears in this list and give that count a number. so if #2 appears 43 times in that column, then i want it to say 2 is listed 43 times. how do i do this? thank you for your help with my beginner newbie questions. -james If your table was like this (in postgresql in this example): CREATE TABLE student_numbers ( id SERIAL, student_id int, fav_num int ); Now I have inserted in 9 rows of student id's and favorite numbers. # SELECT fav_num as Favorite Number, count(*) FROM student_number GROUP BY fav_num; Favorite Number | count -+--- 1 | 1 2 | 3 3 | 1 5 | 3 7 | 1 Cheers, Robby Russell -- #--- # Robby Russell, | Sr. Administrator / Lead Programmer # Command Prompt, Inc. | http://www.commandprompt.com # [EMAIL PROTECTED] | Telephone: (503) 667.4564 #--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting a value REVISED pt2
js wrote: p.s.- im using PHP with MySQL... if that helps any. thanks i want to know what i can use to count the number of times a value appears in a column listing where different values are listed. for example, say in the column of Favorite Number we have 100 students, and for each student his or her own row. and each student can pick a number from 1-10. So, we have a column of 100 rows and each field can contain either 1-10.Now, i want to know how can i count the number of times lets say the #2 appears in this list and give that count a number. so if #2 appears 43 times in that column, then i want it to say 2 is listed 43 times. how do i do this? thank you for your help with my beginner newbie questions. -james Did you really review your question much? Do you have a php script that has connected to the database already? -Robby -- Robby Russell, | Sr. Administrator / Lead Programmer Command Prompt, Inc. | http://www.commandprompt.com [EMAIL PROTECTED] | Telephone: (503) 222.2783 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Skipping a row
John Greco wrote: $sql2 = select * from product where whseNum = '.$whseNumber.' order by prodNum; What does your PHP code look like after that? What is your index starting with? are you starting with 0? or 1? $sql = SELECT id FROM product WHERE something = this; $rs = pg_query($sql); $i = 0; //not needed, but to show what is is to start with while ($i pg_numrows($sql)) { print pg_fetch_result($rs, $i, id) . \n; $i++; // increment } // done -Robby -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php