# Code Snippets

**URL:** https://www.phphelp.com/c/code-snippets/11.md?page=1

[Latest](https://www.phphelp.com/latest.md) · [Categories](https://www.phphelp.com/categories.md)

**Page:** 2

---

## [Thread safety](https://www.phphelp.com/t/thread-safety/26018)

<div class="topic-metadata">

**Author:** [@system](https://www.phphelp.com/u/system)\
**Replies:** 1\
**Last updated:** [August 24, 2017, 1:29pm UTC](https://www.phphelp.com/t/thread-safety/26018 "2017-08-24T13:29:50Z")

</div>

I have good expereince in Java/J2EE but I am very new to PHP. There is an small requirement where i want to share value of a variable(which contains a String token) accross different user requests. Now the issue is that…

---

## [Arrays and the PITA they can be!](https://www.phphelp.com/t/arrays-and-the-pita-they-can-be/25980)

<div class="topic-metadata">

**Author:** [@jbrown1028](https://www.phphelp.com/u/jbrown1028)\
**Replies:** 2\
**Last updated:** [July 25, 2017, 10:55am UTC](https://www.phphelp.com/t/arrays-and-the-pita-they-can-be/25980 "2017-07-25T10:55:53Z")

</div>

Although it doesn’t happen very often, there are a few times when I need to push the values of an array to the keys. Now I know what you may be thinking, why the H E double hockey sticks would anybody need to do that. Th…

---

## [Plurals... Aren't they fun?](https://www.phphelp.com/t/plurals-arent-they-fun/25981)

<div class="topic-metadata">

**Author:** [@jbrown1028](https://www.phphelp.com/u/jbrown1028)\
**Replies:** 0\
**Last updated:** [July 25, 2017, 4:27am UTC](https://www.phphelp.com/t/plurals-arent-they-fun/25981 "2017-07-25T04:27:33Z")

</div>

Can anybody really count the times they needed to have a dynamic number of items and the dreaded number 1 comes up… So your webpage looks like either: You have 1 apples – or even better – You have 234 apple So us pro…

---

## [Retrieving the best IP](https://www.phphelp.com/t/retrieving-the-best-ip/25979)

<div class="topic-metadata">

**Author:** [@jbrown1028](https://www.phphelp.com/u/jbrown1028)\
**Replies:** 0\
**Last updated:** [July 25, 2017, 4:04am UTC](https://www.phphelp.com/t/retrieving-the-best-ip/25979 "2017-07-25T04:04:53Z")

</div>

Keep in mind that obtaining the visitors IP address is somewhat like asking a shady person to hold your wallet… But still many people use it as a type of identification for visitors. The problem is, most of the time, cod…

---

## [MOVED: Connecting to a new Database in PHP](https://www.phphelp.com/t/moved-connecting-to-a-new-database-in-php/24773)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [December 4, 2015, 2:45am UTC](https://www.phphelp.com/t/moved-connecting-to-a-new-database-in-php/24773 "2015-12-04T02:45:27Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=25382.0\[/iurl\]

---

## [Registration Form & PHP Classes](https://www.phphelp.com/t/registration-form-php-classes/24622)

<div class="topic-metadata">

**Author:** [@Strider64](https://www.phphelp.com/u/Strider64)\
**Replies:** 1\
**Last updated:** [November 4, 2015, 7:06pm UTC](https://www.phphelp.com/t/registration-form-php-classes/24622 "2015-11-04T19:06:46Z")

</div>

First I’ll give a link to my pastebins and then explain - http://pastebin.com/u/Strider64 There are five files (pastebins) that are necessary to get the registration form working, but it’s still not the full working cod…

---

## [Building a Bootstrap Contact Form Using PHP and AJAX](https://www.phphelp.com/t/building-a-bootstrap-contact-form-using-php-and-ajax/24605)

<div class="topic-metadata">

**Author:** [@lovekillre](https://www.phphelp.com/u/lovekillre)\
**Replies:** 1\
**Last updated:** [October 1, 2015, 1:40pm UTC](https://www.phphelp.com/t/building-a-bootstrap-contact-form-using-php-and-ajax/24605 "2015-10-01T13:40:10Z")

</div>

Final product image What You’ll Be Creating Opening up the index.html file, copy the following HTML base structure: \[php\] Contact form using Bootstrap 3.3.4 " Send me a message \<…

---

## [Importing CSV data vie PHP](https://www.phphelp.com/t/importing-csv-data-vie-php/24596)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 2\
**Last updated:** [September 29, 2015, 10:55pm UTC](https://www.phphelp.com/t/importing-csv-data-vie-php/24596 "2015-09-29T22:55:06Z")

</div>

---

## [MOVED: Change to actual date from "x years ago"](https://www.phphelp.com/t/moved-change-to-actual-date-from-x-years-ago/24438)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [July 28, 2015, 3:16am UTC](https://www.phphelp.com/t/moved-change-to-actual-date-from-x-years-ago/24438 "2015-07-28T03:16:35Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=25008.0\[/iurl\]

---

## [Colour of word](https://www.phphelp.com/t/colour-of-word/24086)

<div class="topic-metadata">

**Author:** [@polk\_farody](https://www.phphelp.com/u/polk_farody)\
**Replies:** 2\
**Last updated:** [May 2, 2015, 11:33am UTC](https://www.phphelp.com/t/colour-of-word/24086 "2015-05-02T11:33:27Z")

</div>

Recently I had a message board and wanted to give every user a different colour based on their name. I made the following class: \[php\] \<?php class Colour { protected $string = ''; private $instance = null; publ…

---

## [Log Visitor Class](https://www.phphelp.com/t/log-visitor-class/9510)

<div class="topic-metadata">

**Author:** [@commandergc](https://www.phphelp.com/u/commandergc)\
**Replies:** 3\
**Last updated:** [April 27, 2015, 11:32pm UTC](https://www.phphelp.com/t/log-visitor-class/9510 "2015-04-27T23:32:58Z")

</div>

Well here you go folks my first attempt at using Classes. This is a method of loging unique ips that visit your site. Enjoy The code works with php 5 and MySQL 5. this has not been tested with php 4 but i think it shoul…

---

## [get file path from text box to import csv file](https://www.phphelp.com/t/get-file-path-from-text-box-to-import-csv-file/24182)

<div class="topic-metadata">

**Author:** [@iojbr](https://www.phphelp.com/u/iojbr)\
**Replies:** 3\
**Last updated:** [April 25, 2015, 1:50pm UTC](https://www.phphelp.com/t/get-file-path-from-text-box-to-import-csv-file/24182 "2015-04-25T13:50:16Z")

</div>

The code snippet below that I got online will open a file browser window, allow the user to select a file, and then input the file path into a text box in a html form. How do I define this file path as a variable using …

---

## [Slideshow from folder in alphabetica order?](https://www.phphelp.com/t/slideshow-from-folder-in-alphabetica-order/23639)

<div class="topic-metadata">

**Author:** [@handygeek](https://www.phphelp.com/u/handygeek)\
**Replies:** 4\
**Last updated:** [April 13, 2015, 1:31am UTC](https://www.phphelp.com/t/slideshow-from-folder-in-alphabetica-order/23639 "2015-04-13T01:31:24Z")

</div>

17 views & no replies to my Help post re. alphabetic-vs-random-slideshow … maybe I should use entirely different code vs trying to fix my existing code? Anyone have a code snippet for a simple slideshow from a folder (d…

---

## [PHP project](https://www.phphelp.com/t/php-project/24133)

<div class="topic-metadata">

**Author:** [@tarnold4](https://www.phphelp.com/u/tarnold4)\
**Replies:** 5\
**Last updated:** [April 1, 2015, 8:38pm UTC](https://www.phphelp.com/t/php-project/24133 "2015-04-01T20:38:40Z")

</div>

I decided to do a php project, i am gonna try my luck at it and see what happens. The questions below are what i wanna answer. purpose of the application? What input is expected of the user? What screens will the use…

---

## [Etiquette](https://www.phphelp.com/t/etiquette/24085)

<div class="topic-metadata">

**Author:** [@Romantic](https://www.phphelp.com/u/Romantic)\
**Replies:** 1\
**Last updated:** [March 12, 2015, 2:34pm UTC](https://www.phphelp.com/t/etiquette/24085 "2015-03-12T14:34:30Z")

</div>

Etiquette is a code of polite conduct. If you practice proper etiquette, you are less likely to offend or annoy people — and you may even charm them. Johni

---

## [MOVED: Need help with SELECT UPDATE WHERE](https://www.phphelp.com/t/moved-need-help-with-select-update-where/24080)

<div class="topic-metadata">

**Author:** [@Topcoder](https://www.phphelp.com/u/Topcoder)\
**Replies:** 0\
**Last updated:** [March 9, 2015, 3:13pm UTC](https://www.phphelp.com/t/moved-need-help-with-select-update-where/24080 "2015-03-09T15:13:05Z")

</div>

This topic has been moved to Beginners - Learning PHP. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24590.0\[/iurl\]

---

## [MOVED: Failure in script](https://www.phphelp.com/t/moved-failure-in-script/24045)

<div class="topic-metadata">

**Author:** [@Topcoder](https://www.phphelp.com/u/Topcoder)\
**Replies:** 0\
**Last updated:** [February 23, 2015, 8:45pm UTC](https://www.phphelp.com/t/moved-failure-in-script/24045 "2015-02-23T20:45:54Z")

</div>

This topic has been moved to Beginners - Learning PHP. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24544.0\[/iurl\]

---

## [I can't get the Form to work.](https://www.phphelp.com/t/i-cant-get-the-form-to-work/23981)

<div class="topic-metadata">

**Author:** [@emaus1212](https://www.phphelp.com/u/emaus1212)\
**Replies:** 8\
**Last updated:** [February 9, 2015, 9:20pm UTC](https://www.phphelp.com/t/i-cant-get-the-form-to-work/23981 "2015-02-09T21:20:08Z")

</div>

HTML file… I can’t get the form to work. Please \[code\] Translations-Design Services| TDS Who we are | Translation Services | Web Publishing Services | Contact Us \</td\> \<td\> \<fo…

---

## [Get Pdf form field name](https://www.phphelp.com/t/get-pdf-form-field-name/22722)

<div class="topic-metadata">

**Author:** [@ravikanth](https://www.phphelp.com/u/ravikanth)\
**Replies:** 2\
**Last updated:** [January 17, 2015, 5:31am UTC](https://www.phphelp.com/t/get-pdf-form-field-name/22722 "2015-01-17T05:31:01Z")

</div>

Hi, i need to get all form field names of pdf file.

---

## [MOVED: need help with View All function In products](https://www.phphelp.com/t/moved-need-help-with-view-all-function-in-products/23795)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [December 17, 2014, 4:24pm UTC](https://www.phphelp.com/t/moved-need-help-with-view-all-function-in-products/23795 "2014-12-17T16:24:22Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24284.0\[/iurl\]

---

## [MOVED: Invalid username/password combination is not working in this coding.](https://www.phphelp.com/t/moved-invalid-username-password-combination-is-not-working-in-this-coding/23789)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [December 16, 2014, 6:56pm UTC](https://www.phphelp.com/t/moved-invalid-username-password-combination-is-not-working-in-this-coding/23789 "2014-12-16T18:56:37Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24192.0\[/iurl\]

---

## [MOVED: Multiple accounts for one email address](https://www.phphelp.com/t/moved-multiple-accounts-for-one-email-address/23788)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [December 16, 2014, 6:56pm UTC](https://www.phphelp.com/t/moved-multiple-accounts-for-one-email-address/23788 "2014-12-16T18:56:03Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24275.0\[/iurl\]

---

## [How to create iCRUD](https://www.phphelp.com/t/how-to-create-icrud/23706)

<div class="topic-metadata">

**Author:** [@Strider64](https://www.phphelp.com/u/Strider64)\
**Replies:** 6\
**Last updated:** [November 30, 2014, 8:20pm UTC](https://www.phphelp.com/t/how-to-create-icrud/23706 "2014-11-30T20:20:44Z")

</div>

The following just shows how to create a basic interface that Creates, Updates, Reads and Deletes. This is obviously done in Object-Oriented Programming style and is still a work-in-progress for me. However, there are b…

---

## [php sort by folder created date](https://www.phphelp.com/t/php-sort-by-folder-created-date/23653)

<div class="topic-metadata">

**Author:** [@dilshan](https://www.phphelp.com/u/dilshan)\
**Replies:** 6\
**Last updated:** [November 16, 2014, 5:06am UTC](https://www.phphelp.com/t/php-sort-by-folder-created-date/23653 "2014-11-16T05:06:06Z")

</div>

Hi Experts, Currently this file display all folder order by name but i want to order by folder created date. index.php contains : \[php\] \<?php foreach($categories\_array as $photo\_category=\>$photos\_array){?\> \<?…

---

## [Update database wont work in code!](https://www.phphelp.com/t/update-database-wont-work-in-code/23565)

<div class="topic-metadata">

**Author:** [@system](https://www.phphelp.com/u/system)\
**Replies:** 2\
**Last updated:** [October 24, 2014, 5:14pm UTC](https://www.phphelp.com/t/update-database-wont-work-in-code/23565 "2014-10-24T17:14:39Z")

</div>

For some reason, my code wont let me update my database. I know i am connected to proper database with the proper credentials. I have a button that lets me delete a whole row but my update button wont work!. I just want …

---

## [MOVED: Word length limit](https://www.phphelp.com/t/moved-word-length-limit/23559)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [October 23, 2014, 5:30pm UTC](https://www.phphelp.com/t/moved-word-length-limit/23559 "2014-10-23T17:30:13Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=24024.0\[/iurl\]

---

## [MOVED: Help with this array to get unique values in foreach loop please?](https://www.phphelp.com/t/moved-help-with-this-array-to-get-unique-values-in-foreach-loop-please/23494)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [October 11, 2014, 8:02pm UTC](https://www.phphelp.com/t/moved-help-with-this-array-to-get-unique-values-in-foreach-loop-please/23494 "2014-10-11T20:02:44Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=23957.0\[/iurl\]

---

## [A neat way to save to MySQL if you have an array.](https://www.phphelp.com/t/a-neat-way-to-save-to-mysql-if-you-have-an-array/23336)

<div class="topic-metadata">

**Author:** [@Strider64](https://www.phphelp.com/u/Strider64)\
**Replies:** 1\
**Last updated:** [September 17, 2014, 1:46am UTC](https://www.phphelp.com/t/a-neat-way-to-save-to-mysql-if-you-have-an-array/23336 "2014-09-17T01:46:17Z")

</div>

I stumble across this on the internet and found a way where if you have an array that you want to save to a database table. Doing it this way is not only fast, but is also secure. Here’s the function: \[php\] function in…

---

## [MOVED: PHP mysql based simple event calendar](https://www.phphelp.com/t/moved-php-mysql-based-simple-event-calendar/23313)

<div class="topic-metadata">

**Author:** [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Replies:** 0\
**Last updated:** [September 3, 2014, 11:47am UTC](https://www.phphelp.com/t/moved-php-mysql-based-simple-event-calendar/23313 "2014-09-03T11:47:26Z")

</div>

This topic has been moved to General PHP Help. \[iurl\]http://www.phphelp.com/forum/index.php?topic=23770.0\[/iurl\]

---

## [help with messaging system](https://www.phphelp.com/t/help-with-messaging-system/22689)

<div class="topic-metadata">

**Author:** [@djclewes](https://www.phphelp.com/u/djclewes)\
**Replies:** 17\
**Last updated:** [May 21, 2014, 10:18pm UTC](https://www.phphelp.com/t/help-with-messaging-system/22689 "2014-05-21T22:18:48Z")

</div>

trying to install this script http://www.9lessons.info/2013/05/message-conversation-database-design.html ive created the database but i do not understand the php code. How does it connect to the database and how do i se…

[Previous page](https://www.phphelp.com/c/code-snippets/11.md)

[Next page](https://www.phphelp.com/c/code-snippets/11.md?page=2)
