Re: [PHP-DB] PHP4 LDAP
On Wednesday 20 March 2002 17:15, David Christensen wrote: The problem arises when I try to read back all of the attributes within the PHP script. I can see only certain attributes: uid, mail, cn (the normal stuff) but if I try to read these fields that I want to use for the session, they don't print in PHP, but the show up from the LDAP command line util. The fields include: employeeNumber, carLicense, departmentNumber. Like I said earlier, I can update them from PHP, just can't read them back. Try accessing them in lowercase ie. employeenumber There's a note on the ldap man page, it's not very clear but it helped me get at the stuff I needed. matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] order by problem
Thank you all for the Tip ! It works fine now !! :) Gus - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, March 20, 2002 10:32 AM Subject: Re: [PHP-DB] order by problem On Wed, 20 Mar 2002 [EMAIL PROTECTED] wrote: You have your ctrlnumber field defined as varchar. If you define ctrlnumber as number, you could also use SELECT max(ctrlnumber) FROM table WHERE id=14; Cheers Urosh Hello All, Im having a 'problem' that I dont know how to resolve. The problem is: I have a table that I want to get the last number to increment. To do this I want to sort the filed 'ctrlnumber'. Using this querys I get: mysql SELECT ctrlnumber FROM table WHERE id=14; ++ | ctrlnumber | ++ | 7 | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 8 | | 9 | | 10 | | 11 | ++ 11 rows in set (0.00 sec) mysql SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber; ++ | ctrlnumber | ++ | 1 | | 10 | | 11 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | ++ 11 rows in set (0.01 sec) When I try to sort, it doesnt return to me in the order that I need (1 2 3 4 5 6 7 8 9 10 11). Is there a way to do this or Ill have to include 01 02 03 04 05 to all my recoreds ? Thanks in advance, Gus -- 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] Selecting Alphabetically
Hi, Could anyone point me in the right direction with this one please. I have a table of records wit a field of artists. I want to select all the records which begin with the letter a-h then i-p etc What is the best way to do this? Cheers, Jord -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Selecting Alphabetically
select * from sometable where (SUBSTRING(somefield,1,1) in ('a','b','c','d','f','g','h')) AND (SUBSTRING(somefield,2,1) in ('i','j','k','l','m','n','o','p')); Best regards, Andrey Hristov - Original Message - From: Jordan Elver [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 21, 2002 2:05 PM Subject: [PHP-DB] Selecting Alphabetically Hi, Could anyone point me in the right direction with this one please. I have a table of records wit a field of artists. I want to select all the records which begin with the letter a-h then i-p etc What is the best way to do this? Cheers, Jord -- 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] Re: Output of curl to an array.
Hi Keith, I read your post and decided to write a function for you. Basically what it does is does, is take in a string, and optional newline and value separators, and outputs an associative array. It actually works, and has a few comments... so yeah, enjoy.. and thanks for the challenge : ) Adam You can use it like so... PHP Script (of course, you must either have the function on the same page or include() it like so): ?php include('extractPairs.php'); header(Content-Type: text/plain); $strText = Name1=Value1 \n Name2 = Value 2\nName 3 =Value 3; $arrPairs = extractPairs($strText); print_r($arrPairs); ? Output: Array ( [Name1] = Value1 [Name2] = Value 2 [Name 3] = Value 3 ) //= extractPairs.php ?php function extractPairs($strText,$strValueSeparator==,$strNewlineSeparator=\n){ // kill the bad stuff... prevent a meaningless array if (!is_string($strText)){ return array(=); } // gets rid of newlines/spaces etc so we don't get a crap array $strText = trim($strText); // separate each line in an element in an array $arrLines = explode($strNewlineSeparator,$strText); // loop through $arrLines, separating the names/values and placing them in $arrOutput for ($i=0;$icount($arrLines);$i++){ $pos = strpos($arrLines[$i],$strValueSeparator); // get the text before and after the found position // and get rid of the whitespace b4 and after $arrOutput[trim(substr($arrLines[$i],0,$pos))] = trim(substr($arrLines[$i],$pos+1)); } return $arrOutput; } ? Ok, lets say I have some code here: $result = array(); $ch = curl_init (https://www.myverificationplace.com/verify.asp;); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $args); curl_setopt ($ch, CURLOPT_TIMEOUT, 120); // Set the timeout, in seconds. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close ($ch); Now that we see that, how can I make it so that the output from curl, which is in the variable $result, will be an array, for each line of output? Some of the line of output looks like this: ssl_result_message=APPROVED ssl_txn_id=---- ssl_approval_code=00 I need each of the lines to be turned into a variable. Any ideas as to how I might go about this? Thanks, Keith Posehn
[PHP-DB] Relational database
I am trying to get fields from 2 different tables that have the same field name to pull the records from one table For example mysql_connect($DBhost,$DBuser,$DBpass) or die(Unable toconnect to database); mysql_select_db($DBName) or die(Unable to select database $DBName); $sqlquery1 = mysql_query(SELECT Description, Impact, Isolation . FROM ccsd, log WHERE ccsd=log.logccsd); while ($query = mysql_fetch_array($sqlquery1)) { $CCSD = $query[CCSD]; $Description = $query[Description]; $Impact = $query[Impact]; $Isolation = $query[Isolation]; } This code is not working.help please.yes I am a newbie! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Relational database
Try this: SELECT ccsd.Description, ccsd.Impact, ccsd.Isolation FROM ccsd, log WHERE ccsd.logccsd=log.logccsd; You cannot specify a database is = to a row... Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 6:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Relational database I am trying to get fields from 2 different tables that have the same field name to pull the records from one table For example mysql_connect($DBhost,$DBuser,$DBpass) or die(Unable toconnect to database); @mysql_select_db($DBName) or die(Unable to select database $DBName); $sqlquery1 = mysql_query(SELECT Description, Impact, Isolation . FROM ccsd, log WHERE ccsd=log.logccsd); while ($query = mysql_fetch_array($sqlquery1)) { $CCSD = $query[CCSD]; $Description = $query[Description]; $Impact = $query[Impact]; $Isolation = $query[Isolation]; } This code is not working.help please.yes I am a newbie! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: major performance disparities with mysql/php - SOLVED
Nevermind.. I found the problem. My production server is running mysql 3.22.29, and I needed to use a SET SQL_BIG_TABLES=1 in many places to prevent a full table condition. The new server is running 3.23, and once I removed the SQL_BIG_TABLES=1 from the script (and allowed mysql to use memory instead), everything worked as expected. It was a PHP problem afterall - the developer! -Hank __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Relational database
SELECT ccsd.Description, ccsd.Impact, ccsd.Isolation FROM ccsd, log WHERE ccsd.CCSD=log.logccsd I have tried this and the code and now I get to where it include variable from the table, but it is the wrong record??? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Relational database
Is there a way under mysql to identify the last record in a table so that I can pull information that I need from that entry. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Relational database
Ron [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there a way under mysql to identify the last record in a table so that I can pull information that I need from that entry. Um... sort backwards then use the first record (ie LIMIT 1)? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] phpMyAdmin
I'm trying to load phpMyAdmin on, and it seems to work fine, but when I browse a table and run my mouse over the contents of that table I get a jazascript error. Does anyone know a solution for this problem? I doesn't happen in the earlier version of phpMyAdmin .. just this later version. Any help would be great! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Relational database
But can you do that in PHP before you pull info from it -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: phpMyAdmin
Nevermind ... I found the problem! (slamming head against desk) James Kupernik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to load phpMyAdmin on, and it seems to work fine, but when I browse a table and run my mouse over the contents of that table I get a jazascript error. Does anyone know a solution for this problem? I doesn't happen in the earlier version of phpMyAdmin .. just this later version. Any help would be great! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Relational database
What do you mean last record in a table? What are you REALLY trying to do here? Do you want the last entry made according to a specific criteria? -Original Message- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 9:20 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Relational database Is there a way under mysql to identify the last record in a table so that I can pull information that I need from that entry. -- 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
RE: [PHP-DB] Re: Relational database
Huh -Original Message- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 9:30 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Relational database But can you do that in PHP before you pull info from it -- 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
RE: [PHP-DB] Selecting Alphabetically
SELECT * FROM mytable WHERE record_name REGEXP ^[a-h] -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 6:05 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Selecting Alphabetically Hi, Could anyone point me in the right direction with this one please. I have a table of records wit a field of artists. I want to select all the records which begin with the letter a-h then i-p etc What is the best way to do this? Cheers, Jord -- 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] ODBC -- Setting ApplicationID
I am trying to set the ApplicationID, when connecting to an ODBC datasource. I have tried: odbc_setoption ($conn, 1, 1053, PHPAPP); And get a: SQL error: [iODBC][Driver Manager]Option type out of range, SQL state S1092 in SetConnectOption Basically, I want my PHP script to pass the application name to the ODBC server, so that I can set up a mapping on the server that allows write access when a certain application string is sent. PHP 4.06 (with file-upload patch) Openlink ODBC 1.5 Linux Client SCO Informix 5 server TIA- Bruce -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and HTML problems
HI People, I do not use dreamweaver normally, but have to do a few changes and add some php code to this site. I wonder if someone could quickly look at the attached php page, and look at the navigation i use and see why it is looping within the html. Basicall I need the records to look but not the next and previous section for the navigation. If someone could let me know where I am going wrong, as its urgent. It is the html formatting that I think I cannot quite get to grips with. Thanks Barry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: major performance disparities with mysql/php
Hi Henry. I have a suggestion. Run in a seperate window top d 1 with php running or mysql client and compare what happens. I presume that X-windows and similar mem/cpu hogs are disabled. Do post your results please. This should be interesting. Regards, John Henry Hank [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello - I'm posted this to the mysql list but got no response. While it sounds like a mysql problem, I'm convinced that it is a PHP problem (see bottom of note.) I've recently installed mySQL on a RH7.2 box without any problems - it runs great. I've been testing some long running queries (full table scans, etc) under different scenarios, and get wildy differing results. Between each test case, I was flushing all tables and re-starting the mysql deamon. When I run one of my longest queries in the mysql command line client, it runs in about 77 seconds. When I run the identical query via a simple PHP script running on the box, the same query takes about 930 seconds to complete. For the life of me, I can not figure out why the identical query would run differently from the command line than from PHP. I've repeated this test about 10 times just to be sure - and it is entirely repeatable: command line - about a minute - PHP - about 16 times longer. Any ideas or suggestions? I'm running RH 7.2 (2.4.9-21) on a Dell Poweredge 2550, 1GB memory, RAID, with mysql version 3.23.41 (the standard install unchanged from the RH media). Here is the query...pretty simple: insert into summary_table select frb, denom, series, count(*) as cnt, sum(bills) as bills, sum(bills_hit) as bills_hit, sum(total_hits) as total_hits from detail_table If it a memory/cpu resource problem, how do I set RH to give PHP and Apache the same priority as the mysql deamon? I've also written a small Perl script to execute the same queries, and that runs in 70 seconds (same as mysql client), so there must be some memory/processor limitation placed on PHP that prevents it from running as quickly as these other methods. Any ideas/suggestions? Many thanks in advance.. -Hank __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LAST_INSERT_ID()
Hi, In the PHP manual under the function mysql_insert_id() function they have the following line: The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated AUTO_INCREMENT value, and is not reset between queries. How do I get to use the function LAST_INSERT_ID()? When I use it in my php code it is not recognised. Regards, Morten -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] LAST_INSERT_ID()
use mysql_last_id() -Original Message- From: Morten Nielsen [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] LAST_INSERT_ID() Hi, In the PHP manual under the function mysql_insert_id() function they have the following line: The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated AUTO_INCREMENT value, and is not reset between queries. How do I get to use the function LAST_INSERT_ID()? When I use it in my php code it is not recognised. Regards, Morten -- 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
Re: [PHP-DB] Relational database
Try this: SELECT Description, Impact, Isolation FROM ccsd NATURAL JOIN log or SELECT Description, Impact, Isolation FROM ccsd LEFT JOIN log USING(logccsd) Just add on a WHERE conditional to get the required results if necessary. - Original Message - From: Ron [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 21, 2002 5:32 AM Subject: [PHP-DB] Relational database I am trying to get fields from 2 different tables that have the same field name to pull the records from one table For example mysql_connect($DBhost,$DBuser,$DBpass) or die(Unable toconnect to database); @mysql_select_db($DBName) or die(Unable to select database $DBName); $sqlquery1 = mysql_query(SELECT Description, Impact, Isolation . FROM ccsd, log WHERE ccsd=log.logccsd); while ($query = mysql_fetch_array($sqlquery1)) { $CCSD = $query[CCSD]; $Description = $query[Description]; $Impact = $query[Impact]; $Isolation = $query[Isolation]; } This code is not working.help please.yes I am a newbie! -- 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
RE: [PHP-DB] LAST_INSERT_ID()
I mean: mysql_insert_id() -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 2:28 PM To: 'Morten Nielsen'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] LAST_INSERT_ID() use mysql_last_id() -Original Message- From: Morten Nielsen [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] LAST_INSERT_ID() Hi, In the PHP manual under the function mysql_insert_id() function they have the following line: The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated AUTO_INCREMENT value, and is not reset between queries. How do I get to use the function LAST_INSERT_ID()? When I use it in my php code it is not recognised. Regards, Morten -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Resizing images stored in a mysql db
I made a script for retrieving the data of some jpeg images stored in a mysql database.I can get the image and print it on the screen... I have to resize some of them according to their size in order to create thumbnails on the fly. The GetImageSize function receives the image's path or url. As I don't want to have temporary files I created a script that reads the image from an url, (using that url to get the image out of the database). It worked great in my development computer at home, running Red Hat 7.2 and PHP4.0.x. The problem came when I uploaded the application to the final web server, where it can not open the files from an url (don't know why). I checked the urls I'm retrieving and they are all right, in fact they show the images... My problem is how to resize a jpeg image that's stored in the database. This is the whole process: getImage.php?id=x retrieves image x from the database. - and ImageResize gives a timeout when doing $size = getImageSize('http://myserver.com/getImage.php?id=x') Any ideas??? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Temporary MySQL Tables
On Thu, 21 Mar 2002, Georgie Casey wrote: -Hi, - -membership with the username and timestamp in the URL. The users clicks it, -and I run a SQL command that copies the row from tempmembers into the -members table. I assume you are building up all your fields as you move through the site. I would just perform an INSERT into your tempmebers table right away setting whatever fields you have at this point. Then as I pass through each data entry page, I would do UPDATES to that record updating only those new fields, leaving the old ones alone and thus preserved. This way you only have to pass a record ID and the new parameters on each page thus eliminating moving data through the URL. Yuk. Anyway, that's what I would do. - -This process worked well for a while until I discovered if users enter a -single or double quote into any of the fields, it fecks everything up. So I -added an addslashes command but it's all getting a bit hairy so I was -looking for some advice on MySQL temporary tables for either using after -every form or at the end of all the forms. - -Or does anyone have any other method I could use??? Thanks for any help -you might have. - - - --- -PHP General Mailing List (http://www.php.net/) -To unsubscribe, visit: http://www.php.net/unsub.php - ** John Huggins VANet [EMAIL PROTECTED] http://www.va.net/ ** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Temporary MySQL Tables
Hi, On my site now, there's a lengthy register process where the user has to fill in 5 forms, one after the another. I get the PHP script to echo the values from the previous into the next form by using ?php echo input type=\hidden\ name=\name\ value=\ . $name . \; ? for example. Then I keep carrying the information over to each extra form until the user reaches the last page and I insert all the info into a table called tempmembers with an extra timestamp field which I use to verify email addresses. The user gets an email saying click here to verify your membership with the username and timestamp in the URL. The users clicks it, and I run a SQL command that copies the row from tempmembers into the members table. This process worked well for a while until I discovered if users enter a single or double quote into any of the fields, it fecks everything up. So I added an addslashes command but it's all getting a bit hairy so I was looking for some advice on MySQL temporary tables for either using after every form or at the end of all the forms. Or does anyone have any other method I could use??? Thanks for any help you might have. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php