Search found 12 matches

by kladrian
Thu Aug 14, 2014 11:30 am
Forum: PHP coding => General
Topic: Iterating where value is an object or an array
Replies: 0
Views: 647

Re: Iterating where value is an object or an array

try to use

Code: Select all

echo var_dump($value, TRUE);
instead of

Code: Select all

echo $value; // print_r ($value)
---
kladrian
by kladrian
Thu Aug 14, 2014 11:27 am
Forum: PHP coding => General
Topic: PHP Bug I cannot see :S
Replies: 0
Views: 697

Re: PHP Bug I cannot see :S

try to write some echos to see which "false" returns or even better, use xdebug and use breakpoints

---
kladrian
by kladrian
Thu Aug 14, 2014 11:25 am
Forum: PHP coding => General
Topic: Warning: Cannot modify header information...
Replies: 0
Views: 804

Re: Warning: Cannot modify header information...

hi, first of all it's best practice to remove '?>' at the end of each php file or ... maybe it's better to say that is malpractice to write '?>' at the end of the file :) then the problem is not the path of the header but something else before. This is a well know error that means you are trying to ...
by kladrian
Thu Aug 14, 2014 11:18 am
Forum: PHP coding => General
Topic: form/submit, how to check if array ISSET()
Replies: 1
Views: 762

Re: form/submit, how to check if array ISSET()

what about a simple check like

Code: Select all

if (!isset($_POST['sectors'])) {
  // show error message
}
---
kladrian
by kladrian
Thu Aug 14, 2014 11:13 am
Forum: PHP coding => General
Topic: header() sometimes works; sometimes not.
Replies: 0
Views: 609

Re: header() sometimes works; sometimes not.

try to move php code outside html code, put it at the very beginning of the file

---
kladrian
by kladrian
Thu Aug 14, 2014 11:09 am
Forum: PHP coding => General
Topic: Parsing Data
Replies: 0
Views: 608

Re: Parsing Data

that looks like a json so you have to decode it and use it like a normal object. here's the code: try{ $json = json_decode($jsondata); if (empty($json)){ echo "invalid json"; return; } // then you can access to variables $cmd = $json->cmd; echo $cmd; $last_heard = $json->coreInfo->last_heard; echo $...
by kladrian
Thu Aug 14, 2014 10:56 am
Forum: PHP coding => General
Topic: Parsing a JSON file
Replies: 0
Views: 662

Re: Parsing a JSON file

Hi first of all your json is not correct. You can't create an key/value array, that would be an object. So instead of [..] you've to use {} here the correct json: { "birthdays": { "307843200": "Carla", "319507200": "Kyle", "1390435200": "Noah" } } then the code it's easy: try{ $json = json_decode($j...
by kladrian
Thu Aug 14, 2014 6:43 am
Forum: PHP Scripts
Topic: Where is the url to my php script
Replies: 0
Views: 936

Re: Where is the url to my php script

Hi you'd probably want to take a look at $_SERVER variables. There are a lot of cool info about your script and server, such as: absolute path, url and so on You can find a good help list here: http://php.net/manual/en/reserved.variables.server.php maybe you need one of these 2 $_SERVER['SCRIPT_FILE...
by kladrian
Thu Aug 14, 2014 6:37 am
Forum: PHP Scripts
Topic: Get data from a textbox and compare it with a line in a file
Replies: 1
Views: 1103

Re: Get data from a textbox and compare it with a line in a

Hi, first create a form with a text box. In your action php you should get the value of the text box by searching it into the $_POST (or $_REQUEST) array. $text_val = $_POST['text_box_name']; then you'll have to search it in the file; there are few ways to do that. The ugliest and yet quickest way i...
by kladrian
Thu Aug 14, 2014 1:37 am
Forum: PHP Scripts
Topic: create a JSON with xml
Replies: 0
Views: 859

Re: create a JSON with xml

have you tried something like this ?
http://stackoverflow.com/questions/8830 ... ml-to-json

---
kladrian
by kladrian
Thu Aug 14, 2014 1:32 am
Forum: PHP Scripts
Topic: Who knows data scraping?
Replies: 0
Views: 963

Re: Who knows data scraping?

Hi
you should try this http://simplehtmldom.sourceforge.net/
It's a very easy-to-use yet powerful dom inspector.

You can load your remote html page and try to extract informations as you'd do with javascript.

:)

---
kladrian
by kladrian
Thu Aug 14, 2014 1:20 am
Forum: PHP coding => General
Topic: Best editor for PHP
Replies: 210
Views: 177927

Re: Best editor for PHP

Without any doubt PHPStorm http://www.jetbrains.com/phpstorm/
---
kladrian