RE: [PHP-DB] Letters loop
Hi, I didn't even think PHP would do anything until I just tried it. ?php for ($i = A; $i = Z; $i++){ echo $i . br /; } ? outputs: A B C X Y Z AA AB AY AX YA YB YY YZ Why it continues after Z is not clear to me, and why it doesn't continue until ZZ isn't either. This works better and (more importantly) as expected: ?php $alfabet = ABCDEFGHIJKLMNOPQRSTUVWXYZ; foreach(preg_split(!!, $alfabet, -1, PREG_SPLIT_NO_EMPTY) as $char) { echo $char . br /; } ? By the way, this code froze my browser: ?php for ($i = A; $i = z; $i++){ echo $i . br /; } ? Jos -Original Message- From: MIGUEL ANTONIO GUIRAO AGUILAR [mailto:[EMAIL PROTECTED] Sent: 26 May 2005 05:38 To: php-db@lists.php.net Subject: [PHP-DB] Letters loop Hi!! I wanna a do a for loop with letters, Is this possible? for ($i = 'A'; $i = 'Z'; $i++){ // code } -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Cel: 9931-6 -- 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] Help!!!
In the second loop you do an array_shift($entry) which should be array_shift($all). Perhaps a foreach loop would be easier: ?php foreach ($entry as $value) { $update = UPDATE accounts SET ctime=NOW() WHERE id_sys=' . $value. '; $results = mysql_query($update, $Prod) or die(mysql_error()); } foreach ($allas $value) { $update = UPDATE accounts SET ctime=NOW() WHERE id_sys=' . $value. '; $results = mysql_query($update, $Prod) or die(mysql_error()); } ? Jos -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: 18 May 2005 22:47 To: php-db@lists.php.net Subject: [PHP-DB] Help!!! This is driving me absolutely nuts!!! I have a page that has some checkboxes that will cause a database update for the selected items. This page is a self referencing form page that never seems to work. I have no idea what I am doing wrong. Here are the code portions that I think are relevant. This is the top of the page here: ?php while(isset($entry[0])) { $redir = set; $tmp = $entry[0]; $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.'; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } while(isset($all[0])) { $redir = set; $tmp = $all[0]; $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.'; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } if (isset($redir)) { header('Location: link address'); } $SBCUID = $_GET['SBCUID']; This is the point at which some queries build the page content ... Lots of stuff clipped ... Here is the guts of what builds the check boxes. Everything displays properly form method=post action=user_details.php ?php while ($list2 = mysql_fetch_assoc($requests_accounts)) { $all[] = $list2['id_sys']; ? tr bgcolor=#CC tddiv align=center?php echo $list2['system']; ?nbsp; /div/td tddiv align=center?php echo $list2['gid']; ?nbsp; /div/td tddiv align=center?php echo $list2['shell']; ?nbsp; /div/td tddiv align=center?php echo $list2['rtime']; ?nbsp; /div/td tddiv align=center?php echo $list2['atime']; ?nbsp; /div/td tddiv align=centerinput name=entry[] type=checkbox value=?php echo $list2['id_sys']; ?/div/td /tr ?php } ;? /table div align=center input type=submit value=Updateinput name=all[] type=submit value=Update All /div /form The initial load of the page displays everything properly. The problem is when I hit the Update or Update All buttons the page reloads, but never actually makes it into the database update loops. I cannot figure out what I am doing wrong here. I have used this kind of code before and I am at a complete loss as to the problem. Please help so I can actually get past this and onto some realy work. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] Showing the next entry
Can you send the query and some code that you're using? You probably want to loop like this: while ($row = mysql_fetch_assoc($cursor)) { echo $row{case_note} . br /; } Jos -Original Message- From: John R. Sims, Jr. [mailto:[EMAIL PROTECTED] Sent: 17 May 2005 03:07 To: php-db@lists.php.net; php_mysql@yahoogroups.com Subject: [PHP-DB] Showing the next entry Hi All, I have developed a script that allows me to select a students name from the client table and display the call information from the case_note table, but the report only shows the first available case_note for an individual. I want this script to display all entries for the specific client in the case_note table. Can anyone point me in the right direction. Keeping the faith in fatherhood John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Select
Hi, Instead of doing a SELECT *, specify the fields that you require. Allthough you may think the rows are exactly the same, one might be empty () and one null which is not the same. You are more likely to get the result that you need if you specify the fields: SELECT DISTINCT somedata, rev, andthis FROM rev ORDER BY rev By the way, having rev as a name for your table AND as a fieldname is confusing and not advisable. Rgds, Jos -Original Message- From: MIGUEL ANTONIO GUIRAO AGUILAR [mailto:[EMAIL PROTECTED] Sent: 17 May 2005 04:26 To: php-db@lists.php.net Subject: [PHP-DB] Select Hi!! I have this query in PHP: $items2 = mysql_query(SELECT DISTINCT * FROM rev ORDER BY rev, $link); I have three rows with the same data on it, and DISTINCT seems to be not working, since I got all the rows, any ideas of what is going wrong? -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel -- 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] Connection Question!
What are you trying to connect to? Do you have a webservice on the second domain? Is it a database - and if so, which? -Original Message- From: JeRRy [mailto:[EMAIL PROTECTED] Sent: 17 May 2005 08:33 To: php-db@lists.php.net Subject: [PHP-DB] Connection Question! Hi, Okay lets say I own www.fred.com (which I don't but still) and www.getpaid2reademails.com (so I own two domain, lucky me!) Now I want to connect from getpaid to fred... Okay I have done this and achieved this but is it possible to reject this operation and deny connections outside of localhost? Also if this is possible what IP is checked, the actual servers as localhost or the user (different IP)? I hope you understand what I mean, just wondering on stricter security. J - Find local movie times and trailers on Yahoo! Movies. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] R6025 Error
Can you also send us the output generated by PHP? Ie the output HTML... Jos -Original Message- From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] Sent: 09 May 2005 10:48 To: PHP DB List Subject: [PHP-DB] R6025 Error Hi all, I'm having a problem with a R6025 error. What happened is that I have a table generated using MySQL and PHP that displays all the registered customers. On the table header, i allow them to click on some links that can sort the table according to their preference. Sometimes, when users click on these sorting links, they get an error: = Microsoft Visual C++ Runtime Library Runtime Error! Program: C:\Program Files\Internet Explorer\IEXPLORE.EXE R6025 - pure virtual function call = when this error appears, the user will have to click OK which closes the browser!! Can someone advice me what i can do?? the links look like that: a href=?=$PHP_SELF;??sort=descsortBy=?=$order;?argmt1=?=$argmt1;?De sc/a a href=?=$PHP_SELF;??sort=ascsortBy=?=$order;?argmt1=?=$argmt1;? Asc/a why should this cause an error??!!! thank you! best regards, hwee hwee -- 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] Where are my form variables?
Hi, If you expect your variables to be generated automatically, you may find that newer versions of PHP have that disabled by default - because it's less secure. Try to read $_POST{formfieldname} to get your data... To quickly find out all the post data that you received: ?php print pre; print_r($_POST); print /pre; ? Jos -Original Message- From: MIGUEL ANTONIO GUIRAO AGUILAR [mailto:[EMAIL PROTECTED] Sent: 03 May 2005 07:41 To: php-db@lists.php.net Subject: [PHP-DB] Where are my form variables? Hi!! I created a form with five text boxes, method=post and action=myscript.php; but I can't see the variables at the target script, why? Do I need a special sintaxis for accesing the POST array? Regards, -- MIGUEL GUIRAO AGUILERA -- 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] Sorting multidimensional arrays from mysql
mysql_fetch_array will always only return 1 row. $array['town'] won't be an array but just a text and is therefor interpreted differently. If you can give us more information (ie data model, output sample) we might be able to help you a bit better. Jos -Original Message- From: J. Connolly [mailto:[EMAIL PROTECTED] Sent: 02 May 2005 15:42 To: PHP list Subject: [PHP-DB] Sorting multidimensional arrays from mysql Morning all, I am having problems understanding what I need to do. Usually for most of my work, all i need to do is pull the information and place it like this: function office_list(){ global $link; echo tabletr; $sql = SELECT town FROM offices; $result = mysql_query($sql, $link); while ($array = mysql_fetch_array($result)){ $office = $array['town']; $state = $array['state']; $zip = $array['zip']; echo td$office/td td$state/td td$zip/td; } echo /tr/table; } But now I need to separate the information in order to build a more complex table. I do not understand how to obtain each cell. I have a fixed number so it will never change. I thought multidimensional arrays came as array[0][0], but when i try $office = $array['town'][0] I just get the first letter of that office. If someone could point me in the right direction I'd greatly appreciate it. I think I just do not know the terminology I am looking for. The PHP manual keeps brining me to pages that are not what I need. Thank you, jozef -- 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] Aggregate MySQL functions in html table via php - ha ving problems
Hi, Since you're telling mysql Avg(RawData) as Mn the index in $myrow won't be Avg(RawData), it'll just be Mn. Try printing the entire $myrow to find out what you're receiving from mysql: print pre; print_r($myrow); print /pre; That will show you the keys that you should use. Jos -Original Message- From: Finner, Doug [mailto:[EMAIL PROTECTED] Sent: 02 May 2005 16:05 To: php-db@lists.php.net Subject: [PHP-DB] Aggregate MySQL functions in html table via php - having problems I want to build a table that is populated from a MySQL query and have the table include some aggregate data (mean, sd, and cv). If I select 'avg(RawData) as Mn' - and then stuff Mn into the table - life is good. If I try and select just RawData and computed the mean and sd at the time the table is created, I get an error 'Unidentified index: avg(RawData) in php file name at line where I try and do the avg and sd The format used below that does not work came from a suggestion by Oli (the original suggestion used echo rather than printf, but it seems to me the concept should be identical - am I wrong here???). I have a working method so I am in good shape, I'm just trying to learn other ways to get the same result. Any tips or pointers are appreciated. Doug /// Query for STATISTICAL data / $sql = SELECT RunID, ItemSN, RawDataDesc, ReasonRun, RawData, //note, I've tried with including and excluding RawData from this query - no change in the error Avg(RawData) as Mn, Std(RawData) as SD, //note, I've tried leaving this line in and taking it out - no change in the error. (Std(RawData)/Avg(RawData) * 100) as CV FROM $table Where RawData != 'Passed' and RawData != 'Failed' Group By RawDataDesc; echo brbr; $result = mysql_query($sql, $link) or die(mysql_error()); echo This is the statistical data report for Item: $table brbr; echo table border=1\n; echo trtdRunID/tdtdItemSN/tdtdRunReason/tdtdDesc/td td BGCOLOR='33FF99'Mean/tdtd BGCOLOR='99FFCC'SD/tdtd BGCOLOR='FFCC66'CV/tr\n; while($myrow = mysql_fetch_assoc($result)) { printf(trtd%s/tdtd%s/tdtd%s/tdtd%s/td td BGCOLOR='33FF99'%.1f/tdtd BGCOLOR='99FFCC'%.2f/tdtd BGCOLOR='FFCC66'%.2f/tr\n, $myrow['RunID'], $myrow['ItemSN'], $myrow['ReasonRun'], $myrow['RawDataDesc'], $myrow['Mn'], $myrow['SD'], $myrow['CV']); // this works fine every time //$myrow['avg(RawData)'], $myrow['std(RawData)'], $myrow['CV']); // this was suggested by someone on this list but returns Unidentified index: avg(RawData) in php file name at line this line when uncommented and used } echo /table\n; ___ This e-mail message has been sent by Kollsman, Inc. and is for the use of the intended recipients only. The message may contain privileged or confidential information. If you are not the intended recipient you are hereby notified that any use, distribution or copying of this communication is strictly prohibited, and you are requested to delete the e-mail and any attachments and notify the sender immediately. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Sorting multidimensional arrays from mysql
In that case the best way is to read all the data at once. Something like this: // first read all the data $sql = SELECT street, town, state, zip, phone FROM offices; $result = mysql_query($sql, $link); $all_data = array(); while ($this_row = mysql_fetch_array($result)){ array_push($all_data, $this_row); } // then create the HTML echo table; echo tr; foreach ($all_data as $this_row) { echo th . $this_row{town} . /th; } echo /tr; echo tr; foreach ($all_data as $this_row) { echo td . $this_row{town} . /td; } echo /tr; echo tr; foreach ($all_data as $this_row) { echo td . $this_row{street} . , . $this_row{state} . . $this_row{zip} . /td; } echo /tr; echo tr; foreach ($all_data as $this_row) { echo tdPhone: . $this_row{phone} . /td; } echo /tr; echo /table; Jos PS: Please always reply to [EMAIL PROTECTED] -Original Message- From: J. Connolly [mailto:[EMAIL PROTECTED] Sent: 02 May 2005 16:14 To: Juffermans, Jos Subject: Re: [PHP-DB] Sorting multidimensional arrays from mysql I have the data which comes out like this from a select all statement 1, 1510 New State Highway (Rte. 44),Raynham, MA,2767 2, 646 Washington St., South Easton,MA,2375 3, 47 Broad St., Bridgewater, MA,2324 4, 605 Belmont St.,Brockton,MA,2301 5, 662 Main St., Falmouth,MA,2540 I need to be able to pull out certain cells when necessary and place them in a table. When I need to fetch one entire row, it is no problem. I just do not understand how to define each cell as unique. Perhaps this is not possible? I need the data to be inputted something like: th Easton /th th Raynham /th /tr tr td 646 Washinton Street /td td 1510 New State Highway (Rte.44) /td /tr tr td South Easton, MA 02375 /td td Raynham, MA 02767 /td /tr tr td Phone: (508) 238-8400 /td td Phone: (508) 822-7444 /td /tr thanks, jozef Juffermans, Jos wrote: mysql_fetch_array will always only return 1 row. $array['town'] won't be an array but just a text and is therefor interpreted differently. If you can give us more information (ie data model, output sample) we might be able to help you a bit better. Jos -Original Message- From: J. Connolly [mailto:[EMAIL PROTECTED] Sent: 02 May 2005 15:42 To: PHP list Subject: [PHP-DB] Sorting multidimensional arrays from mysql Morning all, I am having problems understanding what I need to do. Usually for most of my work, all i need to do is pull the information and place it like this: function office_list(){ global $link; echo tabletr; $sql = SELECT town FROM offices; $result = mysql_query($sql, $link); while ($array = mysql_fetch_array($result)){ $office = $array['town']; $state = $array['state']; $zip = $array['zip']; echo td$office/td td$state/td td$zip/td; } echo /tr/table; } But now I need to separate the information in order to build a more complex table. I do not understand how to obtain each cell. I have a fixed number so it will never change. I thought multidimensional arrays came as array[0][0], but when i try $office = $array['town'][0] I just get the first letter of that office. If someone could point me in the right direction I'd greatly appreciate it. I think I just do not know the terminology I am looking for. The PHP manual keeps brining me to pages that are not what I need. Thank you, jozef -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: SQL or array ?
Hi, I'd just like to point out that one important option was overlooked: You could create a SQL query which would read the folders AND the mimetype/icon info at the same time. This means that you can have your database do most of the work for you which normally means it's faster. Rgds, Jos -Original Message- From: Simon Rees [mailto:[EMAIL PROTECTED] Sent: 24 April 2005 18:52 To: php-db@lists.php.net Cc: Paul Reilly Subject: Re: [PHP-DB] Re: SQL or array ? On Sunday 24 April 2005 12:25, Paul Reilly wrote: How would I go about benchmarking the different options? What tools are there to do this? a) time the script - quick, dirty and inaccurate but may provide an indicative result. b) use a profiler, which can be more interesting as it will show the CPU time taken by various parts of the script. I've used Xdebug for profiling and found it useful. Have a look at http://www.php.net/debugger for this and other options (I assume the other debuggers have profiling support). Simon -- ~~ Simon Rees | [EMAIL PROTECTED] | ORA-03113: end-of-file on communication channel ~~ -- 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] Too many $_GETs?
As far as I know there is no limit on the amount of variables, however there is a limit on the length of the URL including query (I believe 256 characters). Normally I would use hidden fields in a form (method POST) for this kinda stuff. Jos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 25 April 2005 16:49 To: php-db@lists.php.net Subject: [PHP-DB] Too many $_GETs? Is there a point where a link in a PHP/MySQL-based site has too many $_GET variables attached to it? I use the format index.php?a=1b=2c=3e=4 to pass variables from page to page, and am wondering where the limit is on such a format. Right now, eight variables are passed, each being one to four characters in length. It's the best way I know to keep varaiables alive from page to page in a situation where the user does not use cookies, but I'm worried that too many $_GETs will slow down the server, cause trouble with the page, and possibly cause problems that I have not yet seen. Comments? Suggestions? Thanks in advance for any feedback. -v- -- 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] mixing charactersets
Hi, I have a script that needs to connect to two database. Unfortunately, one of them uses US7ASCII encoding (similar to LATIN1) and the other one uses UTF-8 encoding. Before I connect to the first one, I set these environment variables: putenv(NLS_LANG=AMERICAN_AMERICA.US7ASCII); putenv(NLS_CHARACTERSET=US7ASCII); and before I connect to the second one, I set these environment variables: putenv(NLS_LANG=AMERICAN_AMERICA.UTF8); putenv(NLS_CHARACTERSET=UTF8); I have noticed that once you have set the environment, it ignores (or seems to ignore anyway) the second one. I have tried to set the environment each time just before I connect and also just before I do a query, but that doesn't make a difference. If I don't set the characterset to US7ASCII before I retrieve data from the first database, I get garbage data from the query. If I don't set the characterset to UTF-8 before I store data to the second database, it stores garbage. How can I use those two databases in one script? Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] OCI Binding problem
Hi, Imagine this code: ?php $database_connection = ocilogon(username, password, connection string); // the actual connection code is slightly different but that is not relevant to my problem $postalcode = 3055; // option 1: paste the postalcode into the query: $rowset1 = array(); $statement1 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=' . $postalcode . '); ociexecute($statement1); ocifetchstatement($statement1, $rowset1, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset1 contains some records from the table // option 2: use namebinding: $rowset2 = array(); $statement2 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=:postalcode); ocibindbyname($statement2, :postalcode, $postalcode, 4); ociexecute($statement2); ocifetchstatement($statement2, $rowset2, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset2 is still an empty array ? Both queries should result in the same data but as soon as I use the binding no rows are returned. I can't see what I'm doing wrong here. Can someone help me? Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] OCI Binding problem
Hi, Since flags are normally bitmaps, FLAG1 | FLAG2 should have the same result as FLAG1 + FLAG2. I've tried your suggestion anyway but it had no result. I've also tried to uppercase :postalcode (in the query and in the bindbyname call) but that didn't help either. Jos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 13:40 To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] OCI Binding problem Sorry, trigger happy. Also try :postalcode in uppercase. Neil -Original Message- From: Juffermans, Jos [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 12:18 To: 'php-db@lists.php.net' Subject: [PHP-DB] OCI Binding problem Hi, Imagine this code: ?php $database_connection = ocilogon(username, password, connection string); // the actual connection code is slightly different but that is not relevant to my problem $postalcode = 3055; // option 1: paste the postalcode into the query: $rowset1 = array(); $statement1 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=' . $postalcode . '); ociexecute($statement1); ocifetchstatement($statement1, $rowset1, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset1 contains some records from the table // option 2: use namebinding: $rowset2 = array(); $statement2 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=:postalcode); ocibindbyname($statement2, :postalcode, $postalcode, 4); ociexecute($statement2); ocifetchstatement($statement2, $rowset2, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset2 is still an empty array ? Both queries should result in the same data but as soon as I use the binding no rows are returned. I can't see what I'm doing wrong here. Can someone help me? Jos -- 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] Recall: [PHP-DB] OCI Binding problem
Juffermans, Jos would like to recall the message, [PHP-DB] OCI Binding problem. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] OCI Binding problem
Update: I've found a workaround: ?php $database_connection = ocilogon(username, password, connection string); // the actual connection code is slightly different but that is not relevant to my problem $postalcode = 3055; $rowset2 = array(); $statement2 = ociparse($database_connection, SELECT services FROM location WHERE postalcode='' || :postalcode); ocibindbyname($statement2, :postalcode, $postalcode, 4); ociexecute($statement2); ocifetchstatement($statement2, $rowset2, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // this returns the records ? Somehow Oracle will interpret the :postalcode as a numeric value in this case, eventhough the column is a varchar. By adding '' || Oracle converts it to a string. Jos -Original Message- From: Juffermans, Jos [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 14:05 To: 'php-db@lists.php.net' Subject: RE: [PHP-DB] OCI Binding problem Hi, Since flags are normally bitmaps, FLAG1 | FLAG2 should have the same result as FLAG1 + FLAG2. I've tried your suggestion anyway but it had no result. I've also tried to uppercase :postalcode (in the query and in the bindbyname call) but that didn't help either. Jos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 13:40 To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] OCI Binding problem Sorry, trigger happy. Also try :postalcode in uppercase. Neil -Original Message- From: Juffermans, Jos [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 12:18 To: 'php-db@lists.php.net' Subject: [PHP-DB] OCI Binding problem Hi, Imagine this code: ?php $database_connection = ocilogon(username, password, connection string); // the actual connection code is slightly different but that is not relevant to my problem $postalcode = 3055; // option 1: paste the postalcode into the query: $rowset1 = array(); $statement1 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=' . $postalcode . '); ociexecute($statement1); ocifetchstatement($statement1, $rowset1, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset1 contains some records from the table // option 2: use namebinding: $rowset2 = array(); $statement2 = ociparse($database_connection, SELECT services FROM location WHERE postalcode=:postalcode); ocibindbyname($statement2, :postalcode, $postalcode, 4); ociexecute($statement2); ocifetchstatement($statement2, $rowset2, 0, 100, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); // at this stage $rowset2 is still an empty array ? Both queries should result in the same data but as soon as I use the binding no rows are returned. I can't see what I'm doing wrong here. Can someone help me? Jos -- 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
RE: [PHP-DB] PHPMySQL left/substring etc problem
If you do "SELECT LEFT(loc1,3) FROM openart_table" the column name in $row (Bis probably not "loc1". Try this: "SELECT LEFT(loc1,3) AS loc1 FROM (Bopenart_table". Also, after the fetch you can do some debuggin thru this: (B (B?php (B$row = mysql_fetch_assoc($result); // change $result to your own (Bcursor variable (Bprint "pre"; print_r($row); print "/pre"; (B? (B (BThat prints out a list of all the keys and values of $row and tells you what (Bcolumns you're receiving (and their names). (B (BJos (B (B-Original Message- (BFrom: Sugimoto [mailto:[EMAIL PROTECTED] (BSent: 19 April 2005 07:58 (BTo: php-db@lists.php.net (BSubject: [PHP-DB] PHPMySQL left/substring etc problem (B (B (BHello, (BI need your help about PHP (ver 4.3.1) and MySQL (ver 3.23) database. (BI am struggling to customise a database (using left command etc), and am (Bstuck now. (BPlease have a brief look at my scripts below. (B (BWhat I do like to do is to get first 3 letters from "loc1" column from (Bopenart_table (MySQL). (BAnd show the data in the follwoing part... (B td? echo $row["loc1"]; ?br/td (B (Bbut also I would like to make hyperlinks to jpg files to images/"the first 3 (Bletters from loc1".jpg (BSo it will be something like this... (B td (B a href="/image/? echo $row["loc1"]; ?.jpg"? echo $row["loc1"]; (B?/abr (B /td (B (BBut when I tried, "select left (loc1,3) from openart_table where.." (Bdoesnt work properly. (BI do not want to destroy anything for the rest of the table. (BI need all data from "tit1", "pub1", "id1", and "ref1" in each column. (B (BCould you help me, please? (B (B-PHP script from here (Bhtml (Bbody (Btable border="1" bordercolor="black" cellspacing="0" align="center" (BBGCOLOR="#CC" width="900" (Btr bgcolor="#ffcc66" (Btd align="center"bID No/bbr/td (Btd align="center" BGCOLOR="#CC3366"bBook Title/bbr/td (Btd align="center"bPublisher/bbr/td (Btd align="center"bID/bbr/td (Btd align="center"bReference/bbr/td (Btd align="center" width="10%"bLocation/bbr/td (B/tr (B (B? (Bmysql_connect(localhost,root,cheers); (Bmysql_select_db(openart); (Bif($tit == "" (B $res == "" (B $pub == "" (B $date == "" (B $id == "" (B $ref == "" (B $loc == "" (B $type == "" (B $vol == "" (B $fre == "" (B $note == "") (B{ (B echo 'Type something'; (B} (B (Belseif($tit == "%" || $res == "%" || $pub == "%" || $date == "%" || $id == (B"%" || (B $ref == "%" || $loc == "%" || $type == "%" || $vol == "%" || $fre == (B"%" || $note == "%"){ (B echo 'Not Valid'; (B} (B (Belse{ (B if($tit == ""){ (B$tit = '%'; (B } (B if($res == ""){ (B$res = '%'; (B } (B if($pub == ""){ (B$pub = '%'; (B } (B if($date == ""){ (B $date = '%'; (B } (B if($id == ""){ (B $id = '%'; (B } (B if($ref == ""){ (B$ref = '%'; (B } (B if($loc == ""){ (B$loc = '%'; (B } (B if($type == ""){ (B$type = '%'; (B } (B if($vol == ""){ (B$vol = '%'; (B } (B if($fre == ""){ (B$fre = '%'; (B } (B if($note == ""){ (B$note = '%'; (B } (B$result = mysql_query("select * from openart_table (B where tit1 like '%$tit%' (B and res1 like '%$res%' (B and pub1 like '%$pub%' (B and date1 like '%$date%' (B and id1 like '%$id%' (B and ref1 like '%$ref%' (B and loc1 like '%$loc%' (B and type1 like '%$type%' (B and vol1 like '%$vol%' (B and fre1 like '%$fre%' (B and note1 like '%$note%' order by tit1"); (B (B$rows = mysql_num_rows($result); (B echo $rows,"Records Found p"; (B while($row = mysql_fetch_array($result)){ (B ? (B tr (B tda href = "openart_detail.php ?iden=? echo $row["openart_id"] ?"? (Becho $row["openart_id"]; ?/abr/td (B td? echo $row["tit1"]; ?br/td (B td? echo $row["pub1"]; ?br/td (B td? echo $row["id1"]; ?br/td (B td? echo $row["ref1"]; ?br/td (B td? echo $row["loc1"]; ?br/td (B /tr (B ? (B } (B} (B? (B/table (B/body (B/html (B (Bend of script (B (B-- (BPHP Database Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php (B (B-- (BPHP Database Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySql and PHP question
Hi, I'm afraid I can't help you with the query - I'm used to Oracle which as a bigger set of SQL commands. I can help you with your PHP question. If you want to put a variable in a query, you can add the variable directly into the string: $sql_query = select zg_longitude from zip_code where zg_zipcode = '$zipcode'; Or (my favorite choice) you can break the string and add the variable with .'s: $sql_query = select zg_longitude from zip_code where zg_zipcode = ' . $zipcode . '; With the first option, it is not always clear what is the variable and what not. Jos -Original Message- From: ReClMaples [mailto:[EMAIL PROTECTED] Sent: 07 April 2005 06:04 To: PHP Subject: [PHP-DB] MySql and PHP question All, I have a question as how I can return some results that I am looking for. Ideally I'd like to run this sql statement but for some reason MySql won't allow me to run it: SELECT * FROM zip_code WHERE zg_latitude between ((select zg_latitude from zip_code where zg_zipcode = '78730')- 2) and ((select zg_latitude from zip_code where zg_zipcode = '78730') + 2) and zg_longitude between ((select zg_longitude from zip_code where zg_zipcode = '78730') - 2) and ((select zg_longitude from zip_code where zg_zipcode = '78730') + 2) I get an error to check the mysql manual. This statement runs in an oracle environment though. I guess I am stuck with writing multiple queries and them tying them together. In PHP how can I put a variable into the sql statement (if that's possible). Let's say I have these queries: select zg_longitude from zip_code where zg_zipcode = '78730' This one pulls the zg_longitude from the zip_code table where the zip_code is 78730 for instance. I want to take the result (one record) and put it in this sql statment replacing 'result here': select * from zip_code where zg_longitude = ('result here'-2) and zg_longitude = ('result here'+2) order by zg_city asc Can anyone help me with this or point me in a better direction? Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] find a value in entire table...
Hi, You could do something like this: SELECT 'Accounts' as department, Accounts as id FROM mytable WHERE Accounts IS NOT NULL UNION ALL SELECT 'Human Resources' as department, HR as id FROM mytable WHERE HR IS NOT NULL UNION ALL SELECT 'Support' as department, Support as id FROM mytable WHERE Support IS NOT NULL UNION ALL SELECT 'Marketing' as department, Marketing as id FROM mytable WHERE Marketing IS NOT NULL Replace mytable with your tablename. I know it works on Oracle and I've just tested in on MySql and that works good too. The query above returned this: department | id | Accounts| 23 Accounts| 19 Human Resources | 17 Support | 17 Marketing | 4 Jos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 14:52 To: php-db@lists.php.net Subject: [PHP-DB] find a value in entire table... I need to search an entire table for a value, and then report back what field it was found in... how on earth do I do that? I've a list of departments, as field names. whenever a user interacts with that Dpet, I wanna add thier id No to the appropriate field. so I'll be left with a table that looks like this: | Accounts | HR | Support | Marketing | | 23 | | | | | | 17 | | | | | | 17 | | | 19 | | | | | | | | 4 | So User 17 has dealt with HR and Support, and user 23 has dealt with only Accounts. So I wanna input an user ID no, and then get told what Dpets have been accessed... I need to learn this, as I know it's simple, but I've never had to do it before! Tris -- 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] One more GD ? -- filename
Hi, If I understand correctly, you're using include/function_gd.php?route_photo=$thumb as image source which is the script you pasted. If you use a script as image source, the script should output the image data - not just store the image. I'm not sure what you're trying to do but if you have an image object in php (eg $thumb), you should output that image: ?php $thumb = ImageCreateTrueColor($new_width, $new_height); $tmp_image = ImageCreateFromJPEG(../images/climbs/$route_photo); ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); header(Content-type: image/jpeg); // tell the browser to expect a JPG imagejpeg($thumb, , 100); // send the image to the browser (filename= = output instead of save) exit(); ? However, you cannot use that to show multiple images from 1 script. Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 15:24 To: php-db@lists.php.net Subject: [PHP-DB] One more GD ? -- filename Thanks everyone for answering my other post. However, I'm still having trouble passing the image name from the GD script to the image tag. I'm including the GD script below. Any help would be great. Thanks - Craig //GD script ?php include (db.php); $query = SELECT route_photo FROM routes WHERE route_photo IS NOT NULL ORDER BY RAND() LIMIT 1; $result = mysql_query($query, $db) or die(mysql_error()); while($row = mysql_fetch_array($result)) { //Photo varibale $route_photo = $row[route_photo]; //Start GD //New Image resize $new_width = 125; $new_height = 225; //Content Type header(Content-type: image/jpeg); //Start new image resize list($width_orig, $height_orig) = getImageSize(../images/climbs/$route_photo); if ($new_width ($width_orig $height_orig)) { $new_width = ($new_height / $height_orig) * $width_orig; } else { $new_height = ($new_width / $width_orig) * $height_orig; } //resample the image $thumb = ImageCreateTrueColor($new_width, $new_height); $tmp_image = ImageCreateFromJPEG(../images/climbs/$route_photo); ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); ImageJPEG($thumb, $route_photo, '100'); ImageDestroy($thumb); } ? //Image Tag: echo (img src='include/function_gd.php?route_photo=$thumb' align='center' id='image'); -- 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] One more GD ? -- filename
Hi, Are you trying to display more images at once then? You can store the image like you do now, then have the GD script output the image tag and use the image you've just stored as a source. GD script: ... ImageJPEG($thumb, $route_photo, '100'); echo 'img src=$route_photo width=125 height=225 border=0 title=$route_photo alt=$route_photo /';// add this line ImageDestroy($thumb); ... in the other script instead of echo (img src='include/function_gd.php?route_photo=$thumb' align='center' id='image'); do this: require(include/function_gd.php?route_photo=$thumb); Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 18:12 To: php-db@lists.php.net Cc: Juffermans, Jos Subject: Re: [PHP-DB] One more GD ? -- filename Hi Jos, I understand what your saying. The problem is all the image names are listed in the DB (image.jpg, image1.jpg and so on) and all images have titles attached. For example, Title: Large Green Sea Turtle Image: LargeGreenSeaTurtle.jpg As you can see, the GD script randomly pulls photo names from the DB and shows them. When I output the image with using the image tag I get a blank variable. img src='include/function_gd.php?route_photo=' '' height='x' width='x' align='center' id='image' Since the image name is empty, I can not match/query the title and image. The image output may be showing a Blue Sea Turtle but the title says, Green Sea Turtle. If I could just get the image name, I could run a query to match them. Does this make sense? On Apr 6, 2005, at 10:36 AM, Juffermans, Jos wrote: Hi, If I understand correctly, you're using include/function_gd.php?route_photo=$thumb as image source which is the script you pasted. If you use a script as image source, the script should output the image data - not just store the image. I'm not sure what you're trying to do but if you have an image object in php (eg $thumb), you should output that image: ?php $thumb = ImageCreateTrueColor($new_width, $new_height); $tmp_image = ImageCreateFromJPEG(../images/climbs/$route_photo); ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); header(Content-type: image/jpeg); // tell the browser to expect a JPG imagejpeg($thumb, , 100); // send the image to the browser (filename= = output instead of save) exit(); ? However, you cannot use that to show multiple images from 1 script. Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 15:24 To: php-db@lists.php.net Subject: [PHP-DB] One more GD ? -- filename Thanks everyone for answering my other post. However, I'm still having trouble passing the image name from the GD script to the image tag. I'm including the GD script below. Any help would be great. Thanks - Craig //GD script ?php include (db.php); $query = SELECT route_photo FROM routes WHERE route_photo IS NOT NULL ORDER BY RAND() LIMIT 1; $result = mysql_query($query, $db) or die(mysql_error()); while($row = mysql_fetch_array($result)) { //Photo varibale $route_photo = $row[route_photo]; //Start GD //New Image resize $new_width = 125; $new_height = 225; //Content Type header(Content-type: image/jpeg); //Start new image resize list($width_orig, $height_orig) = getImageSize(../images/climbs/$route_photo); if ($new_width ($width_orig $height_orig)) { $new_width = ($new_height / $height_orig) * $width_orig; } else { $new_height = ($new_width / $width_orig) * $height_orig; } //resample the image $thumb = ImageCreateTrueColor($new_width, $new_height); $tmp_image = ImageCreateFromJPEG(../images/climbs/$route_photo); ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); ImageJPEG($thumb, $route_photo, '100'); ImageDestroy($thumb); } ? //Image Tag: echo (img src='include/function_gd.php?route_photo=$thumb' align='center' id='image'); -- 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
RE: [PHP-DB] Why does this code/query hang time out ?
i Rene, So far, I have found a few mistakes in your SQL: $query .= OR `variant` LIKE '%.$_GET['search'].%'; Why do you have backtick-quotes around variant? Know that backticks are used to call system commands. You also use these backticks in the ORDER BY lines. My guess is the backticks are causing your problems. $query .= AND make.makeID='.$_GET['make'].'; ... $query .= AND make.makeID0; If make.makeID is a number field, why is the value in quotes for the cases where $_GET['make'] is set? Same with socket.socketID a few lines down. Unrelated but very important, putting form variables (either GET or POST) directly into a query is dangerous. If I create a copy of your form and fill $_GET['search'] with eg: a%';DELETE * FROM model;SELECT * FROM model WHERE something LIKE '%a Your query will be like this: SELECT .. FROM WHERE AND model.modelName LIKE '%a%';DELETE * FROM model;SELECT * FROM model WHERE something LIKE '%a OR VARIANT You can't trust incoming variables. Jos -Original Message- From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED] Sent: 31 March 2005 23:43 To: php-db@lists.php.net Subject: [PHP-DB] Why does this code/query hang time out ? Hi gang My CPU database (http://metalbunny.net/computers/cpudb.php) - still a work in progress - used to be in 1 table, but for several reasons I've decided it's better to split the data into multiple related tables. Obviously this means I have to rewrite the query tool for it, and that's where my problem lies. I've included the code I'm working with below, it's a little different than the one for the above URL, as it uses my new faster templates and relies more on the database than the old code did. All the DB connect stuff is in the template, and I use MySQL. The new version isn't available online, it's only on my local development server. I'm pretty sure it's simply a coding problem, but for the life of me I can't find anything that looks wrong ... but then I've been staring at it for hours... My problem came after I tried making it possible to pick 'all' as a search option in make model, and now, nomatter whether it's set to all or not, and nomatter what's in the search field, the code stalls and hangs ... and in the last tries, Firefox ended up closing down ... I tried putting athlon in the search box, and just leave everything on default, and the generated query looks like this: SELECT make.makeID,makeName,model.modelID,modelName,fsb2,socket.socketID,socketName ,cpuID,variant,clock,multi,fsb,l1,l2,l3,vcore,vcache FROM cpu_maker AS make,cpu_model AS model,cpu_socket AS socket,cpu_cpus AS cpu WHERE make.makeID=model.makeID AND socket.socketID=model.socketID AND cpu.modelID=model.modelID AND model.modelName LIKE '%athlon%' OR `variant` LIKE '%athlon%' AND make.makeID0 AND socket.socketID0 Leaving the search box empty produces no result - it's an unintended leftover from the old code that I haven't found a good way to get around yet. The code I'm working on looks like this (beware, it's rather long): ?php // load dependencies require('../include/sql.php'); // set data for template $section = 'tools'; $style2 = 'cputables.css'; $title = 'CPU Database'; $menu = true; // begin to build query string $query = 'none'; $basequery = 'SELECT make.makeID,makeName,model.modelID,modelName,fsb2,socket.socketID,socketName ,cpuID,variant,clock,multi,fsb,l1,l2,l3,vcore,vcache FROM cpu_maker AS make,cpu_model AS model,cpu_socket AS socket,cpu_cpus AS cpu WHERE make.makeID=model.makeID AND socket.socketID=model.socketID AND cpu.modelID=model.modelID'; // part 1, search parameters if (! empty($_GET['search'])) { $query = $basequery; $setorder = true; $query .= AND model.modelName LIKE '%.$_GET['search'].%'; $query .= OR `variant` LIKE '%.$_GET['search'].%'; if ($_GET['make'] != 'all') { $query .= AND make.makeID='.$_GET['make'].'; } else { $query .= AND make.makeID0; } if ($_GET['socket'] != 'all') { $query .= AND socket.socketID='.$_GET['socket'].'; } else { $query .= AND socket.socketID0; } $linkquery = substr($_SERVER['QUERY_STRING'],0,strpos($_SERVER['QUERY_STRING'], 'order')); } // part 2, sort order if ($setorder) { switch ($_GET['order']) { case 'socket': $query .= ' ORDER BY `socketName`'; break; case 'vcache': $query .= ' ORDER BY `vcache`'; break; case 'vcore': $query .= ' ORDER BY `vcore`'; break; case 'l2': $query .= ' ORDER BY `l2`'; break; case 'l1': $query .= ' ORDER BY `l1`'; break; case 'fsb': $query .= ' ORDER BY `fsb`'; break; case 'multi': $query .= ' ORDER BY `multi`'; break; case 'clock': $query .= ' ORDER BY `clock`'; break; case 'variant': $query .= ' ORDER BY `variant`'; break;
RE: [PHP-DB] database connection timeout
Hi, Martin Norland wrote: MN I'm afraid phrasing a question multiple ways over a course of days tends MN not to have much success. In an effort to avoid populating google with MN just the question, I will give to you what I would try. I understand your point but since I wasn't getting any response and never received a confirmation email from the system telling me that my email account had been verified, I wasn't sure that the original post was actually sent to the community. Oddly enough I got an email from the system this morning asking me to verify my email address - again :s Anyway, at least this time it triggered a response ;) MN Is it that it's not always available, or that it needs time to 'come MN back up'. You may want to try running some random low-traffic MN application over it to make sure it remains running. Some simple SNMP MN protocol or even simpler just connect to a remote GKrellM. Heck, a ssh MN connection with top running would do - just something that is constantly MN transmitting a trickle of data. The VPN connection is not always available. I'm afraid I don't have much control over the VPN myself and I believe only the Oracle port has been opened in this VPN. MN Essentially, you want ocilogon (complex network function to login to a MN networked Oracle [in this case] server) to timeout just like fsockopen MN (fairly simple function to open a socket, including network resources). MN My suggestion is to try connecting using fsockopen, with the timeout. MN If it successfully connects - chances are, the majority of the time, MN your ocilogon that follows will work as well. That's a good idea, I'll try to connect to the Oracle port thru fsockopen. MN Another dirty little trick you might use is running the ocilogon in a MN separate script and making use of set_time_limit() to make sure it MN doesn't run too long. Just be sure not to set_time_limit() for your MN whole set of scripts, unless you really want them to abort after the 5 MN or 10 second limit you're setting ocilogon (unlikely). I'm not sure if I can set the time limit (safemode...) but are you saying that set_time_limit only affects the script that you include and not the caller script? I'll try the fsockopen connection test on the oracle port. Thanks for your help. Rgds, Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] database connection timeout
Hi, I'm trying to connect to an Oracle database (using ocilogon) which is in a different country and connected to our serverfarm via a VPN (the database has no public access). Unfortunately the VPN or the database is not always available. In those cases I will present the visitor with a page explaining that the service is unavailable. My problem is that ocilogon takes a long time to return control if the connection cannot be established - often even more than 30 seconds. I've learned that if a connection can be established it'll happen in only a few seconds (usually within 1 second) and am convinced that if the connection is not established in eg 5 seconds, there is no point in waiting another eg 30 seconds. How can I tell ocilogon to timeout after eg 5 seconds (like you can with fsockopen)? Rgds, Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Test
Sorry to use this, but I don't know if my messages are arriving... Can someone (only 1 please) reply that my message was received? Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Query that generates href links
Hi, Please send the code that you used with the hrefs so we can see where the error occurs. Tell us what line the error occured (and what line in your copied code that is). Jos -Original Message- From: John Burroughs [mailto:[EMAIL PROTECTED] Sent: 21 March 2005 03:29 To: php-db@lists.php.net Subject: [PHP-DB] Query that generates href links Hi everyone, I've created a database for my poetry that I've written. I have a table called Titles. It is made up of: title_id (a different number for every poem title. It's the primary key.) title (the title of the poem) title_date (the date I wrote the poem. stored in Date format.) I want to generate an html page that lists all of the poems that I've written in descending order by date. I want each title to be in an href link so my visitors can just click on a link, which will automatically generate a page to display that poem. So for example, each finished line would look like . . . pa href=poem.php?titleid=1Poem Title 1/a - 1/25/05/p pa href=poem.php?titleid=2Poem Title 2/a - 1/20/05/p pa href=poem.php?titleid=3Poem Title 3/a - 1/15/05/p This is my code fragment. This works for printing the Titles and dates in descending order, but that was as far as I could get. //Select the poetry database if ([EMAIL PROTECTED](bdweb320883_poetry)) { echo(pUnable to locate the poetry . database at this time./p); exit(); } //Result the titles of all of the poems that I've written $result = @mysql_query(Select title, title_date from titles order by title_date DESC); if(!$result) { echo(pError performing query: . mysql_error() . /p); exit(); } //Display the title of each poem while ($row = mysql_fetch_array($result)) { $poetrytitle = $row['title']; $poetrydate = $row['title_date']; echo(p . $poetrytitle . - . $poetrydate . /p); } How can I do this. Everytime I tried adding to the above code, I kept getting error messages in php saying that there was an unexpected ''character on line such and such, but I don't know how I could even check to see which line had the error? (I'm using myphpadmin to manage my MySQL database.) Now my connection to my MySQL server for my online hosting company has been done for 12 hours and I haven't been able to work on it anymore. Does anyone know an easy way to do this? Thanks, John Burroughs -- John Burroughs http://johnaburroughs.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0511-1, 03/17/2005 Tested on: 3/20/2005 9:28:43 PM avast! - copyright (c) 1988-2004 ALWIL Software. http://www.avast.com -- 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] ocilogon timeout
Hi, Some of our scripts that generate customer-facing pages, need a connection to a database. The problems is that the database is in Norway and - allthough we have a VPN setup - the connection isn't always available. In case the connection cannot be made, we can redirect the customer to a nice error page and ask them to try again later. That's not too hard. The issue is that it takes really really long before ocilogon returns if the connection cannot be established. Is it possible to set a timeout on ocilogon (like you can with eg fsockopen)? Rgds, Jos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php