Re: [PHP] problem with htmlspecialchars in version5.2.5
which special characters dint converted? this function converts only few special characters. try to use htmlentities function instead -- Regards, Sanjeev http://www.sanchanworld.com | http://webdirectory.sanchanworld.com - submit your site On 5/17/08, It flance [EMAIL PROTECTED] wrote: Hi, this statement: echo nl2br(htmlspecialchars($row['jobdescription'], ENT_QUOTES, 'UTF-8')); works for php4.3.10 but not for php5.2.5 I am wondering if i am missing something. Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert query result to array
fetchAll() works if php version is greater than 5. As Wang suggested, we should write our own function. its easy... i have done so many times for larger database. Store earch rows of the resultset in the array (multidimensional ie. 2). and then work on the array using the loops conditions $query = select * from tablename; $result = mysql_query($query); while($arr = somefunction($result)){ $resultarray[] = $arr; } Hope it works! On 5/13/08, Forcey [EMAIL PROTECTED] wrote: I guess PDOStatement::fetchAll() should work? see http://www.php.net/manual/en/pdostatement.fetchall.php for details. - Forcey On Tue, May 13, 2008 at 9:55 AM, Yi Wang [EMAIL PROTECTED] wrote: I think flance's meaning is whether there is a build-in function that can convert the result set to an array. The short answer is: do it yourself. On 5/12/08, Stut [EMAIL PROTECTED] wrote: On 12 May 2008, at 15:56, It flance wrote: is there any function that can convert the result of query to an associative array? what i want is the following: $query = select * from tablename; $result = mysql_query($query); $arr = somefunction($result); where $arr should be an assoiative array whose indices have the same name as the fields names of table tablename. http://php.net/mysql_fetch_assoc Please please please read the manual: http://php.net/mysql -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Wang Yi -- 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 -- Regards, Sanjeev http://www.sanchanworld.com | http://webdirectory.sanchanworld.com - submit your site
Re: [PHP] mysql query and maximum characters in sql statement
Hi Jim Lucas, You are correct... i want to run in the same way. but as my 2 tables, column name are different i cant run the LOAD DATA infile. And the example you mentioned for break at 100, also i thought to use in that way. but one of the column had the text type which we cant predict about the size. Thanks for the support from all of you. Now, I am inserting the rows one by one only On 5/2/08, Chris [EMAIL PROTECTED] wrote: Jim Lucas wrote: Waynn Lue wrote: Wouldn't using LOAD DATA INFILE be better than writing your own script? depends, does the data file match the table column for column? Doesn't have to. http://dev.mysql.com/doc/refman/5.0/en/load-data.html By default, when no column list is provided at the end of the LOAD DATA INFILE statement, input lines are expected to contain a field for each table column. If you want to load only some of a table's columns, specify a column list: LOAD DATA INFILE 'persondata.txt' INTO TABLE persondata (col1,col2,...); But load data infile requires extra mysql privileges. -- Postgresql php tutorials http://www.designmagick.com/ -- Regards, Sanjeev http://www.sanchanworld.com | http://webdirectory.sanchanworld.com - submit your site
[PHP] mysql query and maximum characters in sql statement
Hi, I have written a program which imports the tab delimited file and insert all the line from file to the mysql line by line. I am succeding in the above case. but problem with the above method is its taking to too much time while inserting into the database. The file's size will be more than 5000 lines. Then i tried to build a string of ; seperated queries. as follows for($i=1; $isizeof($array); $i++){ $insert_string .= insert into tablename (v1, v2. v6) values('$array[$i][1]', '$array[$i][2]'. '$array[$i][6]');; } if(!empty($insert_string)){ mysql_query($insert_string, $conn) or die(query failed : .mysql_errror()); } Its throwing error saying check the manual for right syntax. After investigating in some sites i come to know that its problem of limitations in query size. I also tried with SET GLOBAL max_allowed_packet=3000; Then also its throwing the same error. Can anybody tell me how to fix this error and reduce the inserting time with a single statement instead of writing more insert statements -- Regards, Sanjeev http://www.sanchanworld.com http://webdirectory.sanchanworld.com - submit your site
[PHP] show required row first and then other remaining rows
Hi, Consider the following case mysql select *from names; ++-++ | id | name| phone | ++-++ | 1 | sanju | 984565 | | 2 | sanjeev | 997223 | | 3 | puttu | 990058 | | 4 | raju| 944811 | ++-++ Now I want to display the row whose name is puttu (id=3) first and then want to display other rows in order (order by name) as follows ++-++ | id | name| phone | ++-++ | 3 | puttu | 990058 | | 4 | raju| 944811 | | 2 | sanjeev | 997223 | | 1 | sanju | 984565 | ++-++ Can somebody tell me is it possible. If its possible then please help me to solve this problem. Actually I am fetching all the rows from this table to my php page and there if I choose some name then that should appear at top and rest should be below in name order. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan
Re: [PHP] show required row first and then other remaining rows
Hi Andrew, Thanks a lot. it really worked very well. Sanjeev On 10/26/07, Andrew Ballard [EMAIL PROTECTED] wrote: This should work: ORDER BY CASE WHEN id = 3 THEN 0 ELSE 1 END, name Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Warm Regards Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com/ - Website submission http://webhosting.sanchanworld.com/ - Webhosting solution provider
RE: [PHP] read the main domain cookie in sub domain
I did it. Still I am not able to access it. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 19, 2007 12:41 AM To: Sanjeev N Cc: php-general@lists.php.net Subject: Re: [PHP] read the main domain cookie in sub domain Sanjeev N wrote: Assume, I have www.domain.com http://www.domain.com/ in which I wrote the functionality for user authentication and his profile related functionality. Now, when user logs in using http://www.domain.com/users/login.php then after his successful login a session as well as a cookie is getting created. This will creates a cookie called myCookie123 Now I have my subdomain as http://sub.domain.com/index.php . here at the top I am checking whether the user is logged in or not, for that I have to check whether the cookie is created or not.. Here my problem is that, I am not getting the idea about, how to access or read the cookie of http://www.domain.com http://www.domain.com/ from http://sub.domain.com/. can anyone please suggest me how to achieve this. Set the $domain parameter of setcookie to '.domain.com'. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] read the main domain cookie in sub domain
Hey Stut, Thanks.. Now its working fine. Now I am able to access the value. Actually problem was in main domain the cookies path was wrong. It was showing /user/ . I set it to / Thanks Stut. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 19, 2007 12:46 AM To: Sanjeev N Cc: php-general@lists.php.net Subject: Re: [PHP] read the main domain cookie in sub domain Sanjeev N wrote: I did it. Still I am not able to access it. You'll probably need to delete the existing cookie from your browser and get it set again. -Stut -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 19, 2007 12:41 AM To: Sanjeev N Cc: php-general@lists.php.net Subject: Re: [PHP] read the main domain cookie in sub domain Sanjeev N wrote: Assume, I have www.domain.com http://www.domain.com/ in which I wrote the functionality for user authentication and his profile related functionality. Now, when user logs in using http://www.domain.com/users/login.php then after his successful login a session as well as a cookie is getting created. This will creates a cookie called myCookie123 Now I have my subdomain as http://sub.domain.com/index.php . here at the top I am checking whether the user is logged in or not, for that I have to check whether the cookie is created or not.. Here my problem is that, I am not getting the idea about, how to access or read the cookie of http://www.domain.com http://www.domain.com/ from http://sub.domain.com/. can anyone please suggest me how to achieve this. Set the $domain parameter of setcookie to '.domain.com'. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read the main domain cookie in sub domain
Hi, Assume, I have www.domain.com http://www.domain.com/ in which I wrote the functionality for user authentication and his profile related functionality. Now, when user logs in using http://www.domain.com/users/login.php then after his successful login a session as well as a cookie is getting created. This will creates a cookie called myCookie123 Now I have my subdomain as http://sub.domain.com/index.php . here at the top I am checking whether the user is logged in or not, for that I have to check whether the cookie is created or not.. Here my problem is that, I am not getting the idea about, how to access or read the cookie of http://www.domain.com http://www.domain.com/ from http://sub.domain.com/. can anyone please suggest me how to achieve this. Thanks In advance. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan
RE: [PHP] php Login script issue
Hi, $result = mysql_query(SELECT * FROM tablename WHERE userName='$userName' AND password = '$password'); if($rec = mysql_fetch_array($result)){ //your code } Try like this it may solve. It may solve your problem Don't try to fetch the result from one single line code. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Chris Carter [mailto:[EMAIL PROTECTED] Sent: Sunday, September 16, 2007 3:10 PM To: php-general@lists.php.net Subject: [PHP] php Login script issue Hi, Its just a login and password validation that I am trying to achieve. If the username is correct then the person is able to view certain page, if incorrect then he is directed elsewhere. ? $userid=mysql_real_escape_string($userid); $password=mysql_real_escape_string($password); if($rec=mysql_fetch_array(mysql_query(SELECT * FROM tablename WHERE userName='$userName' AND password = '$password'))){ if(($rec['userName']==$userName)($rec['password']==$password)){ include ../include/newsession.php; echo p class=data centerSuccessfully,Logged inbrbr logout.php Log OUT brbr welcome.php Click here if your browser is not redirecting automatically or you don't want to wait. br/center; print script; print self.location='submit-store-details.php';; // Comment this line if you don't want to redirect print /script; } } else { session_unset(); echo Wrong Login. Use your correct Userid and Password and Try brcenterinput type='button' value='Retry' onClick='history.go(-1)'/center; } ? I am getting this error when I am using this code: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in thispage.php on line 37 Wrong Login. Use your correct Userid and Password and Try Why does it show up everytime and whats wrong with mysql_fetch_array(). Please advice also if there is some other way available please help me try that. Thanks, Chris -- View this message in context: http://www.nabble.com/php-Login-script-issue-tf4450691.html#a12698139 Sent from the PHP - General mailing list archive at Nabble.com. -- 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] Opening a file
?php $fruit = apple; $lines = file(fruits.txt); if (in_array($fruit,$lines)) { $a = Y; } ? Here there may be 2 cases. 1st either file() is not returning any values, that is why array empty and wrong datatype error, are you able to read the file. 2nd try to use implode function to consider each word as different value in an array $lines = implode('', file(fruits.txt)); Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Dan Shirah [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 05, 2007 7:55 PM To: php-general Subject: [PHP] Opening a file Good Morning! Opening this file is proving to be a pain. I have a folder that contains a PHP page and a text file. I am trying to open the contents of the txt file using file() but it keeps erroring out. Below is the code I'm using to try and open it: ?php $fruit = apple); $lines = file(fruits.txt); if (in_array($fruit,$lines)) { $a = Y; } ? So, I'm setting my variable, opening my file as an array in $lines, then checking to see if my variable is in the array, and if it is, assign a value ot a new variable. However, I am getting the following error: PHP Warning: in_array() [function.in-arrayhttp://develop1/credit%20card%20processing/function.in-ar ray]: Wrong datatype for second argument Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cant mail
Hi, Try to set from the program using ini_set()function and or check your mail server is correct or what. In most of the case I have used as follows Ini_set(SMPT,mail.domainname.com); And port If mail server doesn't exist then used as Ini_set(SMPT,domainname.com); And port And believe me it worked well... You just confirm your mailing server and your problem solves Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: Thursday, September 06, 2007 4:12 PM To: php-general@lists.php.net Subject: [PHP] cant mail when I try to send mail using this code: mail([EMAIL PROTECTED],TEST MAIL,TESTING MAIL); I get this error: Warning: mail() [function.mail]: Failed to connect to mailserver at smtp.tsanalytics.com port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\Inetpub\wwwroot\intranet\test.php on line 4 my settings in php.ini are SMTP = smtp.tsanalytics.com smtp_port = 25 -- 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] IE Not Following Header(Location: /path/to/file.php);
There may be some output before header() or may be IE browsing interface is not getting refresh properly Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Scott Wilcox [mailto:[EMAIL PROTECTED] Sent: Thursday, September 06, 2007 11:59 PM To: php-general@lists.php.net Subject: [PHP] IE Not Following Header(Location: /path/to/file.php); hey folks. I have a strange problem with IE sometimes. It doesn't seem to accept and follow a header sent to the browser. The action occurs when a user logs in, then is sent this header. Any hints/ideas appreciated. Scott. -- 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] Flow chart graph library
Hi, The following link may help you for what you want to achieve. I had bookmarked this link a long back. http://www.phpclasses.org/browse/package/3009.html But I have not tried. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Dani CastaƱos [mailto:[EMAIL PROTECTED] Sent: Thursday, September 06, 2007 8:22 PM To: php-general@lists.php.net Subject: [PHP] Flow chart graph library Hi all! Does anybody know a PHP library to create Flow chart graphs?? I need it to do something like this: (yes) Is it true ? --- Update | (no) | | Cancel Thank you in advance! -- 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] Calling functions which names are inside a variable
I tested this functionality. This is working fine. foo.php ? function foo( $var ){ include $var.'.php'; return $var(); }; foo(somefunction); ? somefunction.php ? function somefunction(){ echo hello; } ? Out put is hello. You make sure that your both files are in same folder and make sure that $var.'.php' is exist with $var function. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Robert Keizer [mailto:[EMAIL PROTECTED] Sent: Sunday, August 26, 2007 11:16 AM To: php-general@lists.php.net Subject: [PHP] Calling functions which names are inside a variable I am currently working on a module testing class, I can't seem to find the correct syntax. Here is an example of the problem: function foo( $var ){ include $var.'.php'; return $var(); // !--- problem }; foo(somefunction); In other words I am looking for a way to call a function by the value of a variable. I get a Call to undefined method error, any help would be great.. -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] determine which string is longer and then what is different in that string
Hi Richard, I am trying to get your actual problem. First, you want to compare 2 strings and want to check what the difference between these 2 strings is. I assuming string may contain either numbers or any characters. Second, you are trying to compare the numbers. But I am thinking that your problem is first case. Then first you check the length, and then check character by character (check each position, if different character at same position means changed) for each string. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Richard Kurth [mailto:[EMAIL PROTECTED] Sent: Sunday, August 26, 2007 11:41 AM To: php-general@lists.php.net Subject: [PHP] determine which string is longer and then what is different in that string I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do this or tell me what is wrong with the script I am using $string1 = 1,2,3,4,5,6,7,8; $string2 = 1,2,3,4,6,7,8; function compare_by_length ($a, $b) { $la = strlen ($a); $lb = strlen ($b); if ($la == $lb) return (0); return ($a $b) ? 1 : 2; } $string1 = 1,2,3,4,5,6,7,8; $string2 = 1,2,3,4,6,7,8; $longstring=compare_by_length ($string1, $string2); if ($longstring==0){ echo nochange . $longstring; echobr; } if ($longstring==1){ echo List . $longstring; echobr; $array1 = explode(,, $string1); $array2 = explode(,, $string2); } if ($longstring==2){ echo List . $longstring; echobr; $array1 = explode(,, $string2); $array2 = explode(,, $string1); } for ($i = 0; $i count($array1); $i++) { $associative_array[$array1[$i]] = 1; } // print Not a member of the following lists:br\n; for ($i = 0; $i count($array2); $i++) { if (!$associative_array[$array2[$i]]) { print $array2[$i]br\n; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Does JavaScript not work in php web file?
; $kelas=new koneksi(); $klas=$kelas-getkoneksi(survey,$sqlnya); if ( mysql_num_rows($klas) 0 ) { echo option name=\state\ value=\\/option; while( list($state,$statename) = mysql_fetch_row($klas) ) { echo option name=\state\ value=\$state\$statename ($state)/option; } } else { echo 'No results found'; } ? /select /td /tr /form /table /tdtd/td/tr/table /BODY /HTML == On Sat, 25 Aug 2007 22:26:49 +0530 Sanjeev N [EMAIL PROTECTED] wrote: Hi, JavaScript codes works in php files. Yours code is also fine. But check your calling function and defined functions. Calling function is jsopsi and defined function is opsi. Please check. Other than this everything is ok Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Patrik Hasibuan [mailto:[EMAIL PROTECTED] Sent: Saturday, August 25, 2007 9:17 PM To: php-general@lists.php.net Subject: [PHP] Does JavaScript not work in php web file? Dear my friends... I am confused to implement JavaScript code in php web file. I want my JavaScript change the selected item of select tag based on the selected item of previous selected in same php page. Please help me tell my where is my mistake. === Here is my code pelangganbaru.php === !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org TITLEguru.com - Menu for new customer/TITLE /HEAD Script Language=JavaScript function opsi(){ if (document.formulir.opsinegara.value!=Virgina Islands (USA);){ document.formulir.opsistate.options[0].selected=true; } } /Script BODY ?php if (isset($pid)){ $idproduk=$_GET['pid']; echo Produk ID: $idprodukbr; } ? table border=0 align=center cellpadding=0 cellspacing=0 width=800 trtd/tdtdtable border=0 align=center cellpadding=0 cellspacing=0 width=400 form method=post action=cgi/cgipelangganbaru.php?pid=$idproduk name=formulir tr td align=right bgcolor=#F5D78B 3. Country: /td td align=center /td td align=left select name=negara onchange=jsopsi() name=opsinegara ?php include_once koneksi.php; $sqlnya=select country from countries; $kelas=new koneksi(); $klas=$kelas-getkoneksi(survey,$sqlnya); if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo option id=\opsi.$negara\ value=\$negara\$negara/option; } } else { echo 'No results found'; } ? /select /td /tr tr td align=right bgcolor=#F5D78B 4. State: /td td align=center /td td align=left select name=opsistate ?php include_once koneksi.php; $sqlnya=select state,statename from states; $kelas=new koneksi(); $klas=$kelas-getkoneksi(survey,$sqlnya); if ( mysql_num_rows($klas) 0 ) { echo option name=\opsi.$state.\ value=\\/option; if ($negara==Virgin Islands (US)){ echo option name=\nonusa\ value=\00\ selectedNon USA/option; }else{ echo option name=\nonusa\ value=\00\Non USA/option; } while( list($state,$statename) = mysql_fetch_row($klas) ) { echo option name=\state\ value=\$state\$statename ($state)/option; } } else { echo 'No results found'; } ? /select /td /tr tr td align=right input type=submit /td td align=center /td td align=left input type=reset /td /tr /form /table /tdtd/td/tr/table /BODY /HTML -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Does JavaScript not work in php web file?
Hi, JavaScript codes works in php files. Yours code is also fine. But check your calling function and defined functions. Calling function is jsopsi and defined function is opsi. Please check. Other than this everything is ok Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Patrik Hasibuan [mailto:[EMAIL PROTECTED] Sent: Saturday, August 25, 2007 9:17 PM To: php-general@lists.php.net Subject: [PHP] Does JavaScript not work in php web file? Dear my friends... I am confused to implement JavaScript code in php web file. I want my JavaScript change the selected item of select tag based on the selected item of previous selected in same php page. Please help me tell my where is my mistake. === Here is my code pelangganbaru.php === !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org TITLEguru.com - Menu for new customer/TITLE /HEAD Script Language=JavaScript function opsi(){ if (document.formulir.opsinegara.value!=Virgina Islands (USA);){ document.formulir.opsistate.options[0].selected=true; } } /Script BODY ?php if (isset($pid)){ $idproduk=$_GET['pid']; echo Produk ID: $idprodukbr; } ? table border=0 align=center cellpadding=0 cellspacing=0 width=800 trtd/tdtdtable border=0 align=center cellpadding=0 cellspacing=0 width=400 form method=post action=cgi/cgipelangganbaru.php?pid=$idproduk name=formulir tr td align=right bgcolor=#F5D78B 3. Country: /td td align=center /td td align=left select name=negara onchange=jsopsi() name=opsinegara ?php include_once koneksi.php; $sqlnya=select country from countries; $kelas=new koneksi(); $klas=$kelas-getkoneksi(survey,$sqlnya); if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo option id=\opsi.$negara\ value=\$negara\$negara/option; } } else { echo 'No results found'; } ? /select /td /tr tr td align=right bgcolor=#F5D78B 4. State: /td td align=center /td td align=left select name=opsistate ?php include_once koneksi.php; $sqlnya=select state,statename from states; $kelas=new koneksi(); $klas=$kelas-getkoneksi(survey,$sqlnya); if ( mysql_num_rows($klas) 0 ) { echo option name=\opsi.$state.\ value=\\/option; if ($negara==Virgin Islands (US)){ echo option name=\nonusa\ value=\00\ selectedNon USA/option; }else{ echo option name=\nonusa\ value=\00\Non USA/option; } while( list($state,$statename) = mysql_fetch_row($klas) ) { echo option name=\state\ value=\$state\$statename ($state)/option; } } else { echo 'No results found'; } ? /select /td /tr tr td align=right input type=submit /td td align=center /td td align=left input type=reset /td /tr /form /table /tdtd/td/tr/table /BODY /HTML -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- 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] Cookies and sent headers
Hi, Its not the problem of cookies. Its problem of redirection or the parent.location.replace function. I mean if you already output something on the page and tries to redirect then this problem happens. Redirect before outputting anything on the page.. like space is also an output. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Otto Wyss [mailto:[EMAIL PROTECTED] Sent: Saturday, August 18, 2007 2:56 PM To: php-general@lists.php.net Subject: [PHP] Cookies and sent headers If built a simple login page and store any information within $_SESSION's. Yet I'd like to move these into cookies but I always get an error about sent headers. Is there a way to circumvent this problem without changing too much in the page? The setting of the cookies happens just at the end of the page. if (!$errortext and $Anmelden) { if (!empty($Permanent)) { $expires = time()+ 365 * 86400; // 365 days setcookie (l.Lastname, $_SESSION['l_Lastname'], $expires); setcookie (l.Firstname, $_SESSION['l_Firstname'], $expires); setcookie (l.Email1, $_SESSION['l_Email1'], $expires); setcookie (l.Email2, $_SESSION['l_Email2'], $expires); } echo script type=\text/javascript\ parent.location.replace('$index_php; /script; exit; } O. Wyss -- 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] About Session And Cookies
Hi Kelvin, You can use the session for your ecommerce website.. Cookies also good, but if it is disabled then it is of no use. I basically use session variable to particular member for accessing his data. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Kelvin Park [mailto:[EMAIL PROTECTED] Sent: Saturday, August 18, 2007 3:32 AM To: php-general@lists.php.net Subject: [PHP] About Session And Cookies I am trying to setup a secure login system. I've heard that if I use just cookies for login, members without cookie turned out won't be able to see the member pages. Is using session recommended for e-commerce websites with shopping carts? Or, using both of them might be more effective in some way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] for loop inside a switch
This will not work at all.. Instead of switch try with if condition as follows for ($i=0; $i 21; $i++) { if(faq$i == $q){ echo $faq1; break; } } Now it works.. You can write the code to display the result how you want.. but you cant write the code to write a code :) Cheers Warm Regards, Sanjeev http://www.sanchanworld.com http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Hulf [mailto:[EMAIL PROTECTED] Sent: Thursday, August 16, 2007 3:11 PM To: php-general@lists.php.net Subject: [PHP] for loop inside a switch Hi, switch ($q) { for ($i=0; $i 21; $i++) { case 'faq$i': echo $faq1; break; } } I just want to loop out a big long list of cases. -- 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] cant get if logic correct..
Why don't you try to check for if it is integer. You will get the function to check the variable (is_integer not sure) in manual. Warm Regards, Sanjeev http://www.sanchanworld.com http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Gregory Machin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 15, 2007 7:01 PM To: php-general@lists.php.net Subject: [PHP] cant get if logic correct.. Hi i have a piece of code that gets info from a comma delimited file, then gets each value that is to be insterted into the database The variabls must only contain numbers and must not be null .. but the logic i have is iether not working or there are some hidden characters creeping in because it is processing the data ... how can i do this better ? for($i=2;$i$arrsize;$i++){ $parts=explode(,,$lines[$i]); $stnr=$parts[0]; $subj=$parts[1]; $mark=$parts[4]; if (($stnr) and ($subj) and ($mark)){ //do alot of something lol } } -- Gregory Machin -- 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] problem with require_once
Hi, The problem is simple... Either the file myclass.php path is wrong (may be your calling file is in some folder and myclass.php is in another folder) or if path is correct and file may have some syntax errors or some function may not exist.. Please check the path if wrong and check the file for syntax and content if path is correct Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Vanessa Vega [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 15, 2007 11:30 AM To: php-general@lists.php.net Subject: [PHP] problem with require_once Good day to all... I would like to ask for some help.. I have a form created in javascript codes. The page is a pop up window. I am passing the values of the form using the method post. The PHP file that handles the form displays the values from that and had the following code in the beginning: ?php require_once('myclass.php'); //this class contains all functions for me to connect on the database rest of the code for displaying and saving values to an existing databse-- ? when i clicked the submit button, nothing happens and the page wouldl just refresh... but when i removed the require_once code of my PHP, the values from the form is displayed but of course, will not be saved since the class isnt there. can anyone help me -- 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] www.soongy.com
Hi Gevorg, Great work.. But few things. Scroller is not working even at bottom content is there... I tried in both mozila and IE... In IE when I selected text and moved down then it scrolled down. But where in Mozila no use... Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: Gevorg Harutyunyan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 14, 2007 8:45 PM To: php-general@lists.php.net Subject: [PHP] www.soongy.com Hello, I am Gevorg. I just wanted to introduce you my new PHP based work here www.soongy.com http://www.soongy.com/ . It is working on PHP and MySQL and here is used DHTML, AJAX. Thank you very much. Waiting for your response Regards, Gevorg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing Variables Inside a String
$new = '$good_day$fr['iop']'; This will give you error... Instead if you try in this way as follows $new = $good_day$fr['iop']; or $new = $good_day.$fr['iop']; It will include the They're carzy! in the $new variable.. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 15, 2007 12:21 PM To: php-general@lists.php.net Subject: [PHP] Parsing Variables Inside a String Hi, is there a function that can parse variables within a string? For example: $good_day = 'The'; $fr['iop'] = y're crazy!; $new = '$good_day$fr['iop']'; echo TheFunctionIRequest($new); // They're crazy! Thanks! -- 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] Parsing Variables Inside a String
Consider the variable name inside database is 'emp_name' and now you want to use this as $emp_name.. This variable will be stored in as follows $variable1 = $resultfromdatabase['variable1']; Then next step is store anything in this variable as follows $$variable1 = John; I hope this may not help you for what you want, but at least It will gives an idea for different methods.. Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com - Submit your website URL http://webhosting.sanchanworld.com - Choose your best web hosting plan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 15, 2007 12:41 PM To: Chris Cc: php-general@lists.php.net Subject: Re: [PHP] Parsing Variables Inside a String I need to get the variable names from a database. On 8/15/07, Chris [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, is there a function that can parse variables within a string? For example: $good_day = 'The'; $fr['iop'] = y're crazy!; $new = '$good_day$fr['iop']'; echo TheFunctionIRequest($new); // They're crazy! Well this: echo $good_day . $fr['iop']; will do what you show here. What are you trying to do exactly? -- Postgresql php tutorials http://www.designmagick.com/ -- 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] Check if var has a date (timestamp or regular)
Hi, You need to check with your submitted data as in which format it is. Try with different combination for splitting the string (include -, / while splitting string). If input string works with split then assume input string as in above format. Otherwise simple, consider it as in timestamp. But I suggest if some user is entering the date then let them insert the date as you want. Just mention (mm/dd/) after the text field and it will solve your problem Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: OOzy Pal [mailto:[EMAIL PROTECTED] Sent: Monday, August 06, 2007 5:22 PM To: PHP Subject: [PHP] Check if var has a date (timestamp or regular) How can I check an inputed date if it is a valid date and if it is in the form of a timestamp or regular date such as (22-07-2007 or 22/07/2007) -- OOzy Ubuntu-Feisty -- 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] compose html body with variables
Use as following: $body = Hello, here is your quote from Freight Services.br /br /Shipping from: tab $origin to $destinationbr /Shipping subtotal $ . number_format($subtotal,2). brbrFreight charges $ . number_format($freightCharges,2). br; And so on Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: Matt [mailto:[EMAIL PROTECTED] Sent: Monday, August 06, 2007 8:08 PM To: php-general@lists.php.net Subject: [PHP] compose html body with variables Hello, I'm trying to compose the body of an html email to use with the mail() function. I'm running into problem because I'm not sure how to quote the multi-line body. Here is what I have: $body = echo Hello, here is your quote from Freight Services.br /br /; echo Shipping from: tab $origin to $destinationbr /; echo br; echo Shipping subtotal $ . number_format($subtotal,2); echo br; echo br; echo Freight charges $ . number_format($freightCharges,2); echo br; echo Fuel surcharge $ . number_format($fuelSurcharge,2); echo br; echo Pickup and delivery $ . number_format($pickupDelivery,2); echo br; echo br; echo Miscellaneus costs (e.g. liftgates, etc.) below $ . number_format($miscCost,2); echo br; echo br; if ($liftgatePickup == 50){ echo Adding liftgate on pickup $50.00; echo br; } if ($liftgateDelivery == 50){ echo Adding liftgate on delivery $50.00; echo br; } if ($spectimeDelivery == 35){ echo Adding cost of specific-time delivery $35.00; echo br; } if ($conventionDelivery == 35){ echo Adding cost of convention delivery $35.00; echo br; } if ($dreyageWait != 0){ echo Adding cost for wait $ . $dreyageWait; echo br; } if ($insideDelivery == 25){ echo Adding cost for inside delivery $25.00; echo br; } if ($notifyClient == 10){ echo Adding cost for client notification $10.00; echo br; } echo Total cost is $ . number_format($totalcost,2); echo br /br /; echo a href=\www.foo.net\foo Services/a; $subject = Online Freight Quote; mail($email, $subject, $body, From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=iso-8859-1\r\n); If anyone could assist me I'd appreciate it very much, Matt -- 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] About PHP/MYSQL Pagination
Hi, 1. first you know current page number 2. you know how many pages Next consider total how many page number you want to display Assume 5 I.e. first previous | 1 2 3 4 5 | next last Now when you come to page 4 then starting page is around 4-1 or 4-2 (however you want) and start the for loop till 4+2 or 4+3(depends on you). I.e. first previous | (4-2) (4-1) 4 (4+1) (4+2) (4+3) | next last For loop will be For(i=-2; i=2; i++) Echo a href=$pagenumber+$i/a; I think you got some idea Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: Kelvin Park [mailto:[EMAIL PROTECTED] Sent: Friday, August 03, 2007 6:43 AM To: php-general@lists.php.net Subject: [PHP] About PHP/MYSQL Pagination I just couldn't find it anywhere, google or yahoo. I know how to make first, previous, last, and next links for php/mysql pagination. How do you list page numbers in the middle, between previous and next? (ex. first previous | 1 2 3 4 5 | next last ) I know how to display them from 1 to whatever by using for loop, but the problem comes in when I click next from page 5, it does not get re-listed starting from page 6. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php SHOW
Hi, If I understood your problem correctly then, you can use ob_start and ob_end functions Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: Hulf [mailto:[EMAIL PROTECTED] Sent: Friday, August 03, 2007 4:26 PM To: php-general@lists.php.net Subject: [PHP] php SHOW Is there a way to output my data and tables using a php version of SHOW? Doesn't have to be pretty HTML just output to screen Ta, R. -- 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] Which PHP-Editor to use?
Hi, I have used both Editplus and Macromedia dreamweaver. If you want to see the visual the elements then dreamweaver is best. If you only want the coding environment the I also suggest you to use editplus Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: Merlin [mailto:[EMAIL PROTECTED] Sent: Thursday, August 02, 2007 9:43 PM To: php-general@lists.php.net Subject: [PHP] Which PHP-Editor to use? Hi there, I have worked now for several years happily with homesite 4.5, but now it looks like I have to switch to another system as homesite will not run without admin rights on a XP machine. What editors do you use? Do you have any recomendations on a special one? I have looked into eclipse, but I would hear from your experience which one would you recommend me to switch to? Thank you for any comment. Best regards, Merlin -- 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