Search found 653 matches

by chorn
Wed Jan 22, 2020 2:14 am
Forum: PHP coding => General
Topic: MYSQL DB not showing uft8 on php page
Replies: 6
Views: 250

Re: MYSQL DB not showing uft8 on php page

You should change to MySQLi - or better PDO - soon, the mysql_* functions are deprecated and are already removed in current versions of PHP 7. It looks like you are using PHP 5.x which is outdated:

https://www.php.net/supported-versions.php

https://www.php.net/manual/en/book.pdo.php
by chorn
Wed Jan 22, 2020 2:12 am
Forum: PHP coding => General
Topic: PHP image store and retrieve
Replies: 1
Views: 154

Re: PHP image store and retrieve

just have a look at >> php image upload tutorial <<
by chorn
Thu Jan 16, 2020 10:56 pm
Forum: PHP coding => General
Topic: Finding a date by adding work hours to a date.
Replies: 1
Views: 144

Re: Finding a date by adding work hours to a date.

I would say, you take your start date, fast forward one week for every occurancy of combined sheduled hours within your working hours (50 hours = 1.xx weeks), take the rest with modulus, loop over your sheduled hours, forward one day if sheduled hours are fully covered for that day and subtract them...
by chorn
Thu Jan 16, 2020 12:11 am
Forum: PHP coding => General
Topic: MYSQL DB not showing uft8 on php page
Replies: 6
Views: 250

Re: MYSQL DB not showing uft8 on php page

Did you check the file beeing UTF8 WITHOUT BOM? How do you transfer files? FTP may change the encoding, you can try binary transfer.

Did you try setting SET NAMES statement on database connection?
by chorn
Mon Jan 13, 2020 5:25 am
Forum: PHP coding => General
Topic: PHP MYSQL URL Filtering
Replies: 1
Views: 160

Re: PHP MYSQL URL Filtering

You get URL parameters via the varialbe $_GET. But only unique keys are allowed, or you use an array like ?country[]=france&country[]=spain. After checking all array items against a whitelist, using array_filter() and in_array() or array_intersect(), you can turn them into a comma seperated list to ...
by chorn
Thu Jan 09, 2020 12:58 am
Forum: PHP coding => General
Topic: PHP - IF ELSE ELSE Help (NULL NOT NULL etc)
Replies: 4
Views: 231

Re: PHP - IF ELSE ELSE Help (NULL NOT NULL etc)

still no clue what's wrong / what you want to achieve. you did not answer all questions. i've posted a direct translation to working, tested code from your description.
by chorn
Thu Jan 09, 2020 12:22 am
Forum: PHP coding => General
Topic: Help a newbie please :)
Replies: 2
Views: 175

Re: Help a newbie please :)

Why did you use two single-quotes instead of a double-quote in the second parameter?
by chorn
Wed Jan 08, 2020 6:37 am
Forum: PHP coding => General
Topic: PHP - IF ELSE ELSE Help (NULL NOT NULL etc)
Replies: 4
Views: 231

Re: PHP - IF ELSE ELSE Help (NULL NOT NULL etc)

And what do you expect? What do you define as "wrong"? Which input did you use?

Just write a test: https://3v4l.org/tg5UQ
by chorn
Wed Jan 08, 2020 3:26 am
Forum: mySQL & php coding
Topic: Need guidance and support.
Replies: 4
Views: 454

Re: Need guidance and support.

then you need to know what exactly this management software does, is it open source?
by chorn
Tue Jan 07, 2020 6:16 am
Forum: mySQL & php coding
Topic: Need guidance and support.
Replies: 4
Views: 454

Re: Need guidance and support.

how do you get the logfiles now?
by chorn
Mon Jan 06, 2020 1:29 am
Forum: mySQL & php coding
Topic: why my code not working
Replies: 3
Views: 457

Re: why my code not working

enable error reporting

Code: Select all

