Re: [PHP-DB] Counting HTML Lines
HTML doesn't do anything with long lines of text. But browsers will wrap the lines to fit within the confines of the page or table cell. You can use the wordwrap function to break the string into lines (broken by \n) of a set number of characters. And then use ereg_replace to replace the \n's with 's and then use substr_count to count how many 's you have in the string. Good luck, Jeffrey Baumgartner Ng Hwee Hwee wrote: hi! thanx for your reply. i cannot count the number of "\n" because sometimes the inputted text is very long without any "\n", but because it is inside a cell that has a linited width, HTML will automatically push it to the next line, right? in this case, there won't be a count for "\n". hwee - Original Message - From: "Petar Nedyalkov" <[EMAIL PROTECTED]> To: Sent: Friday, April 15, 2005 5:06 PM Subject: Re: [PHP-DB] Counting HTML Lines Count the "\n" characters in the output. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Moving data from one MySQL table to another
I'm working on a web application and one of the things I am doing is creating an archiving function that would move older data to archive tables in order to minimise the amount of data in the active tables. This so that the data that is being used more frequently can be accessed faster by the users. My approach in building the archive function is: 1) SELECT query on the data 2) mysql_fetch_array to put the data into an array 3) INSERT subqueries to put the data into the archive tables. My concern is that in some cases, hundreds of rows of data would need to be moved - which could lead to awfully big arrays. However, the archiving function is likely to be used infrequently - not more than 1 or 2 times per week. This leads to two questions: 1) Could such a big array cause performance problems or worse? 2) Is there a better way? Many thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Fulltext search against table column in MySQL
I am trying to do a full text search in which the query should check to see if the term in a column in one table exists in a list of terms in a column on another DB. Something along the lines of $query="SELECT this,that,somethingelse FROM some_table,another_table WHERE MATCH (another_table.list) AGAINST (somethingelse)" ; This results in the error: "wrong arguments to AGAINST" Clearly I could do this as two queries, the first to select the term in "somethingelse" and save it in a variable and the second to search against that term. But the query(ies) will run through 100s or more rows, so if I could do it in a singel query it would be so much more elegant. Thanks! Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Security question [was Searchable/Sortable Database Fields with MySQL/PHP]
This is an issue I've been thinking about for an application we are developing. Is it worth encrypting data on the database tables when anyone who can access the application itself - or better still the server - could readily access the encrypted data? Assuming SSL connections, secure server, etc, would you also encrypt on the DB? Thanks, Jeffrey Micah Stevens wrote: Oh! Also, there's built in mysql functions for encryption, I forgot about that, so you can still search, like this: insert into table set name_field = AES_ENCRYPT('Some name', 'secret key'); select * from table where AES_DECRYPT(name_field,'secret key') LIKE '%some'; Make sense? You'll want an SSL connection to the database of course, and anyone that has any decent access to the server memory would be able to get the encryption key, but if you're careful it would work. -Micah On Tuesday 12 July 2005 2:53 pm, Micah Stevens wrote: Just do all your searching/sorting in PHP.. it would be slower, and if your dataset is very large (sounds like it might be the case) it would be impossible.. So that might be out of the question.. A bit of system engineering might find a solution too, consider which fields you need to search/sort by, and by possibly limiting those somewhat to just what is absolutely necessary, you might be able to get by not encrypting those columns. Another idea would be to provide hinting columns, essentially providing just enough data in those columns to be able to sort with, but not enough to give away the data. i.e. just the first 2 characters of each name. This would allow you to search and get a smaller dataset from the database, something you could decrypt in php, and then search further, possibly making it manageable. Hope that helps, -Micah On Tuesday 12 July 2005 2:36 pm, Matt McNeil wrote: Greetings, I need to securely store lots of sensitive contact information and notes in a (MySQL or other freely available) database that will be stored on a database server which I do not have direct access to. This database will be accessed by a PHP application that I am developing. However, I also need to be able to search/sort these data with the database functions (SELECT, ORDER BY, etc) so simple PASSWORD style encryption of specific fields would not work. (For example, I need to encrypt contacts' names, but need to be able to sort results by name). (I realize I could load the entire table into memory with PHP and process/search/sort it there, but that's obviously not a very good solution). Ideally I would like to encrypt entire tables. An encrypted file system is not really an option, because the goal is to prevent loss if the database server is hacked (in addition, I wouldn't be able to install an encrypted file system on the database server). My sense is that this is a difficult problem. However, I made the mistake of promising this functionality, so I'm scrambling to figure out some kind of solution. Any suggestions? Thanks so much! Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] If syntax
See below... Ron Piggott wrote: Take a look at my if ( ) syntax line below. I am wondering if I have it wrong in same way. What I am trying to achieve is if the alias the user enters is already found in the database I want the words "Alias already in use" to be shown on the screen; otherwise "Unique alias" to be shown on the screen. PRESENTLY alias already in use is what comes up all the time. Ron mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM tablename WHERE alias LIKE '$alias%'"; if (mysql_query($query)) { echo "Alias already in use"; } else { echo "Unique alias"; mysql_close(); } Whether or not there are any matches, you will always have a database query - hence mysql_query($query) will always produce something Instead you need to see if there are any matches to your variable. Also, "SELECT * FROM [some_table] is tremendously inefficient when you only need to count results. You are basically calling up every result in your entire table just to see if a single column entry matches a variable. I would suggest something like.. mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT alias FROM tablename WHERE alias LIKE '$alias%' LIMIT 1"; $result=(mysql_query($query)) if (mysql_num_rows($result)==1) { echo "Alias already in use"; } else { echo "Unique alias"; mysql_close(); } Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP email client
Try www.squirrelmail.org - I believe there was a typo in the original post. JeRRy wrote: sqirrelmail.org "can't display page" You sure that is the url? Brent Baisley <[EMAIL PROTECTED]> wrote: SqirrelMail is as customizable as you want, it's written in PHP and you get the source code. By default it comes with various preferences a user can change (i.e. color scheme). You can create folders if you setup it up as an IMAP account. The interface certainly isn't as fancy and dynamic as gmail or yahoo, but it's designed to work in just about any browser. You could certainly add some ad display code to the interface, after all it is "just a web page". sqirrelmail.org dbmail.org postfix.org sendmail.org mysql.com (everything can't be .org) Price: free On Oct 3, 2005, at 11:41 AM, JeRRy wrote: Thanks Brent, Just for future refrence for this list if i look back on it or for others interest as well do you have direct links to the ones you have listed below? I did a search and got third party addresses that did not seem to direct to the real address. But that might of been the search terms I was using or the real sites were not available at the time I searched. But the links would be handy and any costs assosicated to them. SquirellMail I think I have heard about and is used in most CPANEL's. But how customizable is this? That is the sort of client I would need. I know Horde pretty well, is that customizable. What I wanna do is add ads to all accounts and each time a user sees the ad they get credit, they don't need to click it to earn. Something like that but with more detail. So it needs to be able to add ads and to add PHP code and mysql code to it and be able to get basic info back from the email client to know who is logged in. Jerry Brent Baisley wrote: SquirrelMail is used by a lot people and comes with a lot of systems (i.e. Apple Servers, Linux). It's not tied to any particular email server, it's open source and PHP based, so you can customize it to your needs. The email address has to do with the email server, not the web front end. Postfix is a pretty popular email server that supports many configurations and is a heck of a lot easier to learn and setup than sendmail. dbMail is another interesting one that can use a database (mysql, postgres) as a back, which helps with searching large mail boxes or tying into a whole system. On Oct 3, 2005, at 9:39 AM, JeRRy wrote: Hello, What I am looking for is to offer a website that people can freely signup and use as a real email address. A client where they can send/recieve emails just like Yahoo! Mail and Hotmail etc. Have it web based. But I don't just want any email client, it must be customizable and code added to it. So I am not looking to go to a www site and signup for them to brand it. I want to customize it entiley which does not just include the colours and format I mean customize the code itself and add to it as it won't just be a email site, it will pay you to send emails etc. Free or price is fine. I know of a few BASIC free ones but their very basic. If I can avoid allowing attachments that's fine or a section to allow or disallow ataachments. But when is ay basic their damn basic. I need one that you have settings, folders etc. Any ideas? Or anyone have the time to write such a client for me? I'm not really sure if the client can be or would be PHP based or datbase driven. I'd hope so because I could adapt to it bette r and work on it but if not I am willing to learn the bits. Time frame? Well if someone needs to write it I don't need it anytime soon. I want it to be stable and what not so needs to be fine and operate correctly. But if I can buy or get some code I can edit there will be alot of editing but that would be fine. Any ideas people? email will be in the form of [EMAIL PROTECTED] not like [EMAIL PROTECTED] it's going to have it's own domain. Something like rock.com would be fine. Thanks! Jerry - Do you Yahoo!? Find a local business fast with Yahoo! Local Search -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 Do you Yahoo!? Messenger 7.0: Free worldwide PC to PC calls -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Converting the Month from a word into the numerical expression
Ron Piggott wrote: I have the word for the month stored in the variable $month In this example $month may be equal to "June". I wonder if there is a way to use the DATE function to convert this into a numberical expression --- in this example 06 Ron Indeed there is: strtotime See http://php.belnet.be/manual/en/function.strtotime.php Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] µç×Ó´«µ¥,×îÁ ®¼ÛµÄÐû´«·½Ê½
JeRRy wrote: Date:Sun, 16 Oct 2005 02:40:44 -0400From:"Alain Rivest" <[EMAIL PROTECTED]>To:"php-db@lists.php.net" Subject:Re: [PHP-DB] µç×Ó´«µ¥,×îÁ®¼ÛµÄÐû´«·½Ê½ KOKOµç×Ó´«µ¥ a ¨¦crit :>¹ýÁËÁ¼¾Ã£¬½û²»×¡´óÉù˵µÀ£º¡°ÉñÏÉæ¢æ¢£¬ÄãÈôÄÜ»î¹ýÀ´¸úÎÒ˵һ¾ä»°£¬ÎÒ±ãΪÄãËÀһǧ±é£¬Ò»Íò±é£¬Ò²ÈçÉíµÇ¼«ÀÖ£¬»¶Ï²ÎÞÏÞ¡£¡±Í»È»Ë«Ï¥¹òµ¹£¬°ÝÁËÏÂÈ¥¡£ > >Ç𴦻úµÀ£º¡°±±¶·´óÕóÈ«Á¦ÓëÄãÖÜÐý£¬Á½¸öħͷÁì×ÅÒ»Åú¼éÈË£¬³Ë϶¹¥µ½ÖØÑô¹¬Ç°¡£ËûÃÇÒ»ÉÏÀ´¾Í·Å»ðÉÕ¹Û£¬ºÂʦµÜ³öÕóÓëÄÇ»ô¶¼Íõ×Ó¶¯ÊÖ¡£Ò²ÊÇËû¹ýÓÚÇáµÐ£¬¶ø»ô¶¼µÄÎ书ÓÖ±ð¾ßÒ»¸ñ£¬¹ÖÒìÌØÉõ¡£ºÂʦµÜ³öÊÖʱÂÔÏÖ¼±Ô꣬ÐØ¿ÚÖÐÁËËûÒ»ÕÆ¡£ÎÒÃÇæ½áÕóÏ໤¡£Ö»ÊÇÉÙÁ˺ÂʦµÜÒ»ÈË£¬²¹ÉÏÀ´µÄµÜ×Ó¹¦Á¦Ïà²îÌ«Ô¶£¬Õó·¨ÍþÁ¦±ãÊôÓÐÏÞ¡£ÄãÈô²»¼°Ê±¸Ïµ½£¬È«Õæ½Ì½ñÈÕµ±ÕæÊÇÒ»°ÜÍ¿µØÁË¡£ÏÖÏÂÏëÀ´£¬¾ÍËãÊØÔÚɽϵÄÖÚµÜ×Ó²»ÈÏ´íÁ˵ÐÈË£¬ÄÇЩ¶þÁ÷ÑýÈ˹ÌÈ»ÎÞ·¨ÉÏɽ£¬´ï¶û°ÍÓë»ô¶¼¶þÈËÈ´ÖÕ¾¿×èµ²²»×¡¡£´Ë¶þÈËÁªÊÖÓë±±¶·ÕóÏභ£¬ÎÒÃÇÊäÊDz»»áÊäµÄ£¬µ«¾ö²»ÄÜÈçÄãÕâ°ãÓ®µÃǬ¾»Ë¬¿ì¡¡¡±Õý˵µ½ÕâÀºöÌýÎ÷±ßÃùÃùÃùÒ»ÕóÏìÁÁ£¬ÓÐÈË´µ¶¯ºÅ½Ç¡£½ÇÉù²ÔÁ¹¼¤Ô½£¬¹ù¾¸ÌýÔÚ¶úÖУ¬²»ÓɵÃÐÄÂõÒõɽ£¬Éñ³Û´óÄ®£¬ÏëÆðÁËÃɹŻÆɳç硢ƽҰÎ޼ʵķç¹â¡£ >Can you repeat the question, please?-- Alain -- http://www.vivahate.org This is a "english" list. You obviously MUST understand "english" as you have signed up to the list, which emails an "english" plain-text email to you to confirm email address. Also to signup you use a web-form which is also in "english" .. Most messages that are not in "english" are ignored and will continue to be ignored. More likely this occourence is a load of spam. That makes no sense at all or no meaning. However it could be real, but should be ignored. J It is indeed spam - perhaps the administrator could unsubscribe this address.
Re: [PHP-DB] Refreshing text question!
Well, somebody's got to say it: that question has nothing to do with PHP and MySQL, which are server side. I suggest you Google "free javascript" and you will find dozens of sites offering free java scripts. Many of them will have text/text banner offerings that do what you want to do. Good luck, Jeffrey JeRRy wrote: Hi, I did a little bit of script that refreshes a text slogan every 5 or so seconds with a new slogans and wraps to each slogan, I had about 5, and loops over and over again. This was done WITHOUT the need of refreshing the page. I think I used JavaScript but not 100% sure of this. Has anyone seen this before I seen a site use it? I can't recall the site I did it for, I know I have done it before. I need the code again without needing to re-do it all again as it took me a while to configure it last time. The site is written in PHP and uses MySQL. Any help would be mostly appreciated. J - Do you Yahoo!? Messenger 7.0: Free worldwide PC to PC calls -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new guy with stupid question
Lonny wrote: OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny Lonny: Don't slag yourself off so much. That's what this list is for ;o) First question... $subject="Email subject line"; $body="Newsletter content"; $return_address="From: [EMAIL PROTECTED]"; $query="SELECT $email_address FROM some_table"; $result=mysql_query($query) or die("Something went wrong, sweetheart: " . mysql_error()); while($row=mysql_fetch_array($result)){ extract($row); mail($email,$subject,$body,$return_address); } Untested, but should work. And I know some of the people on the list will say that the mysql_fetch_array() is not the best approach - but you can fiddle with mysql_fetch_row() if you'd prefer. It would probably be a bit more efficient. As to HTML content for your newsletter, I would test first. Create a newsletter, send it to yourself and, if possible a couple of other people. Try various layouts until it looks right. But bear in mind that different e-mail clients are not consistent with the display of html content. So try as many different clients as you can, especially Outlook, Lotus Notes (if there are a lot of busness users), Thunderbird, Gmail, hotmail, etc. For what it's worth, I do a popular and highly regarded newsletter entirely in ASCII text. Of the over 2000 subscribers, only one person every complained about the appearance - and his complaints were such that it was clear he wasn't remotely interested in the actual content of the newsletter. For the last question, get the date info from your drop down menus, then in php... $date_for_db=$year."-".$month."-".$day; ...and insert $date_for_db into your table. Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Retricting Access to Menu Items
I've done this kind of thing with a number of web apps. What I usually do is create a user table in MySQL with a user-name, password and access level, which has an integer value. When a user logs in successfully, a session is created (see session_start() in php documentation), the access level is pulled from the user table and saved as a session variable. Then it is a simple matter of using bits of code like... if ($_SESSION['access_level'] > 7){ echo "some stuff"; } In your example, you will also want to check the user's access level on each restricted page - it is not enough to hide menu options. Users could simply type the URL in. I hope that's clear. Good luck, Jeffrey Jeff Broomall wrote: Good morning everyone. I'm building a very simple content management site that tracks "tasks." The options available are: 1. Add Task 2. Edit Task 3. View Task 4. Print Task I need to restrict some users to only View and Print and I'm trying to find a way to tell the page not to load the menu options (the text) for those not having access to the Add and Edit functions. IOW, they would only see View and Print. I have three basic users: 1. System Admin 2. Subject Matter Expert (SME) 3. Viewers Obviously the System Admin and SME will have full access so it's the Viewers that are to have access to only View and Print. I have a users table but haven't set it up for the distinction. What I was thinking was creating a field labeled users_group and assign a numeric value for each user using the numbering system above. I have my page load the menu options: Home View Tasks Edit Task Add Task into here... ICAO Tasks — WAFS Menu <--The menu above inserted here. How can I tell the system not to load the last two lines unless they are a System Admin or SME? I read a chapter on Cookies/Sessions...but it wasn't that helpful for this case. Can I setcookie('user_group', '3') and use that somehow??? Am I in the ballpark with this solution? Thanks. Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Renaming a table once it has been created
Ron Piggott (PHP) wrote: Is there a way to re-name a table once you have created it? Ron ALTER TABLE `old_name` RENAME `new_name` Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] short text strings with apostrophes and forms
I have an application which calls up some data from a MySQL table and puts it into a web form for users to modify. One of the cells holds a text string which is put into a text input field. However, if that text string includes an apostrophe, all text after the apostrophe disappears. For example, if the test string from a database cell reads... Fix the managers' cars by Tuesday and that is saved in the variable $some_text, which is called up in a form... The text field on the web page will only contain... Fix the managers How can I get the text field to show the entire string? Many thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] short text strings with apostrophes and forms
[EMAIL PROTECTED] wrote: I have an application which calls up some data from a MySQL table and puts it into a web form for users to modify. One of the cells holds a text string which is put into a text input field. However, if that text string includes an apostrophe, all text after the apostrophe disappears. For example, if the test string from a database cell reads... Fix the managers' cars by Tuesday and that is saved in the variable $some_text, which is called up in a form... The text field on the web page will only contain... Fix the managers How can I get the text field to show the entire string? Many thanks, Jeffrey htmlentities($some_text, ENT_QUOTES) is more robust than htmlspecialchars (); David Thanks, David. That did the trick. And thanks to everyone else who quickly responded with intelligent advice! Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Chinese characters
John Meyer wrote: Is there any way to filter out Chinese or Asian characters from what I get from this list? I understand that there are a lot of intelligent, well-meaning Asians on this list but my system seems to get Montezuma's revenge when I look at those e-mails. FWIW: The posts with Chinese and Japanese characters are not even posts. They are pure spam. As such, the senders should be removed from the list completely. Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Conditional updating...
Perhaps I have misunderstood something here. But it seems to me that anyone who just happens to put John Smith's name in could alter Mr. Smith's data. If users can update their own data, should you not have a log in process to ensure that only the original user can update his data? Them once he has logged in, you can populate all fields with data from the DB. Jeffrey Grae Wolfe - PHP wrote: That was the first thing that I was going to do, but there is a concern there for security of the data being input... This is a registration site, and I don't want to provide information on "John Smith" to anyone who just happens to put his name in. ""Alejandro Tesone"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Why don't you try populating the fields the user intends to modify with the information you already have? Alex T On 6/17/06, Grae Wolfe - PHP <[EMAIL PROTECTED]> wrote: Good day! I have been working on this little "free" project for a while, and now I have hit another major hiccup. Is there a simple way to only update fields that have something in them? The problem that I am having is that if someone fills out information and submits it, it saves to the DB just fine. However, if they come back later and just put in, for example, a new phone number, it replaces all of the other information with blanks. Here is my current $sql query: $sql = "UPDATE $table SET first_name='$first_name', last_name='$last_name', hs_last_name='$hs_last_name', guest_name='$guest_name', street_address1='$street_address1', street_address2='$street_address2', city='$city', state='$state', zip='$zip', phone1='$phone1', phone2='$phone2', email_address='$email_address', farmers_barn='$farmers_barn', wrhs_tour='$wrhs_tour', crystal_rose='$crystal_rose', registration_comments='$registration_comments', date_registered='$today' WHERE first_name='$first_name' AND last_name='$last_name'"; -- 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] mysqldump via php
I would like to do a backup of an entire MySQL database via php. My thought was to use mysqldump, write the data to a file and save the file. However... $query="mysqldump $dbase"; $result=mysql_query($query) or die(mysql_error()); ...immediately results in an "error in your SQL syntax near mysqldump [database name]". The reason I want to do a MySQL back up via php is that I have a web application in which the user can archive a project, which involves moving a lot data from one set of tables to another set of tables. The user can also delete a project, which removes lots of data from the DB altogether. Although there are lots of "Are you sure you really want to do this?" messages the user must click upon, I am sure I will eventually get a user telling me she accidentally archived/deleted stuff and can I help. So, my thought was to do a incorporate a mysqldump in the archiving/delete page. That way there would be a snapshot of the pre-action db, making it easy to put things right. Can you help with my query - or by suggesting an alternative solution? Thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysqldump via php
Thanks all for the help! exec() seems the best option. Jeffrey Miguel Guirao wrote: You could use exec() within PHP! -Original Message- From: Adrian Bruce [mailto:[EMAIL PROTECTED] Sent: Jueves, 29 de Junio de 2006 06:31 a.m. To: Jeffrey Cc: PHP DB Subject: Re: [PHP-DB] mysqldump via php mysqldump is a .exe, and therefore it will not work within mysql_query(); You may be able to use mysqldump from PHP using the system function check out http://uk.php.net/system Ade Jeffrey wrote: I would like to do a backup of an entire MySQL database via php. My thought was to use mysqldump, write the data to a file and save the file. However... $query="mysqldump $dbase"; $result=mysql_query($query) or die(mysql_error()); ...immediately results in an "error in your SQL syntax near mysqldump [database name]". The reason I want to do a MySQL back up via php is that I have a web application in which the user can archive a project, which involves moving a lot data from one set of tables to another set of tables. The user can also delete a project, which removes lots of data from the DB altogether. Although there are lots of "Are you sure you really want to do this?" messages the user must click upon, I am sure I will eventually get a user telling me she accidentally archived/deleted stuff and can I help. So, my thought was to do a incorporate a mysqldump in the archiving/delete page. That way there would be a snapshot of the pre-action db, making it easy to put things right. Can you help with my query - or by suggesting an alternative solution? Thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Interacting with server without a refresh?
This veers a bit from PHP, but is relevant. I am building an interactive workshop tool using php and mysql. I want the facilitator to be able to control which pages the participants see and to be able to control the data that appears on the page. The obvious way to do this would be to have regular page refreshes. This would reload the page bringing in new data from the db, or could pull in entire new pages using includes. However, page refreshes are less than elegant - and can cause problems if, for example, I want to have a form on a page. I am wondering if there are alternative methods - presumably using something clientside - that could check the server and only do a refresh if new data/new page or somesuch is available. I hope this is clear. Thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Can you recommend Australian LAMP web hosting service?
Sorry, this is a bit off topic, but you are the best people to ask. I am looking for a web hosting service based in Australia (and with servers in Australia). Need Linux+Apache+MySQL+PHP and dedicated server hosting. Importantly, they must provide a very high level of security (especially security), reliability and customer service as sensitive corporate data would be saved on the application(s) hosted by them. Feel free to e-mail me off-list. Many thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search engine
Truth be told, Google's free slap-it-on-your-web site search tool (http://www.google.com/services/websearch.html) will do everything you want and save you a lot of coding. Assuming this is for actsministries.org which seems to be a useful resource of information; it is probably well indexed by Google and updates will be reflected reasonably quickly. On my most popular site, which is sort of a resource, Google is usually 24-48 hours behind changes. Doing your own search coding is best when you want to allow users to search data in a database (rather than on web pages). Good luck, Jeffrey Ron Piggott (PHP) wrote: What I haven't figured out is how to crawl my site. If I knew how to crawl my site I could write a basic search engine and develop it over time. This is the crucial issue I need help with. I have a really basic search engine I wrote last year. I told my web site what pages the user could search ... as in I keyed in the URL's I am giving my site a face lift and making some serious changes to it ... I have my database out of date ... I would like to crawl my site once a day to update what changes I made during the past 24 hours and delete HTML files which no longer exist. If someone knew how to retrieve various then I could start with something and build on it over time ... Ron On Thu, 2006-09-28 at 11:44 +0100, Shaun A Riches wrote: What about the MySQL "LIKE" command? Research it. This is assuming your data is stored properly without redundant data and in a MySQL database. ___ Shaun Riches Computer Science Student -Original Message- From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] Sent: Thu 28/09/2006 03:44 To: PHP DB Subject: [PHP-DB] Search engine ___ Shaun Riches Computer Science Student -Original Message- From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] Sent: Thu 28/09/2006 03:44 To: PHP DB Subject: [PHP-DB] Search engine Has anyone wrote a search engine for the web site? I am wondering if someone has the time to help me walk through doing this. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Generating pages with full stories
Yes... But, the experts on this list need more info in order to help you out. 1. Where are the stories going to come from? If you plant to take news stories from other sites and use them on your own site, there are serious legal issues involved. 2. If you want to write the stories yourself, or invite visitors to write your stories, then you probably want a simple content management system using PHP and MySQL. There are a lot of them about. Google or ask for recommendations. 3. If you'd prefer to make the site yourself in order to learn PHP + MySQL programming, you can find lots of tutorials. Google PHP Tutorials and look around. Good luck, Jeffrey [EMAIL PROTECTED] wrote: I've got a website using PHP and MySQL. I would like to make a "news preview" on the webpage's frontpage with a link to the full story. Is it possible to use one (1) .PHP file to generate full stories, with MySQL involved? I'm just a newcomer in the world of PHP but I am doing my best in reading materials for PHP. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] simple issue
You should be aware the the PHP-DB archives are openly available on the web and searchable. Assuming you have listed your actual username, password, etc, you should immediately go to your web site and change your password. If possible change also your username and database name. Do it now. It would not be an overly demanding task for a hacker to find your web site and once she does, she has free access to your database. And in future, when sharing code on PHP-DB, which is a must if you want the expert help people here can provide, always leave out or change the MySQL log in info. Good luck, Jeffrey Chris Carter wrote: my code: "; echo "Companyname"; echo "Contactname"; while (odbc_fetch_row($result)) { $compname=odbc_result($result,"CompanyName"); $conname=odbc_result($result,"ContactName"); echo "$compname"; echo "$conname"; } odbc_close($conn); echo ""; ?> My error: Fatal error: Call to undefined function: odbc_fetch_row() in /home/chandan/public_html/deb.php on line 19 Companyname Contactname Also .. I am trying this live on cPanel compiler coz I could not install the PHP thing on my localhost. I have apache-tomcat-5.5.17 which works perfectly with jsp files but I do not understand what does it take to run a php using apache. chris smith-9 wrote: Chris Carter wrote: Hi, I am new to PHP, just trying a peace of code to access mySQL database to fetch and show result on web page. But getting errors. Can you help me with this code please. Or if you have a very basic code where in I can do some insertion in the database. There are hundreds of mysql + php tutorials on the 'net - do a search in your preferred search engine. If you *still* can't work it out post a sample of the code you're trying to use and the errors you get. -- Postgresql & php tutorials http://www.designmagick.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] random 'card number' generator
D. Go to the manual at http://be2.php.net/manual/en/function.rand.php and look at the User contributed notes further down the page. You'll find a couple of solutions. Whatever you do, you will presumably need to check the generated number against the db to see if it is already in use and, if not, generate a new random number. Good luck, Jeffrey Desmond Coughlan wrote: X-No-Archive: true Hello, I'm learning PhP and trying to write a library catalogue system, that uses a PostgreSQL back-end. My db looks like this ... http://www.chez.com/desmondcoughlan/unix/bibliotheque.sql I had originally planned to have a username in place of 'card_number', but realised that there was no point. What I need now is the PhP code that will create a card number, and rather than having a sequence, I want a random three-digit number. Can someone point me in the direction of where and how PhP can do this? Thanks. D. - Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Invoking database php file with hyperlink
Chris Carter wrote: I need to fetch data from database with the help of a php file, not with the click on a button but click on the hyperlink. I know this is simple but i have not done it. Please advice or give me some link. Main php file is bars.php that fetches data from MySql DB As another chap has remarked, you don't actually need a button, form or link for a php script to run. Just put whatever queries you want on the page and they will happen whenever the is loaded by a user. If you want to pass variables, via a hyperlink, in order to call specific data from a table, then use the format... Link Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL query error
Chris Carter wrote: What wrong with this syntax, its not giving any error on runtime but I am facing a blank page while paging. $query=" SELECT * FROM gurgaonmalls WHERE mallname = '$mallname' limit $eu, $limit "; Have you tried... echo " $query "; ...to unsure the variables have the values you expect them to have? Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] One big query vs. lots of small queries
Here's a question of efficiency. I have an application in PHP using MySQL. Users select items on a form and each selected item represents a change in a table row. It is possible that 100s of changes might be chosen from a single form. Which is likely to be faster/more efficient? multiple queries like... $query="UPDATE some_table SET x='$y' WHERE id='$z[$key]'"; $result=mysql_query($query); or one huge query like... $query="UPDATE some_table SET x='$y' WHERE id='$z[$key]' OR id='$z[$another_key]' OR id='$z[$another_key] OR id='$z[$another_key]"; etc? $result=mysql_query($query); In the latter, PHP would have to construct the WHERE string, which would require some processing power as well. Is there a limit to how many OR's can be added to a mysql query? No - don't answer that, I'll look in the manual. Many thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Migrate MySQL to Ingres
We have a moderately complex PHP web app collecting data from a MySQL database. We've been offered a rather attractive proposition to build an Ingres version (ie. same app, but collects data from an Ingres database). Questions for experts like you: 1) Is this a reasonably straightforward migration in which we can largely replace mysql_query with ingres_query, etc, or will it be more complex than that? 2) Does Ingres compare reasonably well with MySQL in terms of scalability and speed? 3) Any dangers I should be aware of? I am trying to decide whether or not to go forward with this project. Your advice is much appreciated! Thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Localisation of web app
Ladies and Gentlemen.. I've got a moderately complex web application in PHP feeding off MySQL and user input. The application is in English, but we need to localise it into other languages. We also need to devise a system that makes it easy to administer for translator(s) and programmer(s) and suffers minimal performance slow down. Of course this issue should have been considered at the design stage, but it's too late now. I see three routes.. 1) Replace text with string variables which get their values via queries to a MySQL table. This would be easiest to set up and easiest to administer. But would it significantly slow performance compared to either of the other options? 2) Replace text with string variables which get their values from include files. This would also be almost as easy to administer and presumably faster than 1. 3) Hard code translations right into the php pages. This would presumably offer fastest performance, but would be bloody difficult to administer, particularly with upgrades. Do you have any experience with this kind of thing? My inclination is to go with option (2). But you are the experts. Perhaps I am wrong or there is a better solution I haven't seen. Many thanks! Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP-DB] Optimising LIMITs
> JM> Primary keys aren't any faster than normal keys. They're simply for > JM> identification. (correct me if I'm wrong, that is my understanding) > JM> If you don't already have an index on created, I'd do that. > > I do - here's a question though, what is the best way to have an > index? To combine multiple fields into one index - or to have one > field per index? I ask because MySQL will appear to select the best > possible index for the query and sometimes it's wrong - I read > somewhere you can control which index it uses, but if you had a > "combined" index would this make things any more/less effective? Well, it can't use a multi-column index if you are only matching on one column. If you have 3 indexes, (status, boardid), (status), and (boardid), it won't slow you down any on your queries. If one index is needed it is put into memory and stored there until another index bumps it, otherwise it resides on disk. I don't see it has too much of a performance dock, it may slow down inserts a little... I am not sure about this, but I think if you are going to have the 2 column indexes, they have to match up in both tables you're joining. You'll have to experiment with it a bit. you can say "select * from thread (index statusBoardCombinedIndex) where" to get the index you want. > > JM> If you want to optimize things further, I would run the query at midnight > JM> each morning, and instead of paging through the entire table, just page > JM> through that temporary table. > > Figured someone might suggest that - I will have to look into it. > Thanks. > > -- > Best regards, > Richard Davey > http://www.phpcommunity.org/wiki/296.html > > -- > 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] sybase support in PHP5
Is Sybase support in PHP5 working? I get: /bin/sh /usr/portage/tmp/php-5.0.0b3/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/sybase/ -I/usr/portage/tmp/php-5.0.0b3/ext/sybase/ -DPHP_ATOM_INC -I/usr/portage/tmp/php-5.0.0b3/include -I/usr/portage/tmp/php-5.0.0b3/main -I/usr/portage/tmp/php-5.0.0b3 -I/usr/portage/tmp/php-5.0.0b3/Zend -I/usr/include/libxml2 -I/usr/include/mysql -I/opt/sybase-11.9.2/include -I/usr/portage/tmp/php-5.0.0b3/TSRM -g -O2 -prefer-pic -c /usr/portage/tmp/php-5.0.0b3/ext/sybase/php_sybase_db.c -o ext/sybase/php_sybase_db.lo /usr/portage/tmp/php-5.0.0b3/ext/sybase/php_sybase_db.c: In function `zif_sybase_fetch_object': /usr/portage/tmp/php-5.0.0b3/ext/sybase/php_sybase_db.c:1110: invalid lvalue in assignment /usr/portage/tmp/php-5.0.0b3/ext/sybase/php_sybase_db.c:: invalid lvalue in assignment make: *** [ext/sybase/php_sybase_db.lo] Error 1
Re: [PHP-DB] password input type
It is possible to md5 encrypt a password before you send it off to the server using javascript onSubmit function. Check this code out: http://pajhome.org.uk/crypt/md5/ -Jeff Moss - Original Message - From: "matthew perry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 05, 2004 12:14 PM Subject: [PHP-DB] password input type > Does using a pasword input type > make the transfer more secure from someone "sniffing" my connection or > does it only shield an onlooker from seeing what the user enters? > - Matt > > -- > 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] pdf editor
I think someone else asked about a problem where they had text running off the side of the page, heres everything I've ever learned about PS/PDF. GNU ghostscript is all you really need for editing pdf's. Usually the text appears as plain text once you convert the PDF to a PS with pdf2ps, and you can just delete it and put it back as PDF using ps2pdf. I do quick changes like this all the time. The adobe postscript 3 driver for windows outputs clean postscript, I use it a lot for "email merge" with PDF cause I can't afford more expensive products. Here's some notes I made a while back on it, you may need to view my little diagrams with courier fonts: The first two parameters are the location of the text. Depending on how the text will function, you have two choices, you can either let the postscript file handle spacing, or you can use static letter spacing and if there is too much text for one line it will spill off the page. You want to use static spacing for "fields", where there is no other text to space, but if you are inserting a name into the middle of a line of text, you will want to let postscript handle spacing, like this (here what I know): -2040 -1827 ( *#address1#*) -2.666595 0 725 5 16 A1`65 ^ ^ ^ ^ ^ x coord y coord text string width maximum letter spacing? If you want to do static text, simply convert this line to this, by adding a moveto after the coordinates, and chaging all the number parameters to "show". -2040 -1827 moveto ( *#address1#*) show When the text runs off the right side of the page, my solution was to change the original document, and drop it down onto its own line. Its possible to program postscript to automatically add a line break when the line gets too big, I don't know postscript so don't ask me how to get this to work: . /Helvetica-Bold-SHOWISO exch definefont pop /Helvetica findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding showcaseisoencoding def currentdict end ... 31 189 M (Comments:) S /Helvetica-Bold-SHOWISO findfont 24 scalefont setfont /rule (___) def /y 189 def /x 141.336 def y -29 73 { x exch M rule S } for rule stringwidth pop 29 x y comments BreakIntoLines grestore grestore showpage This postscript is taken from the default fax coversheet file (faxcover.ps) from gnu hylafax. -Jeff - Original Message - From: "matthew perry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 07, 2004 9:53 AM Subject: [PHP-DB] pdf editor > I use Windows XP. > Really all I need to do is remove a single line in a pdf file and I > can't convince myself to spend $749 for Acrobat Pro to do it. > - Matt > > On 7 Apr 2004, at 16:34, matthew perry wrote: > > > Does anyone know a free pdf editor? > > > what platform do you require it for? > -- > Mike Karthauser > Managing Director - Brightstorm Ltd > > Email >> [EMAIL PROTECTED] > Web >> http://www.brightstorm.co.uk > Tel >> 0117 9426653 (office) > 07939 252144 (mobile) > > -- > 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] mysql went away
I would start by seeing if the files are there after you create/load the table. It should by default create a file for each table you create. Sounds to me like a problem reading the disk. If you don't find any answers on your own, post your system specs to the MySQL lists. You could also try verbose debugging options, I've never used any debugging, but here's how to do it in mysqladmin. --debug[=debug_options], -# [debug_options] Write a debugging log. The debug_options string often is 'd:t:o,file_name'. The default is 'd:t:o,/tmp/mysqladmin.trace'. -Jeff - Original Message - From: "Bill Green" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 12, 2004 4:05 PM Subject: [PHP-DB] mysql went away > HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac > OS 10.3.3 as a learning/testing/development environment for a couple of > months now - no problems, works great. > > I've created more than a few mySQL databases and tables, but yesterday > I created a database, a table, and LOAD DATA from within phpMyAdmin. > Successfully. I looked at the data and all was fine. Logged out and > went away for a while. Came back and phpMyAdmin would not show me my > databases in the left frame, and I could not launch a query window. I > could see runtime information, system vars, processes, and even > privileges. > > I tried logging in to mySQL through the terminal, and I can run simple > commands and connect OK, but any commands to show databases or tables > will hang the terminal. Through the command line client I can run > simple commands, but no commands to view or affect databases or tables. > > I can run php scripts - connect to databases, retrieve and even > insert/update data, but I cannot view databases or tables. > > Does anyone have a clue about what the problems may be or where I > should start? > > --- > Bill Green > 20 Meadowview Drive > Asheville, NC 28804 > -- > [EMAIL PROTECTED] > http://www.billgreen.org > 828.252.1492 > > -- > 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] search engines
Read up on MySQL full text search. http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html -Jeff - Original Message - From: "redhat" <[EMAIL PROTECTED]> To: "phplist" <[EMAIL PROTECTED]> Sent: Thursday, April 29, 2004 10:12 AM Subject: [PHP-DB] search engines > Anyone out there know of a good tutorial on creating a php/mysql based > search engine script? I would like to write one for a small "in-house" > application that I am running. > thanks, > DF > > -- > 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] Read a PDF file via PHP
Steve, You must turn the file to postscript before you can read anything out of it, and even then, a lot of the time words are broken up into different "show" statements. use pdf2ps (part of GNU GhostScript) to convert to PS and then search for patterns like this: (text) show that is the most basic postscript syntax but often it is more complex than that. The Adobe postscript 3 driver for windows creates all in one lines with positioning and formatting parameters. So basically, you look for anything in parenthesis to be text. For indexing you may get by just looking for anything in parenthesis, but I would look for a third party utility to do it if you want it done perfectly. -Jeff Moss - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 25, 2004 1:36 PM Subject: [PHP-DB] Read a PDF file via PHP > I'm working on a file upload system that accepts PDF files, reads the text in those files, and enters it into a database, which makes the text from the PDF indexable and searchable. > > I've got it all down except for the ability to read the text from a PDF file. > > When the PHP read file function is used, the PDF file is read just fine, but when I return the results to my browser, they're of course nothing but jumble, because the code for the entire file was read. > > Is there any way to get PHP to simply read the PDF file for text only--just the surface of it, just the words, as if it were a human reading the PDF itself--and not for the internal code of the file? > > Thanks, > Steve > > -- > 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] FULLTEXT and LIKE
Well, like will do a full table scan if it starts with a wildcard, so you dont want to do it that way. I'd do full text search. http://dev.mysql.com/doc/mysql/en/MySQL_indexes.html -Jeff - Original Message - From: "Monty" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 22, 2004 12:57 PM Subject: [PHP-DB] FULLTEXT and LIKE > Hi, > > My head is swimming with lots of info gleaned from various newsgroups about > using fulltext indexes in MySQL, but, I'm still not sure what the best > solution would be for what I want to do. I'm concerned about the 3-char > minimum and not being able to search on partial words (my version of MySQL > doesn't support boolean fulltext searches). > > I have a simple News table that is structured like this: > > CREATE TABLE `news` ( > `id` int(7) unsigned NOT NULL auto_increment, > `author` varchar(50) NOT NULL default '', > `headline` varchar(60) NOT NULL default '', > `content` text NOT NULL, > `url` text NOT NULL, > UNIQUE KEY `id` (`id`), > ) TYPE=MyISAM; > > I want searches for News to be on the author, headline and content fields. > What is the best way to index and search this? > > A) Create a combined fulltext index: FULLTEXT (author,headline,content) -- > and do searches using MATCH() and AGAINST(). > > B) Create a fulltext index only for the content field and use this kind of > select: SELECT * FROM db WHERE author LIKE "%phrase%" OR headline LIKE > "%phrase%" OR MATCH(content) AGAINST(phrase); > > C) None of the above ... is there a better way? > > Thanks a lot for any input or feedback! I'm completely lost! > > Monty > > -- > 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] Checkbox Array Question - Iteration
Well, you should come up with a definitions table. Create an array out of the definitions table (I'd recommend keeping everything in one array, for recursive efficiency). Then go over THIS array, and check for the existence of variables in the form array. That way you can output all the checkboxes and not just the ones that are checked, and all your definitions are stored in the database. Later on you may want to make a simple web based tool to add options (for non-coders). -Jeff - Original Message - From: "Hutchins, Richard" <[EMAIL PROTECTED]> To: "PHP-DB (E-mail)" <[EMAIL PROTECTED]> Sent: Tuesday, August 17, 2004 11:37 AM Subject: [PHP-DB] Checkbox Array Question - Iteration > I am developing a page where people check off items for which they would > like to volunteer. For now, this page has around 50 checkboxes on it, but it > could conceivably change frequently and grow much larger than the current 50 > items once it goes live. > > I have all of the checkboxes arranged into nice little arrays and named > things like name="kitchen[waitstaff]" and name="kitchen[cook]", > name="professional[paint]". I take the checked boxes, serialize them, and > store them in columns in MySQL that bear the same name as the array (e.g., > kitchen, professional). All of this works fine and I'm very happy with it. > > Now, when the person revisits the page to update his/her selections, I query > the database and unserialize the column data. I then search the resulting > array and if the name of the checkbox is found in the array, I echo > "checked" to select the checkbox. See below: > > > while($row = mysql_fetch_array($curRecord)){ > $vid=$row["vid"]; > $pID=$row["pID"]; > $kitchen = unserialize($row["kitchen"]); > $kitchenevt = unserialize($row["kitchenevt"]); > $profesional = unserialize($row["professional"]); > . > . > . > } > > //BUNCHA' IRRELEVENT STUFF CUT OUT OF HERE > > General Kitchen Help > echo " if(in_array("waitstaff",$kitchen)){ > echo "checked"; > } > echo "> class=\"body\">Waiter/Waitress"; > > > echo " if(in_array("cook",$kitchen)){ > echo "checked"; > } > echo "> Cook"; > . > . > . > //AND SO ON FOR EVERY SINGLE CHECKBOX. > ?> > > > > So, having set up a sample section of checkboxes on my page using the logic > in the snippet above, I am wondering if there is a much more efficient way > to look at the arrays that get returned from the database, check to see if > the given checkbox is contained therein, then, if it is, echo "checked". The > solution snippet above works just fine, but whenever I find myself > contemplating doing the same thing over and over in code, that's obviously a > flag for investigating an iterative solution. > > Right now, though, I'm struggling with trying to noodle out whether setting > up some sort of iterative function would be more work than simply doing what > I'm doing now. Obviously, iteration is always great for handling repetitive > work, but I'm just not having much luck coming up with a solution. > > I am aware that this is probably slightly off-topic since it isn't a direct > php/db question, but I was hoping somebody might be kind enough to offer up > suggestions as to how I might construct such a solution anyway. > > Thanks in advance for you time. > > > Rich > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mySQL- Fatal error: Call to undefined function mysql_connect()...
Gotta recompile php with the --with-mysql option (or something like that). Try running configure --help You can see what options you compiled with by grepping for CONFIGURE in your Makefile. Here's what I got: [EMAIL PROTECTED] php-5.0.0b4 # grep CONFIGURE Makefile CONFIGURE_COMMAND = './configure' '--with-mysql' '--with-apxs2=/usr/sbin/apxs2' '--with-zlib' '--with-xsl' '--with-imap-ssl' Dude, I need to update! -Jeff - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 17, 2004 12:02 PM Subject: [PHP-DB] help with mySQL- Fatal error: Call to undefined function mysql_connect()... > I know this is probably the noobiest of questions but please help. > > Fatal error: Call to undefined function mysql_connect() in > .. on line 112 > > This occurs when I try to access a MySQL application, specifically Invision > Power Boards. > > I have PHP5 installed on my Apache 1.3.31, and I believe that my MySQL is > MySQL4, all this on Windows XP personal. > > My php.ini file is in my systemroot (C:/windows). Currently I have no loaded > extensions for MySQL/php connections stuff (ex: php_mysql.dll, > php_mysqli.dll). I tried some stuff I found on help boards but everything > just got all messed > up, so I thought I'd get more official help. > > I have all of the php .DLL files that came with the zip file in > C:/windows/system32. PHP-mysql.DLL and php_mysqli.dll are in both system32 > and just > c:/windows. > > When I run phpinfo() I get no mention of MySQL. MySQL itself connects to the > MySQL server just fine. I think that's everything. > > Thanks in advance. > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mySQL- Fatal error: Call to undefined function mysql_connect()...
Oh, you're using windows. To use an extension, set it up as follows. 1.. Open the PHP.INI file and locate the following line. extension_dir = ./ This line indicates the folder where the PHP extension DLL files are located. Edit this line to: extension_dir = C:\php\extensions 2.. Select from the PHP extension choices. Note that some of these files depend on other software to work correctly (such as the Oracle 8 extension). Consult the PHP documentation to see what additional software (if any) is required. 3.. See an example for loading an extension in the following commented out line: ;extension=php_zip.dll Uncomment the line, as follows: extension=php_zip.dll 4.. Save your changes. 5.. Browse the PHP test page in your browser. The following appears: Also make sure phpinfo is showing the right php.ini file that you expect it to be. (http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_iis.html) -Jeff - Original Message - From: "Jeffrey Moss" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 17, 2004 12:08 PM Subject: Re: [PHP-DB] help with mySQL- Fatal error: Call to undefined function mysql_connect()... > Gotta recompile php with the --with-mysql option (or something like that). > > Try running configure --help > > You can see what options you compiled with by grepping for CONFIGURE in your > Makefile. Here's what I got: > > [EMAIL PROTECTED] php-5.0.0b4 # grep CONFIGURE Makefile > CONFIGURE_COMMAND = './configure' '--with-mysql' > '--with-apxs2=/usr/sbin/apxs2' '--with-zlib' '--with-xsl' '--with-imap-ssl' > > Dude, I need to update! > > -Jeff > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, August 17, 2004 12:02 PM > Subject: [PHP-DB] help with mySQL- Fatal error: Call to undefined function > mysql_connect()... > > > > I know this is probably the noobiest of questions but please help. > > > > Fatal error: Call to undefined function mysql_connect() in > > .. on line 112 > > > > This occurs when I try to access a MySQL application, specifically > Invision > > Power Boards. > > > > I have PHP5 installed on my Apache 1.3.31, and I believe that my MySQL is > > MySQL4, all this on Windows XP personal. > > > > My php.ini file is in my systemroot (C:/windows). Currently I have no > loaded > > extensions for MySQL/php connections stuff (ex: php_mysql.dll, > > php_mysqli.dll). I tried some stuff I found on help boards but everything > > just got all messed > > up, so I thought I'd get more official help. > > > > I have all of the php .DLL files that came with the zip file in > > C:/windows/system32. PHP-mysql.DLL and php_mysqli.dll are in both system32 > > and just > > c:/windows. > > > > When I run phpinfo() I get no mention of MySQL. MySQL itself connects to > the > > MySQL server just fine. I think that's everything. > > > > Thanks in advance. > > > > > > > > > > -- > 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] Which Database Abstraction Layer ?
> Doesn't do Firebird yet ;) - but it looks interesting. As long as it has > not made the mistake of using MySQL as the SQL standard. Many other > packages are simply MySQL wrappers with cobbled support for a couple of > other engines. I was curious about Firebird as I've heard it mentioned a lot lately. What's so great about it in your opinion, in comparison to MySQL and Postgress? (currently I use both of these) -Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how many databases should I create
Matter of preference really. Do you put all your files in one directory? I do for the most part, but when it comes to security you can divy out access to different databases rather than each table and it makes things simpler, so I use different databases for different projects. Also, I think you can move different databases around onto different partitions if they get too big. -Jeff - Original Message - From: "Perry, Matthew (Fire Marshal's Office)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 18, 2004 1:37 PM Subject: [PHP-DB] how many databases should I create I am developing a variety of different web based systems including inventory, payroll, incident reports etc. Should I create a new database for each project category or one huge database with every table I will ever use in it? -Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP + FreeTDS + SunOne + Linux?
I've got a strange situation. I have followed all the directions on how to compile FreeTDS and PHP 4.3.10 to enable MSSQL support. Everything compiles fine works from the command line, but the MSSQL functions fail when I attempt to run them through the Netscape/iPlanet/SunOne plug in. I'm running RedHat 2.1AS on a dual processor Xenon with 2G of ram. My webserver is SunOne(iPlanet) version 6.1. I am also running version 4.0.1 of SunOne ASP(Chilisoft) Here's what I've done: Built FreeTDS 0.62.4 with the following: ./configure --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld It works and I can connect to my database with tsql. I built PHP like this: ./configure --with-nsapi=/opt/iplanet --with-mysql=/usr --prefix=/usr/local --enable-fastcgi --with-zlib --enable-dbase --enable-ftp --with-openssl --with-mssql=/usr/local I am running the Zend_Optimizer2.5.7 and IonCube extensions. I can see that MSSQL support is compiled in from phpinfo If I run this from the command line: php -r '$con= mssql_connect("","",""); mssql_select_db("",$con); $rs=mssql_query("SELECT * from ",$con); print mssql_result($rs,0,0); mssql_close($con);' I get the output I expect. If I run this through the webserver: ","",""); mssql_select_db("",$con); $rs=mssql_query("SELECT * from ",$con); print mssql_result($rs,0,0); mssql_close($con); ?> The only output I receive is "" No error logs are generated anywhere (webserver, php, or freetds), even though php and freetds logging is enabled. Other php scripts that dont use the mssql functions run fine. It seems to fail at the first mssql_ function and no processing continues after that. If anyone has an idea or a way to verify if the ext/mssql module is compiled into the libphp4.so object, I would apprecate it. Thanks, Jeffrey __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 __ Do you Yahoo!? Send a seasonal email greeting and help others. Do good. http://celebrity.mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trigering PHP Code
Or, you could use XmlHttpRequest, which is what google suggest uses. http://www.google.com/webhp?complete=1 You can use this to dynamically populate a section of the page. I wouldn't delve into it unless you have some xml/javascript experience also though. Try this page for more info: http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/ -Jeff - Original Message - From: "Bastien Koert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Wednesday, December 29, 2004 12:15 PM Subject: RE: [PHP-DB] Trigering PHP Code see interspersed comments bastien From: Nayyar Ahmed <[EMAIL PROTECTED]> Reply-To: Nayyar Ahmed <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Trigering PHP Code Date: Wed, 29 Dec 2004 19:43:35 +0500 Hello All, I have two problem in my php file i.e. 1. I want to triger some php code, soon after when a selection is done from Drop Down Menu, For Example: When user select country name the State,city menu fill dynamically. 2 ways to do this 1. use javascript and pass all the data down to the client and have js do the manipulation 2. submit the page and draw the next select box at that time filled with a db query 2. I want to use a variable value gathered in one php file to some any other php file use sessions see http://www.php.net/sessions For Example: When user enter his/her name , I will use in later processing in by some other php file. I hope, I have explained my problem: TIA, Regards, -- Nayyar Ahmad Lecturer Faculty Of Computer Science, Institute Of Management Sciences, Hayat Abad Peshawar , Pakistan. Office : 92-091-9217404 , 9217452 Cell : 92-0333-9139461 -- 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] SSL - PAGE CANNOT BE DISPLAYED
Hi all. I have the following configuration: I'm running a Cobalt RAQ4i with Linux Apache Web Server PHP Version 4.0.3pl1 We have an application which is used via ssl. There are occassions when a user presses on a submit button to post information to a database. The script itself is fine, there is no problem with the php scripts at all. The problem comes in, and I've seen this at other websites while using ssl, that sometime, when they click on the submit button the error message: "Page Cannot Be Displayed" comes up. If the user hits the Refresh button, the page is displayed just fine. Again, this doesn't always happen at the same place. Some users experience it more often than others. And ONLY Internet Explorer users get this message. It never happens with Netscape. I had hear somewhere an issue like this with SSL/Apache/PHP combination, but am not aware of the solution. Can anyone enlighten me or have any ideas? Thanks in Advance, Jeffrey Cleary -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Looking for Experienced PHP Programmers
Hi all. My apologies if this is the wrong list. My company, JeffreyCo, Inc., is looking for one or two experienced PHP Programmers familiar with MySQL and a Linux environment for short term project work. Qualified candidates should send their resume, complete with links to any current applications on the web to [EMAIL PROTECTED] Please include your current hourly rate in your email. We have several exciting short and long term projects available and new ones showing up all the time. Qualified candidates should have a demonstrative working knowledge of the latest versions of PHP, MySQL and Linux Administration, along with prior PHP application success. Only replies with their resume and hourly rate will be considered. Please post to another list if this is the wrong one. Thanks, Jeffrey Cleary JeffreyCo, Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Newbee Question
Hello All, I am new to PHP, and I am trying to design what I thought would be a fairly simple form, that queries a MYSQL database for two fields, (first, and last name). It should then return the entire results of the entry in the table. This part is actually 5 fields. If I run the script with static entries for "first", and "last", the process work flawlessly (as it should). If I try using variables for the search values, I do not receive any results. I have tried changing the form method from post, to get, and the problem continues. Any help would be greatly appreciated. Thank you. The first grouping is the html form, the second set is the php form that actually performs the search. Also the username, and password are populated in the actual script, I just took them out for the email. Thanks again. Contact lookup form First Name: Last Name: '; } mysql_select_db(mysql_db); if ($http_get_vars['first'] && $http_get_vars['last']) { echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . ''; } $result=mysql_query("select * from chs where first='$first' or last='$last'"); echo "Results"; while ($row = mysql_fetch_array($result)) { echo "{$row['first']} {$row['last']} {$row['branch']} {$row['extension']} {$row['voice_mail']} {$row['position']} "; } ?> Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED]
Re: [PHP-DB] PHP Newbee Question
Thanks for the tip. Unfortunately it didn't fix the issue. I am sorry about the way the address message is displayed. There unfortunately isn't anything I can do about it. Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] >>> Bogdan Stancescu <[EMAIL PROTECTED]> 07/02/02 10:15AM >>> Variable names are case-sensitive in PHP - try $HTTP_POST_VARS["first"] - or, for new versions of PHP, $_POST["first"]. In another train of thoughts, please use the proper e-mail address - I'm sure I'm not the only one using filters to automatically move mail to folders and your although probably valid according to the RFC, the way you formatted the php list e-mail address doesn't match the filter names... Thanks! Bogdan Jeffrey Norsworthy wrote: >Hello All, > I am new to PHP, and I am trying to design what I thought would be a fairly simple >form, that queries a MYSQL database for two fields, (first, and last name). It should >then return the entire results of the entry in the table. This part is actually 5 >fields. > If I run the script with static entries for "first", and "last", the process work >flawlessly (as it should). If I try using variables for the search values, I do not >receive any results. I have tried changing the form method from post, to get, and the >problem continues. Any help would be greatly appreciated. Thank you. The first >grouping is the html form, the second set is the php form that actually performs the >search. Also the username, and password are populated in the actual script, I just >took them out for the email. Thanks again. > > >Contact lookup form > > >First Name: >Last Name: > > > > > > > > > > > > > > >define ('mysql_host', 'localhost'); >define ('mysql_user', ''); >define ('mysql_pass', ''); >define ('mysql_db', 'chs'); > >if (! mysql_connect(mysql_host, mysql_user, mysql_pass) ) >{ >die('Failed to connect to host " ' . mysql_host . ' " . '); >} >else >{ >echo '' . mysql_host . ''; >} > >mysql_select_db(mysql_db); >if ($http_get_vars['first'] && $http_get_vars['last']) >{ > echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . ''; >} >$result=mysql_query("select * from chs where first='$first' or last='$last'"); >echo "Results"; > >while ($row = mysql_fetch_array($result)) >{ >echo >"{$row['first']} {$row['last']} {$row['branch']} {$row['extension']} > {$row['voice_mail']} {$row['position']} "; >} >?> > > > >Jeffrey Norsworthy MCP, CCNA >Network Administrator >Community Health Services >[EMAIL PROTECTED] > > > Mail scanat cu RAV Antivirus! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie q: problem with mysql_connect() on hosted service
Sorry to bother you experts with a simple question (well, two actually). I'm new to PHP and mysql. I'm using a hosted service (so I don't have access to configuration files, server, etc). Recently, the server crashed. Since resurrecting, all files attempting to connect to MySQL using $dbcnx = mysql_connect("localhost", "[user]", "[password"); result in an error like: Fatal error: Call to undefined function: mysql_connect() in /home/.sites/22/site13/web/werks/formtest2.php on line 8 Prior to the crash, there was no problem. After a string of questions to support, they finally admitted they don't know PHP well enough to help me (!?!). However, they did install phpMyAdmin - which seems to work okay. So, I'm not sure if I am doing something fundamentally stupid or if the web host (Easyhost) has not configured things correctly. Any suggestions will be most welcome. On a related issue, I am completely fed up with Easyhost and am looking for another web host. They should obviously be able to provide PHP + MySQL together with decent support (very important). Ideally, they should provide scalable service (from shared hosting to dedicated and be EU located (but this isn't critical). They must be willing to host adult content (soft-core erotica and adult humour). Any recommendations (on or off-list will be much appreciated). A million thanks, Jeffrey Baumgartner -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mail() and replies
Is there any way to receive mail via PHP? What I am interested in doing is creating a double opt-in e-mail list whereby someone can subscribe to an e-mail service via an on-line form. Upon doing so, they would get a confirmation e-mail. Replying to this e-mail would confirm the subscription and add the sender's e-mail address to the database (MySQL). Doable? Thanks, Jeffrey Baumgartner eBusiness Consultant - ITP Europe http://www.itp-europe.com [EMAIL PROTECTED] +32 2 721 51 00 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Efficiency
A couple of questions of efficiency, please: 1. If I am creating a web page with numerous PHP calls to an MySQL database is it more efficient to have lots of small blocks of php in an html page or is it better to have just one or two big blocks of PHP with the html code being delivered via echo statements? 2. If I want to know how many rows there are in a MySQL table, I can either use the count function in MySQL (although I am having trouble figuring out how to capture that value in a variable) or I can do a general "select * from" from command in MySQL and then use the mysql_num_rows function in PHP to get a row count (which is dead easy). It SEEMS to me the former would be more efficient. Am I correct? Many thanks! Jeffrey Baumgartner eBusiness Consultant - ITP Europe http://www.itp-europe.com [EMAIL PROTECTED] +32 2 721 51 00 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Members area
I'm working on a similar project - I'm also a newbie - here's my approach - which is fairly simple really. Create a database of all members that includes columns for "login", "name" and "paymentStatus" as well as any other info you need for your database. paymentStatus would be an integer with values of 2 and 5 initially (this allows room for the creation of other levels in the future) in which 2 is for paid members and 5 is for free members. Once members log-in, their paid status is saved as a session variable: $paymentStatus. All member-area pages will start with session_start(); at the beginning and a check of the value of $paymentStatus. If it is null, they are sent to the log-in page. If the page is for members only, then the value of $paymentStatus must be <=2. If it is for any member, then $paymentStatus will have to be <=5 (this all gives room for different levels of membership in the future, you see). Likewise content, which is stored on tables, includes a $paid variable which indicates who is able to view it. This way, you can deliver dynamic content, links and other information according to the $paymentStatus value of each visiting member. In my case, I will have index pages with links to content pages. All links will be visible, but links for paid members will be clearly indicated. The purpose of this is to show freeloaders what they are missing! I hope this is clear. More experienced members of this list may well find flaws with my method. Good luck, Jeffrey Baumgartner eBusiness Consultant - ITP Europe http://www.itp-europe.com [EMAIL PROTECTED] +32 2 721 51 00 > -Original Message- > From: Gavin Amm [SMTP:[EMAIL PROTECTED]] > Sent: Thursday, January 23, 2003 2:03 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Members area > > Hi All, > > I'm about to start development on a members area for a site. > The members area will have 2 levels - Paid & Free, with the Paid members > having access to more pages. > > I have not created a members area before & am after any advice or links > I can get... I think a lot of reading is in order... > > Particularly: > - DB structure & fields (I'll be using MySQL if that's relevant) > - Sessions (I've seen quite a few threads covering sessions over the > last couple of months, so should have some links in my 'inbox' > somewhere... But the more the merrier...) > - Any PHP suggestions/advice/links > - Anything else you can think is relevant... > > > Thanks, this will be a big help. > > Cheers, > Gav > > -- > 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] Data won't insert
I've learned the basics of PHP and MySQL by using a web hosting service over the past few weeks. Call this site 1. And I am finally feeling that I am getting the hang of things. Now, another web host that I have been using is letting me try out PHP and MySQL on their server. Call this site 2. The problem I am having is that if I take pages with php scripts from site 1; change the user, password and database names; and upload them to site 2 - data does not insert into tables. However, the scripts are connecting to the database (no die messages or other error messages are appearing) and the tables have been prepared via phpmyadmin without problem. Likewise, I can insert data via phpmyadmin without problem. Below is a sample script that is causing such a problem. I appreciate that it is sloppy (it was one of my first). But it works on site 1 and not site 2. Could this be a matter of the permissions the site 2 web host has granted me? And if so, why can I do things with phpmyadmin but not via my own scripts? Many thanks, Jeffrey Baumgartner " . $name . " " . $age . ""; } ?> Name: Age: " . $name . " " . $age . ""; } else { echo ("Tough cookies, sunshine"); exit(); } } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] collaborating on a document
I'm thinking about making a little tool where people can contribute ideas in real time. Thus far, the best way I can see to do this is via 2 frames Frame 1: for entering data - which is inserted into a table. Frame 2: would select from the table. It would also refresh frequently - say every 30 seconds. But perhaps you have a more elegant solution? Thanks, Jeffrey Baumgartner eBusiness Consultant - ITP Europe http://www.itp-europe.com [EMAIL PROTECTED] +32 2 721 51 00 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] collaborating on a document
> > 1-Since he's posting to a PHP-DB list, I think we can assume he plans > > to implement it in PHP using a database to capture and store the > > comments/ideas. > > Correct, thank you. > > > Jeff - Do you have a plan in place for your DB schema or the backend > > processing that might take place? > > No, I'm still at the thinking stage. Since I'm new to PHP + databases, I > was hoping to get expert feedback at the earliest stage, rather than > discovering too late that my idea wasn't the best approach. > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Session variables when global variables switched off
I am making a section on a web site which requires that visitors log-in. Log-in, password, etc are in an MySQL table. I am using (via a web host) PHP 4.2.2 with global variables turned off. Until now, I have worked with a different host in which global variables were switched on. The way it works The user logs in at index.php. When she does so successfully, index.php returns a menu of links. However, if she clicks on any of those links, which are different pages, she gets a please log-in first message eBusiness Consultant - ITP Europe http://www.itp-europe.com [EMAIL PROTECTED] +32 2 721 51 00 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Session variables when global variables switched off [Sorry, first message accidentally fired off to quickly ]
[sorry for the incomplete posting of a couple moments ago. I hit ctl something or other and outlook fired off the e-mail against my wishes!] I am making a section on a web site which requires that visitors log-in. Log-in, password, etc are in an MySQL table. I am using (via a web host) PHP 4.2.2 with global variables turned off. Until now, I have worked with a different host in which global variables were switched on. The way it works The user logs in at index.php. When she does so successfully, index.php returns a menu of links. However, if she clicks on any of those links, which are different pages, she gets a please log-in first message because each page includes... if ($_SESSION['verified'] <> "yes"){ echo "Please log in first"; exit(); } Returning to index.php requires a log-in again. So, it seems the session variable is not being sent being sent between pages, although it works within the same page. I expect I am missing something obvious. I've made this kind of thing work with global variables on - so I assume I am misunderstanding something related to lack of global variables. I use session_start(); at the top of all pages and session_register($_SESSION['okbabe']); on index.php. Your enlightenment will be highly appreciated. Jeffrey Baumgartner -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_fetch_array and extract() with LEFT SELECT
I'm having a problem when I use mysql_fetch_array and extract() following a left select query. As an example... $query = "SELECT id,LEFT(fluff,80) FROM sometable"; $result = mysql_query($query) or die('message'); while ($row = mysql_fetch_array($result){ extract($row); echo "" . $id . ": " . $fluff . ""; } would echo the $id, but there would be nothing for $fluff. However, if I select only 'fluff' from the MySQL table, I get the full text for $fluff. I am reluctant to SELECT the entire fluff text from the table and shorten it in PHP as that seems inefficient to me - (but correct me if I am wrong). I expect the solution must be dead easy, but I can't find it or figure it out. Many thanks, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Free php editor!!
There is eClipse, it can be found at http://sourceforge.net. It is a modular IDE, and there is a plugin for php. It is Java based, so it works on any platform. phpEdit is also free: http://www.phpedit.com Those are the best two editors I've found. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with mysql_fetch_array after first loop...
I've made a little programme that deletes expired records from database tables. The troublesome bit looks like this... $query = "SELECT ic FROM ic_ic WHERE date <= CURDATE()"; $result = mysql_query($query) or die("Unable to get old campaigns because " . mysql_error()); while ($row = mysql_fetch_array($result)){ extract($row); ...delete records from tables where ic = ic } It works fine for the fitst value of $ic, but on the second time around I get an error message saying that line [starting with "while..."] is not a valid MySQL resource. This really puzzles me because it works one time around, but not after that. $ic, incidentally, is a string originally generated from the timestamp (ie. getdate[0]) - could this be causing a problem? Many thanks! Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] solved [Re: [PHP-DB] Re: Problem with mysql_fetch_array after first loop...]
That was indeed the problem and of course I should have seen it myself! Thanks very much, Jochem. Jeffrey Jochem Maas wrote: Steve McGill wrote: "Jeffrey Baumgartner" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] I've made a little programme that deletes expired records from database tables. The troublesome bit looks like this... $query = "SELECT ic FROM ic_ic WHERE date <= CURDATE()"; $result = mysql_query($query) or die("Unable to get old campaigns because " . mysql_error()); while ($row = mysql_fetch_array($result)){ extract($row); ...delete records from tables where ic = ic are you by any chance doing a query inside this while loop? if you are then make sure you assign the result of the call to mysql_query() to a variable that is NOT called $result. } It works fine for the fitst value of $ic, but on the second time around I get an error message saying that line [starting with "while..."] is not a valid MySQL resource. This really puzzles me because it works one time around, but not after that. print_r(), var_dump() (and plain echo or print) are your friends: if you preceed the line starting 'while ($row =' with the following: var_dump( $result ); and then also add such a statement at the bottom of your while code ie: var_dump( $result ); while ($row = mysql_fetch_array($result)) { extract($row); // not a good idea IMHO // do your stuff var_dump( $result ); } then you should see it change on the second call to var_dump(), which will hopefully lead you to the code that changes the $result var when you don't want it to change. $ic, incidentally, is a string originally generated from the timestamp (ie. getdate[0]) - could this be causing a problem? Why don't you try it without using extract($row), and use $row[variable1] $row[variable2] instead in your loops. extract() pulls all the variables into the global namespace and can be quite dangerous as it might overwrite other variables. (this might be whats happening with the $result variable for example. also, how does extract() behave when trying to convert the [0] [1] [2] variables? you might be better off using mysql_fetch_assoc() ditto, dont extract() in this situation - its a waste of a function call and a waste of variable initialization... just use the values in the $row array directly... e.g. echo $row['ic']; // this could have been $ic if you had called extract($row) Best wishes, Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Can you recommend a development tool?
That's been going on for a VERY long time. And instead of waiting, DUMP Ultradev and take a look at Code Charge (www.codecharge.com). It fills the niche in PHP (and a bunch of other languages as well!) that Ultradev tries to fill in ASP. -- Jeff (FurBall) WebOverdrive Newbie Tech Board http://www.topniche.com/tech/ [EMAIL PROTECTED] -Original Message- From: Sean Weissensee [mailto:[EMAIL PROTECTED]] Sent: Friday, February 09, 2001 10:06 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Can you recommend a development tool? Yes only ASP,JSP and CF, I did read on the Macromedia newsgroup that someone is developing a PHP plugin for Ultradev. - Original Message - From: "Alarion" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> , 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]
Re: [PHP-DB] Problems with MySQL
* Bruno ([EMAIL PROTECTED]) wrote: > The strange thing about this is that MySQL leaves the mysqld.sock in /tmp, > not in the directory that the error reports. I've just installed MySQL > v3.23, and I had v3.22 before, which had it's sock file on /var/run/mysqld. You might want to make sure your path points to the newer version of mysql then, and not an old outdated one. Make sure you've removed all binary (for that matter all source) files for Mysql-3.22 if you've upgraded to 3.23. If in doubt, type which mysql and see if that's where you think it lives. Jeffrey -- 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] SELECT statement
* Julio Cuz, Jr. ([EMAIL PROTECTED]) wrote: > Ron, > > Thanks for your help, but my problem still there even when I made the > following changes: > > $sql = "SELECT * FROM \"Remodel\" WHERE Email=\"".$find."\""; You don't have to quote the table name either. You can probably get away with something like this: $sql = "SELECT * FROM Remodel WHERE Email=\"$find\" \n"; I put the \n at the end of my queries, at the end of every line if it's a long query, just makes it easier for me to read if I need to do debugging later, it won't affect your query. Jeff -- 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] diferent user passwords
* Romeo Manzur ([EMAIL PROTECTED]) wrote: > how could I configure diferent user password to each database on my > server??? You can probably achieve this with grant statements. Grant SELECT on test.* to myuser@localhost identified by 'pass1'; Grant SELECT on other.* to myuser@localhost identified by 'pass2'; Jeff -- 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] MySQL connects to localhost via socket reguardless
I am trying to connect to a DB on a difrent server but mysql keeps connecting to the local server via the socket. What is going on? -- code snippet-- $connection = mysql_connect("mysql.meanspc.com:3306", "Removed", "Removed"); -- Jeffrey D. Means [EMAIL PROTECTED] Owner / CIO for MeansPC http://www.meanspc.com/ Custom Web Development For Your Needs. (970)308-1298 My Public PGP Key ID is: 0x81F00126 and available via: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x81F00126 signature.asc Description: This is a digitally signed message part
RE: [PHP-DB] MySql and PHP question
You are probably running mysql 3.x if you move to 4.x or the beta 5.x you can use subqueries and even user functions in 5.x hope this helps... On Thu, 2005-04-07 at 08:50 +0200, Juffermans, Jos wrote: Hi, I'm afraid I can't help you with the query - I'm used to Oracle which as a bigger set of SQL commands. I can help you with your PHP question. If you want to put a variable in a query, you can add the variable directly into the string: $sql_query = "select zg_longitude from zip_code where zg_zipcode = '$zipcode'"; Or (my favorite choice) you can break the string and add the variable with .'s: $sql_query = "select zg_longitude from zip_code where zg_zipcode = '" . $zipcode . "'"; With the first option, it is not always clear what is the variable and what not. Jos -Original Message- From: ReClMaples [mailto:[EMAIL PROTECTED]] Sent: 07 April 2005 06:04 To: PHP Subject: [PHP-DB] MySql and PHP question All, I have a question as how I can return some results that I am looking for. Ideally I'd like to run this sql statement but for some reason MySql won't allow me to run it: SELECT * FROM zip_code WHERE zg_latitude between ((select zg_latitude from zip_code where zg_zipcode = '78730')- 2) and ((select zg_latitude from zip_code where zg_zipcode = '78730') + 2) and zg_longitude between ((select zg_longitude from zip_code where zg_zipcode = '78730') - 2) and ((select zg_longitude from zip_code where zg_zipcode = '78730') + 2) I get an error to check the mysql manual. This statement runs in an oracle environment though. I guess I am stuck with writing multiple queries and them tying them together. In PHP how can I put a variable into the sql statement (if that's possible). Let's say I have these queries: select zg_longitude from zip_code where zg_zipcode = '78730' This one pulls the zg_longitude from the zip_code table where the zip_code is 78730 for instance. I want to take the result (one record) and put it in this sql statment replacing 'result here': select * from zip_code where zg_longitude >= ('result here'-2) and zg_longitude <= ('result here'+2) order by zg_city asc Can anyone help me with this or point me in a better direction? Thanks -Rich -- Jeffrey D. Means [EMAIL PROTECTED] Owner / CIO for MeansPC http://www.meanspc.com/ Custom Web Development For Your Needs. (970)308-1298 My Public PGP Key ID is: 0x81F00126 and available via: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x81F00126 signature.asc Description: This is a digitally signed message part