[PHP-DB] Function to create bar chart problem
Hi guys. I am a newbie triying to do grown-up people stuff :) I am trying to write a function to create a bar chart using JPGraph where I have to pass two variables (query name, and x axis column name) and the function creates the graphic. It is because I have several queries with diferent length, so I would like to have a function to create lots of graphics without to much coding. I have two questions: a) How could I create an array which collects the result of a mysql_fetch_array() function (excluding only the first column). b) How can I execute the string from a variable as if it where part of the script: For example I have the following variable var1 = '$y_'.$row_query[$org_field_name].' = new BarPlot('.($row_query).');'; which creates a string like this: $y_org1=new BarPlot(array); /* $y_org1 is the result of the query $row_query[$org_field_name] and $row_query is the array which contains the result of $row_query=mysql_fetch_assoc($sql)*/ Any clue will be very, very, very appreciated. Best regards, Alvaro Following is the whole code. 1. The sample table is as follows +--++++ | org_name | field1 | field2 | field3 | +--++++ | org1 | 1 | 5 | 10 | | org2 | 12 | 4 | 8 | | org3 | 45 | 12 | 20 | | org4 | 40 | 30 | 4 | +--++++ 2. The script as far as I've got it is: FILE: functions.inc.php ?php include ( ../../addons/jpgraph/src/jpgraph.php); include (../../addons/jpgraph/src/jpgraph_bar.php); function fnc_y_name($query_name, $org_field_name) { $row_query=mysql_fetch_assoc($query_name);//Array que recoge los datos de las filas de la consulta. $total_rows=mysql_num_rows($query_name); //Nmero total de filas que devuelve la consulta $total_fields=mysql_num_fields($query_name);//Nmero total de campos en la consulta for($i=1; $i$total_fields; $i++) { $fieldname = mysql_field_name($query_name,$i); $array_fieldname[] = $fieldname; }; do { for($i=0; $i$total_fields-1; $i++) { $y_data[] = $row_query[$array_fieldname[$i]]; //Here is my bigger problem. } } while ($row_query=mysql_fetch_assoc($query_name)); //STARTS THE GRAPHIC CREATION //Creates the graphic $graph = new Graph(900,400,auto); $graph-SetScale(textlin); $graph-SetShadow(); $graph-img-SetMargin(40,30,20,40); //I will try to build this calls with a do..while loop from the data collected from the y_data array. This is why I need to pass the variable or array contents directly to the script. $b1plot = new BarPlot($y_data); $b1plot-SetFillColor(olivedrab3); $b2plot = new BarPlot($y_data); $b2plot-SetFillColor(orange); // Joins the plots $gbplot = new GroupBarPlot(array($b1plot, $b2plot)); // Executes the graphic $graph-Add($gbplot); $graph-title-Set(Graphic Title); $graph-subtitle-Set(Sales); $graph-xaxis-title-Set(Organization); $graph-yaxis-title-Set(Sales amount in thousands); $graph-img-SetMargin(75,30,80,80); $graph-title-SetFont(FF_FONT1,FS_BOLD); $graph-yaxis-title-SetFont(FF_FONT1,FS_BOLD); $graph-xaxis-title-SetFont(FF_FONT1,FS_BOLD); // Displays the graph $graph-Stroke(); }; //End of the function ? FILE: function_test.php (executes the function) ?php require_once('../Connections/sis_mon_conn.php'); include('../Connections/my_connection.php'); include (functions.inc.php); ? ?php mysql_select_db($database_sis_mon_conn, $sis_mon_conn); $query_rec_sql = SELECT * FROM test; $rec_sql = mysql_query($query_rec_sql, $sis_mon_conn) or die(mysql_error()); $row_rec_sql = mysql_fetch_assoc($rec_sql); $totalRows_rec_sql = mysql_num_rows($rec_sql); mysql_data_seek($rec_sql, 0); fnc_y_name($rec_sql, org_name); ? ?php mysql_free_result($rec_sql); ? //I know, the code is awful, but is the best I have got with my poor experience
Re: [PHP-DB] Function to convert a Date String to a MYSQL TimeStamp
You can use date('YmdHis',strtotime($your_date_string)); check http://ro.php.net/manual/en/function.date.php for more about the date function. On Sat, 2005-05-07 at 18:06 -0700, Graham Anderson wrote: I need to batch convert a bunch of date strings into mysql time stamps: If I have the following: May 7, 2005, 7:29 pm how do I convert that to a MySQL Timestamp like: 20050507192957 many thanks g -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Function to convert a Date String to a MYSQL TimeStamp
strtotime bastien From: Graham Anderson [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Function to convert a Date String to a MYSQL TimeStamp Date: Sat, 7 May 2005 18:06:12 -0700 I need to batch convert a bunch of date strings into mysql time stamps: If I have the following: May 7, 2005, 7:29 pm how do I convert that to a MySQL Timestamp like: 20050507192957 many thanks g -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Emisor de respuesta automática: [PHP-DB] Function to convert a Date String to a MYSQL TimeStamp
In the DB, I guess you should use an ALTER TABLE sentence in order to change your DATE field into a TIMESTAMP field. -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Cel: 9931-6 - Mensaje original - De: Graham Anderson [EMAIL PROTECTED] Fecha: Sábado, Mayo 7, 2005 6:06 pm Asunto: [PHP-DB] Function to convert a Date String to a MYSQL TimeStamp I need to batch convert a bunch of date strings into mysql time stamps: If I have the following: May 7, 2005, 7:29 pm how do I convert that to a MySQL Timestamp like: 20050507192957 many thanks g -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Function to convert a Date String to a MYSQL TimeStamp
I need to batch convert a bunch of date strings into mysql time stamps: If I have the following: May 7, 2005, 7:29 pm how do I convert that to a MySQL Timestamp like: 20050507192957 many thanks g -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Function Problem
Hi there everyone, This code works fine until I put it into my function, then it still works BUT however many lines are in the file are multiplied. For example, if I have 3 lines with the following: [EMAIL PROTECTED], myname [EMAIL PROTECTED], yourname [EMAIL PROTECTED], ourname In THEORY this should just print the above, HOWEVER, when it's being called as a function it's giving me the following: [EMAIL PROTECTED], myname [EMAIL PROTECTED], myname [EMAIL PROTECTED], myname [EMAIL PROTECTED], yourname [EMAIL PROTECTED], yourname [EMAIL PROTECTED], yourname [EMAIL PROTECTED], ourname [EMAIL PROTECTED], ourname [EMAIL PROTECTED], ourname When it is inserted into the DB. It might be something obvious, but here's the code below to see if there's anything obvious i'm doing wrong. Oh and i've checked and $userfile AND $delim are being picked up ok. function db_importcsv($userfile,$delim) { if ($userfile == ){ $failed = 'yes'; } else { $date = date('d m Y'); $row = 1; $handle = fopen ($userfile,r); while ($data = fgetcsv ($handle, 5024, ,)) { $num = count ($data); $row++; mysql_query (INSERT INTO emaillist (EMail,name,date) VALUES ('$data[0]','$data[1]','$date') ); }; fclose ($handle); $failed = no; }; return $failed; }; Any help would be really appreciated, as i'm new to functions but enjoying it :-) Chris
[PHP-DB] Function Name available within function?
Is there some sort of master variable which will tell you which function you are currently in? Like __FUNCTION__ like there is for __FILE__ and __LINE__... Something like that. Even a function that does that? I am writing a program in which several functions refer back to themselves by name, and it'd be nice to be able to do it dynamically. If I change a function name, then I have to change (currently) the string that contains the function name within that function. Peter --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] function needed
Use str_replace $FQDN = www.domain.com $domain_only = str_replace(array('www.','.com','.mil','.edu','.org','.gov'),'',$FQDN); Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 8:20 PM To: Shahar Tal Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] function needed function get_domain($domain){ preg_match('/^(www.)?([A-Za-z_-]+).+$/',$domain,$arr); return $arr[2]; } Shahar Tal wrote: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] function needed
Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] function needed
Try searching www.phpclasses.org. I'm almost positive it's been written before and if it exists, this is a great place to start looking for it. -Original Message- From: Shahar Tal [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 12:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] function needed Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] function needed
Hi! I hope I understood you right... I would use PCREs: ?php function getdomainname($string) { $pattern = '#(([[:alnum:]]+)(\.))?(.+)(\.)([[:alnum:]]+)#i'; $replace = '\\4'; return preg_replace($pattern, $replace, $string); } $var = $_SERVER['SERVER_NAME']; echo getdomainname($var); ? .ma Shahar Tal [EMAIL PROTECTED] [EMAIL PROTECTED] 18:44 Uhr: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] function needed
? function stripdomain($string) { if(stristr($string, co.)) { $string = ereg_replace(.co., ., $string); } $end = strrpos($string, .); $string = substr($string, 0, $end); while(strchr($string, .)) { $start = strpos($string, .); $string = substr($string, $start+1); } return $string; } ? There we go. This one also parses .co.uk, which frustrated me there for a minute, but oh well, I'm over it. I don't believe there are any others that will slip by this, but of course I can't be certain. Give it a shot, see if it does what you need. I tested it with: Print stripdomain(this.will.irritate.me.if.I.don't.figure.it.out.soon.co.uk); It returned with soon ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: heilo [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 1:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] function needed Hi! I hope I understood you right... I would use PCREs: ?php function getdomainname($string) { $pattern = '#(([[:alnum:]]+)(\.))?(.+)(\.)([[:alnum:]]+)#i'; $replace = '\\4'; return preg_replace($pattern, $replace, $string); } $var = $_SERVER['SERVER_NAME']; echo getdomainname($var); ? .ma Shahar Tal [EMAIL PROTECTED] [EMAIL PROTECTED] 18:44 Uhr: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] function needed
You could also use this: function getdomainname($name) { $parts = explode('.',$name); return $parts[count($parts)-2]; } which will always return the second to last section when divided up by the periods. So it will return 'domain' for all of the following: www.domain.com www.subdomain.domain.org subdomain.domain.org domain.museum ---John Holmes... - Original Message - From: heilo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:27 PM Subject: Re: [PHP-DB] function needed Hi! I hope I understood you right... I would use PCREs: ?php function getdomainname($string) { $pattern = '#(([[:alnum:]]+)(\.))?(.+)(\.)([[:alnum:]]+)#i'; $replace = '\\4'; return preg_replace($pattern, $replace, $string); } $var = $_SERVER['SERVER_NAME']; echo getdomainname($var); ? .ma Shahar Tal [EMAIL PROTECTED] [EMAIL PROTECTED] 18:44 Uhr: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] function needed
But what about www.domain.co.uk, you ask? Well, it'll fail with this. :) Just filter out the 'co.' like the other function that was posted and this will still work. ---John Holmes... - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: heilo [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:58 PM Subject: Re: [PHP-DB] function needed You could also use this: function getdomainname($name) { $parts = explode('.',$name); return $parts[count($parts)-2]; } which will always return the second to last section when divided up by the periods. So it will return 'domain' for all of the following: www.domain.com www.subdomain.domain.org subdomain.domain.org domain.museum ---John Holmes... - Original Message - From: heilo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:27 PM Subject: Re: [PHP-DB] function needed Hi! I hope I understood you right... I would use PCREs: ?php function getdomainname($string) { $pattern = '#(([[:alnum:]]+)(\.))?(.+)(\.)([[:alnum:]]+)#i'; $replace = '\\4'; return preg_replace($pattern, $replace, $string); } $var = $_SERVER['SERVER_NAME']; echo getdomainname($var); ? .ma Shahar Tal [EMAIL PROTECTED] [EMAIL PROTECTED] 18:44 Uhr: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] function needed
Well I lost the race as well, because I failed to account for .com.br, or .com.at, or any of those other rarely used ones. Bah... ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 2:02 PM To: 1LT John W. Holmes; heilo; [EMAIL PROTECTED] Subject: Re: [PHP-DB] function needed But what about www.domain.co.uk, you ask? Well, it'll fail with this. :) Just filter out the 'co.' like the other function that was posted and this will still work. ---John Holmes... - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] To: heilo [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:58 PM Subject: Re: [PHP-DB] function needed You could also use this: function getdomainname($name) { $parts = explode('.',$name); return $parts[count($parts)-2]; } which will always return the second to last section when divided up by the periods. So it will return 'domain' for all of the following: www.domain.com www.subdomain.domain.org subdomain.domain.org domain.museum ---John Holmes... - Original Message - From: heilo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 24, 2003 1:27 PM Subject: Re: [PHP-DB] function needed Hi! I hope I understood you right... I would use PCREs: ?php function getdomainname($string) { $pattern = '#(([[:alnum:]]+)(\.))?(.+)(\.)([[:alnum:]]+)#i'; $replace = '\\4'; return preg_replace($pattern, $replace, $string); } $var = $_SERVER['SERVER_NAME']; echo getdomainname($var); ? .ma Shahar Tal [EMAIL PROTECTED] [EMAIL PROTECTED] 18:44 Uhr: Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Function questions...
I am trying to convert something that I have working in a PHP script to be a function in a library type of file. The code contained in the function works fine in another script, but I am currently getting no output from the function. I have a question about the nature of functions that may help clear up my problems. Do 'echo' commands within functions actually work to directly display information? I have only used functions up to this point that use the 'return' command to pass a variable back to the script that called the function. I am pretty confused on how to actually use a function that formats data to be displayed. This is my primary source of confusion. Below is the function that is giving me trouble: function CheckboxList($query) { $result1 = mysql_query($query); do { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 2) { $cnt = 3; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 3) { $cnt = 4; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 4) { $cnt = 1; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td/tr; } } while ($list = mysql_fetch_assoc($result1)); } Here is also the way I am calling this function: snip... $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; snip... CheckboxList($query); snip... Is there something wrong with the way in which I am calling this function? Thanks in advance for all the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function questions...
I would replace $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; by $query = SELECT * FROM accounts WHERE verifyurl='{$safe_verify_string}'; to force interpolation of variable $safe_verify_string HTH Ignatius - Original Message - From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 06, 2002 6:04 PM Subject: [PHP-DB] Function questions... I am trying to convert something that I have working in a PHP script to be a function in a library type of file. The code contained in the function works fine in another script, but I am currently getting no output from the function. I have a question about the nature of functions that may help clear up my problems. Do 'echo' commands within functions actually work to directly display information? I have only used functions up to this point that use the 'return' command to pass a variable back to the script that called the function. I am pretty confused on how to actually use a function that formats data to be displayed. This is my primary source of confusion. Below is the function that is giving me trouble: function CheckboxList($query) { $result1 = mysql_query($query); do { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 2) { $cnt = 3; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 3) { $cnt = 4; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 4) { $cnt = 1; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td/tr; } } while ($list = mysql_fetch_assoc($result1)); } Here is also the way I am calling this function: snip... $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; snip... CheckboxList($query); snip... Is there something wrong with the way in which I am calling this function? Thanks in advance for all the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function questions...
$sys is an array, so echoing $sys will cause problems. Are you trying to get a 4xN table of values and checkboxes? There's got to be an easier way... --- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote: I am trying to convert something that I have working in a PHP script to be a function in a library type of file. The code contained in the function works fine in another script, but I am currently getting no output from the function. I have a question about the nature of functions that may help clear up my problems. Do 'echo' commands within functions actually work to directly display information? I have only used functions up to this point that use the 'return' command to pass a variable back to the script that called the function. I am pretty confused on how to actually use a function that formats data to be displayed. This is my primary source of confusion. Below is the function that is giving me trouble: function CheckboxList($query) { $result1 = mysql_query($query); do { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 2) { $cnt = 3; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 3) { $cnt = 4; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 4) { $cnt = 1; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td/tr; } } while ($list = mysql_fetch_assoc($result1)); } Here is also the way I am calling this function: snip... $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; snip... CheckboxList($query); snip... Is there something wrong with the way in which I am calling this function? Thanks in advance for all the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *** __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Function questions...
Thanks guys. I was able to work through this issue pretty much on my own. I got this portion of things working nicely except for a form button that is appearing at the top rather than the bottom of the page. -Original Message- From: Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Function questions... $sys is an array, so echoing $sys will cause problems. Are you trying to get a 4xN table of values and checkboxes? There's got to be an easier way... --- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote: I am trying to convert something that I have working in a PHP script to be a function in a library type of file. The code contained in the function works fine in another script, but I am currently getting no output from the function. I have a question about the nature of functions that may help clear up my problems. Do 'echo' commands within functions actually work to directly display information? I have only used functions up to this point that use the 'return' command to pass a variable back to the script that called the function. I am pretty confused on how to actually use a function that formats data to be displayed. This is my primary source of confusion. Below is the function that is giving me trouble: function CheckboxList($query) { $result1 = mysql_query($query); do { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 2) { $cnt = 3; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 3) { $cnt = 4; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 4) { $cnt = 1; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td/tr; } } while ($list = mysql_fetch_assoc($result1)); } Here is also the way I am calling this function: snip... $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; snip... CheckboxList($query); snip... Is there something wrong with the way in which I am calling this function? Thanks in advance for all the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *** __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Function questions...
OK. Stumped once again. This function is now properly generating and displaying the form as I intend it to. The only problem is that the optional text and button at the end of the function is actually displaying above the choices provided in the while loop from the database. Please let me know what you think. function CheckboxList($query, $CheckboxText) { $cnt = 1; $result1 = mysql_query($query); echo form name=\form1\ method=\post\ action=\test_display.php\; echo table border=\0\ align=\center\; while ($list = mysql_fetch_assoc($result1)) { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys[1]\; echo $sys[1]./td; } elseif ($cnt == 2) { $cnt = 3; echo td width=\161\input name=\system[]\ type=\checkbox\ value=\$sys[1]\; echo $sys[1]./td; } elseif ($cnt == 3) { $cnt = 4; echo td width=\161\input name=\system[]\ type=\checkbox\ value=\$sys[1]\; echo $sys[1]./td; } elseif ($cnt == 4) { $cnt = 1; echo td width=\161\input name=\system[]\ type=\checkbox\ value=\$sys[1]\; echo $sys[1]./td/tr; } } if ($CheckboxText) { echo p align=\center\font size=\4\$CheckboxText/font/p; } echo div align=\center\input type=\submit\ name=\Submit\ value=\Submit\/div/form; } One other question while I am at it... I am wanting to provide a button that selects all of the checkboxes automatically and refreshes the page. You know, a select all button. I know nothing of Javascript, but this is what should do this, correct? Once again, any and all help is most appreciated. -Original Message- From: Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Function questions... $sys is an array, so echoing $sys will cause problems. Are you trying to get a 4xN table of values and checkboxes? There's got to be an easier way... --- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote: I am trying to convert something that I have working in a PHP script to be a function in a library type of file. The code contained in the function works fine in another script, but I am currently getting no output from the function. I have a question about the nature of functions that may help clear up my problems. Do 'echo' commands within functions actually work to directly display information? I have only used functions up to this point that use the 'return' command to pass a variable back to the script that called the function. I am pretty confused on how to actually use a function that formats data to be displayed. This is my primary source of confusion. Below is the function that is giving me trouble: function CheckboxList($query) { $result1 = mysql_query($query); do { $sys = split('-', $list['id-sys']); if ($cnt == 1) { $cnt = 2; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 2) { $cnt = 3; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 3) { $cnt = 4; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td; } elseif ($cnt == 4) { $cnt = 1; echo trtd width=\161\input name=\system[]\ type=\checkbox\ value=\$sys\; echo $sys./td/tr; } } while ($list = mysql_fetch_assoc($result1)); } Here is also the way I am calling this function: snip... $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'; snip... CheckboxList($query); snip... Is there something wrong with the way in which I am calling this function? Thanks in advance for all the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *** __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function questions...
On Saturday 07 December 2002 04:12, NIPP, SCOTT V (SBCSI) wrote: OK. Stumped once again. This function is now properly generating and displaying the form as I intend it to. The only problem is that the optional text and button at the end of the function is actually displaying above the choices provided in the while loop from the database. Please let me know what you think. Your table doesn't seem to be closed. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Never volunteer for anything. -- Lackland */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Function questions...
Duh, OK. That fixed me right up. Thanks. Now if I can just figure out the 'Select All' option. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 2:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Function questions... On Saturday 07 December 2002 04:12, NIPP, SCOTT V (SBCSI) wrote: OK. Stumped once again. This function is now properly generating and displaying the form as I intend it to. The only problem is that the optional text and button at the end of the function is actually displaying above the choices provided in the while loop from the database. Please let me know what you think. Your table doesn't seem to be closed. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Never volunteer for anything. -- Lackland */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function that outputs at line xxx
Hi, A new function 'debug_backtrace()' will be available in PHP 4.3.0. This function will print a list of all the functions called. - Frank Yeah, I understand what your asking. I don't know of any method to get the line number a function was called on, from within the function. You may have to pass __LINE__ and __FILE__ in your db_query() function, or whatever it is. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: 1LT John W. Holmes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:26 PM Subject: Re: [PHP-DB] Function that outputs at line xxx John, that does work! Thanks. The problem is this: Database calls are in db.inc. The script problem occurs in wine.inc. True, the SQL is called and executed from db.inc, so __LINE__ and __FILE__ are correct in a way. But how do I find out where in the execution of my script the other files are in their execution? index.php -- calls function in wine.inc -- calls function in db.inc -- throws SQL error, calls function in wine.inc -- which prints error to user nicely and exits What I want is when db.inc throws the error and passes the error text to the db_error function in wine.inc to look pretty for the user, I want to know where the function db_query was called in wine.inc (one level up, the script which called the function now running). Is this possible? Does it exist? Peter On Wed, 23 Oct 2002, 1LT John W. Holmes wrote: __LINE__ and __FILE__ should work. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:00 PM Subject: [PHP-DB] Function that outputs at line xxx Hey -- I'm writing a database error handler function in PHP, and I want it to tell me at what line in what script the error occurred. Is this possible? I know it happens when PHP hits a warning or a fatal error, but is it possible to do in a live script? Or is there a global variable which keeps track of what line in which scripts each execution is at? Thanks, Peter -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Function that outputs at line xxx
Hey -- I'm writing a database error handler function in PHP, and I want it to tell me at what line in what script the error occurred. Is this possible? I know it happens when PHP hits a warning or a fatal error, but is it possible to do in a live script? Or is there a global variable which keeps track of what line in which scripts each execution is at? Thanks, Peter --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function that outputs at line xxx
__LINE__ and __FILE__ should work. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:00 PM Subject: [PHP-DB] Function that outputs at line xxx Hey -- I'm writing a database error handler function in PHP, and I want it to tell me at what line in what script the error occurred. Is this possible? I know it happens when PHP hits a warning or a fatal error, but is it possible to do in a live script? Or is there a global variable which keeps track of what line in which scripts each execution is at? Thanks, Peter -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function that outputs at line xxx
Yeah, I understand what your asking. I don't know of any method to get the line number a function was called on, from within the function. You may have to pass __LINE__ and __FILE__ in your db_query() function, or whatever it is. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: 1LT John W. Holmes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:26 PM Subject: Re: [PHP-DB] Function that outputs at line xxx John, that does work! Thanks. The problem is this: Database calls are in db.inc. The script problem occurs in wine.inc. True, the SQL is called and executed from db.inc, so __LINE__ and __FILE__ are correct in a way. But how do I find out where in the execution of my script the other files are in their execution? index.php -- calls function in wine.inc -- calls function in db.inc -- throws SQL error, calls function in wine.inc -- which prints error to user nicely and exits What I want is when db.inc throws the error and passes the error text to the db_error function in wine.inc to look pretty for the user, I want to know where the function db_query was called in wine.inc (one level up, the script which called the function now running). Is this possible? Does it exist? Peter On Wed, 23 Oct 2002, 1LT John W. Holmes wrote: __LINE__ and __FILE__ should work. ---John Holmes... - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 23, 2002 3:00 PM Subject: [PHP-DB] Function that outputs at line xxx Hey -- I'm writing a database error handler function in PHP, and I want it to tell me at what line in what script the error occurred. Is this possible? I know it happens when PHP hits a warning or a fatal error, but is it possible to do in a live script? Or is there a global variable which keeps track of what line in which scripts each execution is at? Thanks, Peter -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Function help....
Hi people, i wanna know from you if this is the way to complete a filed with zeros 0... if i type 01 it completes to 0001 function zero4($campo) { if(strlen($campo) == 4) { $status = ok; }else{ while(strlen($campo) 4) { $campo = 0 . $campo; } } } what do you think? Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED]
RE: [PHP-DB] Function help....
Why don't you just try it and see? Aaron -Original Message- From: Rodrigo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 03, 2002 1:41 PM To: PHP Subject: [PHP-DB] Function help Hi people, i wanna know from you if this is the way to complete a filed with zeros 0... if i type 01 it completes to 0001 function zero4($campo) { if(strlen($campo) == 4) { $status = ok; }else{ while(strlen($campo) 4) { $campo = 0 . $campo; } } } what do you think? Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Function help....
Sprintf() or printf() would be better... ---John Holmes... -Original Message- From: Rodrigo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 03, 2002 1:41 PM To: PHP Subject: [PHP-DB] Function help Hi people, i wanna know from you if this is the way to complete a filed with zeros 0... if i type 01 it completes to 0001 function zero4($campo) { if(strlen($campo) == 4) { $status = ok; }else{ while(strlen($campo) 4) { $campo = 0 . $campo; } } } what do you think? -- -- Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Function OCILogon().
Dear sir, Do you have exactly URL about part OCI8 ? thank you very much. regards, Somsak. On 21 Dec 2001, B. PERRINE wrote: Look at php manual on www.php.net, part OCI8, about env. variables for ORACLE. ORA-12545 is typical of a NET8 error. B. le jeu 20-12-2001 à 12:09, Somsak RAKTHAI a écrit : Dear all, I used PHP 4.1.0 and Oracle 9i running on RedHat-7.2. I have question about Oracle function OCILogon(). I have problem about my source below. ?php $db = ; $c1 = ocilogon(scott,tiger,$db); $c2 = ocilogon(scott,tiger,$db); ? When run this source on browser, it has messages below. Warning: _oci_open_server: Error while trying to retrieve text for error ORA-12545 in /usr/local/apache/htdocs/registra/oracle2mysql/a.php on line 3 Warning: _oci_open_server: Error while trying to retrieve text for error ORA-12545 in /usr/local/apache/htdocs/registra/oracle2mysql/a.php on line 4 Please let me know how to solve this problem. thank you very much. regards, Somsak. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Function OCILogon().
Dear all, I used PHP 4.1.0 and Oracle 9i running on RedHat-7.2. I have question about Oracle function OCILogon(). I have problem about my source below. ?php $db = ; $c1 = ocilogon(scott,tiger,$db); $c2 = ocilogon(scott,tiger,$db); ? When run this source on browser, it has messages below. Warning: _oci_open_server: Error while trying to retrieve text for error ORA-12545 in /usr/local/apache/htdocs/registra/oracle2mysql/a.php on line 3 Warning: _oci_open_server: Error while trying to retrieve text for error ORA-12545 in /usr/local/apache/htdocs/registra/oracle2mysql/a.php on line 4 Please let me know how to solve this problem. thank you very much. regards, Somsak. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
Paul if your there I have another issue similar to the past. It is probably a PHP3 to PHP4 problem. Here tis function hidden_field ($name=, $value=) * I have no clue what could be wrong. Darren, Check out http://uk.php.net/manual/en/functions.php and from there look up Default Argument Values. =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
Dl, Thanks for the input an the link to the manuels, there are very helpful. I have looked at them but I don't understand what default variables has to do with the listed code. To give you a better idea (if you need it you may not) I'll put a little more of code in for context purposes. // string hidden_field ([string name [, string value]]) // This function returns an HTML hidden field. A value may be supplied. function hidden_field ($name=, $value=) { $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; } I still don't understand what the fix should be or what is wrong. Thanks for the help Darren Dl Neil wrote: Paul if your there I have another issue similar to the past. It is probably a PHP3 to PHP4 problem. Here tis function hidden_field ($name=, $value=) * I have no clue what could be wrong. Darren, Check out http://uk.php.net/manual/en/functions.php and from there look up Default Argument Values. =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
On Monday 05 November 2001 04:45, Darren wrote: [snip] // string hidden_field ([string name [, string value]]) // This function returns an HTML hidden field. A value may be supplied. function hidden_field ($name=, $value=) { $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; } I still don't understand what the fix should be or what is wrong. You can just define that function as: function hidden_field($name, $value) { blah... blah... } hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
Jason, Thanks alot! now the next line gets an error. The original code was as follows $output = EOQ input type=hidden name=$name value=$value EOQ; return $output; Then I changed it to $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; I did this so the code would be compatible with php3 instead of php4 (what the code was originaly written for. Thanks for the help, Jason, Dl, and Paul, and anybody else that is keeping up with the thread. Darren Jason Wong wrote: On Monday 05 November 2001 04:45, Darren wrote: [snip] // string hidden_field ([string name [, string value]]) // This function returns an HTML hidden field. A value may be supplied. function hidden_field ($name=, $value=) { $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; } I still don't understand what the fix should be or what is wrong. You can just define that function as: function hidden_field($name, $value) { blah... blah... } hth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
Darren, We're not really set up to do line-by-line debugging. You may need to spend a bit (more) time learning PHP to avoid these sorts of frustrations. When the code is executed it gives a parse error on the line containing value=\$value. It would have been helpful to have pointed us at that line and told us the error msg (cf now the next line gets an error). The problem is that the last set of (internal) double-quotes are not 'escaped' and consequently PHP thinks they terminate the string to be printed. Otherwise everything seems to be fine. Regards, =dn - Original Message - From: Darren [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 04 November 2001 22:24 Subject: Re: [PHP-DB] Function Prolem parse error Jason, Thanks alot! now the next line gets an error. The original code was as follows $output = EOQ input type=hidden name=$name value=$value EOQ; return $output; Then I changed it to $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; I did this so the code would be compatible with php3 instead of php4 (what the code was originaly written for. Thanks for the help, Jason, Dl, and Paul, and anybody else that is keeping up with the thread. Darren Jason Wong wrote: On Monday 05 November 2001 04:45, Darren wrote: [snip] // string hidden_field ([string name [, string value]]) // This function returns an HTML hidden field. A value may be supplied. function hidden_field ($name=, $value=) { $output = print(input type=\hidden\ name=\$name\ value=\$value); return $output; } I still don't understand what the fix should be or what is wrong. You can just define that function as: function hidden_field($name, $value) { blah... blah... } hth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Function Prolem parse error
Dl and everybody else, Thank you all for your help and patience. Dl Neil wrote: Darren, We're not really set up to do line-by-line debugging. You may need to spend a bit (more) time learning PHP to avoid these sorts of frustrations. O.K. Meanwhile .. Dl Neil wrote: Darren, When the code is executed it gives a parse error on the line containing value=\$value. It would have been helpful to have pointed us at that line and told us the error msg (cf now the next line gets an error). I'll do my best to inform everybody of the error. In this case it was the same parse error as the other. The problem is that the last set of (internal) double-quotes are not 'escaped' and consequently PHP thinks they terminate the string to be printed. Otherwise everything seems to be fine. I was comparing a similar line earlier in the code and it looked fine to me. But I'm still learning I tryed it and I got the same error The code I used $output = print(input type=\hidden\ name=\$name\ value=\$value\); return $output; Thanks Darren -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Function Prolem parse error
Howdy all Paul if your there I have another issue similar to the past. It is probably a PHP3 to PHP4 problem. Here tis function hidden_field ($name=, $value=) * I have no clue what could be wrong. Thanks Oh I think I got the rest fixed. Thanks for the help. I think I have a few left that are after this error, so I'll know for sure after I get this taken care of. I am doing the sight on a Mac (I know its against the grain somewhat, but not on purpose) Thanks Darren -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Function problem???
Anybody know what might be wrong with this function? My first version of the function was... function Include_Lib($libFile) { include(LIB_DIR.$libFile); } but it didn't work so I simplied it... function Include_Lib() { include(/path/generic_vars.phpi); } // Function call Include_Lib(); and it still doesn't work? HELP!! I can't figure out what I'm missing??? I have this included in a file that is also included. Would that cause a problem??? B R I A N G R A Y L E S S Web Administrator Premier Resorts www.premier-resorts.com P: 435-655-4812 F: 413-618-1518 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] function ??
are INSERT INTO statements forbiden inside a function?? Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] function login problem
I am creating a function called login, I have a main file called index.php .. which has my login form , it calls a login.php file, and in that login.php there is file include statement which calls config.php and that is where the function lie. This is my function , now if i don't set this as a function and just put it my login.php it works fine. But when I name the function in put it in my config.php no matter what I do all ways giving me the error You have entered an invalid username or password. I dont know if this has to do with passing of variables.. or what is going on but if something can please help me I would appreciate it .. Thank You function login() { $query=Select uname from members where pass='$pass'and uname='$username'; $result=mysql_query($query) or die(You are not authorized to be here.); $array= @mysql_fetch_array($result); $uname = $array[0]; if($uname==) { echo You have entered an invalid username or password; } else { echo You are logged in; $remote_address = getenv(REMOTE_ADDR); echo Your IP address is $remote_address.; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] function login problem
Hi Greg, I can't C a call 2 Ur function login() in the below code-snipplet ... perhaps that's the clue ?? Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - ___ Suchtreffer AG Bleicherstraße 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-17 fax: +49-(0)7531-89207-13 e-mail: mailto:[EMAIL PROTECTED] internet: http://www.suchtreffer.de ___ -Original Message- From: Greg K [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 2:17 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] function login problem I am creating a function called login, I have a main file called index.php .. which has my login form , it calls a login.php file, and in that login.php there is file include statement which calls config.php and that is where the function lie. This is my function , now if i don't set this as a function and just put it my login.php it works fine. But when I name the function in put it in my config.php no matter what I do all ways giving me the error You have entered an invalid username or password. I dont know if this has to do with passing of variables.. or what is going on but if something can please help me I would appreciate it .. Thank You function login() { $query=Select uname from members where pass='$pass'and uname='$username'; $result=mysql_query($query) or die(You are not authorized to be here.); $array= @mysql_fetch_array($result); $uname = $array[0]; if($uname==) { echo You have entered an invalid username or password; } else { echo You are logged in; $remote_address = getenv(REMOTE_ADDR); echo Your IP address is $remote_address.; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]