Search found 427 matches

by chorn
Thu Jan 11, 2018 10:28 pm
Forum: PHP coding => General
Topic: clean url with slug in database
Replies: 5
Views: 94

Re: clean url with slug in database

I dont really get what this code does, where exactly do you have the problem? I would also recommend to refactor this code to make it more readable, e.g.: - seperate logic from what it looks like, skip out the HTML to a dedicated function - do not use GLOBAL so you make this more comprehensible - is...
by chorn
Thu Jan 11, 2018 4:54 am
Forum: PHP coding => General
Topic: clean url with slug in database
Replies: 5
Views: 94

Re: clean url with slug in database

how do oyu get anything else from the database?
by chorn
Wed Jan 10, 2018 10:52 pm
Forum: PHP coding => General
Topic: clean url with slug in database
Replies: 5
Views: 94

Re: clean url with slug in database

what? var_dump($_GET['page']);
by chorn
Mon Jan 08, 2018 2:23 am
Forum: PHP coding => General
Topic: reference a file in a phar
Replies: 1
Views: 33

Re: reference a file in a phar

i don't think (never seen) that browsers interpret phar files, especially not as a protocol, because phar is code that has to be interpreted by a PHP processor.
by chorn
Wed Jan 03, 2018 10:51 pm
Forum: mySQL & php coding
Topic: Retaining value after refresh
Replies: 2
Views: 69

Re: Retaining value after refresh

whenever the filter is updated, you can store it in a SESSION, and restore it on every other page.
by chorn
Sun Dec 31, 2017 12:54 pm
Forum: PHP coding => General
Topic: Extracting a single value from an array?
Replies: 1
Views: 39

Re: Extracting a single value from an array?

as the API responses in JSON, you should use json_decode();

Code: Select all

var_dump(json_decode($a));
by chorn
Sun Dec 31, 2017 10:47 am
Forum: PHP Scripts
Topic: How to correctly parse a $url
Replies: 1
Views: 130

Re: How to correctly parse a $url

you can add the port after SERVER_NAME.
by chorn
Sun Dec 31, 2017 10:35 am
Forum: PHP coding => Images
Topic: php page showing image from mysql db that links to other page
Replies: 1
Views: 409

Re: php page showing image from mysql db that links to other page

just adda link around the image

Code: Select all

<a href="detais.php">...</a>
by chorn
Sun Dec 31, 2017 7:15 am
Forum: PHP coding => Images
Topic: Custom image name
Replies: 1
Views: 106

Re: Custom image name

why would you want to change the actual filename? where should this text be displayed? but at least you should not take the same name for different inputs, if its not an array.
by chorn
Sun Dec 31, 2017 7:11 am
Forum: PHP coding => General
Topic: array to string conversion
Replies: 1
Views: 56

Re: array to string conversion

so the value you are using is an array. var_dump() it.
by chorn
Sun Dec 31, 2017 7:10 am
Forum: PHP coding => General
Topic: First time Post - in need of advice
Replies: 1
Views: 64

Re: First time Post - in need of advice

your SQL statement is invalid, throw any error on your development system.

Code: Select all

$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
by chorn
Sun Dec 31, 2017 7:08 am
Forum: PHP coding => General
Topic: Hi I need to develop a php site that can automatically copy some content from source
Replies: 3
Views: 91

Re: Hi I need to develop a php site that can automatically copy some content from source

when does the foreign system inform you about the data beeing updated? and how?
by chorn
Sun Dec 31, 2017 7:04 am
Forum: PHP coding => General
Topic: creating a task-list with time tracker
Replies: 1
Views: 48

Re: creating a task-list with time tracker

as a general hint, i would recommend to think in time-spans, so your estimate time left is taskduration - sum(past runtimes) - (time between login and now) you may want to cache this every time the user logs on and off to this task, so you just need to store the duration and rest time and can work w...
by chorn
Wed Dec 20, 2017 6:15 am
Forum: PHP coding => General
Topic: Send quiz results to server - help needed!
Replies: 3
Views: 92

Re: Send quiz results to server - help needed!

this message is not part of the code you posted, nor is it a native php error message.
by chorn
Wed Dec 20, 2017 4:29 am
Forum: PHP coding => General
Topic: Send quiz results to server - help needed!
Replies: 3
Views: 92

Re: Send quiz results to server - help needed!

whats the exact problem? whats happening? error messages?
by chorn
Mon Dec 11, 2017 3:22 am
Forum: PHP coding => General
Topic: Discount calculator problem
Replies: 2
Views: 96

Re: Discount calculator problem

this is messy. you have too much redundant code. concentrate on a single task at a single point, which will go in a single function

https://3v4l.org/hf4W0
by chorn
Mon Dec 11, 2017 2:19 am
Forum: PHP coding => General
Topic: barcode help
Replies: 1
Views: 105

Re: barcode help

and what have your tried by yourself?
by chorn
Wed Nov 29, 2017 2:33 am
Forum: PHP coding => General
Topic: Sorting data by smallest distance first from Distance Matrix service
Replies: 5
Views: 139

Re: Sorting data by smallest distance first from Distance Matrix service

there are several methods you can choose from. if you have the GPS coordinates for your postcodes, you may also let the client calculate the distances with javascript. i provide you an example for an in-database calculation:

http://sqlfiddle.com/#!9/fd67ed/3
by chorn
Tue Nov 28, 2017 6:49 am
Forum: PHP coding => General
Topic: Sorting data by smallest distance first from Distance Matrix service
Replies: 5
Views: 139

Re: Sorting data by smallest distance first from Distance Matrix service

you won't store this information in the database, or at least, not only one distance per user, because it changes for every user. if you want to store it, you have to build a cache table that holds this data from every user to every user. and you have to make sure this is always in sync, and will fi...
by chorn
Tue Nov 28, 2017 5:22 am
Forum: PHP coding => General
Topic: Sorting data by smallest distance first from Distance Matrix service
Replies: 5
Views: 139

Re: Sorting data by smallest distance first from Distance Matrix service

what should ORDER BY 123.456 mean for the database? you need the distance for each record. so you at least have to store the distance within every record as a seperate field, so you can then use usort() to sort afterwards, within PHP. or you just use the appropriate tools like i already mentioned in...
by chorn
Tue Nov 28, 2017 1:45 am
Forum: PHP coding => General
Topic: using mail classes
Replies: 3
Views: 81

Re: using mail classes

Code: Select all

<?php

	require('PHPMailer.php'); // case sensitive, same directory
	
	$phpmailer = new PHPMailer\PHPMailer\PHPMailer; // namespace + classname
by chorn
Tue Nov 21, 2017 2:56 am
Forum: PHP coding => General
Topic: style php results in html and css
Replies: 4
Views: 411

Re: style php results in html and css

just google for TWIG. it has a tutorial.
by chorn
Tue Nov 21, 2017 1:41 am
Forum: PHP coding => General
Topic: style php results in html and css
Replies: 4
Views: 411

Re: style php results in html and css

use TWIG to output your results as HTML.
by chorn
Mon Nov 20, 2017 12:01 am
Forum: PHP coding => General
Topic: Post email from input into the database
Replies: 1
Views: 84

Re: Post email from input into the database

you're not actually queriing the database, read this:

https://phpdelusions.net/pdo

enable exceptions.