|
naijafan (m)
|
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)
|
lets start simple! to read from a database in CF, the users table <cfquery name="getUsers" datasource="#dsn#"> select * from users order by firstname asc </cfquery> <cfdump var=#getUsers# >
|
|
|
|
|
|
breeolan (f)
|
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)
|
@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
|
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)
|
Simple php mail function : <?php
mail("test@example.com","Hello world","This is a mail from php mail function simple?");
?>
|
|
|
|
|
|
alexis (m)
|
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)
|
that is even more complex, How do u send mail in cfm?
The mail function drew me from asp to php!
|
|
|
|
|
|
boraddo (m)
|
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)
|
plain text mails: <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: <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)
|
file upload in CF <cffile action = "upload" fileField = "FileContents" destination = "c:\files\upload\" nameConflict = "MakeUnique">how do you do that in PHP 
|
|
|
|
|
|
naijafan (m)
|
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
|
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>
|
|
|
|
|
|