Re: [PHP-DB] Indepth Tutorial... need help.
These should be helpful: http://zc8.net/zc8/shownews.php?articleid=93 http://zc8.net/zc8/shownews.php?articleid=95 http://zc8.net/zc8/shownews.php?articleid=98 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array limit? - more details
I use mysql_fetch array to retrieve large text data many many times without a problem. I've actually written functions to retrieve the data for me using this function, and I never had a single problem, truncated or speed, on Unix, Linux or Windows platform. Check out the code for the functions getrow(), getrows(), they use mysql_fetch array. http://zc8.com/zc8/samplecode/sqltools.phps This is the explanations of the functions: http://zc8.net/zc8/shownews.php?articleid=98 You can use those as you please if you want On Tue, 30 Jul 2002, Paul Worthington wrote: No I don't have PhpMyAdmin installed. I work directly in MySQL via a terminal, so all my checking is with native calls anyway. Working natively in MySQL, all my data is there and everything works the way I expect it to. Using mysql_fetch_array() in PHP results in a truncated result set. And I am trying to figure out why, and how I can work around this problem. Thanks again, Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik... Do you have PhpMyAdmin installed? If you have try with it to see the results. It uses native mysql functions. Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:53 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List
Re: [PHP-DB] A challenge
On Wednesday 03 July 2002 13:27, you wrote: ... At least, I found it challenging. Hopefully someone here will find this a lot easier =) I am developing a website wherein customers can log in, enter in the name and type of their business (rather like the yellow pages.) I have a database of all the customers, and each table in the database is another type of business. (For example, in the table 'Gyms' all of the places where you can workout will be listed.) Currently the database has no tables in it. When a new type of business registers, then the table is created. In order to prevent many variations of the same table from being created (I.E. Restaurants, Cafe's, Luncheonettes etc) I have customers choose what type of business they are from a pull down menu. Here is the challenge: I would like my users who come to browse to see a similar pull down menu, but I want this menu only to list those types of businesses that have registered. Essentially I would like the pull down menu customers see to be a dynamic list of names of existing tables, updating for each new table that is created. As for how to do this I'm stuck. It seems that it must be php that modifies an html form. Any suggestions?? Deeply appreciated. Thanks. [EMAIL PROTECTED] -- Jonathan I'm not sure I understand, but you could set it: * A table with customers * A table with business types * A link table with that holds the key to a customer and a business type. A customer can belong to different business type. When a new business is created, you just add an entry to the business type table When a customer assigns himself a business type, you just add a record for this association in the link table. To get the list of business type: select id, name from busitype order by name asc For a search with the $busitypeid variable, you just do select customers.id, customers.name from link left join customers on link.custid=customers.id where link.typeid=$busitypeid I really don't see you would create tables for every business type. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP in Database Fields..
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I want to put PHP code into database fields holding HTML text, how can I make it execute that PHP before sending to the browser?? I save the code into a file and save the url of the file into a database and then just include that file into my code. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj0X0KYACgkQB+LNTWXM8xRhQQCcCAjQRcc6oq8QTTIBiq2PN/qN 2noAnAxue/MZM+3JC9YePkVBzbQQasme =/jFr -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Variable names
If I have a variable, how do I extract the name of the variable. In principle: $varname=somefunction($myvar); The value of $varname is then myvar How do I do it? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Variable names
Kodrik wrote: If I have a variable, how do I extract the name of the variable. In principle: $varname=somefunction($myvar); The value of $varname is then myvar How do I do it? Sorry, this was meant for the general list. You an still reply though :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is it possible ?
On Saturday 16 February 2002 07:35 pm, you wrote: Is it possible to get the AUTO-INCREMENTed ID's value while doing an INSERT and have the value INSERTed to another table in the same FORM ? Raju mysql_query(insert whatever); $insertid=mysql_last_insert(); Then you use this value for your other insert. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ABC listings
On Monday 07 January 2002 04:48 am, Barry Rumsey wrote: One last question for tonight as I have been given alot of help from this group to keep me going for awhile. I would like to set up one of those A B C D E F page listings. How do i query the database to grab the first letter from each entrey. $firstletter=a ... where textfield='$firstletter*' and ... -- 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] Why use MySQL with PHP
I wrote this a few month ago for the db comparaison. It's simple and you can easily add to it: http://zc8.com/zc8/ZC8news/shownews.php?articleid=571 As for PHP my reasons are: * No need to typecast which makes it easier to code. * You can have multi-dimensional multi-cast arrays which in many case can do instead of objects. * It's nothing to learn if you already know a modular language (pascal, c, java...). * It types easily within your html code and it is extremelly readable (although you can put some effort into making it hard to read). * No need to compile. * It's open source * You can compile it with Apache and with your specs. * Many interesting module available (like Ming) * It's very portable. * It's widely present on web server. * It has easy communications with databases, ftp, remote ip files, mail... * It has great support and online reference. * It is very well maintained. * Lot's of sample code on the web to look at. And I probably forget a lot On Thursday 15 November 2001 12:53 pm, Sheridan Saint-Michel wrote: I use PHP/MySQL for a few reasons. 1) Ease of Use - I am a Computer Science student and a Web Programmer. As such have been exposed to a wide variety of programming languages and environments. PHP/MySQL is one of the easiest to work with and learn, and is THE easiest to do Web related things with (and yes, I have used and am including ASP in that statement). 2) Availability - By this I mean not only that both PHP and MySQL are free (which is a big factor for us starving student types), but that they setup very easily on a variety of platforms. This means I can test scripts on a copy of the MySQL DB from my Linux Server on my windows box before uploading them. 3) Support - Both PHP and MySQL have very good Manuals which are very easily accessable (both online and downloadable). In addition, I have received extremely valuable help from the PHP mailling lists on both PHP and MySQL questions. In most cases I have gotten faster and better responses than I get from professors at school (who I am asking things concerning their class...not PHP =P ) who I am paying to teach me. That alone is quite a strong arguement. 4) Good Balance between Flexibility and Readability - In PERL they have a saying There's More Than One Way To Do It. I think this is a good philosophy, but PERL takes this to more of an extreme than I like (this is not to say that this extreme is not right for some people). When I read through a 50 line program in a language that I am fairly skilled at I shouldn't have to refer to the manual more than say a dozen times...right? In Perl I often find myself having to refer to manuals a dozen times for two or three lines! For example: perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??; for (??;(??)x??;??) {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}' Any idea what that one does? Without running it? Paste it into a terminal... it should run as is (does on my Linux box with PERL 5 anyway). On the other hand, having to write in languages where you have strict types (You want to treat a variable as an int and then as a string?!?!?!?) and very structured design is just as distasteful to me. PHP strikes a very good balance between the two even when working with MySQL (I won't paste any of the kludge needed to interface with CGI and DB in other languages... but if you have some free time look some of these programs up). Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: søren eriksen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 2:34 PM Subject: [PHP-DB] Why use MySQL with PHP Hi everybody I'm writing a synopsis about PHP and mySQL. I'm hoping someone can help me, and tell me why the combination og PHP and MySQL is so common. What makes MySQL such a good choice when using PHP? What seperates MySQL from others dbms? -Søren Eriksen- -- 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] RE: what's a GOOD starting HOURLY rate for a PHP/MYSQL job?
I'd also be interested in what people are charging as I'm thinking of setting up as a contractor myself and it would be nice to have a 'ball park' figure of what the going rate is ... A lot depends on what you've done and the image your customer has of the value of what you are doing. Many times I meet with customers, talk to them about their system and offer my services for $500/day (I don't like to charge hourly). Many times they think it's too much because some wanna be visual developer thinks there is nothing to it using Microsoft. Those people usually encounter major cosltly problems because the guy they are paying $20/hour has no experience but gives them a false sense of security. And when it goes wrong, it costs them so much that paying you $500 seems like a bargain. It happened to me many times and I am smiling as I am writing this remembering some situations. The problem is that you have to be able to differentiate yourself from those fakes, and it can be difficult. They usually have flashy sites that move and make sound linked some database capability with access (like to catalog their dad's wine bottle so they never plan more than one simultaneous connection). But it certainly looks hell lot more impressive than what you have to show, since you have to worry about little things like the number of connections and bandwidth. Meanwhile you are telneting to your server to show the customer how efficient and performing your code is in a language they don't understand. A guy posted earlier about a customer that does not want to change host provider and this host provider cannot guarantee any security. The provider will even provide access to the customer to compile MySQL himself so he can increase security. They will probable give full access to the server! I can't believe a hosting company would give root access to one of his customers don't they realize the damage and security hole they are exposing themself to. I don't give root access to anybody, it is not a matter of trust, accidents happen and all gets lost. This host company is crazy and the client who wants to stay with them is crazy too. -- 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] Need Help on Chat Program!!!!!
What I do is have an invisible frame that checks the timestamp of the last update to the chat against your last refresh timstamp. If it's superior, I refresh the chat list. I actually make this check without a call to the database, if you have 100+ chatters, check calls to the db can become heavy. I just have a file that holds the last update tstamp and read this file. The check page refreshes itself every 20 seconds (plenty enough for a chat I realized) and has the last given value of a refresh. You can see my chat at http://zc8.com, you have to login though. On Thursday 08 November 2001 01:09 pm, kelvin wrote: Hi everyone, I have designed a chat program which used a refresh function to update the chat list every 10 second. But How can I perdict the flicker screen, or Can anyone tell me how to re-write the program so everytime people send message to the chat box, the chat box will not flicker at all. Oh, Please I'm not really good at PHP, so,please give me more details on it. Thanks. so much. Regards, Kelvin. Main window --index.html (break down into two frame. topframe for chat box, bottonframe for input message) Bottonframe PHP will save the message to file. Topframe PHP will refresh every ten second and retrieve the data from the file. -- 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] Session Broken
1: Rid any whitespace between '?php' and 'session_start()' That makes no difference as long as you are not producing any output. You can have spaces and code withing the php brackets, just not echo anything. But don't have any spaces prior to ?php since it will be echoing a character. The reason is that you are setting a cookie and making a header call. 2: You need to populate the variable you wish to use as a session variable before registering it I don't agree with that either Without even going to another page, the $PHPSESSID and $UserName variables are both empty. They are also empty on subsequent pages. If you don't leave the page and your variable is empty, that means it in empty within PHP in the first place. The variable within the session will not be retrieved until you hit the next page. Your PHPSESSID will be also empty because it is the value that get transferred to another page.If you didn't transfer yet, you will not have a value. If you want your session id, do: $sessid=sessionid(); Also, be careful about the scope of your cookies. A session is transfered through cookies in php (if available) and if you don't set your scope right, your session can be lost from one folder to another. That brings me to a MySQL question for knowledgeable people: I don't use php sessions but a custom session that is stored in a simple tables. I just transfer the a variable which holds the id to my session (which is a primary auto-increment int) that points to a row which holds all the information I need about the user. Is it smart or is it a total waste of resources and I should stick with php built in support for sessions? So far, I never experienced any problems with it. -- 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] Re: Newbie Question
I wrote this cleanup function: function cleanup($copy) { $copy=trim($copy); $copy=htmlspecialchars($copy, ENT_QUOTES); $copy=eregi_replace (%, #37;, $copy); $copy=eregi_replace (, lt;, $copy); $copy=eregi_replace (, gt;, $copy); $copy=eregi_replace (amp;, , $copy); $copy=nl2br($copy); $copy=StripSlashes($copy); return($copy); } nl2br converts the carriage returns into br or br / depending on your version of php. So if you want to offer your copy for editing instead of viewing, you might want to run $string=str_replace(br /, , $string); The rest of the code removes characters that can be used for malicious coding. You might want to edit it if you want them to enter html code. I also made some functions to access MySQl easier with php: http://zc8.com/zc8/ZC8news/shownews.php?articleid=98 You are welcome to use and modify the code -- 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] Newbie Question
Hi Kodrik: I just looked at your function and would like to use it myself, but shouldn't the ampersand line: $copy=eregi_replace (amp;, , $copy); look like this instead? So it matches the other lines that have a symbol replaced by HTML?? $copy=eregi_replace (, amp;, $copy); Cheers. Russ No, because the sign is needed to represent the ascii values. So I'm actually doing it to put it back where it got converted by htmlspecialchars. If you are going to use it for a forum, you might also be interested by hyperlinkor. It converts urls into links, however they are entered (with a www. or not, httpd or not...) http://zc8.com/zc8/ZC8news/shownews.php?articleid=108 You run your string through this function before displaying. and the links are anchored. Do not run it before entering a string in a database, only before echoing the string. My reply to you was bounced back, so I replied to your message on the list instead. -- 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]