[PHP-DB] PHP Developer's Suggestion !
Why don't you make the php.net site Printer Friendly? olinux _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Session with php and mysql problem!
Hello all... i have the following script which checks a username and pass from a db and if it is correct it starts a session.. The problem is that when i go to next page the session is gone.!! What must i do to start the session and keep it permanent until the uses logs off??? $handle=mysql_connect("localhost","root","s"); $db = mysql_select_db("cosmonaut",$handle); $auth=mysql_query("select * from users where user_name='$username' and user_pass='$password'",$handle); $match=mysql_num_rows($auth); if ($match 0) { session_start(); $userid = session_id(); echo $userid; include("index.php"); } else { echo "wrong pass"; } __ _ PGP KEY ID: 0xA86600E9 ___
[PHP-DB] Re: Session with php and mysql problem!
I'm still at the start of trying to get to grips with PHP so these comments should be treated with a healthy scepticism. Most of the examples I have seen and used involving sessions will start the session at the start of the script. If you want to continue checking on a particular user's name you can then pass a variable using session_register in order to track the user's name during the session. In your example this might involve placing the start_session at the start of the script and then carrying out a separate check to see if the user is a valid user. You can then control the program flow on subsequent sessions by again checking if the user is valid and presenting appropriate messages to them if they are not. Hope this helps, Michael Egan Koutsogiannopoulos Karolos wrote: Hello all... i have the following script which checks a username and pass from a db and if it is correct it starts a session.. The problem is that when i go to next page the session is gone.!! What must i do to start the session and keep it permanent until the uses logs off??? $handle=mysql_connect(localhost,root,s); $db = mysql_select_db(cosmonaut,$handle); $auth=mysql_query(select * from users where user_name='$username' and user_pass='$password',$handle); $match=mysql_num_rows($auth); if ($match 0) { session_start(); $userid = session_id(); echo $userid; include(index.php); } else { echo wrong pass; } __ _ PGP KEY ID: 0xA86600E9 ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Session with php and mysql problem!
session_start(); should do it on the second page Steve Koutsogiannopoulos Karolos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello all... i have the following script which checks a username and pass from a db and if it is correct it starts a session.. The problem is that when i go to next page the session is gone.!! What must i do to start the session and keep it permanent until the uses logs off??? $handle=mysql_connect(localhost,root,s); $db = mysql_select_db(cosmonaut,$handle); $auth=mysql_query(select * from users where user_name='$username' and user_pass='$password',$handle); $match=mysql_num_rows($auth); if ($match 0) { session_start(); $userid = session_id(); echo $userid; include(index.php); } else { echo wrong pass; } __ _ PGP KEY ID: 0xA86600E9 ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Application dev w/ PHP MySql
i was really gonna try and answer this for you then it struck me that you've got quite a way to go in terms of your position relating to database design and so on. so... i'd sugest you read up a bit on the logic of the way you are trying to implement your database and theink about the logical flow of information from your tech guys. for example, you've got cust_key, cust_fname, cust_lname in the same row of the db where cust_key, presumabely, uniquely identifies each customer. this would be stored elsewhere in the database and will be replicated for no reason. i'd think seriously about the job the db is performing and then design it from the bottom up instead of hacking out a simple db that will cause you problems in the future. don't mean to sound like an ass but if you put the work in at first then you'll reap the rewards later. or something :-) Steve Robert Barish [EMAIL PROTECTED] wrote in message 01073014001600.22120@mail">news:01073014001600.22120@mail... Hello I am having to learn php and mysql, at the sametime and with a time constraint. So I am hoping I can have a lending hand from all the coding gurus out there. Let my give you a little back ground. I the owner of an ISP tech support outsourcing company and am trying to develop a call note system where the techs input to mysql notes on the call the teched and then have our clients (isps) use and authenicated site to do a search view the browser on a particuliar user's call note history. At the present time I am working on the Insertion part of the php script. I have created a data base in mysql and have been able to populate the data base.When the tech hits the submit button and the data is inserted into the customer table, with cust_key, tech_key, cust_fname, cust_lname, cust_username, cust_timestamp columns and into table issues with issue_key, issue_type, issue_entry, issue_date columns. I have this part working great. There is one more table in need to populate when the tech submits a call note and this is labled cust_issue_association. The cust_issue_association table has the following columns cust_key and issue_key. This table is being use to tie in the tables for a search. My problem is I have no idea on how to populate this table. When a call note is submitted into the customer table the cust_key is auto_incremented and in the issues table the issue_key is auto incremented. So the million dollar question that is driving me crazy with is how do I get these two keys to be inserted into cust_issue_association table when the call note is submitted. I have attached what I have done so far (please excuse the readabiltiy and basicness of the code this is my first time doing this) I hope I have described this clearly enough. Of course, I will give created in the code and on the appropriate html page, where create is do for the people who help me. Thank you ahead of time for all your inputs. Bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: [PHP-GTK] [PHP-GTK-ORACLE] - Erreur TNS
Such questions are best asked at [EMAIL PROTECTED] . I've defined them in the envoironent throgh a shell script looking like this export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/8.1.7 export ORACLE_SID=home export PATH=/u01/app/oracle/product/8.1.7/bin:$PATH export CLASSPATH=.:/u01/app/oracle/product/8.1.7/jdbc/lib/classes111.zip export LD_LIBRARY_PATH=/u01/app/oracle/product/8.1.7/lib export ORA_NLS33=/u01/app/oracle/product/8.1.7/ocommon/nls/admin/data export NLS_LANG=german and I had no problems whatsoever to access oracle database within my php-gtk application. - Markus On Tue, Jul 31, 2001 at 04:06:16PM +0100, Christophe Chassagneux wrote : I have a simple script in php : putenv(ORACLE_HOME=D:\\ORANT); putenv(TNS_ADMIN=D:\\ORANT\\NETWORK\\ADMIN); putenv(ORACLE_SID=x); echo Oracle : . getenv(ORACLE_HOME). \n; echo TNS_ADMIN : . getenv(TNS_ADMIN). \n; echo ORACLE_SID : . getenv(ORACLE_SID). \n; $connect_oracle = ora_logon(x@xxx , SERETI); But then i do : e:\ php testoracle.php the prog reply : ORA-12154 : TNS name not resolved with apache server, I don't have this problem. Can u help me ? -- Markus Fischer, http://guru.josefine.at/~mfischer/ EMail: [EMAIL PROTECTED] PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Warning Page Expired
Edit your php.ini file and find the line that starts with session.cache_limiter. Replace it so that the line says: session.cache_limiter = ; Fix for Caching Problems If you leave the value blank (the ; Fix for part is just a comment), the browsers will handle their own caching and will eliminate this error. Occasionally you will get a page that is cached and you will need to refresh in order to see the updated contents, but for the most part, it works. Another solution is simply to use GET methods in your forms instead of POST. The whole page expired error is supposed to be a safety feature to keep people from seeing private, posted information. The GET method puts all the information in the query string, so there's nothing to hide, so caching doesn't become a problem. - Jonathan Olinux O [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How do I eliminate this error when the BACK button is used? Warning Page Expired Thanks, olinux __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Problem compiling pgsql and php (Semi OT)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all I'm trying to add support for pgsql to my current setup. Everything (php 4.0.4, pgsql 7.1.1, apache 1.3.19) is compiled from source. Postgres is working fine on its own. Postgres is installed to /usr/local/pgsql I've tried compiling with - --with-pgsql - --with-pgsql=/usr/local/pgsql but each time I get the same error when I run make. The error is php_pgsql.h:32 postgres.h No such file or directory make[3]: *** [pgsql.lo]Error 1 make[3]: Leaving current directory '/usr/local/src/php-4.0.4pl1/ext/pgsql' I seem to remember when I install postgres onto nother machine using RPM I had to add pgsql_devel but I don't know to do this compiling postgres from source. Trawling through the manual and archives has sofar proved fruitless. Any help will be gratefully appreciated TIA M@ -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBO2bJ/qW0/zC+QxWwEQIkXACfXt7RAVI1JMkt5I3K01b+pur3cLkAoLZt CacpMr4hD8IO+UpXwEYNamSf =VZof -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Problem compiling pgsql and php (Semi OT)
ok . i've had this problem and fixed it thus: --with-pgsql=/path/to/unzipped/files e.g. --with-pgsql=/usr/src/postgresql7.1.1/ and it works, and has done for the last seven months. rasmus bit my head off though when i suggested it though so sh. Steve Matt Williams [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all I'm trying to add support for pgsql to my current setup. Everything (php 4.0.4, pgsql 7.1.1, apache 1.3.19) is compiled from source. Postgres is working fine on its own. Postgres is installed to /usr/local/pgsql I've tried compiling with - --with-pgsql - --with-pgsql=/usr/local/pgsql but each time I get the same error when I run make. The error is php_pgsql.h:32 postgres.h No such file or directory make[3]: *** [pgsql.lo]Error 1 make[3]: Leaving current directory '/usr/local/src/php-4.0.4pl1/ext/pgsql' I seem to remember when I install postgres onto nother machine using RPM I had to add pgsql_devel but I don't know to do this compiling postgres from source. Trawling through the manual and archives has sofar proved fruitless. Any help will be gratefully appreciated TIA M@ -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBO2bJ/qW0/zC+QxWwEQIkXACfXt7RAVI1JMkt5I3K01b+pur3cLkAoLZt CacpMr4hD8IO+UpXwEYNamSf =VZof -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Random question selection in PHP w/ MySQL backend.
I'm having a bit of trouble creating a random question selector. I'm using PHP 4.0.6 and MySQL 3.23.36 on Windows 98 SE. I've tried several different solutions, but none work at all. What i need to do is select 10 questions from a database (db: vpt, table: questions), and make sure that the same question doesn't appear twice. The questions need to appear in a random order each time the script is loaded. It sounds simple enough, but i just can't seem to get it to work. Any suggestions?? Thanks in advance, -Adam Lundrigan CEO, VPU http://www.vpu-virtual.com/ ICQ # 73617446 [EMAIL PROTECTED]
Re: [PHP-DB] Random question selection in PHP w/ MySQL backend.
Adam, I'm what I would call a novice to PHP and databases in general, however if I had to do what you're doing, I might do the following... Add a field to the table that contains your questions called displayed and have it be an enum of Yes/No True/False, etc... In your script, you'd then query for all the questions that haven't already been displayed. Then get a random one of those (plenty of randomizing functions in PHP I believe). Display it, mark it as displayed in the db... Next time, it won't even get returned in the query. I don't know if you have to do this on a per-user basis or what. If so, you will probably have to create a session table and keep track of the questions each user has viewed... Hope this gets you started... Cheers! My 2 ยข John Pickett http://www.bvstudios.com/ Co-Author: Inside Dreamweaver 4 http://www.amazon.com/exec/obidos/ASIN/0735710848/xtremist - Original Message - From: Adam Lundrigan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 2:32 PM Subject: [PHP-DB] Random question selection in PHP w/ MySQL backend. I'm having a bit of trouble creating a random question selector. I'm using PHP 4.0.6 and MySQL 3.23.36 on Windows 98 SE. I've tried several different solutions, but none work at all. What i need to do is select 10 questions from a database (db: vpt, table: questions), and make sure that the same question doesn't appear twice. The questions need to appear in a random order each time the script is loaded. It sounds simple enough, but i just can't seem to get it to work. Any suggestions?? Thanks in advance, -Adam Lundrigan CEO, VPU http://www.vpu-virtual.com/ ICQ # 73617446 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] update from PHP3 to PHP4
Hi, How can I update from PHP3 to PHP4 on an Apache web server? I need to reinstall Apache? Best regards, Rares -- K Free E-mail http://www.k.ro/ by KappaNet http://www.kappa.ro/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] dba_open
HI, I have compiled php4 with the following command: ./configure' '--with-mysql' '--with-apache=../apache_1.3.20' '--enable-track-vars' '--enable-tans-sid' '--enable-dba The function dba_open() does not work for me. I get the following error message: Fatal error: Call to undefined function: dba_open() It is not clear to me how I cause these functions to be available to me. I have perused the online documentation and I have tried several different switches on the command line compilation. All help is greatly appreciated. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Random question selection in PHP w/ MySQL backend.
Adam Lundrigan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What i need to do is select 10 questions from a database (db: vpt, table: questions), and make sure that the same question doesn't appear twice. The questions need to appear in a random order each time the script is loaded. $mysql_connect(host, user, pwd); $result = $mysql_db_query(vpt, SELECT id, txt FROM questions .ORDER BY RANDOM() LIMIT 10 ); function makeQuestion($qid) { return ( input type='radio' name='q[$qid]' value=11 .input type='radio' name='q[$qid]' value=22 .input type='radio' name='q[$qid]' value=33 .input type='radio' name='q[$qid]' value=44 .input type='radio' name='q[$qid]' value=55 ); } function makeRow() { $str = \n\ttr; $num = func_num_args(); for ($i = 0; $i $num; $i++) $str .= \n\t\ttd.func_get_arg($i)./td; $str .= \n\t/tr; return $str; } echo \nform\ntable; while ($row = mysql_fetch_array($result)) echo makeRow(makeQuestion($row[id]), $row[txt]); echo makeRow(input type='reset', input type='submit'); echo \n/table\n/form; Voila - they get ten questions at random, in random order; when they submit the form, you get the question id back as the array key and the answer as the value. Hope that helps ;-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: dba_open
Patrick Callihan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... HI, I have compiled php4 with the following command: /configure' '--with-mysql' '--with-apache=../apache_1.3.20' '--enable-track-vars' '--enable-tans-sid' '--enable-dba The function dba_open() does not work for me. I get the following error message: Fatal error: Call to undefined function: dba_open() If you will use this in many of your scripts, edit php.ini - remove the ';' before 'extension=php_dba.so'. If you'll only use it in a few, look up the dl() function in the manual, http://www.php.net/dl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: dba_open
I don't seem to have the *.so modules available. When I added the line 'extension=php_dba.so' to php.ini, nothing changed. When I tried to use the dl() function, I just got an error message: Warning: Unable to load dynamic library './php_dba.so' - ./php_dba.so: cannot open shared object file: No such file or directory in /home/pat/html I did a 'find / -name php_dba.so' and came up with nothing. Thanks in advance for any help. Hugh Bothwell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Patrick Callihan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... HI, I have compiled php4 with the following command: /configure' '--with-mysql' '--with-apache=../apache_1.3.20' '--enable-track-vars' '--enable-tans-sid' '--enable-dba The function dba_open() does not work for me. I get the following error message: Fatal error: Call to undefined function: dba_open() If you will use this in many of your scripts, edit php.ini - remove the ';' before 'extension=php_dba.so'. If you'll only use it in a few, look up the dl() function in the manual, http://www.php.net/dl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]