[PHP-DB] Re: Problems with displaying results
Terion Miller wrote: I have two queries one pulls out which users to use and the second pulls those users orders Looks something like this but is only pulling the first record: $query = SELECT `UserName`, `AdminID` FROM admin WHERE Key1 = 'YES' ; $result = mysql_query ($query) ; $row = mysql_fetch_assoc($result); //Reveal Variables for Debugging // include(VariableReveal2.php); echo (Hello br); //echo $row['AdminID']; echo ($row['UserName']); if ($row['Key1'] == NO) { header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do not have access to that page.); } if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy = 'WorkOrderID DESC';} if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;} $PerPage = 30; $StartPage = ($Page - 1) * $PerPage; second query here is using the $row from the first (and yes I know not to use *, just did so here to keep post shorter) $sql= SELECT * FROM workorders WHERE AdminID = '.$row['AdminID'].' ; // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage; $result = mysql_query ($sql); $row2 = mysql_fetch_assoc($result); $Total = ceil(mysql_num_rows($result)/$PerPage); So this works but only half way as it only displays the first record in the table. Thanks Terion Happy Freecycling Free the List !! www.freecycle.org Over Moderation of Freecycle List Prevents Post Timeliness. Twitter? http://twitter.com/terionmiller Facebook: a href=http://www.facebook.com/people/Terion-Miller/1542024891; title=Terion Miller's Facebook profile target=_TOPimg src= http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0 alt=Terion Miller's Facebook profile/a Groucho Marx - I have had a perfectly wonderful evening, but this wasn't it. You need to lookup the mysql_fetch_assoc() function. It only returns one row from a result set that may contain multiple rows. You need something like: while($row = mysql_fetch_assoc($result)) { // do something with $row } -- Thanks! -Shawn http://www.spidean.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Hi,
John Jairo Vega Angulo wrote: Hi, How are u doing these days?Yesterday I found a web of a large trading company from china,which is an agent of all the well-known digital product factories,and facing to both wholesalers,retailsalers,and personal customer all over the world. They export all kinds of digital products and offer most competitive and reasonable price and high quality goods for our clients,so i think we you make a big profit if we do business with them.And they promise they will provide the best after-sales-service.In my opinion we can make a trial order to test that. Look forward to your early reply! The Web address:http://www.mwhdy.com/ Hi John Jairo Vega Angulo, I'm doing well. Wow! That's truly awesome! I'm all about promises, let's do a trial order! Happy Independence Day! -Shawn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem Using Sessions
Hey All, I'm fairly new to PHP Programming. I have compiled and installed postgres version 8.0.1, and with that compiled postgres support into my postgres (I'm using PHP version 5.0.4), and I've compiled support for PHP into Apache (version 2.0.53) and all is working (in that I can embed PHP into my HTML documents and get the expected results). Recently I started working on a website in which I would like there to be an administration page where the person who is logged in can add and delete records. I figured that the best way to do this would be to establish a session, (at the login page) then if the user login is successful, I would then register the username and password and redirect the user to the admin page. I chose not to use cookies, b/c everyone may not have cookies enabled on their browser and I didn't want that to be a hurdle that a user would have to jump over. I've written the code but when I try to login to the site I get this message: Warning: Cannot modify header information - headers already sent by (output started at /export/home/www/htdocs/login.php:13) in /export/home/www/htdocs/login.php on line 25 Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Information I've seen on the web for these types of messages would indicate that I don't have a /tmp directory, but such is not the case. Other messages have indicated that my session variables are not getting written to /tmp, but that is not true either, as I have seen them in there...as I see entries such as: sess_ec2249332b8b29863f161461cf8c1409 So, I'm guessing that there aren't problems with my /tmp filesystem. Please excuse the lack of style as I have mainly been trying to hack out something, but plan to clean it up later. My source code for the login page is as follows: ?php session_start(); echo html titleJoshua Generation Login Page/title body bgcolor='#9C9C9C' form action='login.php' method='POST' table border='1' trtdEnter Username:/tdtdinput type='text' name='username'/td/tr trtdEnter Password:/tdtdinput type='text' name='password'/td/tr input type='hidden' name='login' value='1' input type='submit'value='Login' /table /form; if ( $_POST ) { $username = $_POST['username']; $password = $_POST['password']; if ( $username == test $password == test ) { global $username, $password; session_register(username); session_register(password); echo h1Authorized Entry/h1; header(Location: http://joshua1and8.homelinux.org/admin.php;); } else { echo $username; echo br; echo $password; echo br; echo h1Login FAILED/h1; } } echo /body /html; ? My source code for the admin page is as follows: ?php session_start(); global $username, $password; session_register(username); session_register(password); ? html head titleJoshua Generation Admin Page/title /head body bgcolor='#9C9C9C' ?php /* * Radesh N. Singh * Admin Page */ if (isset($username)) { echo h1Joshua Generation Admin's Corner/h1 form action=\admin.php\ method=\POST\ table border=\1\ trtdName/td tdCell Phone/td tdWork Phone/td tdHome Phone/td tdEmail Address/td /tr trtdinput type=\text\ name=\name\//td tdinput type=\text\ name=\cphone\//td tdinput type=\text\ name=\wphone\//td tdinput type=\text\ name=\hphone\//td tdinput type=\text\ name=\emailaddr\//td /tr trinput type=\hidden\ name=\proc\ value=\add\ input type=\submit\ value=\Add Member Records\ input type=\hidden\ name=\proc\ value=\del\ input type=\submit\ value=\Delete Member Records\ /tr /table /form; if ($_POST) { $conn_string = dbname=joshua_generation user=admin password=admin; $conn_hndl = pg_connect($conn_string); switch ($_POST['proc']) { case 'add': $name = $_POST['name']; $cphone = $_POST['cphone']; $wphone = $_POST['wphone']; $hphone = $_POST['hphone']; $emailaddr = $_POST['emailaddr']; /* To add a member a name is all that is needed. Based on the name that is entered, the next nameid will be generated by the dbms, and the insert will be done into: NAMES, PNUMBERS, EMAILADDRS, MBRSTATUS based on that number The default MBRSTATUS.status will be ACTIVE */ $ins_names_stmt = INSERT INTO NAMES VALUES ('nextval('nid'),'; $ins_names_stmt .=
Re: [PHP-DB] Problem Using Sessions. .
that was very helpful...Thank you. One question I have is that I want to ensure that my admin page cannot get accessed unless a variable that was registered upon a successful login has been passed into the session...what can I do to ensure this? Thank you, Shawn On 5/4/05, Patel, Aman [EMAIL PROTECTED] wrote: From the PHP help page on session_register() If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled. I'm assuming since you compiled and installed PHP 5.0.4 that your register_globals is disabled. I wouldn't recommend enabling it to fix this problem. Instead use $_SESSION super global to register session data. So instead of: session_register(username); try this: $_SESSION['username'] = $username; /* TO SET */ $username = $_SESSION['username']; /* TO GET */ Hope this helps, Aman Shawn Singh wrote: Hey All, I'm fairly new to PHP Programming. I have compiled and installed postgres version 8.0.1, and with that compiled postgres support into my postgres (I'm using PHP version 5.0.4), and I've compiled support for PHP into Apache (version 2.0.53) and all is working (in that I can embed PHP into my HTML documents and get the expected results). Recently I started working on a website in which I would like there to be an administration page where the person who is logged in can add and delete records. I figured that the best way to do this would be to establish a session, (at the login page) then if the user login is successful, I would then register the username and password and redirect the user to the admin page. I chose not to use cookies, b/c everyone may not have cookies enabled on their browser and I didn't want that to be a hurdle that a user would have to jump over. I've written the code but when I try to login to the site I get this message: Warning: Cannot modify header information - headers already sent by (output started at /export/home/www/htdocs/login.php:13) in /export/home/www/htdocs/login.php on line 25 Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Information I've seen on the web for these types of messages would indicate that I don't have a /tmp directory, but such is not the case. Other messages have indicated that my session variables are not getting written to /tmp, but that is not true either, as I have seen them in there...as I see entries such as: sess_ec2249332b8b29863f161461cf8c1409 So, I'm guessing that there aren't problems with my /tmp filesystem. Please excuse the lack of style as I have mainly been trying to hack out something, but plan to clean it up later. My source code for the login page is as follows: snip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Looking for help.
A book that has great examples of mysql and php is the book titled: Programming PHP it's an O'Reilly Book and was written by Lerdorf Tatroe... On 5/4/05, Philip Hallstrom [EMAIL PROTECTED] wrote: So to make a long story short, I am now learning mysql and php. I has been a slow and often aggravating process, but we are starting to make some progress. But I need to learn more. Can anyone suggest a really good book, or possibly some tutorial classes I can on line that I can use to learn more about these programs. Online: http://www.hudzilla.org/phpbook/index.php Paper: http://www.php.net/books.php -philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] OCI8 Memory Leak?
Hi folks- I am building an application which uses OCI8 functions (abstracted with PEAR::DB) to perform queries against an Oracle 9i database. Here's my platform info: Solaris 8 (SunOS 5.2) on a Sun Ultra II workstation Oracle 9i PHP 4.3.5RC2-dev Apache 1.3.29 Here's my problem: Everything works well, but over time the Apache httpd processes start to take huge amounts of memory: for instance: I checked this morning and each of the apache processes running were using over 125MB per instance, and the server had slowed to a standstill. The processes upon restart use between 15-20MB per instance. Is there something in the Oracle client configuration or in php/pear that can lead to this sort of memory problem? Any help is greatly appreciated. Shawn
RE: [PHP-DB] OCI8 Memory Leak?
Thanks a lot for the response, Greg. I poked around quite a bit in the PEAR::DB source, and everything at first glance looks OK. Connections are closed properly, etc. After doing a little more digging on the Web, I noticed a mention to remove any reference to SERVER=DEDICATED from Oracle's tnsnames.ora file. I did, and it seems to have helped... though I'm not convinced. Thanks! Shawn -Original Message- From: Greg Skouby [mailto:[EMAIL PROTECTED] Sent: Friday, February 20, 2004 3:28 PM To: Shawn Coomey Subject: RE: [PHP-DB] OCI8 Memory Leak? Hi Shawn, We are using almost the exact same setup that you describe without the PEAR abstraction. We host a moderate sized application on this box and it has performed flawlessly. My first indication, though I don't know why it would be happening, is that there is a problem in the PEAR abstraction level. --Greg -Original Message- From: Shawn Coomey [mailto:[EMAIL PROTECTED] Sent: Friday, February 20, 2004 11:38 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] OCI8 Memory Leak? Hi folks- I am building an application which uses OCI8 functions (abstracted with PEAR::DB) to perform queries against an Oracle 9i database. Here's my platform info: Solaris 8 (SunOS 5.2) on a Sun Ultra II workstation Oracle 9i PHP 4.3.5RC2-dev Apache 1.3.29 Here's my problem: Everything works well, but over time the Apache httpd processes start to take huge amounts of memory: for instance: I checked this morning and each of the apache processes running were using over 125MB per instance, and the server had slowed to a standstill. The processes upon restart use between 15-20MB per instance. Is there something in the Oracle client configuration or in php/pear that can lead to this sort of memory problem? Any help is greatly appreciated. Shawn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Easier Queries
Here's what I'm thinking, just looking to see if anyone has done this or similar. - I have a MySQL DB and I create an ODBC datasource for it on my windows box - I then open MS Access and link the tables from my datasource - Access provides a graphical relationship builder, so I build relations in this - Access also provides a graphical query builder that uses the stored relationships - So I build a query, view the SQL and use the SQL code in some mysql_ PHP functions - Maybe next I instead save the queries in a query table so I can get them via simple name, like 'All_Customers' Sort of analogous to MS SQL Views? Sound good, or is there a better way? TIA -Shawn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and Stored Procedures
Hi, I'm new to this newsgroup, and I can't seem to find this anywhere else, so I thought I would ask. I have a problem getting output from stored procedures through PHP. I am connecting to an MS-SQL server through odbc (easysoft OOB), however this is a flexible environment. What I really need to know is. Is it possible to recieve output from a stored procedure in PHP v 4.0.6 in any environment, and if so, what kind of configuration is required. A big question I know.. but any help what-so-ever is appreciated. Shawn. -- 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]
Re: [PHP-DB] file() fails to read https
Steve, I'm going to assume that you meant I don't think the standard PHP file functions support HTTPS, because they definitely DO support HTTP. Check http://www.php.net/file if you don't believe me. :) As for whether or not PHP support HTTPS, I'm not sure ... but I'd be curious to know the answer to this as well, since I may be doing some projects involving secure servers in the near future. Regards, Shawn - Original Message - From: Steve Sobol [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 7:50 PM Subject: Re: [PHP-DB] file() fails to read https From 'Mark Cain': Yes. I am actually getting real content on the non-secure connection. Yes. The secure connection is really functional on the other server. (I = can actually cut the above address and paste it into the address bar and = get the results that I am expecting.) I don't think the standard PHP file functions support HTTP - you may need to use CURL. (Check the appropriate section of the PHP docs) -- Tired of Earthlink? Get JustTheNet! Nationwide Dialup, ISDN, DSL, ATM, Frame Relay, T-1, T-3, and more. EARTHLINK AMNESTY PROGRAM: Buy a year, get two months free More info coming soon to http://JustThe.net, or e-mail me! B!ff: K3wl, w3'v3 r00t3D da [EMAIL PROTECTED] 0h CrAp, INC0M!Ng $%^NO CARRIER -- 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 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] I know this has been asked before, but....
I can't find the answer to this, I know it's easy. What's the SELECT statment I want to use to find duplicate entries in a specific field? Thanks in Advance! Shawn Sellars