Search found 903 matches

by hyper
Mon Apr 22, 2019 6:23 am
Forum: PHP coding => General
Topic: Url Rewrite Dynamic to static...
Replies: 3
Views: 622

Re: Url Rewrite Dynamic to static...

Please read and answer all (No one has an idea as to what you have or want to change without the information, we cannot see what you aren't telling us): Explain a bit more clearly what it is you hope to achieve / change: How are the urls generated at the moment? (or what generates them?) Are the url...
by hyper
Mon Apr 22, 2019 6:16 am
Forum: PHP coding => General
Topic: Need help using USORT to rearrange array order
Replies: 5
Views: 770

Re: Need help using USORT to rearrange array order

You don't have any doubling in your script, I'm not sure usort will be of an easy thing to use to help you in this. Far simpler: Create an array of the special products which are going to be doubled, Read in the whole products array (using your select query), Then loop through it- Use in_array to ch...
by hyper
Fri Apr 19, 2019 6:09 pm
Forum: PHP coding => General
Topic: Searched the forum. Sending html form data to php file
Replies: 2
Views: 535

Re: Searched the forum. Sending html form data to php file

Ok, first things first: if the file cannot be found, then it can't be in the same directory, I've just copy pasted them into a trial directory and it can find the file. And now the rest: A basic html file should use the following- <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title...
by hyper
Fri Apr 19, 2019 5:09 am
Forum: PHP coding => General
Topic: Url Rewrite Dynamic to static...
Replies: 3
Views: 622

Re: Url Rewrite Dynamic to static...

Explain a bit more clearly what it is you hope to achieve / change:

How are the urls generated at the moment? (or what generates them?)

Do you already have pages at each location? e.g. /news/4592/global-news-auto

Can you or do you intend to code this yourself?
by hyper
Thu Apr 11, 2019 9:53 am
Forum: PHP coding => General
Topic: Replace null in jsonencoded array
Replies: 2
Views: 558

Re: Replace null in jsonencoded array

Is there a reason why you want to convert nulls after you have converted it to Json?

It would help us to help you if you posted some code in code blocks: </> button on the editor.
by hyper
Thu Apr 04, 2019 8:07 am
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

An echo will there appear on every page so no header() function is going to work.
Correct :D

Lesson learned: if you are going to use header() under certain conditions [filling form out], check for those conditions first and re-direct if necessary, or build page [re show form].
by hyper
Tue Apr 02, 2019 8:17 am
Forum: MySQL Installation
Topic: php and mysql install errors
Replies: 4
Views: 11371

Re: php and mysql install errors

It's totally free.
Do you show the attention to detail shown in answering a post made 7 years ago?
by hyper
Tue Apr 02, 2019 8:12 am
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

You cannot use echo and then header later on.

Do the logic first, then use header or echo depending on the logic.
by hyper
Thu Mar 28, 2019 12:03 pm
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

Do all the validation first, and use the logic to decide if to include or re-direct:

Code: Select all

<?php
  if (form_validates){
    header('thank_you_page');
  } else {
    echo 'errors: ';
  }
by hyper
Wed Mar 27, 2019 4:41 pm
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

You're looking at this from the wrong point of view, you are trying to do it in a particular way - don't - you need to do it in the way that it needs to be done. Do not rely on JavaScript to re-direct, and learn from your mistakes: I thought if I concatenated them it should work but it didn't. You a...
by hyper
Wed Mar 27, 2019 4:18 pm
Forum: PHP General
Topic: Dynamically display images in a container depending on page height
Replies: 7
Views: 1317

Re: Dynamically display images in a container depending on page height

Is there any method of doing the container height calculation clientside Not easily or consitantly, there are too many variations in the way browsers do things. to use the result to render 'x' number of images serverside By rendering dynamic images, you would change the size of the page. or is it s...
by hyper
Tue Mar 26, 2019 8:54 am
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

Hyper I have to admit a 'double dunce' here. Not at all, we all have to learn, and learning like this is usually a good way, as it sticks. I thought if I concatenated them it should work but it didn't. You are missing the slash $root . "frm/frm-pm.php"; should be $root . "/frm/frm-pm.php"; Getting ...
by hyper
Tue Mar 12, 2019 2:52 pm
Forum: PHP coding => General
Topic: Help - Invalid argument supplied for foreach()
Replies: 1
Views: 363

Re: Help - Invalid argument supplied for foreach()

It looks like $rules is not iterable (can't be used in a foreach loop)

try

Code: Select all

echo gettype ($rules);
to see what you've got.
by hyper
Tue Mar 12, 2019 2:42 pm
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

Include it using the path to the file or replace the echo with the code you want instead. There is no good reason to use $_SERVER["PHP_SELF"], as I said, learn the directory structure and use $root as shown above, you should already know which file is going to process the form and which files will b...
by hyper
Tue Mar 12, 2019 1:12 pm
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

$_SERVER['DOCUMENT_ROOT'] is the full address of your web address from your systems point of view, which is probably to public_html on your system - not all set ups use public_html - by using $_SERVER['DOCUMENT_ROOT'] you can ignore what your path is when developing on one system and then uploading ...
by hyper
Tue Mar 12, 2019 8:46 am
Forum: PHP coding => General
Topic: form validation using form from include () file
Replies: 15
Views: 1538

Re: form validation using form from include () file

Your path is wrong, which is why the file can't be found. I use $_SERVER['DOCUMENT_ROOT']: $root=$_SERVER['DOCUMENT_ROOT']; include "$root/retail/pm_form.php"; Don't bother with $_SERVER["PHP_SELF"], just use $root and set the rest of the path: "$root/frm/frm-pm.php"; Warning: PHP doesn't guarantee ...
by hyper
Sat Mar 09, 2019 1:34 pm
Forum: PHP coding => General
Topic: Why PHP is better than Java?
Replies: 0
Views: 505

Re: Why PHP is better than Java?

Java and JavaScript are completely different languages. A CMS is not exclusive to PHP, there are no language constructs which are exclusive to PHP which mean that it is the only language that you can write a CMS in. JAVA provides database connectivity. JAVA and PHP are cross platform. Any program th...
by hyper
Mon Feb 11, 2019 1:57 pm
Forum: PHP coding => General
Topic: Storing a database value as a SESSION VAR
Replies: 1
Views: 396

Re: Storing a database value as a SESSION VAR

Sessions can be used for storing a name or anything else you need, only store what you need. It's a bad practice to pull information from a database unless you need it. 'SELECT * FROM Members' will pull everything and storing it all in sessions will place a heavier un-necessary load on the server. Y...
by hyper
Sat Feb 09, 2019 11:19 am
Forum: PHP coding => General
Topic: Print correct dates in PHP
Replies: 7
Views: 933

Re: Print correct dates in PHP

I meant to state on my last post:

Well done for giving it a go!
by hyper
Sat Feb 09, 2019 6:58 am
Forum: PHP coding => General
Topic: Print correct dates in PHP
Replies: 7
Views: 933

Re: Print correct dates in PHP

I don't know what you're expecting, are you trying to learn PHP and want some help? the switch statement, "switch" happens to be effective than several 'if, else if" Correct, but irrelevant, there are more efficient and user friendly ways that don't involve writing pages of variables, ifs or cases. ...
by hyper
Sat Feb 09, 2019 2:36 am
Forum: PHP coding => General
Topic: migrate to different php version
Replies: 2
Views: 512

Re: migrate to different php version

The bit after: PHP Warning: fclose() expects parameter 1 to be resource, boolean given in will give you the file name and line number to look at: fclose ( resource $handle ) you have not given a file handle (the one created using fopen) Whenever you get an error, read it; as it gives you where to lo...
by hyper
Fri Feb 08, 2019 9:28 am
Forum: PHP coding => General
Topic: Print correct dates in PHP
Replies: 7
Views: 933

Re: Print correct dates in PHP

You have quite a few problems in that code. I can't work out how any of it works as the switch statement can only have one result? Your foreach loops don't do anything if they find a weekend day. I suggest that you re-think how you want to achieve the end result as the way you are going about it can...
by hyper
Thu Feb 07, 2019 11:48 am
Forum: PHP coding => General
Topic: Join 2 php files
Replies: 2
Views: 486

Re: Join 2 php files

You've got the path wrong and PHP can't find the file you want, which is why it gave the error. Try php/remainder.php leaving the / off the address, I can't be sure of this since I don;t know your file structure; however I'm quite certain that you do not have a directory at the root of your file sys...