Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Muddy_Funster last won the day on April 25 2017

Muddy_Funster had the most liked content!

Contact Methods

  • Website URL
    http://muddy-dev.blogspot.com

Profile Information

  • Gender
    Male

Muddy_Funster's Achievements

Regular Member

Regular Member (3/5)

99

Reputation

12

Community Answers

  1. No, you can't bind column names as parameters. This is going back to what I said about maintaining dynamic where clauses.
  2. And your point is caller? The link in my sig is to a reputable blogging host, not some random zip file that could contain god knows what viruses. I don't ask anyone to click the link in my sig and it's certainly not a requirement that people do it in order for help to be provided. You're comparing apples to oranges. To be honest I had forgotten it was even there, now you have reminded me I'll probably remove it as most of the content is seriously out of date. That's Right, it is "PHP Coding Help", but you didn't post any code and your not asking for help, your asking for someone to do the work for you. The point of this forum is to provide guidance and tuition for those that have hit a block in writing their own code. Commonly those proffering help on this forum will take the time and effort to write longer posts than just the fix requires, this is because just fixing things for people isn't a long term solution. It fixes the code, but not the underlying problem that caused the code to be an issue in the fist place. If you don't want help, just code, then go try another site. If you want real help however then suck it up and do what is asked. This is all for your benefit, not ours.
  3. First post on a public forum and you're asking people to download a zip file? Sorry, I don't think so.
  4. I always find html localStorage ( https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API ) is a quick, easy (and yeah ok, kinda dirty) way to have JS persistence, sessionStorage would probably be better for your use case though.
  5. Exactly what I was going to suggest next. If the data stored isn't accurate then you should be sorting that, not trying to make a workaround for it. Also, your countdown is granular to the second and your date is only to the day. The whole field type should be changed to datetime and the insert script is what you should be looking to alter, not the display one. What do you mean? It already is, that's kinda the issue.
  6. I'm still not sure about the code you are using. var is used in JS and the $ prefix is used in php, so it looks like you are mashing the two together. What is $time? and where does it come from?
  7. add it where? in JS or in PHP?
  8. I think the issue here is really just coming from a lack of understanding the capabilities of the processes you are working with. The following is a basic representation of the processing when using a web browser: Step 01 > Server gets an http request from client Step 02 > Server runs php using any header information passed in the http request Step 02.1 > Server connect to backend storage Step 02.2 > Server retrieves data from backend storage Step 02.3 > Server processes data from backend storage Step 03 > Server finishes running php and buffers result Step 04 > Server returns result of php script to requesting client. -------------- Step 05 > Client receives the result from the server into buffer Step 06 > Client browser processes the header information in the server response Step 07 > Client browser processes client side scripting (such as javascript) stored in the header Step 08 > Client browser applies css styles to buffered page content Step 09 > Client browser renders page content to screen Step 10 > Client browser processes client side scripting in the page body Step 11 > Client Browser allows interaction with the page in the browser --------------- Step 11 > Client browser submits user data to server in form of http request Step 12 > GOTO Step 01 The first break is where the server relinquishes the data to the client - at this point php will no longer run. Thus all data the php needs to work with will need to be present BEFORE this happens. The second break is where the client would send data back to the server, all relevant data from the page that is required to go to the server must be included in the http header at this time or the server will not know anything about it. While some basic visual effects can be "programmed" into CSS, complex manipulation of DOM elements requires something a little more suited to the task. To debug the problems you are having you will need to follow your data on it's way though the process above and see at which point it's getting lost. Then you will know what side of things you need to look at: server->transport->client.
  9. <?php while($row_product1 = mysqli_fetch_assoc($result_product)){ every one of those lines is a loop, I was saying that by applying the order to the actual query you will only need one loop, not one for every value in specials.if you want a better answer ask a better question: Generaly include: 1>what are you trying to accomplish - in detail 2>what result to you get just now Specifically for this question include: 1>what order are you trying to get the products in? 2>what is stored in specials if it's not 0,1,2,3,4,5 or 9 ? 3>are you expecting to get results from the database where the specials column does not have one of the values (1,2,3,4,5,9) and if so how are you expecting to handle it? 4>what is this form element that you are trying to add supposed to do?
  10. change query string to: SELECT * FROM products WHERE NOT specials='0' AND product_publish='y' ORDER BY specials ASC then just echo out from a single loop.
  11. @mac_gyver, Just looking over that UPDATE syntax and something's bugging me - what case would cause someone to want to ORDER BY during an update? O_o
  12. Quite welcome, could you mark post as answered please if there's nothing more you need on it?
  13. ok, change the following and let us know what it gives you: $id = $db->lastInsertId('id'); becomes $id = $db->lastInsertId(); var_dump('last-insert-id = '.$id);
  14. For that scenario you would be better using the method @barand has described, that way you only need to loop through the 200 id's that you want to update, rather than having to loop through the 1000 products and then the 200 id's. assuming your 200 id's are in an array: //load in your xml element as before - going to call it $xml in this //also going to add a bit to build some of the query string to save another loop $setStr = ""; foreach($idArray as $key=>$id){ $prod = $xml->xpath("/eshop/product[id={$id}]"); $update[$id] = $prod->price; $setStr .= "\tWHEN {$id} THEN {$prod->price}\n" } that will give you an array of the prices that you want to update in the database ::Edit - changed $setStr to set both values directly as source id data feed rather than user input.
×
×
  • 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.