[PHP] Name in HTML input
Hi all, I am using php 4.3.2 , mysql db and Red Hat Enterprise. I have some issue regarding the name in INPUT Tag in html , as shown below: a: input name=FOX08340027hostname[] type=hidden value=FOX08340027 b: input name=FHK0924F0JG (2771890816)hostname[] type=hidden value=FHK0924F0JG (2771890816) I can get value from INPUT tag in the sample a) above , however in the sample b) , there are no value when submit form ? Anybody have any ideas to get value in the sample b? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name in HTML input
Hi , Thanks for your info. I am new in PHP , how to remove the the space and '(',')' ? Thanks Sameer N Ingole wrote: Sameer N Ingole wrote: weetat wrote: input name=FHK0924F0JG (2771890816)hostname[] type=hidden value=FHK0924F0JG (2771890816) Space in name. Remove it. oh, also remove '(' and ')' then check. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort Array
Hi I have the array below : How to sort the array by Model and Country? Thanks array( TBA0123456 = array(Country=Singapore,Model=WS8234), TBA0123458 = array(Country=Indonesia,Model=WS2234), TBA0123459 = array(Country=Vietnam,Model=WS7234), TBA0123452 = array(Country=England,Model=WS1234), TBA0123451 = array(Country=Germany,Model=WS6234), ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ROZ pdf
Hi all, I am using EZpdf class to create pdf in mysql database . The Ezpdf class is open source tool for auto-creation of pdf in php , the link is http://sourceforge.net/projects/pdf-php I have the problem with tool , the pdf page is blank , eventhough have some data in my MySQL database . Anybody have been using the ROS tool successfully , please give me some guidance what that i have done wrong . Thanks Below is the code: error_reporting(E_ALL); require_once('../library/sql.php'); require_once('../library/class.ezpdf.php'); $pdf = new Cezpdf(); $pdf-selectFont('../fonts/Helvetica'); $_db = dbconnect(); $result = $_db-queryDB(Select user_name from tbl_user); $data = array(); while ($row = $result-fetchRow(DB_FETCHMODE_ASSOC)) { $data [] = $row['user_name']; } $pdf-ezTable($data); echo print_r($pdf); if (isset($d) $d) { $pdfcode = $pdf-output(1); $pdfcode = str_replace(\n, \nbr, htmlspecialchars($pdfcode)); echo 'htmlbody'; echo trim($pdfcode); echo '/body/html'; } else { $pdf-stream(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] search string
Hi all , I am using php4.3.2,MYSQL and RedHat I have a sql text as shown below: SELECT DISTINCT(tbl_chassis.serial_no),tbl_chassis.host_name,tbl_chassis.chasis_model,tbl_chassis.country,tbl_chassis.city,tbl_chassis.building, tbl_chassis.other,tbl_chassis.status,tbl_chassis.chasis_eos,tbl_chassis.chasis_eol,tbl_chassis.chasis_user_field_1,tbl_chassis.chasis_user_field_2,tbl_chassis.chasis_user_field_3 from tbl_chassis tbl_chassis,tbl_card tbl_card WHERE tbl_chassis.serial_no = tbl_card.serial_no AND tbl_chassis.chasis_model LIKE '%WS-C5500%' AND lower(country) = lower(trim('Malaysia')) ORDER BY country,city,building,other I need to extract the tbl_chassis.chasis_model LIKE '%WS-C5500%' and lower(country) = lower(trim('Malaysia')) and join them to new string. Anyone have any suggestion how to do this? Thanks -weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select option and php
Hi all , I have a code below : function goToPageSelect($selectname,$totalItems){ $_logger = new Log4jLogger(); $_logger-logdebug(starting ..goToPageSelect()); $_logger-logdebug(starting ..goToPageSelect(), $totalItems); $selecthtml = Go to Page:select name=\$selectname\ class=\inputfield\ onchange=\javascript:gotoPage()\; for ($index=0;$index$totalItems;$index++){ $value = $value + 1; $selecthtml .= option value=\$value\$value/option; } $selecthtml .= /select; return $selecthtml; } It will produce the html tag as shown below: script language=JavaScript function gotoPage(){ var urlpath = ../listflag.php?start=pageID=+3; document.forms['listfrm'].method = 'post'; document.forms['listfrm'].action = urlpath; document.forms['listfrm'].submit; } /script form name=listfrm Go to Page:select name=pageid class=inputfield onchange=javascript:gotoPage() option value=11/option option value=22/option option value=33/option option value=44/option option value=55/option /select /form I tried using onchange in the select tag,but it did not work. It go to the javascript but the form is not submitted . Anyideas why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Step by step code running
Hi Ryan, I use Log4jPhp to log any debug value. I think it is better than using echo or print method. Thanks - weetat Ryan A wrote: Hi, I need to explain a script to a pal of mine but either i cant explain it properly or he just cant get the concept being new to php's slightly advanced stuff (OO and classes, mind you...i ain't no expert myself in this, more like Jochem's(from this list) field of expertise) I remember in my old C++ days we used to use something that basically showed how the code executed, line by line, running in the loops etc anything like that for PHP? Personally I use EditPlus and a lot of echo/print statements when I debug, I try to keep things simple. Thanks! -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select option and php
Hi Jay , I am not in the javascript group. Btw , i have added document.forms['listfrm'].pageid.value in the page , but the form is not submitted ? var pageid = document.forms['listfrm'].pageid.value; var urlpath = ../listflag.php?start=pageID=+pageid; document.forms['listfrm'].method = 'post'; -- did not submit form at all document.forms['listfrm'].action = urlpath; document.forms['listfrm'].submit; Any ideas why ? How to submit form when user change value in the select tag ? Thanks Jay Blanchard wrote: [snip] It will produce the html tag as shown below: script language=JavaScript function gotoPage(){ var urlpath = ../listflag.php?start=pageID=+3; document.forms['listfrm'].method = 'post'; document.forms['listfrm'].action = urlpath; document.forms['listfrm'].submit; } /script form name=listfrm Go to Page:select name=pageid class=inputfield onchange=javascript:gotoPage() option value=11/option option value=22/option option value=33/option option value=44/option option value=55/option /select /form I tried using onchange in the select tag,but it did not work. It go to the javascript but the form is not submitted . Anyideas why? [/snip] In gotoPage() you're not referencing the value of pageid (document.forms['listfrm'].pageid.value). More of a JavaScript question, are you a member of a JavaScript list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert byte to MB
Hi all , I have data which have value in bytes for example , $bytes = 33554432; How to convert this to MB ? THanks - weetat (PHP Novice) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pop up save dialog box
Hi all, I have code below which save MYSQL to csv file. I am using ADODB library to do this. The saving MYSQL to csv file is ok . However i need to allow the the user to enter file name for csv file. Anybody have any ideas how to do this? Thanks $sql = $_SESSION['CSV_SQL']; $_logger = new Log4jLogger(); $_logger-logdebug('sql:', $sql); if (!isset($_REQUEST['maintainall'])) { $filename = 'tbl_chassis.csv'; CSVUtil::UploadTbtoCSV($sql, $filename); unset($_SESSION['CSV_SQL']); header('Location: ../maintain.php?csv'); exit; } else { //$sql = 'SELECT * from tbl_card'; $filename = 'tbl_card.csv'; CSVUtil::UploadTbtoCSV($sql, $filename); unset($_SESSION['CSV_SQL']); header('Location: ../maintainall.php?csv'); exit; } function UploadTbtoCSV($sqltext,$filename) { $_logger = new Log4jLogger(); $_logger-logdebug(starting.. upload tb to csv); $rs = dbQuery($sqltext); $rs-MoveFirst(); $_logger-logdebug(UploadTbtoCSV csvpath:,CSV_PATH); $fp = fopen(CSV_PATH./.$filename, w); if ($fp) { rs2csvfile($rs, $fp); fclose($fp); $_logger-logdebug(starting upload tb to csv done); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compare values in 2 array
Hi all , I am using PHP 4.3.2 and MYSQL DB. I need to compare values in array which populated by database , below is the code : $temp_tbl = array(); while ($row = $temptbl_result-fetchRow(DB_FETCHMODE_ASSOC)){ $rs_chasis_serialno = $row['serial_no']; $rs_card_serial_no = $row['card_serial_no']; $rs_country = $row['country']; $status = $row['status']; $temp_tbl[] = array(chassis_serial_no=$rs_chasis_serialno, card_serial_no=$rs_card_serial_no, country=country status=status); } $current_tbl = array(); while ($row = $currenttbl_result-fetchRow(DB_FETCHMODE_ASSOC)){ $rs_chasis_serialno = $row['serial_no']; $rs_card_serial_no = $row['card_serial_no']; $rs_country = $row['country']; $current_tbl[] = array(chassis_serial_no=$rs_chasis_serialno, card_serial_no=$rs_card_serial_no, country=country); } -- need to compare $temp_tbl array and $current_tbl array. -- if values is different between 2 array , need to update the status field in the $temp_tbl array. Anybody have any suggestion how to do this ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compare values in 2 array
Hi John all, Thanks for your info. I have 2 array which populated from MYSQL as shown below : My program will update status in the temporary table according to compare of 2 arrays, for example from 2 array below: in $temptablearr = there 3 elements in $currenttablearr = there 2 elements If value different betweeen $temptablearr and $currenttablearr , the status is change to 'update'. If value are same between $temptablearr and $currenttablearr , no action taken. If there are new elements in $temptablearr and not found in $currenttablearr, the status is change to 'new' If there are elements found in $currenttablearr and not found in $temptablearr , the status is change to 'deleted' Anyone have any ideas or suggestion how to do this ? Thanks for your help. $temptablearr = array(0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-890, card_model=ws1234), 2 = array(chassis_serial_no=, country=Indonesia, card_serial_no=cd-12345, card_model=ws999), ); $currenttablearr = array( 0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1= array(chassis_serial_no=1235, country=Singapore, card_serial_no=cd-890, card_model=ws1234), ); Below is my test code . ?php $temptablearr = array(0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-890, card_model=ws1234), 2 = array(chassis_serial_no=, country=Indonesia, card_serial_no=cd-12345, card_model=ws999), ); $currenttablearr = array( 0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1= array(chassis_serial_no=1235, country=Singapore, card_serial_no=cd-890, card_model=ws1234), ); $compare = true; foreach($temptablearr as $key = $val) { if($currenttablearr[$key] != $val) { $compare = false; } if($compare === false) { echo 'update status in table to updatebrbr'; }else if($compare === true){ echo 'skip, do not shown in page.brbr'; } } ? John Wells wrote: On 7/28/06, weetat [EMAIL PROTECTED] wrote: I need to compare values in array which populated by database , below is the code : Without mentioning how your code performs some unnecessary actions, and is also full of errors, here's the idea of what you want (untested): [code] // assume at first they are same $compare = true; // compare $array1 and $array2, assuming they have same structure foreach($array1 as $key = $val) { // value
[PHP] different value in array
Hi all, I have 2 array which populated from MYSQL as shown below : My program will update status in the temporary table according to compare of 2 arrays, for example from 2 array below: in $temptablearr = there 3 elements in $currenttablearr = there 2 elements If value different betweeen elements in the $temptablearr and $currenttablearr , the status is change to 'update'. If value are same between $temptablearr and $currenttablearr , no action taken. If there are new elements in $temptablearr and not found in $currenttablearr, the status is change to 'new' If there are elements found in $currenttablearr and not found in $temptablearr , the status is change to 'deleted' Anyone have any ideas or suggestion how to do this ? Thanks for your help. $temptablearr = array(0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-890, card_model=ws1234), 2 = array(chassis_serial_no=, country=Indonesia, card_serial_no=cd-12345, card_model=ws999), ); $currenttablearr = array( 0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1= array(chassis_serial_no=1235, country=Singapore, card_serial_no=cd-890, card_model=ws1234), ); Below is my test code . ?php $temptablearr = array(0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-890, card_model=ws1234), 2 = array(chassis_serial_no=, country=Indonesia, card_serial_no=cd-12345, card_model=ws999), ); $currenttablearr = array( 0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1= array(chassis_serial_no=1235, country=Singapore, card_serial_no=cd-890, card_model=ws1234), ); $compare = true; foreach($temptablearr as $key = $val) { if($currenttablearr[$key] != $val) { $compare = false; } if($compare === false) { echo 'update status in table to updatebrbr'; }else if($compare === true){ echo 'skip, do not shown in page.brbr'; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compare value in 2 multidimension array
Hi all , I have 2 multidimension array as shown below: I need to compare all values in the 2 multidimension array where there are any elements values updated or a new elements or be deleted. Updated mean when value in $temptablearr element is different from value in $currenttablearr element, update status to 'Updated' New mean when value in $temptablearr element is not exists in $currenttablearr , update status to 'New' Deleted mean when value in $currenttablearr element is not exists in $temptablearr elements, update status to 'Deleted' If the value are the same in 2 array elements , update status to 'SKIP' The result of comparing is array of data which deleted,updated and new except SKIP status. I have been trying many way to do compare in array unsuccessful. Anybody have any ideas or suggestions how to solve the issue , your help is much appreciated. Thanks $temptablearr = array(0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-890, card_model=ws1234), 2 = array(chassis_serial_no=, country=Indonesia, card_serial_no=cd-12345, card_model=ws999), ); $currenttablearr = array( 0 = array(chassis_serial_no=1235, country=Malaysia, card_serial_no=cd-12345, card_model=ws8950), 1= array(chassis_serial_no=1235, country=Singapore, card_serial_no=cd-890, card_model=ws1234), ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting in array
Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country' = '', ) , array ( 'country' = 'Thailand', ) , array ( 'country' = 'Singapore', ) , array ( 'country' = 'Singapore', ) , array ( 'country' = '', ) , array ( 'country' = '', ) , array ( 'country' = '', ) ); function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 $country2) ? -1 : 1; } usort($arraytest,cmpcountry); while(list($name,$value)=each($arraytest)){ echo $name.brbr; while(list($n,$v) = each($arraytest[$name])){ echo $v.brbr; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting in array
Hi , Doesn't work . Any ideas ? Thanks Peter Lauri wrote: function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1=='') return 1; else return ($country1 $country2) ? -1 : 1; } -Original Message- From: weetat [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 12:32 PM To: php-general@lists.php.net Subject: [PHP] sorting in array Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country' = '', ) , array ( 'country' = 'Thailand', ) , array ( 'country' = 'Singapore', ) , array ( 'country' = 'Singapore', ) , array ( 'country' = '', ) , array ( 'country' = '', ) , array ( 'country' = '', ) ); function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 $country2) ? -1 : 1; } usort($arraytest,cmpcountry); while(list($name,$value)=each($arraytest)){ echo $name.brbr; while(list($n,$v) = each($arraytest[$name])){ echo $v.brbr; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting in array
Thanks Paul, Very weird tried Peter's option, it doesn't work. Btw , how to sort by ascending ? Thanks Paul Novitski wrote: At 12:22 AM 7/31/2006, Paul Novitski wrote: I could make that last statement just a bit simpler: function cmpcountry($a, $b) { $country1 = ($a['country'] == '') ? zzz : $a['country']; $country2 = ($b['country'] == '') ? zzz : $b['country']; return ($country1 '' $country1 $country2) ? -1 : 1; } *Sigh* I shouldn't post this late at night. This is the comparison function that works for me: function cmpcountry($a, $b) { $country1 = ($a['country'] == '') ? zzz : $a['country']; $country2 = ($b['country'] == '') ? zzz : $b['country']; return ($country1 $country2) ? -1 : 1; } demo: http://juniperwebcraft.com/test/sortTest.php code: http://juniperwebcraft.com/test/sortTest.txt Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Printer Friendly
Hi all , I have a web page which need to be print to the printer. However when i use javascript window print() function , the page and alignment is out. Read on the net , suggest that i need to setup a printer friendly page in the web page. Any ideas how i going to accomplished it in php ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Issue regarding flow in php
Hi all , I have a php page . The php page is display when i have completed upload xml file to server. In the php page , there is a function name insertxmldataToTempTbl(), which insert xml data to MYSQL database as shown below after i have uploaded xml file to server , After insert xml data to MYSQL , i have function name compareTable()which do comparisation between the table A(XML data inserted) and table B(User data table)and store comparisation array data to the $_SESSION . However , sometimes when completed uploaded to xml file to server, the data is not display on the php page . I need to logout and login again then i can see the data on the same php page. PHP developer who have any ideas or suggestion , please email to me? Thanks. $data = $xml_util-getUnserializedData(); insertxmldataToTempTbl($data); $compareTable(); $comparearr = $_SESSION['LIST_SESSION']; $listchassis = $comparearr['listchassis']; $pagerOptions = array( 'itemData' = $listchassis, 'perPage' = 10, 'delta' = 8, 'useSessions' = true, 'closeSession' = false, 'mode' = 'Sliding' ); $pager = Pager::factory($pagerOptions); $chassisdata = $pager-getPageData(); $links = $pager-getLinks(); while (list($name, $value) = each($chassisdata)) { blah blah blah - List data in HTML table tag } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] format timestamp
Hi all , I am using php 4.2 , mysql and Linux OS. I need to format timestamp to string using strftime , for e.g: strftime('%e',117000) - the day should be 28 , but is 29 when i execute strftime() function. Anyone have ideas what is the problems ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to compare value between 2 arrays
Hi all, I am using php 4.3.2 in Red hat enterprise. Have some issue which need some advice from php experts here. I need to compare value between 2 arrays . The arrays data are populated by data from the database resultset. The database resultset fields are the same type and name. for example , serial_no is PK field. in resultset 1 , have field serial_no = '123456' country = 'England' and city = 'London' in resultset 2 , have field serial_no = '123456' country = 'England' and city = 'Manchester As you can see , the city value is different between the 2 resultset. So i will update status fields in the resultset 1 to 'Update'.If the same is 'New' ,and so on. Thanks -weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ADODB store session to database
Hi all , I am having problem in store session in the database . Below is the example code from code. The issue is that the code run ok , however the expireref fields is not updated in the sessions table, below is the sessions schema : CREATE TABLE `sessions` ( `sesskey` varchar(32) NOT NULL default '', `expiry` int(11) unsigned NOT NULL default '0', `expireref` varchar(64) default '', `data` longtext, PRIMARY KEY (`sesskey`), KEY `expiry` (`expiry`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | Anybody have ideas why all fields are updated except expireref field ? ?php function NotifyExpire($ref,$key) { print pbNotify Expiring=$ref, sessionkey=$key/b/p; } $ADODB_SESSION_DRIVER='mysql'; $ADODB_SESSION_CONNECT=''; $ADODB_SESSION_USER =''; $ADODB_SESSION_PWD =''; $ADODB_SESSION_DB =''; $ADODB_SESS_DEBUG = 99; session_start(); $userdata = new User(); $_SESSION['USER_NAME'] = $userdata-getUsername(); $ADODB_SESSION_EXPIRE_NOTIFY =array('USER_NAME','NotifyExpire'); ob_start(); include('./library/adodb/session/adodb-cryptsession.php'); adodb_session_regenerate_id(); $_SESSION['MONKEY'] = array('1','abc',44.41); if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pear Pager
Hi all , Thanks all in this newsgroup for your help. I have question regarding PEAR Pager . The PEAR pager is working ok , however , the PEAR Pager always display totalItems: display and value 1 on my web page. How to make the totalItems: and the value 1 not to display on webpage? I am using MYSQL database and PHP 4.3.2 Thanks -weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remove last comma in string
Hi all, I am using php 4.3.2 and mysql , linux. I have a sql statement below : UPDATE tbl_chassis_temp SET country = 'Singapore', city 'SINGAPORE', building = 'Tampines Central 6', other = 'Level 03-40', I need to remove the last comma from sql text above. I have tried using substr and rtrim , without any success ? Anyone have any suggestion ? THanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xml validation
Hi all , Thanks to everbody in this group , really help me a lot. I have a raw xml file from our clients. My question is how to validate the xml file if the file is xml compliance ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multidimension Array
Hi all , I have the arrays as shown below : How to get the array value in the [TBA04490054] and [JAE070406RT] ? For example , [0] = 'SAD04520AZD' ,[1]= 'SAL04430RE9' and so on. Anybody have any ideas or suggestions how to do it ? Thanks - weetat Array ( [TBA04490054] = Array ( [0] = SAD04520AZD [1] = SAL04430RE9 [2] = SAL04430M00 ) ) Array ( [JAE070406RT] = Array ( [0] = JAE070406RT [1] = JAB023808EC [2] = JAB030704WM ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] weird problem in php
Hi all , I have using php 4.3.2 and mysql database. I have a form which have select tag which have the value for example -New York. When use submit the form , i need to find the first occurence of - , i use strpos function as shown below : $country = $_POST['country']; $findme = '-'; $pos = strpos($country, $findme); if ($pos === false) { $_logger-logdebug(starting searchChassisTblDB() not found); } else { $_logger-logdebug(starting searchChassisTblDB() found); } however it always give false . I did not know why. Then i did a testing , added below code in the php file without form submission, it give true value which what i wanted. Anybody have ideas or suggestion what happening ? Any difference when value submitted from form ? Thanks $mystring = '-New York'; $findme = '-'; $pos = strpos($mystring, $findme); if ($pos === false) { echo The string '$findme' was not found in the string '$mystring'; } else { echo The string '$findme' was found in the string '$mystring'; echo and exists at position $pos; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql + PHP
Hi all, I have SQL query , for example , Select country , name from tbl_chassis order by country. The problem of the sql statement is that , if there are empty value in country field , it be sorted first . How to do sorting the empty value last ? I can cp() function to do this ? or any mysql function to use? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql + PHP
hi , not working . The empty value still sorted first. Thanks. Satyam wrote: perhaps this will work: Select country , name from tbl_chassis order by ifnull(country,'') didn't try it. - Original Message - From: weetat [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, June 15, 2006 8:14 AM Subject: [PHP] mysql + PHP Hi all, I have SQL query , for example , Select country , name from tbl_chassis order by country. The problem of the sql statement is that , if there are empty value in country field , it be sorted first . How to do sorting the empty value last ? I can cp() function to do this ? or any mysql function to use? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql + PHP
Thank all for your inputs. Yes . the data should be null , really bad data , will try to change database structure. Richard Lynch wrote: On Thu, June 15, 2006 1:14 am, weetat wrote: I have SQL query , for example , Select country , name from tbl_chassis order by country. The problem of the sql statement is that , if there are empty value in country field , it be sorted first . How to do sorting the empty value last ? I can cp() function to do this ? or any mysql function to use? This is really an SQL question, and the empty values should properly be called NULL to avoid confusion with '', the empty string... Unless you have '' in your data for country, which is really just Bad Data, imho... The solution for NULL is fairly easy. There is an SQL function called 'coalesce' which will convert any NULL value to, err, whatever you want. So: select coalesce(country, 'ZZ'), name from ... would probably be the simplest answer. If, however, your country values are '', and if you don't want to fix the application to avoid such a bogus value, you could do: ORDER BY country = '', country, ... country = '' should turn into true/false, which should turn into 0/1 which should order by the ones that have something first, and the ones that are '' last. You may need to do some kind of 'typecast' on the country = '' depending on your SQL engine. You may even be forced to do: select country, nane, typecast_function(country = '', bool) as empty from ... order by empty, country if your SQL engine is particularly baroque (MySQL 3.23, I do believe...) :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] progress monitor in php
Hi all , I was using PEAR:HTTP_Upload to upload file in php 4.3.2. Is ok , however i need to display some sort of progress monitor to the user because some file is very large and took some times to upload. I need to inform the users to uploading is in progress. I have search google ,and found megaupload , however the problem of megaupload is the filename is rubbish, i need the filename of uploaded file because the file is xml , need to convert data from xml to database. Anybody have any ideas ? Or have any another php upload progress monitor ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] progress monitor in php
hi , That gd. However i did not see any upload progress monitor at all. Anybody have any ideas how to implement it? Thanks tedd wrote: At 5:48 PM +0800 6/15/06, weetat wrote: Hi all , I was using PEAR:HTTP_Upload to upload file in php 4.3.2. Is ok , however i need to display some sort of progress monitor to the user because some file is very large and took some times to upload. I need to inform the users to uploading is in progress. I have search google ,and found megaupload , however the problem of megaupload is the filename is rubbish, i need the filename of uploaded file because the file is xml , need to convert data from xml to database. Anybody have any ideas ? Or have any another php upload progress monitor ? Thanks - weetat weetat: Been there, tried that. Need js to do it and I haven't seen anything simple. Instead, I put a wait spin-gif and hope that the file doesn't take too long. Such as: http://xn--ovg.com/a4.php Feel free to steal my gif -- I stole it fair and square myself. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] progress monitor in php
Hi all , Thanks for your inputs. I have tried the uber upload progress monitor , look good to me. Thanks all - weetat Richard Lynch wrote: On Thu, June 15, 2006 4:48 am, weetat wrote: I was using PEAR:HTTP_Upload to upload file in php 4.3.2. Is ok , however i need to display some sort of progress monitor to the user because some file is very large and took some times to upload. I need to inform the users to uploading is in progress. I have search google ,and found megaupload , however the problem of megaupload is the filename is rubbish, i need the filename of uploaded file because the file is xml , need to convert data from xml to database. Anybody have any ideas ? Or have any another php upload progress monitor ? [soapbox] Can I respectfully suggest you just take php *OUT* of the equation? You're talking about something on the CLIENT that needs to indicate number of bytes SENT by the client out of total number of bytes the client needs to SEND. All the information involved is client-side. Trying to hook PHP, on the server, into this is just plain daft. Go bug the FireFox guys to give you callback hooks into the upload process, or submit a patch to them. Getting PHP involved in this equation makes zero sense -- You'd only be generating a TON of HTTP traffic for PHP to tell the browser what the browser already KNOWS. [/soapbox] PS Or you could just train your users to actually look at the progress meter in those browsers that already have one... :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT tag and PHP
Hi all , I have a SELECT for country in the php file . I would like to load the country and city belong to the country dynamically from the database. Anyone have ideas how to do it ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SELECT tag and PHP
Thanks barry for input . Barry wrote: weetat schrieb: Hi all , I have a SELECT for country in the php file . I would like to load the country and city belong to the country dynamically from the database. Anyone have ideas how to do it ? Thanks - weetat www.php.net/foreach -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compare data between 2 array
Hi all, I would like to say good job to this newsgroup , they are the best. Ok. My dilemma is that i have to compare values between 2 table which are exactly the same structure and fields. Below is rough example . The table are tbl_chassis and tbl_chassis_temp. Below are the fields. `id` int(11) NOT NULL auto_increment, `serial_no` varchar(100) NOT NULL default '', `host_name` varchar(100) NOT NULL default '', `chasis_model` varchar(100) NOT NULL default '', `chasis_flash_size` varchar(100) NOT NULL default '', `chasis_dram_size` varchar(100) NOT NULL default '', `chasis_sw_version` varchar(100) NOT NULL default '', `chasis_eos` date NOT NULL default '-00-00', `chasis_eol` date NOT NULL default '-00-00', `chasis_user_field_1` varchar(100) NOT NULL default '', `chasis_user_field_2` varchar(100) NOT NULL default '', `chasis_user_field_3` varchar(100) NOT NULL default '', `status` varchar(100) NOT NULL default '', What i need to figure out are when the records are deleted , updated and insert ,i need to update status in tbl_chassis table. What i am plan to do is to select query in the tbl_chassis_temp table and compare the value from each records to the records in the tbl_chassis table.Any others ways to do it? There are about 1000 records in each table. What is the better alternative to do this ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php calendar
Hi all , Any php calendar out there, search google , most of them are javascript calendar ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pear xml_serializer
Hi all, I am using PEAR:XML_Serializer to unserializer our customer xml file. However in some customer xml file , there are some value in xml which are not unicode , for example as shown below: HardwareVersion![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/HardwareVersion I need to amended the value above to be empty. Anyone have any suggestion how to do this ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session problem
Hi all, I have 2 php page , whenever i click the submit in 1st page , the $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page. If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it displayed the data correctly. Anybody have any ideas why php session behaviour is like that ? Thanks - weetat below is the 1st page : ?php session_start(); $arrayoffiles = listoffiles(); $params = array( 'mode' = 'Jumping', 'itemData' = $arrayoffiles, 'perPage' = 10, 'delta' = 8, 'append' = true, 'clearIfVoid' = true, 'useSessions' = true, 'closeSession' = true, ); $pager = Pager::factory($params); $data = $pager-getPageData(); $links = $pager-getLinks(); $_SESSION['LIST_OF_DATA'] = $data; ? below is second page : ?php session_start(); echo print_r($_SESSION['LIST_OF_DATA']); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session problem
yes i am Thank for you help Barry wrote: weetat schrieb: Hi all, I have 2 php page , whenever i click the submit in 1st page , the $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page. If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it displayed the data correctly. Anybody have any ideas why php session behaviour is like that ? Thanks - weetat below is the 1st page : ?php session_start(); $arrayoffiles = listoffiles(); $params = array( 'mode' = 'Jumping', 'itemData' = $arrayoffiles, 'perPage' = 10, 'delta' = 8, 'append' = true, 'clearIfVoid' = true, 'useSessions' = true, 'closeSession' = true, ); $pager = Pager::factory($params); $data = $pager-getPageData(); $links = $pager-getLinks(); $_SESSION['LIST_OF_DATA'] = $data; ? below is second page : ?php session_start(); echo print_r($_SESSION['LIST_OF_DATA']); ? Let me take a guess: Your FORM action is action=http:// Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sort multidimension array
Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country empty string value are sort first . Any ideas what happen in the cmpcountry() function ? The result of sort array below is : Singapore Singapore Thailand '' Thailand '' '' Malaysia Phillipines function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1 == ''){ if($country1 $country2){ return 1; } } if($country2 == '') { if($country1 $country2){ return 1; } } return ($country1 $country2) ? -1 : 1; } usort($arraytest,cmpcountry); $arraytest= array( array ( 'country' = 'Thailand', 'city' = 'Z' ) , array ( 'country' = 'Thailand', 'city' = 'M' ) , array ( 'country' = 'Singapore', 'city' = 'G' ) , array ( 'country' = 'Singapore', 'city' = 'B' ) , array ( 'country' = '', 'city' = 'U' ) , array ( 'country' = '', 'city' = 'Y' ) , array ( 'country' = '', 'city' = 'J' ) ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sort multidimension array
Hi David , Thanks for your input, it solve my problem. David Tulloh wrote: Examine your function for the case of cmpcountry(Thailand, ); if($country2 == '') is true if($country1 $country2) is false Then ($country1 $country2) is false again and 1 is returned. This means that is less than Thailand, and should be sorted higher. The easiest way to fix this is actually to remove the inner ifs in both your if blocks, they are not necessary. The second if block should also return -1. David weetat wrote: Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country empty string value are sort first . Any ideas what happen in the cmpcountry() function ? The result of sort array below is : Singapore Singapore Thailand '' Thailand '' '' Malaysia Phillipines function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1 == ''){ if($country1 $country2){ return 1; } } if($country2 == '') { if($country1 $country2){ return 1; } } return ($country1 $country2) ? -1 : 1; } usort($arraytest,cmpcountry); $arraytest= array( array ( 'country' = 'Thailand', 'city' = 'Z' ) , array ( 'country' = 'Thailand', 'city' = 'M' ) , array ( 'country' = 'Singapore', 'city' = 'G' ) , array ( 'country' = 'Singapore', 'city' = 'B' ) , array ( 'country' = '', 'city' = 'U' ) , array ( 'country' = '', 'city' = 'Y' ) , array ( 'country' = '', 'city' = 'J' ) ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] detect user click stop button in browser
Hi all, Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CDATA tag
Hi all, I need to parse and write data to xml file , There some value as shown below: InstanceName![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/InstanceName I need to write the data to be valid value. I am using PEAR:XMLSerializer to read the xml file, however , the PEAR XMLSerializer always prompt me the error message below: No unserialized data available. Use XML_Unserializer::unserialize() first. It cause by the CDATA above. I have attached for your reference. Thanks - weetat ?xml version=1.0 encoding='ISO-8859-1'? InvDetails SchemaInfo RMEServerRMEhostname/RMEServer CreatedAtTue Mar 28 14:37:43 CST 2006/CreatedAt SchemaVersion1.0/SchemaVersion /SchemaInfo RMEPlatform Cisco_Chassis InstanceID1/InstanceID ModelWS-C6506/Model SerialNumberTBA04490054/SerialNumber ChassisSystemTypewsc6506/ChassisSystemType NumberOfSlots6/NumberOfSlots Cisco_Backplane BackplaneTypegiga16/BackplaneType /Cisco_Backplane Cisco_Card InstanceID1/InstanceID ModelWS-X6K-SUP1A-2GE/Model SerialNumberSAD04520AZD/SerialNumber LocationWithinContainer1/LocationWithinContainer CardTypewsx6ksup1a2ge/CardType HardwareVersion7.1/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.3(1)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=active/AD AD name=ModuleSubType value=wsf6kpfc/AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card Cisco_Card InstanceID2/InstanceID ModelWS-X6348-RJ-45/Model SerialNumberSAL04430RE9/SerialNumber LocationWithinContainer2/LocationWithinContainer CardTypewsx6348rj45/CardType HardwareVersion1.4/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.4(2)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=other/AD AD name=ModuleSubType value=empty /AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card Cisco_Card InstanceID3/InstanceID ModelWS-X6348-RJ-45/Model SerialNumberSAL04430M00/SerialNumber LocationWithinContainer3/LocationWithinContainer CardTypewsx6348rj45/CardType HardwareVersion1.4/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.4(2)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=other/AD AD name=ModuleSubType value=empty /AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card AdditionalInformation AD name=PowerSupply1 value=wscac1300/AD AD name=PowerSupply2 value=wscac1300/AD AD name=MgmtType value=snmpV3V2cV1/AD AD name=BroadcastAddress value=99.99.99.99/AD AD name=AvailableSlots value=3/AD /AdditionalInformation /Cisco_Chassis Cisco_NetworkElement InstanceID1/InstanceID DescriptionCisco Systems WS-C6506 Cisco Catalyst Operating System Software, Version 7.6(10) Copyright (c) 1995-2004 by Cisco Systems /Description PrimaryOwnerNameNetwork Services Asia Pacific Head Office/PrimaryOwnerName InstanceName![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/InstanceName PhysicalPosition/Thailand/BANGKOK/208 Wireless Rd//PhysicalPosition SysObjectId99.99.99.99.99.99.99.99.45 /SysObjectId OfficialHostNamehostname1/OfficialHostName Cisco_LogicalModule InstanceID1/InstanceID NumberOfPorts2/NumberOfPorts Cisco_Port PortNumber1/PortNumber IfInstanceID106/IfInstanceID /Cisco_Port Cisco_Port PortNumber2/PortNumber IfInstanceID107/IfInstanceID /Cisco_Port AdditionalInformation AD name=ModuleIPAddress value=99.99.99.99/AD /AdditionalInformation /Cisco_LogicalModule Cisco_LogicalModule InstanceID3/InstanceID NumberOfPorts48/NumberOfPorts Cisco_Port PortNumber1/PortNumber IfInstanceID58/IfInstanceID /Cisco_Port Cisco_Port PortNumber2/PortNumber IfInstanceID59/IfInstanceID /Cisco_Port Cisco_Port PortNumber3/PortNumber IfInstanceID60/IfInstanceID /Cisco_Port Cisco_Port PortNumber4/PortNumber IfInstanceID61/IfInstanceID /Cisco_Port Cisco_Port PortNumber5/PortNumber IfInstanceID62/IfInstanceID /Cisco_Port Cisco_Port PortNumber6/PortNumber IfInstanceID63/IfInstanceID /Cisco_Port Cisco_Port PortNumber7/PortNumber IfInstanceID64/IfInstanceID /Cisco_Port Cisco_Port PortNumber8/PortNumber IfInstanceID65/IfInstanceID /Cisco_Port Cisco_Port PortNumber9/PortNumber IfInstanceID66/IfInstanceID /Cisco_Port Cisco_Port PortNumber10/PortNumber IfInstanceID67/IfInstanceID /Cisco_Port Cisco_Port PortNumber11/PortNumber IfInstanceID68/IfInstanceID /Cisco_Port Cisco_Port PortNumber12/PortNumber IfInstanceID69/IfInstanceID /Cisco_Port Cisco_Port PortNumber13/PortNumber
Re: [PHP] detect user click stop button in browser
Hi Andrei, I have tried the connection_aborted() in my code , however it not working at all , below is my code: If i close the browser window(IE) , the script still running and call the difference() function as shown below: Any ideas what is happening ? Thanks ignore_user_abort(true); $options = array(complexType = object); $xml_util = new XMLUtil($filepath, $options); $xml_util-unserializer_XML(false); $xml_error = $xml_util-getXMLError(); $_logger-logdebug(xml error listflag.php, $xml_error); if (!$xml_error) { $data = $xml_util-getUnserializedData(); } else { $errorMessage = 'XML file is not well-formed. Please amend XML file before upload.'; echo $errorMessage; } if (!connection_aborted()) { $diffresult = difference($data); call function even close browser window $_SESSION['diffresult'] = $diffresult; header('Location: ../difference.php'); exit; } else { $_logger-logdebug(program aborted); header('Location: ../difference.php'); exit; } Andrei wrote: Check int connection_aborted ( ) in the PHP manual Andy weetat wrote: Hi all, Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xmldoc
Hi all, I have simple code below : It run ok in one of my test server (Red Hat Enterprise) , PHP 4.3.2. However in the one of production server which have same OS and PHP version , the code did not display done parsing xml in log file. It just display starting parsing xml only. I have check all setting in php.ini , however cannot found any different between 2 server. Anybody have any ideas what happening here ? Thanks ?php $xmlfile = '/test/test.xml'; $_logger-logdebug(starting parsing xml); $doc = xmldoc($xmlfile); $_logger-logdebug(done parsing xml); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xmldoc issue
Hi all , I have two server . In first server , which PHP version 4.3.2, the code below is ok : function validatexmlfile($xmlfilename) { $_logger = new Log4jLogger(); $_logger-logdebug(starting validate xml); $_logger-logdebug(starting validate xml xmlfilename:,$xmlfilename); if (!$doc = xmldocfile($xmlfilename)) { die(Error in XML); $this-xml_error = TRUE; } // version check else if ($doc-version 1.0) { die(Unsupported XML version); $this-xml_error = TRUE; } else { $this-xml_error = FALSE; } However in second server , it did not get past the xmldocfile() at all. Anybody have any ideas what is happening ? I have set the error_reporting to E_ALL , but it did not display any error at all. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array to String
Hi all, I have the error below in my PHP version 4.3.2: PHP Notice: Array to string conversion in /data/html/library/config.php on line 45 If i have turned on the magic_quotes in php.ini, it is ok . Any ideas? It cause by the code below: if (!get_magic_quotes_gpc()) { if (isset($_POST)) { foreach ($_POST as $key = $value) { $_POST[$key] = trim(addslashes($value)); } } if (isset($_GET)) { foreach ($_GET as $key = $value) { $_GET[$key] = trim(addslashes($value)); } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML
Hi all, I am using PHP 4.3.2 in Red Hat Entreprise. I have xml file which have tags as show below: HardwareVersion![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/HardwareVersion I need to lookup for Hardware Version tag in php ,and edit the value to empty string and save the modified xml file. Any one have any ideas how to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML
Add on : I got this error when i using xmldocfile() function to read the xml file , Warning: xmldocfile(): /home/gvintranet/datacraft/htdocs/uploads/test_cdata.xml:99: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): error: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): CData section not finished ù?¸ü÷úù?àù?Ø in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/I in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): ^ in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 weetat wrote: Hi all, I am using PHP 4.3.2 in Red Hat Entreprise. I have xml file which have tags as show below: HardwareVersion![CDATA[ù?¸€ü÷Œúù?àù?Ø€Z4À„Ï]]/HardwareVersion I need to lookup for Hardware Version tag in php ,and edit the value to empty string and save the modified xml file. Any one have any ideas how to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML
Hi all , Can I edit the xml file before doing xml parsing ? My xml file is around 16MB size. Anyone have any ideas how to do that? Thanks weetat wrote: Add on : I got this error when i using xmldocfile() function to read the xml file , Warning: xmldocfile(): /home/gvintranet/datacraft/htdocs/uploads/test_cdata.xml:99: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): error: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): CData section not finished ù?¸ü÷úù?àù?Ø in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/I in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): ^ in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 weetat wrote: Hi all, I am using PHP 4.3.2 in Red Hat Entreprise. I have xml file which have tags as show below: HardwareVersion![CDATA[ù?¸€ü÷Œúù?àù?Ø€Z4À„Ï]]/HardwareVersion I need to lookup for Hardware Version tag in php ,and edit the value to empty string and save the modified xml file. Any one have any ideas how to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] modify xml before parse
Hi all, I need to read xml file before it was parsed by PHP DOM functions. The xml file have some encrypted value as shown below : InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/InstanceName Anybody have any suggestion how to do it ? Thanks. - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: modify xml before parse
Hi Adam, Thank for your input. However search and replace the value such as ![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]] to empty string ? Try the code below , no successful. $xmlfile = /home/gvintranet/datacraft/htdocs/properties/test_cdata.xml; $xml = file_get_contents($xmlfile); $xml = preg_replace('/HardwareVersion[^(\\/HardwareVersion)]\\/HardwareVersion/', 'HardwareVersion\/HardwareVersion', $xml); fwrite(fopen($xmlfile, 'wb'), $xml); Thanks - weetat Adam Zey wrote: weetat wrote: Hi all, I need to read xml file before it was parsed by PHP DOM functions. The xml file have some encrypted value as shown below : InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/InstanceName Anybody have any suggestion how to do it ? Thanks. - weetat $xmlfile = file_get_contents(http://urloffile.com/filename.xml;); I mean, that is what you asked, how to read the xml file... Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdf
Hi all , I am using PHP 4.3.2 and MYSQL database. I need to convert the sql query to Adobe PDF format. Any one have any suggestion how to do this? I have search phpclasses , found SQL2PdfReport classes , however it gave error message as shown below : Error in opening pdf Lookup the code in the SQL2Report class , it did not support pdf 7.0 and above. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running number in paging
Hi all , I have using PEAR:Pager , to do paging . Everthing are ok . Except the running no will always start from 1 to 10 . Anyway to increase the running number when user click next page for example Page 1 : 1 to 10, Page 2 : 11 to 20, and so on Thanks below is the code , the running number is the variable k. ?php while (list($name, $value) = each($chassisresult)) { $model = $value['chasis_model']; $serialno = $value['serial_no']; $hostname = $value['host_name']; $country = $value['country']; $city = $value['city']; $building = $value['building']; $other = $value['other']; $chasis_user_field_1 = $value['chasis_user_field_1']; $chasis_user_field_2 = $value['chasis_user_field_2']; $chasis_user_field_3 = $value['chasis_user_field_3']; $status = $value['status']; $chasiseos = $value['chasis_eos']; $chasiseol = $value['chasis_eol']; $countrynamestr = $serialno . country[]; $citynamestr = $serialno . city[]; $buildingnamestr = $serialno . building[]; $othernamestr = $serialno . other[]; $hostnamestr = $serialno . hostname[]; $modelnamestr = $serialno . model[]; $userfield1name = $serialno . userfield1[]; $userfield2name = $serialno . userfield2[]; $userfield3name = $serialno . userfield3[]; $statusname = $serialno . status[]; $eosname = $serialno . eos[]; $eolname = $serialno . eol[]; $checkboxname = selected[]; ? tr td align=center class=std1input name=?php echo $checkboxname? type=checkbox value=?php echo $i ?/td td align=center class=std1?php echo $k += 1 ?input name=?php echo $countrynamestr? type=hidden value=?php echo $country ?/td td class=std2?php echo $country == '' ? 'nbsp;' : $country ?input name=?php echo $citynamestr? type=hidden value=?php echo $city ?/td td class=std2 ?php echo $city == '' ? 'nbsp;' : $city ?input name=?php echo $buildingnamestr? type=hidden value=?php echo $building ?/td td class=std2?php echo $building == '' ? 'nbsp;' : $building ?input name=?php echo $othernamestr? type=hidden value=?php echo $other ?/td td class=std2?php echo $other == '' ? 'nbsp;' : $other ?/td td class=std2?php echo $hostname == '' ? 'nbsp;' : $hostname ?input name=?php echo $hostnamestr? type=hidden value=?php echo $hostname ?/td td class=std2 ?php echo $model == '' ? 'nbsp;' : $model ?input name=?php echo $modelnamestr? type=hidden value=?php echo $model ?/td td class=std2?php echo $serialno ?input name=Serialno[] type=hidden value=?php echo $serialno ?/td td class=std2nbsp;/td td class=std2nbsp;/td td class=std2nbsp;/td td class=std2?php echo $chasiseos == '' ? 'nbsp;' : dateconvert($chasiseos,2) ?input name=?php echo $eosname? type=hidden value=?php echo $chasiseos ?/td td class=std2?php echo $chasiseol == '' ? 'nbsp;' : dateconvert($chasiseol,2) ?input name=?php echo $eolname? type=hidden value=?php echo $chasiseol ?/td td class=std2?php echo $chasis_user_field_1 == '' ? 'nbsp;' : $chasis_user_field_1 ?input name=?php echo $userfield1name? type=hidden value=?php echo $chasis_user_field_1 ?/td td class=std2 ?php echo $chasis_user_field_2 == '' ? 'nbsp;' : $chasis_user_field_2 ?input name=?php echo $userfield2name? type=hidden value=?php echo $chasis_user_field_2 ?/td td class=std2 ?php echo $chasis_user_field_3 == '' ? 'nbsp;' : $chasis_user_field_3 ?input name=?php echo $userfield3name? type=hidden value=?php echo $chasis_user_field_3 ?/td input name=?php echo $statusname? type=hidden value=?php echo $status ? /tr ?php $i += 1; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stop process when user close window browser
Hi all, I am using PHP 4.3.2 and MYSQL database. I think this question has been asked many times, however not solutions. The problem is that I have a php script which connect to db and update data to db which took length of time to be completed. However sometimes user accidentally close the window browser or kill the window browser. The php which a server script language will not know that the window browser has been closed , so the program execution is keep running . This will choke the memory in the server and thus choke the web page. So ,are there ways to stop program from executing when user close the browser window. Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop process when user close window browser
Hi Thomas, Yes. I read the manual regarding the connection handling. However ,in my php program , the execution did not stop , because i have logger which log sql statement INSERT statement when inserted data to database is ok . When i close the browser , the sql execution still running, statement is logged. Any idea how to stop it ? Because it cause my web page to be slow. Thanks. Thomas Munz wrote: By default, PHP will also stop execution when the browser is closed. See: http://de.php.net/manual/en/features.connection-handling.php on Friday 30 June 2006 09:06, weetat wrote: Hi all, I am using PHP 4.3.2 and MYSQL database. I think this question has been asked many times, however not solutions. The problem is that I have a php script which connect to db and update data to db which took length of time to be completed. However sometimes user accidentally close the window browser or kill the window browser. The php which a server script language will not know that the window browser has been closed , so the program execution is keep running . This will choke the memory in the server and thus choke the web page. So ,are there ways to stop program from executing when user close the browser window. Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Printing in php
Hi all , I am using PHP 4.3.2 and MYSQL . I need to do printing function in php . Basically , in my client web page , it will display the list of items on the html page. And i have a print button , so that the user can print the html page to their local printer. Any way how to do this in PHP ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string problem
Hi all , I am using PHP 4.3.2 , MYSQL database and Red Hat Entreprise OS. I have the SQL statement which store in $str variable as shown below : How to get the '%WS-X5225R%' from $str variable ? $str = SELECT DISTINCT(tbl_chassis.serial_no),tbl_card.card_model, ; tbl_chassis.host_name,tbl_chassis.chasis_model,tbl_chassis.country,; tbl_chassis.city,tbl_chassis.building, tbl_chassis.other,tbl_chassis.status,tbl_chassis.chasis_eos,tbl_chassis.chasis_eol,tbl_chassis.chasis_user_field_1,tbl_chassis.chasis_user_field_2,tbl_chassis.chasis_user_field_3 from tbl_chassis tbl_chassis,tbl_card tbl_card WHERE tbl_chassis.serial_no = tbl_card.serial_no AND tbl_card.card_model LIKE'%WS-X5225R%'; thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php