Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. We understand what you want; a multidimensional array. Provide all of your code, maybe that will help?
  2. This went from being an array to being a JSON object, I'm just as confused now as I was to begin with.
  3. I do not see anywhere in your code where you actually use the $_GET['country'] variable.
  4. The plus sign (+) is used for arithmetic statements, not for concatenation like Javascript. array_slice is going to do exactly as it's name suggests.. Slice the array. If you simply want to add an array to an array, then this should work $equipo['Jugadores'] = $jugador; Still, you haven't provided enough code for an effective answer.
  5. <?php $check = 1; echo <<<JSCRIIPT function checkB4SaveForm() { var checkacct={$check}; if (checkacct==1) { var show = confirm("This account exists! Would you like to view it?"); if (show) { searchAndDeleteForm(); return false; // show the record and cancel save transaction } else { return false;"; // cancel save transaction } } } // end function JSCRIPT; ?> Try this out, for the sake of syntax and good reabability
  6. You haven't provided any code whatsoever for us to use to point out the error.
  7. What do you mean it doesn't work?
  8. SELECT substring(invW.StockCode, 1, (len(invW.StockCode) - 1)) as sStockCode , SUM(invW.QtyOnHand - invW.QtyAllocated) AS 'Value' FROM SysproCompanyJ.dbo.InvWarehouse as invW WHERE invW.QtyOnHand > '0' And Warehouse = 'SW' GROUP BY substring(invW.StockCode, 1, (len(invW.StockCode) - 1)) HAVING SUM(invW.QtyOnHand - invW.QtyAllocated) > 0 Untested.
  9. True.. I guess I'm used to the mysql errors rather than mysqli, mysql would throw a non-boolean error.
  10. You get this notice because $row is not defined.. By this I mean, it is ONLY defined in your IF statement and no where else, put $row=null; above your if statement and your notice will be gone. The 'm' would throw an SQL error, not a PHP Notice.
  11. Read up on Nested Sets, that seems to be what you're after. I must sleep now. http://www.evanpetersen.com/item/nested-sets.html http://www.slideshare.net/billkarwin/models-for-hierarchical-data
  12. You should never store aggregate/calculated data in a table like that, it's an absolute waste of space and energy. Imagine your elder sent you to the store to get groceries and handed you 100 dollars. Also imagine that you must go to multiple stores to pick everything up, plus you may need gas money, and you might even want a bottle water too. Would you continue to calculate what you have spent after every transaction? Would you seriously want to continue adding the totals of the receipts and writing down the sum every time? When you go to pay the cashier(s), are you planning to pull all of those receipts out of your pocket, add them up and see whether or not it is greater than 100? Or, would you simply count what money you have left in your pocket? The quickest possible way would be the latter. Storing your total_replies would be known as storing duplicate and redundant data. Every time a reply is made, you will have to run one extra unnecessary query to update total_replies. Furthermore, you logic for the post_id to reply_to does not make sense. According to your data, Post ID 1 is a reply to Post ID 1 and that cannot be. That would be like saying you are your own parent; that your mother and father are literally yourself. In order to do what you are describing would require an endless amount of self joins, if I'm not mistaken. Ideally, the post_id should be a primary key that auto increments. Your next column would be the thread id. and you could query like so SELECT p.post_id from posts p inner join threads t on t.thread_id = p.thread_id where p.thread_id = XWhere X would be, of course, the thread id. This would give you a table of posts inside thread X. And since your post_id is auto incremented, you can assume that the lowest post_id returned from the above query is the first post in that thread. So you could safely add an ORDER BY p.post_id to receive a list of posts for thread X in ascending or descending order.
  13. What, may I ask, is holding you back from switching hosts, other than financial reasons? You are a member of a community where very detailed solutions to virtually any technical problem(s) can be found; given, of course, that you supply a just as detailed question? Shared hosting is meant to be very affordable, and you definitely get what you pay for. You can't buy a Geo and expect it to run like a Ferrari. I have used GoDaddy as a registrar ever since I can remember buying my first domain name, way back in the 90s. I have also used OpenSRS and PipeDNS, but in the end I find that GoDaddy supplies me with the best user interface for my domain administration needs and that is why they are so revered. When you see a commercial of theirs, hardly ever will you hear them hawking hosting plans. Even though they could easily paint a picture of a hosting plan and its prices onto Danica Patrick and still make sales, they aren't. Domains are their forte, it's plastered all over their pages just as Danica was erotically painted on camera. For around 200 bucks an account with justhost, or bluehost or anyotherhost.com can be purchased; and that's for a one year lease. For 20 bucks you can have a host up, running, and accessible for a month. They even offer free domains names, which you will not need since you're already with godaddy. Yeah, a FREE domain may seem enticing, but you would end up with a sub-par, poor quality, domain name management system. At that point you will have realized that Godaddy is a better place for your domains, and it will cost you fifty dollars or more to have that domain transferred to your Godaddy account. This is how I have experience with OpenSRS and PipeDNS, I took the bait and grabbed a FREE domain, which is only like a dollar (and some change) every month. So when you say that the income is not there yet, I don't believe you. Unless you're living off free wifi, a free laptop scored by a successful dumpster dive, potatoes and water, there's no good reason you can't afford the switch. Packup/Backup your entire site and database and copy it to your new host. It's not like switching apartments. So long as your godaddy account is not expired, all of your data will ideally be on both hosts until you let your GD account expire, or you physically delete them. Until you change the nameservers on your domain, the new host will act as a development server. When you run into technical problems, PHPF and all of the rest of the free Web Dev Help communities that exist are going to be there for you, given, of course, your construct a clear question. Yea, being a consumer has it's downsides at times as far as power and control go. Every financial institution has some sort of contract with their preferred software company making them consumers as well, passing all the savings and heartache of commercial software onto you as you struggle to understand how to transfer $2.52 to your checking account for that check floated for a double cheeseburger. I promise you, once you switch to an actual host that doesn't spend most of its earnings on models, extremely gorgeous ones at that, who can seduct you into buying yourfullname.com just in spite of your dream of seeing it on her body; as though you were living vicariously through your domain name, you will have more of a stress-free experience with your website.
  14. You need to make sure that $_GET['username'] contains exactly what you're looking for before you query the database. echo it out, alert it, whatever you feel like doing. Also, it might not hurt to add the word 'username' or 'user' or the letter u in front of the usernames... for instance RewriteRule ^u/([-a-zA-Z0-9_\.]+)$ userprofile.php?username=$1 That should match http://domain.com/u/the.rocker
  15. I use ZPanel. It's free and has pretty much everything I need without having to shell out hundreds for something like CPanel.
  16. In my eyes, Godaddy is just a registrar (a place to buy and manage domain names).. When I look for hosting I got somewhere where hosting is their main business. Whenever I see a Godaddy commercial, I see that really hot chick talking about the new deals on .COM domains, not hosting. There is a thread somewhere that has a list of good hosts. I enjoy linode, but only for large scale projects...otherwise, I usually got with justhost.com or webhostingpad.com
  17. Going back to the initial problem you mentioned in your OP. This problem can easily be solved by adding a $id = null; into your else statement. That is only one reason though why it is ruining your query. You where statement should be in a separate variable if you intend to collect all records at some point. instead of, or along with $id, you should have a variable called $where, that contains a string like this WHERE id = $id and give it a value of null when you don't need it as I explained in the beginning. So you query will look something like this instead SELECT blah.* FROM someTable $where
  18. Here is an excellent tutorial on exactly what you're looking for. http://net.tutsplus.com/tutorials/other/a-deeper-look-at-mod_rewrite-for-apache/
  19. If there was ever a correct way to necro a thread, I would have to say you nailed it CV.
  20. $array = array('one' => 'one'); $array= json_encode($array); $array= json_decode($array); All this does is create and array, encode it, and decode it. In other words, you are turning it into a sendable format, then changing it back to an array. Completely anti-productive if you ask me.
  21. if($balanceQ->fetch_assoc()['balance'] >= 0){
  22. Experiment first, ask questions later. It's like asking someone the best way to hold your breath underwater; you will never know for sure unless you get in the water yourself.
  23. foreach ($animals as $word){ if($word == "chicken") echo '' $animals[2] ''; else echo $word; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.