Search found 548 matches

by chorn
Thu Jun 21, 2018 9:16 pm
Forum: mySQL & php coding
Topic: Breif query about reading from PDO
Replies: 3
Views: 41

Re: Breif query about reading from PDO

what function.

use $conn->fetchAll().
by chorn
Thu Jun 21, 2018 9:13 pm
Forum: PHP coding => General
Topic: Code Editor
Replies: 2
Views: 21

Re: Code Editor

Just try out some editors (notepad++, phpstorm), at least it's your preference, and even notepad (on windows) can be a 'good' [enough] editor if it's the only one you are allowed to use, but other tools will give you way more help and faster results.
by chorn
Tue Jun 19, 2018 12:02 am
Forum: PHP General
Topic: How to build a simple calendar, timetable.
Replies: 1
Views: 25

Re: How to build a simple calendar, timetable.

If you want the calendar to be clickable, use some javascript, have a look at "jquery ui datepicker" for some input. You can also just build a list of dates with the DateInterval and DatePeriod classes from within PHP and provide clickable links in plain HTML.
by chorn
Mon Jun 18, 2018 9:37 pm
Forum: PHP coding => General
Topic: RewriteRule
Replies: 3
Views: 76

Re: RewriteRule

your rewrite rule is missing the terminator at the end.
by chorn
Mon Jun 18, 2018 9:29 pm
Forum: PHP coding => General
Topic: append every n lines in a file PHP
Replies: 1
Views: 28

Re: append every n lines in a file PHP

while walking over the data you can check every key with the modulo operator.
by chorn
Sun Jun 17, 2018 9:39 pm
Forum: PHP coding => General
Topic: RewriteRule
Replies: 3
Views: 76

Re: RewriteRule

Did you really not even try anything like just removing the parts you do not want to match within the URL?
by chorn
Fri Jun 15, 2018 10:21 am
Forum: PHP coding => General
Topic: create multiple instances of a script
Replies: 2
Views: 48

Re: create multiple instances of a script

You can run every file over CLI via `php -f file.php`, or use thread with e.g. pthreads.
by chorn
Wed Jun 06, 2018 9:37 pm
Forum: PHP coding => General
Topic: Insert php inside double quotes
Replies: 2
Views: 87

Re: Insert php inside double quotes

Only variables are interpreted within double-quotes - php code is not. And fopen requires just a filename, like "phpwtf.txt", that may be hold within a string, but also filesystem restrictions apply (e.g. no slashes, except for if you want to create a directory).
by chorn
Sat Jun 02, 2018 5:00 am
Forum: PHP General
Topic: Shipment Tracking
Replies: 1
Views: 104

Re: Shipment Tracking

Get an HTML form, receive the value within a PHP script and make a query to your shipments-database.
by chorn
Wed May 30, 2018 8:06 am
Forum: PHP coding => General
Topic: Encrypt Query
Replies: 1
Views: 54

Re: Encrypt Query

libsodium.
by chorn
Mon May 28, 2018 12:02 am
Forum: PHP coding => General
Topic: Modals from PHP
Replies: 1
Views: 70

Re: Modals from PHP

You can use websockets for bi-directional communication, but i wonder what script should message the client after it was done...
by chorn
Sun May 27, 2018 5:51 am
Forum: PHP coding => General
Topic: Alogo to password_needs_rehash
Replies: 5
Views: 165

Re: Alogo to password_needs_rehash

the manual says something else.
by chorn
Wed May 23, 2018 10:52 pm
Forum: PHP coding => General
Topic: custom wordpress plugin code
Replies: 3
Views: 106

Re: custom wordpress plugin code

There are alreadysolutions for it, just search for "jquery datepicker disable sundays".
by chorn
Wed May 23, 2018 9:14 am
Forum: PHP coding => General
Topic: Inserting NULL into date Field
Replies: 3
Views: 110

Re: Inserting NULL into date Field

I would recommend to first fix the SQL statement before testing around with any value. But still: if you want to insert a NULL value, the quotes must be removed. Better use Prepared Statements, e.g. with PDO, so the quotes are added automatically only when necessary.
by chorn
Wed May 23, 2018 5:47 am
Forum: PHP coding => General
Topic: Inserting NULL into date Field
Replies: 3
Views: 110

Re: Inserting NULL into date Field

Why do you try to insert $rowData when you cast to $dateValue first? The variable wouldn't be interpreted within single quotes. Also a NULL value must be inserted without quotes, or it's taken as a string. You should read the section about quotes again: http://php.net/manual/en/language.types.string...
by chorn
Tue May 22, 2018 11:17 pm
Forum: PHP coding => General
Topic: Grouping By returns first record
Replies: 5
Views: 145

Re: Grouping By returns first record

EVERY (!) column that is not in the group by clause must be aggrgated, you can't write "select *" here.
by chorn
Tue May 22, 2018 3:20 am
Forum: PHP coding => General
Topic: Grouping By returns first record
Replies: 5
Views: 145

Re: Grouping By returns first record

Every column that is not in the GROUP BY clause must be aggregated, with e.g. SUM, AVG, MIN, MAX,, or whatever you think might be suitable. Otherwise you get random results. More sophisticated databases would give you an error, MySQL just gives you fucked up results.
by chorn
Mon May 21, 2018 9:56 am
Forum: PHP coding => General
Topic: Alogo to password_needs_rehash
Replies: 5
Views: 165

Re: Alogo to password_needs_rehash

Provide a different algo to password_hash().
by chorn
Sun May 20, 2018 10:08 pm
Forum: PHP coding => General
Topic: Alogo to password_needs_rehash
Replies: 5
Views: 165

Re: Alogo to password_needs_rehash

Just like the manual says: A hash created by password_hash().
by chorn
Sun May 20, 2018 10:07 pm
Forum: PHP coding => General
Topic: extracting data from xml into custom array
Replies: 2
Views: 100

Re: extracting data from xml into custom array

Use XPATH to get the node, then assign every value to a new array as the key you want.
by chorn
Tue May 15, 2018 5:47 am
Forum: PHP coding => General
Topic: I want to make contact form work/How Do I make php work on a website ?
Replies: 4
Views: 199

Re: I want to make contact form work/How Do I make php work on a website ?

have a look at var_dump($_POST) to see what you get from the form.
by chorn
Mon May 14, 2018 9:23 am
Forum: PHP coding => General
Topic: Sessions and included files
Replies: 1
Views: 86

Re: Sessions and included files

Why don't you try yourself? Make a test case which leads to different results. And have a look at the manual again for what include does.
by chorn
Sun May 13, 2018 4:22 am
Forum: PHP General
Topic: ob_get_contents()
Replies: 3
Views: 115

Re: ob_get_contents()

Your assumptions are wrong, look at the sourcecode (ctrl+u), you are looking at messy results, because you are mixing PHP and JS (server- vs clientside scripting). The JS kicks in after all the PHP is already done.
by chorn
Sun May 13, 2018 4:17 am
Forum: PHP General
Topic: how to get value from js alert message to store in PHP varible?
Replies: 1
Views: 80

Re: how to get value from js alert message to store in PHP varible?

As PHP scripts only run when triggered, you have to make a request to your script's URL with the parameter in the URL or via POST / form. Or you take AJAX.
by chorn
Sat May 12, 2018 1:45 pm
Forum: PHP General
Topic: ob_get_contents()
Replies: 3
Views: 115

Re: ob_get_contents()

your case is not replicable

Code: Select all

echo (string)"14" * 2; // 28