Coldfusion Vs Php Code Battle

A Member? Please Login  
type your username and password to login
Date: October 08, 2008, 02:32 AM
247345 members and 146316 Topics
Latest Member: Enconoprows
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Coldfusion Vs Php Code Battle
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Coldfusion Vs Php Code Battle  (Read 276 views)
naijafan (m)
Coldfusion Vs Php Code Battle
« on: February 16, 2007, 02:34 PM »

Here, calling on all ColdFusion and PHP gurus out there to do write a piece of code that performs the same functionality in either language so we can judge which is more readable and optimized.

Let the battle begin!
boraddo (m)
Re: Coldfusion Vs Php Code Battle
« #1 on: February 16, 2007, 02:43 PM »

lets start simple!

to read from a database in CF,  the users table

Code:
<cfquery name="getUsers" datasource="#dsn#">
     select * from users order by firstname asc
</cfquery>
<cfdump var=#getUsers# >
      
breeolan (f)
Re: Coldfusion Vs Php Code Battle
« #2 on: February 16, 2007, 02:55 PM »

haba, your being too high, am sure this level is ok for beginners lke me, you will have to use this to get a list of employees from the database

<cfquery name=”GetEmployees” datasource=”#Request.MainDSN#”>
   SELECT c.CompanyName,e.SSN,e.Firstname,e.Lastname,e.Salary,e.DateOfBirth
      FROM Employee e INNER JOIN Company c
         ON e.CompanyID = c.CompanyID
            ORDER BY c.CompanyName,e.Lastname,e.Firstname
</cfquery>
   <cfoutput>#getemloyees.companyname#  </cfoutput>
naijafan (m)
Re: Coldfusion Vs Php Code Battle
« #3 on: February 16, 2007, 03:04 PM »

@breeolan

after getting the list, what will we do with the variable? try to output it. and please enclose your codes in withing the code tag.
yommie07
Re: Coldfusion Vs Php Code Battle
« #4 on: February 21, 2007, 02:02 PM »

the battle between coldfusion and Php can't hold in a forum take it to real world with real problems and let see what you both can do.

skima (m)
Re: Coldfusion Vs Php Code Battle
« #5 on: February 21, 2007, 05:04 PM »

Simple php  mail function :

Code:
<?php

mail
("test@example.com","Hello world","This is a mail from php mail function simple?");

?>
alexis (m)
Re: Coldfusion Vs Php Code Battle
« #6 on: February 21, 2007, 07:43 PM »

coldfusion hides alot of things from you, it does alot for you at the background. PHP let's you control everything; that is where the power lies.

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


boraddo,

How did you create your datasource?
skima (m)
Re: Coldfusion Vs Php Code Battle
« #7 on: February 21, 2007, 07:53 PM »

that is even more complex,
How do u send mail in cfm?

The mail function drew me from asp to php!
boraddo (m)
Re: Coldfusion Vs Php Code Battle
« #8 on: February 22, 2007, 09:40 AM »

sending a mail in CF is this simple
  <cfmail to = "seun@nairaland.com"  from = "anybody"  subject = "helloworld">
            This is a mail from coldfusion
   </cfmail>   
naijafan (m)
Re: Coldfusion Vs Php Code Battle
« #9 on: February 22, 2007, 09:44 AM »

plain text mails:

Code:
<cfmail from="user@nairaland.com" to="user@nairaland" subject="Test Mail" server="nairaland.com" username="admin" password="admin">
this is how to send a plain text mail in coldfusion
</cfmail>

html mails:

Code:

<cfsavecontent variable="htmail">

<!--- html tags and stuff goes here--->

</cfsavecontent>

<cfmail from="xolubi@yahoo.com" to="xolubi@yahoo.com" subject="Test Mail" server="nairaland.com" username="admin" password="admin" type="html">
             <!--- reference the saved variable --->
             #htmail#
</cfmail>

plain simple
boraddo (m)
Re: Coldfusion Vs Php Code Battle
« #10 on: February 22, 2007, 09:55 AM »

file upload in CF

<cffile action = "upload"   fileField = "FileContents"   destination = "c:\files\upload\"     nameConflict = "MakeUnique">

how do you do that in PHP  Huh
naijafan (m)
Re: Coldfusion Vs Php Code Battle
« #11 on: February 22, 2007, 12:24 PM »

major advantage of administrator controlled DSNs

ColdFusion supports different database types out there (almost all of 'em out there). You can create your database in any of these and reference it via a datasource name set in the ColdFusion Administrator. Just in case you need to change your your database platform or something, this change will just require changing where the DSN is pointing to in the CF Administrator and no change at all in your code. Beat that?!
penyng
Re: Coldfusion Vs Php Code Battle
« #12 on: February 24, 2007, 07:46 AM »

creating a simple flash form in coldfusion

<cfform format="flash" width="200" height="150">
   <cfinput type="text" name="fahrenheit" label="Fahrenheit" width="100"
      value="68">
   <cfinput type="text" name="celsius" label="Celsius" width="100">
   <cfinput type="button" name="convert" value="Convert" width="100"
      onClick="celsius.text = Math.round((farenheit.text-32)/1.8*10)/10">
</cfform>

 Paths In Programming Knowledge And Careers  Superb Banking Software For Microfinance Banks  Why Are Nigerian Programmers So Dumb?  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.