$pdo = new PDO('mysql:host=localhost;dbname=someTable', 'username', 'password', array(
  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
by chorn
Mon Jan 06, 2020 1:21 am
Forum: PHP General
Topic: Problem with API call
Replies: 1
Views: 366

Re: Problem with API call

on a blank page you should have a look in the error.log of your webserver.
by chorn
Mon Jan 06, 2020 1:19 am
Forum: PHP coding => General
Topic: CSgo gambling error
Replies: 1
Views: 159

Re: CSgo gambling error

ok what error
by chorn
Mon Jan 06, 2020 1:18 am
Forum: PHP coding => General
Topic: File_get_contents
Replies: 1
Views: 178

Re: File_get_contents

source code is just plain text, you can perform plain text search with strpos().
by chorn
Wed Dec 04, 2019 11:21 pm
Forum: PHP General
Topic: Array Indexing Question
Replies: 3
Views: 440

Re: Array Indexing Question

What for do you need an numerical-only index? Numerical and string indexes don't really make a difference in PHP. You could alter the data with array_values, or use array_column to get a list of one property. Looping is with foreach.
by chorn
Tue Dec 03, 2019 1:41 am
Forum: PHP General
Topic: I need PHP to zip certain files on my server
Replies: 4
Views: 547

Re: I need PHP to zip certain files on my server

Haven't you tried the code?
by chorn
Thu Nov 14, 2019 11:29 pm
Forum: PHP coding => General
Topic: Remove session key
Replies: 1
Views: 127

Re: Remove session key

Qhy would you set the session key to null? At least all session data would be inaccesible then. But session_destroy() already manages that.
by chorn
Tue Nov 12, 2019 3:55 am
Forum: PHP coding => General
Topic: Classes/Databases
Replies: 7
Views: 228

Re: Classes/Databases

What for? Looks like you think about a solution that needs a problem.
by chorn
Tue Nov 12, 2019 2:35 am
Forum: PHP coding => General
Topic: Classes/Databases
Replies: 7
Views: 228

Re: Classes/Databases

So your db connection already gives you the data encapsuled in the class provided, you could directly use the db connection without wrapping that in your class again.
by chorn
Mon Nov 11, 2019 11:56 pm
Forum: PHP coding => General
Topic: Classes/Databases
Replies: 7
Views: 228

Re: Classes/Databases

Whatever db-conn you are using must be an external lib because that's not standard PHP. So what is processSqlRow actually doing? If it gives back a class of the defined name, what for do you even need to use MyClass in the first place, instead of just querying the database?
by chorn
Tue Oct 01, 2019 10:05 pm
Forum: PHP General
Topic: How do I calculate Time Please? ie take the timestamp and subtract the current time
Replies: 4
Views: 479

Re: How do I calculate Time Please? ie take the timestamp and subtract the current time

you could do that all in database. get an overview of matching clients

http://www.sqlfiddle.com/#!17/409a6/1

and use this as a base for your update query
by chorn
Mon Sep 30, 2019 10:15 pm
Forum: PHP coding => General
Topic: How to edit a file on website
Replies: 1
Views: 214

Re: How to edit a file on website

You can use the file_get_contents and file_put_contents functions to handle files.

Also there's exec() and shell_exec()
by chorn
Wed Sep 04, 2019 10:38 pm
Forum: PHP coding => General
Topic: Php code not displaying anything
Replies: 5
Views: 754

Re: Php code not displaying anything

So you changed the code and fixed the first error and get a new one now.

That's because you are accessing an array key that does not exist, you always have to check if an array key exists, just like you did with $_POST['submit'], either by isset() or empty(), depending on your requirement.
by chorn
Tue Sep 03, 2019 10:38 pm
Forum: PHP coding => General
Topic: How can I use foreach with JSON?
Replies: 1
Views: 601

Re: How can I use foreach with JSON?

There's nothing wrong with using foreach <?php $response = '[{"INTCOID":"56","INTCOCompanyName":"Jacks Appliance"},{"INTCOID":"94","INTCOCompanyName":"Jims Appliance"}]'; // file_get_contents("http://localhost/REST2/RestController.php?view=wwmCompany"); $assoc_array = true; $z = json_decode($respons...
by chorn
Mon Sep 02, 2019 11:28 pm
Forum: PHP coding => General
Topic: Php code not displaying anything
Replies: 5
Views: 754

Re: Php code not displaying anything

Just prepend that to the very beginning of the very first file called after <?php