Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. Is your storage engine set to InnoDB? For the commands to set it up yourself (run in navicat query window) see :here:
  2. When building SQL statement strings to use bound variables you either need to set the parameter marker by name using a preface of a colon or numerically using question marks as placeholders. e.g. named. $sql = <<<QUERY_STRING SELECT col1, col2, col3 col4 FROM table1 WHERE param1 = :var QUERY_STRING; ... $stmt->bindParam(':var', $variable, PDO::PARAM_INT); // change third part to suit parameter type numerical. $sql = <<<MY_QUERY SELECT col1, col2, col3, col4 FROM table1 WHERE param1 = ? MY_QUERY; ... $stmt->bindParam(1, $var, PDO::PARAM_INT); // again, change third part to suit parameter type.
  3. pretty much the only way to do it is to use the API provided by paypal and/or your financial organisations online card processing system that is attached to your online merchant identity.
  4. It sounds a lot like it's not catching the hook to your MMO. I don't think there is any specific fault in the PHP. Although the best test would be to just make a bat file that outputs the contents directly to a text file like this: @echo off echo %* > C:\users\%username%\Desktop\test.txt echo "Write Complete to C:\users\%username%\Desktop\test.txt" Edit: OK, seem to lost the second half of post. The point here is to establish where the problem lies, if it is with the PHP or with the app you are calling. calling this with your original PHP code should get you the write complete message in the browser and the test.txt file on your desktop
  5. I think you want to alter the database, rather than the script, as changing the script is likely to break things deeper in the application. Have a look through the db to see if you can establish where the blog_info('name') value is coming from and change that.
  6. Hi and welcome to phpfreaks, you have posted in the wrong section though. That said, we need a little more context on the problem. What's actually wrong with the title? should it be displaying an image or custom text? Have you tried changing the settings from within the wordpress admin pages? if so what was the result Vs what was the desired result? What exactly are you looking to change the title to?
  7. Glad it's working, but that doesn't match the error you mentioned in your last post... :-)
  8. The Sort Scan is when you load a (hopefully) indexed table into memory. it will sort that table by the relevant columns that are indexed in the table - or MySQL will take it's best guess of it's not indexed. Each time you have a sub query requesting a different subset of data from the table the system will reload the relevant subsection of the original table and reorder it to suit that request...It's one of the biggest problems with this type of query, as you can appreciate. Using joins allows MySQL to load in all columns and indexes as a mapped entity and load in aggregate subqueries as associative branches of it, rather than having to build each subqueries dataset independently and then append the results into temp tables for use in the overall query. Another issue is that each of your SELECT subqueries are nested within an overall SELECT * which is just about as bonkers as the fact that (at a glance) 10 of the subqueries are against the same table. Whoever wrote that needs not to get payed.
  9. It may be that you would be better off putting the results into an explicitly defined multidimensional array: $custResArray = array(); foreach($result as $row){ $custResArray[$row['label'][$row['cid']] = array('list'=>$row['list'], 'image_th'=>$row['image_th'], 'image'=>$row['image'], 'commant'=>$row['comment']); } this will then give you an array where the top level is label, so you can then use that as a basis of rendering things on the page: foreach($custResArray as $lbl=>$items){ echo $lbl; foreach ($items as $cid=>$item){ echo $item['list']; echo $item['image_th']; ... echo $item['comment']; } } this is just meant as an illustration, it's not supposed to work as is, but should give you what you need to work with.
  10. and what about the post field that you are checking with the empty() conditional? !empty($_POST['position-guests'] did you double check what's in that one? As it's a button rather than an input I personally would be inclined to check against !isset() rather than !empty() - that's not to say that !empty() shouldn't work, it should, I just prefer to do it that way because I'm not interested in the contents, just if it's there or not.
  11. Hi and welcome to phpfreaks. I expect there will be a few hurt feelings from your comparison to that other site - which many here dislike for reasons including, but not limited to, the one you have given. :-) We don't operate like that here, and while there is the option to like a post, it's more akin to a facebook like than an upvote. We are generally a far more altruistic community than that other place. That aside, onto the problem at hand: do you get the same behaviour using system(), exec() and passthru()? do you have access to the task manager to see if the exe is actually loading when called with PHP, and if it is, is it using the expected memory?
  12. PHP is designed as a high level scripting language for web servers. It's not really equipped for low level interaction with the server OS (what you need for robotics). For that you would want something like Python or a C derivative. That said, you can launch shell scripts and applications through PHP by using shell_exec(). It's not exactly the answer you are looking for as it's not PHP doing things with the server directly, but it does bridge the gap and let you interact with scripts that can natively engage with the OS and its applications. PHP isn't written with the tools and libraries that would be required to fully interact with a server OS directly. It knows what it is, and has a toolset based around what it was designed to do: server side scripting of web applications. There may well be third party libraries that will engage with specific aspects of specific operating systems, but that's not the core purpose - as thus not the core functionality - of the language. Languages such as Python have native controls to interact with the OS directly, Python has also got a fairly high level and pretty simplistic syntax, which is why it's the language of choice for the R-Pi: it's easy for people to pick up without needing a formal tutor. Either one way or another you are going to need to learn another language to program the robotics of your project. You are either going to have to learn how to script low level linux (or windows if you are using the Win10 IoT dev release) commands to signal the headers on the board using the installed base drivers directly, or you are going to need to get to grips with a higher level language that can interact with the drivers and abstract control of the headers into something more human friendly. Whichever route you take, you will be able to launch your scripts through PHP by using the shell_exec() function as a broker.
  13. Yeah, turns out it was the "\r\n" that fixed it. I was a bit sceptical as I would have thought that it wouldn't have returned anything (or at best a single row) with the wrong line termination in there. Just goes to show.
  14. Cheers Barand - congrats on Mod by the way, I only just realised. I kinda broke the table :/ (some perpetual locking issue caused the query to hang and then blocked further attempts) so have had to rebuild from a backup template and am re-running now. sadly I have a family matter to attend to this after-noon and this is likely going to have to hang in the air over the weekend. I will get back to you with the results (fingers crossed this will do it).
  15. The problem is that Adaptive and Responsive are somewhat intertwined. Adaptive isn't a new thing in and of itself, rather it is a refinement on the core offerings of Responsive. Try googling (or using any other search engine of choice) "RESS tutorials" instead I'm seeing plenty of results on that.
  16. So I'm trying to import 2104320 lines from a CSV into a table using the following: (some names changed to protect the guilty) LOAD DATA INFILE '/var/.../MYDATA.CSV' REPLACE INTO TABLE mydata FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (@c1,...@c107) SET stcode = @c1, ... tvalue = @c105 Problem is, it's only importing 1052160 lines. When I looked through the table I seen that relative ID fields have only got their odd number values (1,3,5,7...) so as the CSV has a row of headings, it's only loading in every second line. I have run it without the IGNORE 1 LINES and this hasn't made a difference. I have tried changing the escape character in case that was a problem - didn't help. I have also increased buffers and timeouts on the MYSQL server, that didn't help either, I have no control over the CSV as it's auto generated by third party software. As the file is created on a windows platform i'm re-running just now using line termination of '\r\n' but am not confident as I would have thought that if the line terminator was wrong I wouldn't have any lines. Anyone have any other suggestions while I wait (it takes a while as it's actually running over the network using a hardlink) - I will update once it's complete.
  17. You should really be using the Google Calendar API for this.
  18. My mommy always told me "don't accept zip's from strangers" Seriously though, post up your code (inside code tags!) and you will get a much better response.
  19. assuming @requinix is correct, I would say: Three functions that take the same parameters and do the same thing = two functions too many. Three functions that take the same parameters but do different things = three different functions that should have three unique names. Three functions that take the same parameters and do the same thing, but depend on context = use namespaces.
  20. You are loading multiple versions of the same library. This is going to cause problems. Pick one (I recommend the more recent one), run with it, and if you get any errors doing that or have any issues with code then post us the errors along with the relevant JS code from your project and we will have a look. If you're not familiar with JS debugging use the developer tools in chrome or IE by pressing F12 while in the browser or if you are on firefox download the firebug addon. This will let you see what problems are occurring and where in the scripts they are being thrown. best of luck.
  21. Yeah, you don't want to do that, you are just forcing the variables to be empty strings. I'm coming to the party a bit late here, so I may miss the mark, but I would suggest that what you want to do is wrap the SELECT and update inside an isset check on the $_GET array, so that it performs a different action depending on whither you have selected the task id or not if(!isset($_GET['task_id']){ //select goes here } else{ //update goes here unset($_GET['task_id']); } Also, I see you have been using prepared statements for the SELECT, but have chosen not to do this for the UPDATE - was there a reason for this?
  22. are you assigning a value to $q? when passing values through form input (either by ajax or normal form submission) the value is normally passed to either the $_GET or $_POST superglobals. To get the value out of that you would access it like any other associative array: $q = $_GET['q'];
  23. While you really should be using the insert rather than a select for this occasion, to elaborate more on what I said about the SELECT * : When you use the SELECT * you are returning the data from every column in the table, asides from this not being best practice for transactional or relational queries, this means that you are exposing all that data through the query. What would be safer would be to run a count query such as: SELECT COUNT(*) as nameNum FROM tableName WHERE userName = :uName This means that you are not exposing any real data from the table to the query result, then rather than checking the count of the result, just check the value: $result = $selectResult->fetchAll(PDO::FETCH_ASSOC); if($result[0]['nameNum'] === 0){ //good to go } else{ //oh dear team! } By doing this you don't pull unnecessary data out in your query and reduce risk from "man in the middle" style data sniffing as well as prevents you from having redundant data floating about your app. Its similar to only selecting the unique ID for a user when checking for login success, as that's normally all you need to reference for persistence. Hope that makes some sense, and good luck with the rest of your project
  24. There is also absolutely no reason to be using SELECT * for this, all you need is to select the count of results that come back matching the criteria. [Rule of thumb] : Never expose more information than you need to.
  25. Sound to me that there is a good chance it could be a permissions issue, Have you set and checked permissions for the offending folder? You should make sure to have both the php and httpd service accounts able to read, write and execute within that folder. It's definitely a quicker and simpler check to start with than going through the ini file. Let us know how you get on.
×
×
  • 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.