# Php?

**URL:** <https://forum.kirupa.com/t/php/16626>\
**Category:** Uncategorized\
**Created:** [March 26, 2003, 10:42pm UTC](https://forum.kirupa.com/t/php/16626 "2003-03-26T22:42:28Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 4:17pm UTC](https://forum.kirupa.com/t/php/16626/41 "2003-03-27T16:17:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 4:52pm UTC](https://forum.kirupa.com/t/php/16626/42 "2003-03-27T16:52:12Z")

</div>

HTML is a **hyper text markup** language, not a **Programming** language 😛 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 5:56pm UTC](https://forum.kirupa.com/t/php/16626/43 "2003-03-27T17:56:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 6:25pm UTC](https://forum.kirupa.com/t/php/16626/44 "2003-03-27T18:25:40Z")

</div>

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](http://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](http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 9:27pm UTC](https://forum.kirupa.com/t/php/16626/45 "2003-03-27T21:27:05Z")

</div>

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

```auto
<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 😉

```php

$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);

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 9:43pm UTC](https://forum.kirupa.com/t/php/16626/46 "2003-03-27T21:43:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 11:18pm UTC](https://forum.kirupa.com/t/php/16626/47 "2003-03-27T23:18:22Z")

</div>

php?

Forums!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 27, 2003, 11:21pm UTC](https://forum.kirupa.com/t/php/16626/48 "2003-03-27T23:21:24Z")

</div>

> \*Originally posted by Mike \*  
> \*\*php?

Forums! \*\*  
?? :trout:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 8:32am UTC](https://forum.kirupa.com/t/php/16626/49 "2003-03-28T08:32:35Z")

</div>

Yeah actually…

[http://www.fantom-stranger.com/~mentalconcepts/forum/](http://www.fantom-stranger.com/~mentalconcepts/forum/)

That’s what I’m currently working on 😉

playamarz

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 9:36am UTC](https://forum.kirupa.com/t/php/16626/50 "2003-03-28T09:36:56Z")

</div>

> 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. 🙂 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:

```php
<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:

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

```

Which one would you choose? 🙂

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 1:07pm UTC](https://forum.kirupa.com/t/php/16626/51 "2003-03-28T13:07:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 1:11pm UTC](https://forum.kirupa.com/t/php/16626/52 "2003-03-28T13:11:57Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 1:14pm UTC](https://forum.kirupa.com/t/php/16626/53 "2003-03-28T13:14:26Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 1:51pm UTC](https://forum.kirupa.com/t/php/16626/54 "2003-03-28T13:51:23Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 2:47pm UTC](https://forum.kirupa.com/t/php/16626/55 "2003-03-28T14:47:45Z")

</div>

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:

```php

<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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 2:50pm UTC](https://forum.kirupa.com/t/php/16626/56 "2003-03-28T14:50:21Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 2:54pm UTC](https://forum.kirupa.com/t/php/16626/57 "2003-03-28T14:54:33Z")

</div>

I just love this part of the code…

```php
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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 2:56pm UTC](https://forum.kirupa.com/t/php/16626/58 "2003-03-28T14:56:57Z")

</div>

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 (-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 2:57pm UTC](https://forum.kirupa.com/t/php/16626/59 "2003-03-28T14:57:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 28, 2003, 3:01pm UTC](https://forum.kirupa.com/t/php/16626/60 "2003-03-28T15:01:25Z")

</div>

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

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

```

why didnt they just say,

```php

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

```

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

[Previous page](https://forum.kirupa.com/t/php/16626.md?page=2)

[Next page](https://forum.kirupa.com/t/php/16626.md?page=4)
