Re: [PHP] datetime formatting problem
[snip /] Hi Matt, try this: function formatDate($val) { $timestamp = strtotime($val); return date('M d, Y g:i A', $timestamp); } strtotime possibly will not work if your date is 01/01/1970. [snip /] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Review PLEASE !!!
Wells first of all, you are going to want better form input validation. For Example: foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } Are you sure that $_POST['fleet_id'] is valid? or even a number? What happens with $_POST['fleet_id'] == '1 = 1'?? Well, long story short, imp_fleet has no more records. Just a simple example of a huge problem. Jordan S. Jones Matthew Oatham wrote: Hi, I am a newbie PHP programmer, I have some code that works but I want some tips on how I an Improve my code, i.e. should I be doing my updates / deletes on same php page as the display page, am I using transactions correctly, am I capturing SQL errors correctly am I handling form data as efficient as possible? My code displays some information from a database and gives users the chance to delete or edit any field and is as follows: ? include (../db.php); $acton = $_POST['action']; if ($action == update) { if (isset($_POST['delete'])) { $deleteList = join(', ', $_POST['delete']); } //Enter info into the database mysql_query(begin); foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } if ($deleteList) { mysql_query(DELETE FROM imp_fleet WHERE fleet_id IN($deleteList)) or die (mysql_error()); } if (mysql_error()) { echo (There has been an error with your edit / delete request. Please contact the webmaster); mysql_query(rollback); } else { mysql_query(commit); } } ? html head title/title /head body form name=edit method=post h1Edit / Delete Fleet/h1 table tr tdFleet Code/td tdDownload URL/td tdHistory URL/td tdDelete/td /tr ? $sql = mysql_query(SELECT fleet_id, fleet_code, download_url, history_url FROM imp_fleet); if (mysql_num_rows($sql) 0) { while ($row = mysql_fetch_array($sql)) { ? tr tdinput type=text name=fleet_code[] value=?=$row['fleet_code']?input type=hidden name=fleet_id[] value=?=$row['fleet_id']?/td tdinput type=text name=download_url[] value=?=$row['download_url']?/td tdinput type=text name=history_url[] value=?=$row['history_url']?/td tdinput type=checkbox name=delete[] value=?=$row['fleet_id']?/td /tr ? } } ? tr td colsapn=4 table tr tdinput type=hidden name=action value=updateinput type=reset value=cancel/td td colspan=2input type=submit value=submit/td /tr /table /td /tr /table /form /body /html Thanks for your time and feedback. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Review PLEASE !!!
If it were me I would do both Client and Server side validation. The majority of the time the client side will suffice, but, simply put, because you don't/may not look at the HTML source of a web page, doesn't mean that nobody else does. The fact of the matter is, you should not trust any data that comes from a form. Even if the ids come from the database, you still want to ensure that they really are a valid numerical value or whatever your ids happen to be based upon. Jordan S. Jones Matthew Oatham wrote: Yes I agree I need some validation, dunno whether to do server or client side validation. I don't think the fleet_id example will be a problem though as this is retrieved from the database where the field is an int. Thanks for your feedback Matt - Original Message - From: Jordan S. Jones [EMAIL PROTECTED] To: Matthew Oatham [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 05, 2004 11:56 PM Subject: Re: [PHP] Code Review PLEASE !!! Wells first of all, you are going to want better form input validation. For Example: foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } Are you sure that $_POST['fleet_id'] is valid? or even a number? What happens with $_POST['fleet_id'] == '1 = 1'?? Well, long story short, imp_fleet has no more records. Just a simple example of a huge problem. Jordan S. Jones Matthew Oatham wrote: Hi, I am a newbie PHP programmer, I have some code that works but I want some tips on how I an Improve my code, i.e. should I be doing my updates / deletes on same php page as the display page, am I using transactions correctly, am I capturing SQL errors correctly am I handling form data as efficient as possible? My code displays some information from a database and gives users the chance to delete or edit any field and is as follows: ? include (../db.php); $acton = $_POST['action']; if ($action == update) { if (isset($_POST['delete'])) { $deleteList = join(', ', $_POST['delete']); } //Enter info into the database mysql_query(begin); foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } if ($deleteList) { mysql_query(DELETE FROM imp_fleet WHERE fleet_id IN($deleteList)) or die (mysql_error()); } if (mysql_error()) { echo (There has been an error with your edit / delete request. Please contact the webmaster); mysql_query(rollback); } else { mysql_query(commit); } } ? html head title/title /head body form name=edit method=post h1Edit / Delete Fleet/h1 table tr tdFleet Code/td tdDownload URL/td tdHistory URL/td tdDelete/td /tr ? $sql = mysql_query(SELECT fleet_id, fleet_code, download_url, history_url FROM imp_fleet); if (mysql_num_rows($sql) 0) { while ($row = mysql_fetch_array($sql)) { ? tr tdinput type=text name=fleet_code[] value=?=$row['fleet_code']?input type=hidden name=fleet_id[] value=?=$row['fleet_id']?/td tdinput type=text name=download_url[] value=?=$row['download_url']?/td tdinput type=text name=history_url[] value=?=$row['history_url']?/td tdinput type=checkbox name=delete[] value=?=$row['fleet_id']?/td /tr ? } } ? tr td colsapn=4 table tr tdinput type=hidden name=action value=updateinput type=reset value=cancel/td td colspan=2input type=submit value=submit/td /tr /table /td /tr /table /form /body /html Thanks for your time and feedback. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3.4 EAPI
Hello all.. For some odd reason, I am having a very very difficult time compiling PHP with EAPI support.. Here is my configure line: CFLAGS= -DEAPI \ ./configure \ --with-apxs \ --with-config-file-path=/etc \ --disable-short-tags \ --with-zlib \ --with-bz2 \ --with-curl \ --with-mcrypt \ --with-mhash \ --with-mysql \ --enable-xslt \ --without-pear \ --with-pgsql \ --with-gd \ --enable-gd-native-ttf \ --with-xslt-sablot \ --disable-debug \ --enable-bcmath \ --enable-calendar \ --enable-inline-optimization \ --enable-memory-limit \ --enable-rule=EAPI Any help on the matter would be greatly appreciated.. Thanks, Jordan S. Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie pls help
This might help as well: http://www.php.net/manual/en/installation.php Jordan S. Jones Mrs. Geeta Thanu wrote: Hi all, I want to install apache and php in a redhat box version 8 and want apache to load php. So how i shld proceed. Just downloading the rpms of both and installing will help or I have to down load the source and compile it. Pls help Thank u Geetha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Why make PHP work harder than it needs to? Jordan Robin Kopetzky wrote: Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Recursion Multi-Dimensional Arrays
Navid, So you want something like this: Category 1 Category 2 | --- Category a | Category b | Category X | Category Y | Category AC | Category BC | Category Z | Category c Category 3 in a multi-dimentional array Jordan S. Jones Navid Yar wrote: Hello Guys, I need a little bit of help with recursion. I've searched our PHP website and Google, but none helped me understand my problem. There is a code below this message in order to help you understand what I am trying to achieve. Here is an explaination: What I'm trying to do is list a typical category/subcategory system with parents and children associated with those parents. My database table (categories) lists all the parents and children together, each with a parent_id field (with root being a value of 0). What I want to do is, if a user clicked on one of the parent categories, only one level of that category will show (or only the direct children of that specific category will show). I want the depth to be endless because I want to control the depth some other way. I know that using a recursive theory would cost a lot as far as speed goes, but I'm willing to risk it for now. Here is the problem: The problem is that the recursive method yields several arrays, instead of one long array. I tried to use an array_push() function, but that doesn't seem to work well with multi-dimentional arrays. I tried the straight way, i.e. $menu_array[$count]['name'] = $name_of_category or $menu_array['name'][$count] = $name_of_category, but that yields several arrays instead of one long array or category names. The depth of the categories can be determined by the $_GET string passed, $_GET['some_path'], which is in the format: parent1_child1_grandchild1_grandchild2, etc.($some_path = 1_4_6_8), where all of these are related to each other. These, of course, are split using the underscore delimeter: $path['0'] = 1, $path['1'] = 4, and so on. And finally, here is my question: How do I get all these categories, parents and children, listed into one array and then returned. I want to be able to list them on the web page using one array. I will also include id, parent_id, and other info with each array, but first I want to get the name listings of the categories to work. Also, if anyone has any suggestions about a more speedier way to do this, please let me know. Sorry for the long explaination, I just wanted to make sure you guys understood my goals. Thanks in advance to anyone that responds, I appreciate it very much. Here is the code I promised: - function menu_tree($parent_id = '0', $cPath = '', $menu_array = '') { if (!is_array($menu_array)) { $menu_array = array(); $cPath = $this-separatePath($_GET['cPath']); // separates $_GET string into array of category ids } else { reset($cPath); array_shift($cPath); } if (sizeof($cPath) = 0) { $db = new base_db(); $query = select cid, name, parent_id from categories where parent_id = ' . $parent_id . ' order by sort_order, name;; $categories = $db-fetch_results($query); //echo sizeof($cPath).br /; //echo $query.br /; for ($i = 0, $count = 0; $i count($categories); $i++, $count++) { // The following are the methods I tied, but failed to work //$menu_array['name'][$count] = $categories[$i]['name']; //$menu_array[]['name'] = $categories[$i]['name']; //$menu_array['name'][] = $categories[$i]['name']; //array_push($menu_array, $categories[$i]['name']); // This one works, but does not yeild a multi-dimensional array, which is what I need if I were to add more information to the output of this array, like id and parent_id //array_push($menu_array[$count]['name'], $categories[$i]['name']); // This does not work, gives error saying the first parameter of array_push must be an array if (($this-get_children($categories[$i]['cid'])) in_array($categories[$i]['cid'],$cPath)) { $this-menu_tree($categories[$i]['cid'], $cPath, $menu_array); } } } print_r($menu_array); } - Here is what it returns using the print_r() function on $menu_array Array ( [name] = Array ( [0] = Cars [1] = Honda [2] = Accord [3] = 1996 [4] = 1997 [5] = 1998 [6] = 1999 [7] = 2000 [8] = 2001 [9] = 2002 ) ) Array ( [name] = Array ( [0] = Cars [1] = Honda [2] = Accord [3] = Civic ) ) Array ( [name] = Array
Re: [PHP] OT - Quick JavaScript Question
Jake McHenry wrote: I have tried this already, and it works, the JavaScript get's the server's time, but then the JavaScript clock doesn't keep counting, it's stuck at the servers time. It needs that Date() function to keep pulling the time from the local machine I guess. I was wondering if anyone knew of a way I could pass the server time into the JavaScript Date() function to make it start counting from that time, instead of the users machine time. Thanks, Jake Yes, http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/date.html#1193137 Jordan S. Jones -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database
Alain, You can pass it in the function as a variable. E.g... Function closeDB($ref_link) { mysql_close($ref_link); } closeDB($connectie); Hope this Helps, Jordan S. Jones -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database
Alain, Ok, I aplogize, for I neglected to notice that you were not passing back the db connection $link variable from your openDB function, so here is what you are going to want to do. page connectie.php Function openDB() { $link = mysql_connect(localhost, host, pas) or die(geen connectie mogelijk : . mysql_error()); print connectie ok; mysql_select_db(database) or die(geen database gevonden); return $link; } Function closeDB($ref_link) { mysql_close($ref_link); } include ('connectie.php'); //open connectie $connectie = openDB(); //code //close connectie closeDB($connectie); Jordan S. Jones alain dhaene wrote: I have try but I get the following error: Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/schoolre/public_html/Hitek/Online/connectie.php on line 16 Alain Jordan S. Jones [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Alain, You can pass it in the function as a variable. E.g... Function closeDB($ref_link) { mysql_close($ref_link); } closeDB($connectie); Hope this Helps, Jordan S. Jones -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jord an+S.+Jonesno_note=1tax=0currency_code=USD -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with intval and !=
Cesar, You can take a look into is_numeric () (http://www.php.net/is_numeric). It will tell you whether the value is a number or a numeric string, but it will also return true if the value is a float. However, at that point you know your working with the right type of variable. Jordan S. Jones Cesar Cordovez wrote: Sorry, typo, this is what I meant, !is_integer(12thisisnotanumber) retuns true. but also, is_integer(12) return false. therefore, is_integer(12) return true. So, how can I check if what ever the user writes is an integer or not, knowing that he will write it in a string field. Any how, I solved the problem with preg_match(/^([0-9]+)$/, $value) Thanks for your help, list =) Robert Cummings wrote: On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote: Because is_integer(12thisisnotanumber) retuns true. Not for me it doesn't. Returns false. Prolly because it's a string. Even the following returns false for me: is_integer(12) Cheers, Rob. -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array in SQL-table
If the field isn't required to be searchable, you could just serialize the array and shove that into a VARCHAR column.. Then unserialize the return value for that column. Jordan S. Jones Reidar wrote: I want to store an ARRAY in a SQL-table but don't know how to define it in the table. The PHP-stuff is working OK but the DB-thing isn't. Anyone tried this? Hopefully it is Reidar Solberg -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding blank lines in HTML when field is empty
Robb, You pretty much have it.. Here is what you will most likely want: ?php if (!empty($row_rsVandyDivAddresses['Address']) strlen (trim ($row_rsVandyDivAddresses['Address'])) 0) { echo $row_rsVandyDivAddresses['Address']) . 'br'; } ? Feel free to format as you wish. Jordan S. Jones Robb Kerr wrote: I'm a PhP /MySQL newbie so please excuse the simple question. I'm returning results from a MySQL query on a webpage. My code includes... [snip] I've tried... ?php if (!empty($row_rsVandyDivAddresses['Address']) echo $row_rsVandyDivAddresses['Address']); ? but don't know how to include the line break br in the if statement. Any help is greatly appreciated, Robb -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
I remember reading something very very similar from one of the main php developers.. However, for the life of me, I can't remember where it was exactly... Jordan S. Jones Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
I believe I read someplace once that it is more efficient to have your php embedded in your HTML where required. Something to do with the amount of parsing that the engine has to do. However, to reiterate what Captain John W. Holmes said, using a templating engine does allow you to better manage the project especially in dealing with maintenance down the road. I personally prefer to let the business logic create XML and employ XSLT to do my Html rendering. It may not be the quickest or most memory efficient, but, in my humble opinion, it is one of the easiest to maintain. Jordan S. Jones Ryan A wrote: Hi everyone, Just a simple doubt and basically your opinion needed. I have an option box on a webpage and have around 10 options on it and have run into a doubt, which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Thanks, -Ryan -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me
Dave, First thing you need to do is find the location of your php.ini file. I typically create a document with the function phpinfo (); and load it up in the browser. This will tell you the location of the php.ini file. From there you need to use your favorite command line editor to open the php.ini file. I prefer to use VI, so I will give you instructions for that. (I will list the actual keystrokes you need to press to open/save the file. E.g. Enter would be pressing the enter key and / would be pressing the / key.) 1. vi /location/to/php.ini 2. /upload_max_filesizeEnter 3. Arrow keys to the the position where the 2 (or whatever number it is) is. 4. x 5. i 6. 99 (or what ever value you want) 7.Esc:wqEnter (Escape, colon, w, q, Enter) From there you will want to reload apache or whatever webserver you are using. HTH Jordan S. Jones Feel free to donate https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD Dave wrote: Hi I need to edit my php.ini file. I tried to do this through ftp but no go. I am really desperate. How do I do it through putty. Ie I log in su to root NOW WHAT? Please give me step by step instructions including how to save and make my changes. I need to do the following I need to change my php ini file as follows ; Maximum allowed size for uploaded files. upload_max_filesize = 2M Chance It To ; Maximum allowed size for uploaded files. upload_max_filesize = 9M Please Help me I am so desperate. :( -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php with Interbase ?
It really depends on what you want compiled in. If you are not sure what options are available, you could try ./configure --help Jordan S. Jones Luiz Gustavo Sarubi Macchi wrote: Hi all, Please, I´d like to compile my php with interbase. I know that i should put --with-interbase[=DIR], but what else should i put in configure ? Is anyone has a script to do this ? Should I compile apache too ? thanks a any help I´m using: Mandrake 9.1 kernel 2.4.21-0.13mdk php-ini-4.3.0-1mdk mod_php-4.3.1-1mdk php-readline-4.3.0-1mdk php-domxml-4.3.0-2mdk php-xslt-4.3.0-3mdk php-manual-en-4.3.0-2mdk libphp_common430-430-11mdk php-gd-4.3.0-2mdk php-tclink-4.3.0_3.3.1-12mdk php-cli-4.3.1-11mdk php-cgi-4.3.1-11mdk php-mysql-4.3.0-2mdk phpgroupware-0.9.14-2mdk php-xmlrpc-4.3.0-2mdk php430-devel-430-11mdk apache2-mod_php-2.0.44_4.3.1-2mdk php-rrdtool-1.0.40-2mdk php-xml-4.3.0-2mdk gugao -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php framework
Where I work, we use a heavily modified version of Fusebox. We like it. Jordan S. Jones Lai, Kenny wrote: just wanted a general idea on what kind of PHP framework everyone is using.. i've heard of pear, and interjinn.. is there a preference or distinct advantage that a particular framework has in comparison to one another? thanks in advance, kenny -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php framework
Modified to be object oriented and support xml/xslt. Jordan S. Jones wrote: Where I work, we use a heavily modified version of Fusebox. We like it. Jordan S. Jones Lai, Kenny wrote: just wanted a general idea on what kind of PHP framework everyone is using.. i've heard of pear, and interjinn.. is there a preference or distinct advantage that a particular framework has in comparison to one another? thanks in advance, kenny -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var static
If I were you, I would use the following: if (!is_a ($miInstancia, 'db')) $miInstancia=new db(); That way you can ensure that the variable has been instantiated and is an instance of the db class.. But it may not really matter.. Jordan S. Jones Alvaro Martinez wrote: I've found the solution myself. The db class is the next: class db{ function db (){ // funcion que se conecta con la BBDD $result = @mysql_pconnect(inforalv, discoteca, password); if (!$result) return false; if ([EMAIL PROTECTED](discoteca)) return false; } function getInstancia(){ static $miInstancia; if (!get_class($miInstancia) == 'db') $miInstancia=new db(); return $miInstancia; } and the call to this class is the next: $conexiondb1=db::getInstancia(); $conexiondb2=db::getInstancia(); In the second call I obtain the same object. Muchas gracias por vuestra ayuda Alvaro Dynamical.Biz [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] Although PHP supports static variables in functions (see here), it has no support for static variables in classes. http://www.php.net/manual/en/language.variables.scope.php (espero que te sirva) saludos aniceto lópez :: DYNAMICAL.BIZ web development host services Barcelona - Spain -Mensaje original- Asunto: [PHP] var static I want to obtain only one instance of one class. In other to do that, I call to a static method, that creates the instance(if it doesnt exit) or returns the reference of the instance. The call to the static method is the next: $conexiondb=db::getInstancia(); Well, but if I call to db::getInstancia() another time, I obtain another new object :-( The code of the db class is the next (it is a Singleton Pattern, but it doesnt work) class db{ var $_miInstancia; function db (){ // funcion que se conecta con la BBDD static $miInstancia; $this-_miInstancia=$miInstancia; $result = @mysql_pconnect(inforalv, discoteca, password); if (!$result) return false; if ([EMAIL PROTECTED](discoteca)) return false; } function getInstancia(){ if (!isset($this)) $_miInstancia=new db(); return $_miInstancia; } } I think that the problem is that the var _miInstance is not static and I dont know how to do it. Could you please tell me if there is anything wrong? Thanks. Alvaro -- 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] general questions
Dale, 1. If my memory serves me correctly, when you initialize a variable, it is given the default value of NULL until something is assigned to it. 2. PHP is not a strongly typed language, meaning that your array would act as so: $arr_test[0] = 1; /// Integer type $arr_test[1] = My Name; /// String type $arr_test[2] = true; /// Boolean type Hope this helps, Jordan S. Jones Dale wrote: I am new to php and I just have some general questions. 1. when you create a new variable such as an integer, is it automatically initialized or is it considered empty similar to asp? 2. If I were to create an array and filled the array with a Boolean value, a string, and an integer what type would the array take on? Thanks, Dale
Re: [PHP] easy conversion to a date?
Anthony, I believe that what you are looking for is the following: http://www.php.net/strtotime Jordan Anthony wrote: I have a form where the user enters a date into a text input field. I need to convert this text to a date and put it in a field in a mySQL database. Is there an easy way to do this? Do I have to tear the string appart and create a date out of the parts? Someone must have a fiunction that will do this work already right? Thanks for your help - Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sound
Have you copied the sound file to your server as well? Jordan Bobby wrote: Does anybody know of a way under php to add a background sound to a webpage...i have sound on my page when it's local but as soon as I copy it to the server, nothing :( thanks -bobby Bobby Brooks [EMAIL PROTECTED] http://bobby-brooks.com Public Key = bobby-brooks.com/pubring.pkr Simulated disorder postulates perfect discipline; simulated fear postulates courage; simulated weakness postulates strength. Sun Tzu - The Art of War (Chap 5-17) ICQ-33647303 AOL_IM-TX Copenhagen Yahoo-tx_copenhagen1977 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_FILES help. Counting help
Didier, My guess is in your HTML, you have the input(s) named as 'file'.. Because of the way that PHP handles it's POST/GET variables, you will want to redeclare your input names in your HTML to 'file[]'... This basically defines that it is an array.. Hope that helps, Jordan Didier McGillis wrote: I have three file fields in a form. I need it to upload those three items or two or one. I can get it to upload one, but not all three, habing trouble with the for loop and how I get a value of $i. if(isset($_POST['upload'])){ if (!empty($_FILES['file']['name'])){ $formats = array('mp3','exe'); if(in_array(strtolower(substr($_FILES['file']['name'],-3)),$formats)) { echo font face=\verdana,arial,helvetica\ size=\2\ color=\#00\bSorry! MP3's and .EXE's are disallowed!/b/font; }else{ //mkdir(upload/ . $_POST['dir'],0777); copy($_FILES['file']['tmp_name'], images/ . $_FILES['file']['name']); unlink($_FILES['file']['tmp_name']); echo font face=\verdana,arial,helvetica\ size=\2\ color=\#00\b.$i. File(s) Uploaded Successfully to b . $_POST['dir'] . /b directory!/b/font; } }else{ echo font face=\verdana,arial,helvetica\ size=\2\ color=\#00\bYou must specify a file to upload/b/fontbr\n; echo font face=\verdana,arial,helvetica\ size=\2\ color=\#00\a href=\javascript:history.back()\ back/a/fontbr\n; exit(); } } $i =$_FILES['file']['name']; is it for ($i=1;$i4;i++) { run code } or am I way off, help please. thanks, _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'undef' as an argument value
function foo ($arg1_required, $arg2_options = ) { if (empty($arg2_optional) { print not passed; } else { print explicit; } } Or you can go the other route. Jordan Rodent Of Unusual Size [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rick Emery wrote: function foo($arg1_required, $arg2_optional=) if ($arg2_optional==) { print not passed; } else { print explicit; } } No, I said 'undef' because I mean 'undefined'. The argument can have *any* value; I need to know when it has *none*. That is, there is no magic cookie to which I can set the default that might not be a valid call value. -- #ken P-)} Ken Coar, Sanagendamgagwedweinini http://Golux.Com/coar/ Author, developer, opinionist http://Apache-Server.Com/ Millennium hand and shrimp! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't display PNG images
The icon essentially means that it was a broken image, or that they code did not work. I know that wasn't much help. On another point, in my opinion, it doesn't make a whole lot of logical sense to have a die(Error text) statement in code that creates an image.. If an error does occur, it will still display the same broken image icon. However, I am not the definitive word on the matter, and if you or anyone else has a different opinion on the matter, I would be more than happy to hear it. Jordan Teresa Narvaez [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Background info: I'm running o PHP 4.1.1 on a linux server kernel(2.2.16). o Using Netscape Communicator 4.75 o Compiled and installed the gd(1.8.4) library Problem(2 problems): 1.- The following code won't display an image(I get an icon of some type of piece of paper). ?php header (Content-type: image/png); $im = @ImageCreate (50, 100) or die (Cannot Initialize new GD image stream); $background_color = ImageColorAllocate ($im, 255, 255, 255); $text_color = ImageColorAllocate ($im, 233, 14, 91); ImageString ($im, 1, 5, 5, A Simple Text String, $text_color); ImagePng ($im); ? 2.- The configure Command from phpinfo() is different than what I actually typed at the command line. Also, phpinfo() area for GD does not show PNG or JPEG support. why? from phpinfo() -- './configure' '--with-mysql' '--with-apxs=/var/apache/bin/apxs' '--with-gd=/home/builder/downloads/untarred/gd-1.8.4' '--enable-sockets' '--enable-calendar' '--enable-ftp' '--enable-trans-sid' What I typed at the command line: - ./configure --with-mysql --with-apxs=/var/apache/bin/apxs --with-gd=/home/builder/downloads/untarred/gd-1.8.4 --with-png-dir=/usr/lib --enable-gd-native-ttf --with-ttf --with-jpeg-dir=/home/builder/downloads/untarred/jpeg-6b --with-t1lib=/home/builder/downloads/untarred/t1lib-1.3.1 --enable-sockets --with-zlib-dir --with-xpm-dir --enable-calenda r --enable-ftp --enable-trans-sid OUTPUT from phpinfo() --- GD Supportenabled GD Version1.6.2 or higher WBMP Support enabled I would really appretiate any ideas you could give me. Thanks in advance! -Teresa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: reset auto_increment field mysql
Direct quote from MySQL by Paul DuBois MySQL 3.23 introduced the new AUTO_INCREMENT behaviors of not reusing sequence numbers and allowing you to specify an initial sequence number in the CREATE TABLE statement. These behaviors are undone if you delete all records in the table using a DELETE statement of the following form: DELETE FROM tablename In this case, the sequence starts over from 1 rather than continuing in strictly increasing order. The sequence starts over even if your CREATE TABLE statement specifies an initial sequence number explicitly. This occurs due to the way MySQL optimizes DELETE statements that empty a table entirely: It re-creates the data and index files from scratch rather than deleting each record, and that causes all sequence number information to be lost. If you want to delete all records but preserve the sequence information, you can suppress the optimization and force MySQL to perform a row-by-row delete operation instead, like this: DELETE FROM tablename WHERE 1 0 Things may have changed since this book was published. Jordan Claudiu [EMAIL PROTECTED] wrote in message Pine.LNX.4.40.0203121306001.26884-10@betanou">news:Pine.LNX.4.40.0203121306001.26884-10@betanou... I have a mysql table which contains an id field which is set to auto_increment. I have a script which empties this database at regular intervals. My problem is that the auto_increment field won't reset to 0 after deleting all of tha data, but continue incrementing from where it left. How can i solve this problem.. I want id to reset to 0 when i delete the contents of the table. Can someone help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP IDE
Hey all, I am, and have been for some time, in search of a PHP IDE that allows me to view things more on a project basis. Meaning, that I would like to have some sort of Class browsing capabilities along with file browsing capabilities. I am also looking for a decent freeware Texteditor/Web Development environment for OS X.. If anyone can help me out in these areas, I would be greatly appreciative. Thank You, Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE
Sweet.. Thanks.. Andrey Hristov [EMAIL PROTECTED] wrote in message 047801c1c9c1$ae7ec820$0b01a8c0@ANDreY">news:047801c1c9c1$ae7ec820$0b01a8c0@ANDreY... on gtk.php.net there is a link to PHPMole. Built with PHP requires GTK. Not sure but I think that there is gtk lib for OSX since it is BSD. Best reagrds, Andrey Hristov - Original Message - From: Jordan S. Jones [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 12, 2002 2:23 PM Subject: [PHP] PHP IDE Hey all, I am, and have been for some time, in search of a PHP IDE that allows me to view things more on a project basis. Meaning, that I would like to have some sort of Class browsing capabilities along with file browsing capabilities. I am also looking for a decent freeware Texteditor/Web Development environment for OS X.. If anyone can help me out in these areas, I would be greatly appreciative. Thank You, Jordan -- 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
[PHP] Re: removing ALL whitespace from a string
You can use a regular expression for that.. However, I don't have that right here.. Jordan Lee P Reilly [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can somebody tell me if there is a function that will remove *all* whitespace (\n, \r, \t, \w, etc) from a string i.e. from the beginning, the end, and the middle?. Something like chop(), trim()? e.g. input =12 3ad e.g. output = 123ad Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] index.php question
That means that it isn't getting passed off to the PHP executable or dll. Instead, it is getting sent to the client as plain text.. Go to the Home Directory tab in the IIS admin. From there, click on Configuration. Add an Application Mapping for .php. Restart IIS, and you should be good. Jordan Daniel Negron/Kbe [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... do you happen to have an answer for IIS. I alreazdy tried to add index.php to the list of documents, along with index.asp, index.html, and so on.But I still get the same result. Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com |+ || Samuel| || Ottenhoff | || sam@gothamjaz| || z.com| ||| || 03/11/02 01:47| || PM| ||| |+ --- --| | | | To: Omland Christopher m [EMAIL PROTECTED], [EMAIL PROTECTED]| | cc: | | Subject: Re: [PHP] index.php question | --- --| # # DirectoryIndex: Name of the file or files to use as a pre-written HTML # directory index. Separate multiple entries with spaces. # IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html /IfModule Sam On 3/11/02 1:36 PM, Omland Christopher m [EMAIL PROTECTED] wrote: Hi all, I'm new to the mailing list, I hope I'm in the right spot. I have installed php, and .php files work fine, unless they are my index file. For example http://whatever.com/~jondoe/info.php will work. But if I make a index.php file and go to http://whatever.com/~jondoe it wont work. I can view the source and see my php code, which I know means the server isn't translating it. I'm running RH LINUX, and running apache webserver. I have checked the httpd.conf file and the load modules lines are in there, and they are correct??(I THINK) Any help would be appreciated. Thank You. -Chris -- 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
[PHP] Re: dynamic startpage in flash...
In the HTML for embedding the Flash Movie, do something like this: OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354 codebase=http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0 ,0 id=projector WIDTH=100% HEIGHT=200% PARAM NAME=movie VALUE=filename.swf?mail_url=?php echo urlencode(http://www.blabla.com/mailTarget.php?target=6;); ? PARAM NAME=quality VALUE=high PARAM NAME=bgcolor VALUE=#00 EMBED src=filename.swf?mail_url=?php echo urlencode(http://www.blabla.com/mailTarget.php?target=6;); ? quality=high bgcolor=#00 WIDTH=100% HEIGHT=200% TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_ Version=ShockwaveFlash NAME=projector/EMBED /OBJECT That should work for what you need. That is, if I understand what it is you are trying to do.. Eric Trezza [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Far from being an expert in PHP, I work with it to make Flash dynamic... But I need help for the following point: I would like to send a dynamic variable to a Flash movie at the same time PHP build the HTML page containing this Flash movie. The idea behind it is for mail links. We want to give some links in emails like http://www.blabla.com/mailTarget.php?target=6 and then ask PHP build the HTML page containing the flash movie which needs the variable 'target' to know which part of the movie to begin with. Thanks for your help... Trezza Eric -- ) b-tween ( web design e-communication e-education http://www.b-tween.com Geneva, Switzerland Tel. (+41) 22 782 38 60 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php