Author | Message | Time |
---|---|---|
St0rm.iD | 1) Use single quotes ( ' ) when you have strings that don't have $values in them. Double quotes for those. 2) Use mysql_pconnect() instead of mysql_connect(), mysql_pconnect() creates persistent connections to the database which reduces the load. 3) You can use $c = new COM("ADODB.Recordset") to use ADO if you want. Just wanted to post something related to PHP :) Invert please don't delete just because it's not ASP :P | June 4, 2003, 12:58 AM |
Dumb_Canadian | [quote author=St0rm.iD link=board=22;threadid=1532;start=0#msg11496 date=1054688280] 1) Use single quotes ( ' ) when you have strings that don't have $values in them. Double quotes for those. - Great tip. Using PHP's string literals (Single quotes,) is a great, simple way to increase the performance of large applications that use the alternative. PHP is actually doing a lot of work with strings when you use double-quotes. Even when using the value of a variable, I use string literals, but with the append operator (.), like: [code] $str = (string) 'there!'; echo('Hi, ' . $str); [/code] [/quote] Another tip I'd like to add, though, is try your best not to use quoation when you shouldn't. A lot of people don't realize that when you create a variable, intended to be an integer: [code] $integerContainer = (int) '123'; [/code] The quotation is actualy telling PHP you want to put a string literal in the $integerContainer, but at the same time, using the (int) type cast, instruct PHP to declair this container as an integer. Clearly, this is going to give PHP internal head-aches. Instead, consider this: [code] $integerContainer = (int) 123; $stringContainer = (string) 'Hello, world.'; [/code] Either should work. But consider using logic such as this: [code] $integerContainer = (int) '123'; if( $integerContainer == 123 ) { echo('True.'); } [/code] This isn't going to happen, because the == operator is asking if the container is of the same type, and value of '123'. It doesn't happen, because $integerContainer, even though it contains integers, was cast as a String based on the String literal quotes. | June 4, 2003, 4:33 PM |
Invert | [quote author=St0rm.iD link=board=22;threadid=1532;start=0#msg11496 date=1054688280] Just wanted to post something related to PHP :) Invert please don't delete just because it's not ASP :P [/quote] I am not bias towards PHP, I consider it to be better than ASP (not ASP.NET). I don't even like to script in ASP. Oh and here is a tip: If you want to use a free database when scripting with PHP use PostgreSQL not MySQL. Stored procedures = good | June 5, 2003, 10:13 AM |
Dumb_Canadian | [quote author=Invert link=board=22;threadid=1532;start=0#msg11624 date=1054808026] Stored procedures = good [/quote] Ah, indeed, indeed! This is why I choose to use Microsoft's SQL Server 2000 for all my RDBMS needs;) The MySQL group likes to claim full T-SQL support, but technicaly, the MySQL engine doesn't support it in the slightest. They can claim support for it, though, because they ship the InnoDB engine with their package, heh. Regardless, SQL Server 2000 and/or PostgreSQL's where it's at for performance and stability, IMO:) | June 5, 2003, 7:04 PM |
St0rm.iD | I agree Postgres is technically superior from what I've heard (.org root database runs on it afaik), but I've never learned it so I can't preach it. | June 9, 2003, 7:29 PM |
WinSocks | Views Tips: Views can be used to define numerous combinations of rows and columns from one or more tables. << (Basics whoop dee doo) - A view is nothin more than a SELECT statement, unlike alot of people mistaken it as a actual physical Table in the database, it's just a collection of specified rows and columns from other tables. - A View can contain a max of 1,024 colums - Defaults, Triggers aan rules are useless to try to put into a view, considering they are disalllowed to associate with view functions. but the only exception to this rule is the new "INSTEAD OF" trigger. - Views Cannot be created using the "ORDER BY" clause unless they use the "TOP" clause. - Views Cannot be Created using the "COMPUTE BY" or "SELECT INTO" Clauses. - Temporary Views Cannot be created (stupid newbs like to think that ;) ) - Views can be nested up to 32 levels. - Local Partitioned Views do no tneed to use "CHECK" constraints. NOt using "CHECK" constraints will aslo provide the same results as with using a "CHECK" constraint, except that the Query Optimizer will have to preform a lengthy search against all member tables meeting the query search condition. Using "CHECK" constraints will reduce the cost of queries - Be sure that in a Local Partitioned View that Primary Keys are defined on the same column for each member table. | July 24, 2003, 6:34 PM |