Search found 65 matches

by phpRob
Mon Mar 26, 2018 6:19 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

Oh my goodness. This is frustrating for me. Is this even your php page you are dealing with? Sorry but if you don't use or have studied php and don't intend to, but if you want someone to solve this for you, please hire a contractor. There is this session variable in the code: $_SESSION["paymentmeth...
by phpRob
Sun Mar 25, 2018 5:20 pm
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

I think you're thinking is correct. You did not get some error did you? Assuming not. As long as you generate identical output in terms of XML (elements/tags)--regardless of which write/output technique you use--you should be fine. Just remember that an element must have opening and closing tags, fo...
by phpRob
Sat Mar 24, 2018 3:59 pm
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

I hope you got it working by now, but if you want to just copy and paste exactly where and how the variable is set--that would help us help you and make it less painful to give answers. Haystacks of code are no fun to go through. Thanks.
by phpRob
Fri Mar 23, 2018 10:20 pm
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

Function gmp_add only takes two arguments. And even the arguments you had, you were missing brackets for the session variables.
This would be correct:

Code: Select all

$sum = 25 + $_SESSION['paymentmethod'] + $_SESSION['grandtotal'];
echo strval($sum) . "\n";
by phpRob
Fri Mar 23, 2018 8:08 pm
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

Great job, I'm super glad you got it. I appreciated that you were putting effort into it and that helped make it worth it and rewarding for me to spend some time on this with you. Good luck in your continued work.
by phpRob
Fri Mar 23, 2018 12:16 pm
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

Keep working on it. You just need to step back. Be realistic about what you understand and don't read up on where you are weak. Fill in the gaps. Understand every function of every library you are working with. What they need; what they return. I've spent the time to give you logic--not necessarily ...
by phpRob
Fri Mar 23, 2018 11:44 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

No, I'm sorry. I can't bring myself to help you on this further. I told you how to add two global array variables even with uncertainty about what they present. Adding two variables. Super sorry, I can't take your hand and take you all the way to the dance.
by phpRob
Fri Mar 23, 2018 3:32 am
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

Please check out this sample code that gets you the logic you need. It is runnable in the browser so you can tweak and see the results. <?php //First thing to note, you only need to get and save off column names one time. $arrColNames = array('col1','col2','col3'); $strColNames = implode('.',$arrCol...
by phpRob
Thu Mar 22, 2018 1:43 pm
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

I just saw in my IDE that I had a missing semicolon.
Change this line
$strColNames = implode('.',$arrColNames)
by adding a " ; " to the end of it
$strColNames = implode('.',$arrColNames);
by phpRob
Thu Mar 22, 2018 1:13 pm
Forum: PHP coding => General
Topic: Help outputting 2 query results between 2 child elements
Replies: 11
Views: 2738

Re: Help outputting 2 query results between 2 child elements

Check this out. It should get you very close to what you need. I made variable names more meaningful so look at absolutely everything. I'd say work from this new set of code so you don't introduce errors by cutting/pasting. <?php $MEMBSS = $_GET['EXEC_CNETELIG_MEMELIG']; $data = "SELECT * FROM CNETE...
by phpRob
Thu Mar 22, 2018 5:59 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

Sorry I should add that what I said above uses PHP 7.x. If you are on a version before 7.x you need to use the isset() function and test the global array values, and then if they are "set" or at least converted to a default value of zero or something, use a numeric conversion function like floatval(...
by phpRob
Thu Mar 22, 2018 5:47 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 3077

Re: Adding 2 Variables for Total

Code: Select all

$grandTotalToRuleThemAll = floatval(($_SESSION['grandtotal'] ?? 0)) + floatval(($_POST['shipping'] ?? 0));
This, however, just silently totals them without letting you know if they are missing; if missing they are defaulted to zero.
by phpRob
Wed Mar 21, 2018 1:16 pm
Forum: PHP coding => General
Topic: Mingling PHP with HTML
Replies: 2
Views: 744

Re: Mingling PHP with HTML

Hi. That is a pretty big haystack you've given us to look at to find your needle in. You should on your own try to use a process of elimination and see why the script is not running. Cut everything down to its essence--bare bones. A simple echo statement instead of the whole script can temporarily s...
by phpRob
Wed Mar 21, 2018 4:22 am
Forum: PHP coding => General
Topic: Truncated incorrect DOUBLE value
Replies: 3
Views: 852

Re: Truncated incorrect DOUBLE value

I've seen errors like this. Check out this link related to the error: https://bugs.mysql.com/bug.php?id=63112 But before that you can also consider the following... It could be possible that column ad_id is not a string column but a numeric column; looks like it has been (via a bug) resolved to an e...
by phpRob
Tue Mar 20, 2018 10:22 am
Forum: PHP General
Topic: Saving text into array into a file
Replies: 3
Views: 1076

Re: Saving text into array into a file

600 posts for hyper with that! congrats and always glad to see what hyper has to say. And in this case, I second what hyper says. Familiarize yourself with those links as they are key. And if you don't get them, google and read until you get them. That is your ticket.
by phpRob
Tue Mar 20, 2018 4:44 am
Forum: PHP coding => General
Topic: When I should use static classes or methods ?
Replies: 2
Views: 599

Re: When I should use static classes or methods ?

There is no such thing as a static class. Just static methods and properties. I use abstract classes that are full of (and only have) static methods that serve as utility functions. This is a common practice. No instantiation of object needed; no dependencies on instances. Just call as needed from a...
by phpRob
Tue Mar 20, 2018 4:33 am
Forum: PHP coding => General
Topic: What is the difference between Abstract and Interface ?
Replies: 4
Views: 995

Re: What is the difference between Abstract and Interface ?

I think he was asking about abstract method vs interface method and not abstract classes vs interfaces, but I definitely like your answer and it is relevant regardless of what he meant.
by phpRob
Mon Mar 19, 2018 12:34 pm
Forum: PHP coding => General
Topic: mPDF Error: Doesn´t work on Server
Replies: 8
Views: 1471

Re: mPDF Error: Doesn´t work on Server

One thing is to be sure to not get tripped up on paths on the server vs on your local machine. The permissions errors could have you distracted from a path issue. Needed paths could be different. Relative paths are best, but you must make them work both on server and on local machine at least this h...
by phpRob
Mon Mar 19, 2018 12:28 pm
Forum: PHP coding => General
Topic: Quotations surrounding variable
Replies: 8
Views: 1043

Re: Quotations surrounding variable

I've spent my share of time grappling with these things also. After much studying and trial and error and just what seems to work best is the use of php function "htmlentities" ( http://php.net/manual/en/function.htmlentities.php ) I use it for everything going to the browser. echo '<div>' . htmlent...
by phpRob
Mon Mar 19, 2018 12:07 pm
Forum: PHP coding => General
Topic: Quotations surrounding variable
Replies: 8
Views: 1043

Re: Quotations surrounding variable

Okay, but also, think about if you really need function stripslashes because I am unclear about why you think you need it. If you know you need it, then fine; just make sure you know how the function works and then also get a solid understanding about escaping strings in php. You will be fine then.
by phpRob
Mon Mar 19, 2018 11:06 am
Forum: PHP coding => General
Topic: Quotations surrounding variable
Replies: 8
Views: 1043

Re: Quotations surrounding variable

Two points for you. One I should have shared my first response to you. Please read about php "interpolation". When a string is wrapped in double-quotes, php replaces all variables in the string and returns the result, NOT including the double-quotes you wrapped the string with. If you want to end up...
by phpRob
Mon Mar 19, 2018 9:51 am
Forum: PHP coding => General
Topic: Quotations surrounding variable
Replies: 8
Views: 1043

Re: Quotations surrounding variable

Change from
<? echo "$_POST[name]"; ?></p>
to

Code: Select all

<? echo '"' . $_POST[name] . '"'; ?></p>
or
<? echo "\"$_POST[name]\""; ?></p>
or
<? echo "'$_POST[name]'"; ?></p>
or
<? echo '\'' . $_POST[name] . '\''; ?></p>
by phpRob
Sun Mar 18, 2018 1:19 pm
Forum: PHP coding => General
Topic: IF statement not working
Replies: 3
Views: 651

Re: IF statement not working

No problem, glad to help, and I totally get it--we all need a second pair of eyes sometimes.
by phpRob
Sat Mar 17, 2018 3:35 pm
Forum: PHP General
Topic: Want to read and edit MS documents like excel and word without download
Replies: 3
Views: 831

Re: Want to read and edit MS documents like excel and word without download

I would suggest to not even think in terms of storing your data in MS documents. Store your data in a database or even a text file or json file or xml file and then when the need arises, build and make available an MS file that the user can save to their machine (or print, etc). Treat the MS file as...