Php?

yeah… client side and serverside are two completely different worlds… I dont think there’s a language out there that can do both.

For example… javascript. I sometimes have to do some back end stuff in javascript (cause here we’re still doing stuff with the crappy NS Enterprise server), and it’s not regular javascript… it’s Server Side javascript… an entirely different animal.

See… a client computer and a server do different things… that’s why their languages are different. I ‘think’ you can do some clientside stuff using VBscript, but even then, the commands are different.

HTML is a hyper text markup language, not a Programming language :stuck_out_tongue: :wink:

GEEZ!!! I’m programing in php, and I know that html is not really a programing language…
I was just asking about CF… blub

Kiti’,
“PHP is good for Tagboxes, email forms etc, although a little more difficult to learn than CF

is that true? I found PHP to by quite easy, looks a lot like AS…how can CF by easier?
Anyway, almost all hosts now offer PHP support, some even for free, and if you want CF, you gotta search and pay! no?
But: CF is Macromedia, so I guess they’ll always favor it over free alternatives, it’s native to remoting and stuff…is it worth getting into?

If all you want is Flash + some PHP for mailforms, forums, chats, all these apps that need to store stuff server-side and / or interact with databases, I’d recommend getting “Foundation PHP for Flash” from friends of ED, be quick though coz their out of business since a week or so, don’t even know if the book’s still available…it’s what got me started with php, nice way to learn to integrate the server-side with Flash…also check www.flash-db.com and www.sephiroth.it for some nice examples…

Also, have a read at this:
http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

this is a CF sample to insert a record into a database

<CFCOMPONENT>
  <**CFFUNCTION access="remote" name="doInsert" output="false" returntype="boolean">
    <**CFARGUMENT name="firstName" type="any" required="false" default="">
    <**CFARGUMENT name="lastName" type="any" required="false" default="">
    <**CFARGUMENT name="emailAddr" type="any" required="false" default="">
    <**CFARGUMENT name="isSubscribe" type="any" required="false" default="yes">
	<**CFARGUMENT name="subscribeType" type="string" required="false" default="html">
    <**CFARGUMENT name="source" type="any" required="false" default="">
    <**CFARGUMENT name="comments" type="any" required="false" default="">
    <**CFQUERY NAME="getData" datasource="mailer">
    INSERT INTO tbl_userData (firstName, lastName, emailAddr, isSubscribe,source,
    comments) VALUES('#arguments.firstName#','#arguments.lastName#','#arguments.emailaddr#',#arguments.isSubscribe#,'#arguments.source#','#arguments.comments#')
    <**/CFQUERY>
  <**/CFFUNCTION>
<**/CFCOMPONENT>

========================================

and its php semi-equivelent :wink:


$firstName = $_GET['firstName'];
$lastName = $_GET['lastName'];
$emailAddr = $_GET['emailAddr'];
$isSubscribe = $_GET['isSubscribe'];
$subscribeType = $_GET['subscribeType'];
$source = $_GET['source'];
$comments = $_GET['comments'];
mysql_connect('localhost', 'root');
mysql_select_db('dbname');
$query = "INSERT INTO tbl_userData (firstName, lastName, emailAddr, isSubscribe, source, comments) VALUES('$firstName','$lastName','$emailaddr','$isSubscribe','$source','$comments')";
mysql_query($query);

I’ll stick with PHP until I have a need to learn something else…

php?

Forums!

*Originally posted by Mike *
**php?

Forums! **
?? :trout:

Yeah actually…

http://www.fantom-stranger.com/~mentalconcepts/forum/

That’s what I’m currently working on :wink:

playamarz

Kiti’,
“PHP is good for Tagboxes, email forms etc, although a little more difficult to learn than CF”

is that true? I found PHP to by quite easy, looks a lot like AS…how can CF by easier?
I guess this is just my opinion. :slight_smile: Personally I found ColdFusion easy to pick up. I think it might be easier to get started with than PHP, but again that’s a subjective viewpoint.

When you compare CF to JavaScript and Perl, that’s when you really notice the difference. There’s a function on the Churchill site written in JS to get the date. It looks like this:

<script language="JavaScript">
month = Array ("January","February","March","April","May","June","July","August","September", "October","November","December");
var now = new Date();
theDate = now.getDate();
if ((theDate == 1) || (theDate == 31) || (theDate == 21)) theDate += "st";
else if (((theDate > 1) && (theDate < 3)) || ((theDate > 21) && (theDate < 23))) theDate += "nd";
else if (((theDate > 3) && (theDate < 21)) || ((theDate > 23) && (theDate < 31))) theDate += "th";
else if ((theDate == 23) || (theDate == 3)) theDate += "rd";
theDate += " " + month[now.getMonth()];
theDate += ", " + now.getFullYear();
</script>

Now a call in ColdFusion to do the same thing looks like this:

<cfoutput>Today's date is #DateFormat(Now(), "mm/dd/yyyy")# </cfoutput>

Which one would you choose? :slight_smile:

Once again though I’ll stress that this is my view. PHP is still a great language, and can do a whole load of stuff quickly and easily. :slight_smile:

somehow, I feel that the PHP code you wrote was unnecessarily long…

I didn’t write that JS date function. An outside company did it a year or so ago. I’m sure there’s a better way to do this…

whoops… why did I say PHP?
I woke up 2 minutes ago… haha. But wow, that’s a long function…
that’s one thing I like about VBscript… you can just say:
Response.Write (Now)

Probably because that’s the format thing I used on it. :slight_smile:

And you don’t even want to ask how much the company paid for that bit of code. Soon as I saw it I thought “hang on a minute”. But it does what it’s supposed to so they didn’t care. Then you see the PHP / CF equivalent and begin to wonder.

Believe it or not, I’ve never done anything in Javascript. But I have a book on it here at work, and I looked it up. try this code:


<script>
now = new Date();
document.write (now.toLocaleString());
</script>

that outputs this:
Friday, March 28, 2003 9:35:55 AM

you can knock off the time if you want to with substring or something like that.

Precisely. And this design agency had the gall to charge £2000 for that bit of code I posted up. Two whole grand! And the company paid it!

I just love this part of the code…

else if (((theDate > 1) && (theDate < 3)) || ((theDate > 21) && (theDate < 23))) theDate += "nd";
else if (((theDate > 3) && (theDate < 21)) || ((theDate > 23) && (theDate < 31))) theDate += "th";
else if ((theDate == 23) || (theDate == 3)) theDate += "rd";

haha… it’s the dumbest thing I’ve ever seen…
man… they paid 2000 too much…

Aren’t there numerous free scripts on the net that anybody could have found for free and installed to display the date? I think 2000 (about $3500+ USD) is quite a large sum to pay for that.

Cheers!
Kirupa (-:

It’s so picky… Having to put an extension on to the date… Just adds code. And an array of months… Surely you can get this from the server. But would they listen? Noooo… :sigh:

And you’re right, £2000 is a horrendous sum of money to pay for just those few lines of code. I can’t believe they fell for it.

you don’t even need the array of months… toLocaleString() does that for you. But ok, lets suppose you need to have “nd” at the end of the day

else if (((theDate > 1) && (theDate < 3)) || ((theDate > 21) && (theDate < 23))) theDate += "nd";

why didnt they just say,


if (theDate == 2 || theDate == 22)

it’s so dumb… maybe they wanted to make it fancier.