ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
slide show fails when i change 'name' tag to 'id' so it is validated
ManiacDan replied to jasonc's topic in Javascript Help
Just give it an ID as well as a name if it's that important to you that it validates 100% -
One very simple question about php and decimals
ManiacDan replied to eleos's topic in PHP Coding Help
Mage::helper('checkout')->formatPrice($this->getSubtotal()) That function returns a formatted string. You cannot re-format a formatted string. You'll have to add the decimal place definition to the formatPrice() function. I bet it already has one, actually. -
One very simple question about php and decimals
ManiacDan replied to eleos's topic in PHP Coding Help
number_format() is a function. Functions require that you surround their arguments in parentheses. Also, "doesn't work" in this case is a very explicit error message. Either you don't have errors turned on or you're not telling us what they are. Both would be mistakes. <?php echo number_format( Mage::helper('checkout')->formatPrice($this->getSubtotal()), 2 ); ?> -
If each class has its own functionality, you have to keep them as separate classes. You could do the array thing, but that would require an extra database query on every page load, which might be costly if you have large traffic stats.
-
Write a "class maker." Give it a database table. The script issues a SHOW CREATE TABLE for that table, and parses the output. Print out properly-formatted PHP code to the screen, then copy and paste into your favorite editor.
-
You can also have it accept a database tablename and parse its own fields from the db, but that will require a query which may be unnecessary if these tables rarely change.
-
Also, this is pretty slick.
-
Works for me, even with constants up to 5 as the second argument. Copy and paste your code from HERE back into your actual code and try it again. Maybe you're namespaced weird or there's some non-english character somehow. Copying and pasting works for me. -Dan
-
You have to edit the template if you want the username to remain in the box. This is what you need to do: 1) Somewhere in this code you gave is the case in which the password is wrong. You should be able to find that, since it's the case you said you were working on. 2) Inside of that case, you re-display the login form somehow. Find that. 3) $tpl->assign() is the method your code uses to assign PHP variable content to the template. Use $tpl->assign() to assign the username to a variable for the template. 4) Inside the template file is an <input /> tag that the user uses to input their username. Find it. 5) Insert template code such that, if the variable for their username is set, the <input /> tag gets a "value" attribute which contains the variable you assigned to the template. Without your template code or a working knowledge of Dutch that's all I can really give you.
-
When there is an error, $tpl->assign() their username to a template variable. Then in your template, if that username variable is set, use it as the value for the input.
-
the PHP keyword 'continue' skips to the next iteration of a loop.
-
$row=""; $row.=mysql_fetch_array($results, MYSQL_BOTH); These two lines will make $row into a string that just says "Array" foreach($row as $row_result ){ WHen you give a string to foreach, it throws that error. You want to use $results directly in your foreach: foreach ( $results as $row ) {
-
You might be trying to sort strings as though they were numbers. If you're getting: 1 10 11 2 20 21 Then you've set up your table wrong, those are numbers, not strings. -Dan
-
Make use of flags. Make a variable called "insideAStringOfZeroes." Set it to true at the end of the loop when you hit a zero, set it to false when you hit a 1. You can then check to see if you're inside a string of zeroes or 1s.
-
Doesn't matter who paid for it, you didn't pay for the right to publish it. Buying Seinfeld on DVD doesn't let you email copies to your friends. Anyway, copyright matters aside, this task is above your skill level.
-
As a side note, PHP scripts do not correspond 1:1 with the resulting HTML. Thinking that lines 3-12 of your PHP script will make lines 3-12 of your HTML output means you need a lot more help than we can provide.
-
We cannot help you with copyrighted code. You paid for this, call the company you paid and ask them for help. Posting the code like you just did is illegal in the US and in most other countries. I am not a lawyer, but I'd recommend against doing that again. And if you were about to say "but I didn't pay for the code," save yourself the trouble of being banned and don't say it. This code costs money. Pay for it, and they'll be happy to give you tech support.
-
Couting how many records have the same id.
ManiacDan replied to son.of.the.morning's topic in PHP Coding Help
You're* Thread closed. -
Then maybe you want a left join. Or you could provide the two things I asked for last time. I'm going to go ahead and ignore this thread from now on. It really isn't that hard to copy/paste the results of your query and I'm not getting paid to beg you for the information I need to help you.
-
Couting how many records have the same id.
ManiacDan replied to son.of.the.morning's topic in PHP Coding Help
Honestly, if you really were sorry, you would have fixed them. Read how to write a smart question. You were asked to clarify 3 times and you refused. That's not a "haha sorry" situation. -
There are hundreds of ways for a PHP script to display HTML. Maybe it's mixed in. Maybe it's in an external template file. Maybe it's at the bottom and you just didn't scroll far enough. We can't help very much without seeing the site. Who wrote it? How come you can't ask them?
-
Couting how many records have the same id.
ManiacDan replied to son.of.the.morning's topic in PHP Coding Help
Good thing you actually showed us the error, otherwise we'd be grasping blind! Hint: how is your code different from the code you were provided? (Double hint: there's two key differences) -
Not 3 hours later, no. Don't bump your threads, it's against the rules.
-
Couting how many records have the same id.
ManiacDan replied to son.of.the.morning's topic in PHP Coding Help
SELECT COUNT(*) FROM yourTable WHERE category_id = 4; Unless of course you mean something else, the sentence you said has four possible interpretations, I chose the easiest one because I'm not done with my coffee yet. Show data, and show the kind of result you're looking for.