Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. array_shift array_pop unset array()?
  2. Use a shell script with rsync or scp to transfer from server to server.
  3. View -> Show Line Numbers But copying from netbeans shouldn't copy the line numbers, but yea, that should turn them off long enough for you to copy.
  4. Using string concatenation ( .= ) $string = ''; foreach ($_POST['test'] as $test){ $string .= "This is a '" . $test . "'"; } echo "Hello $string";
  5. Just to make a point, maybe it will stick w00t another full quote!
  6. You are mixing up your quotes, you need to stay consistent, either use single or doubles. You only need 1 set of quotes. I would suggest looking at PHP's Basic Syntax before you venture further on, as this is programming 101.
  7. AyKay, you might be mis-understanding his intentions. And no, I fully understand the heredoc syntax everything I wrote there was what I meant from my understanding. To me, it seems that he does not want the variables parsed, instead he wants a full php code to store in a file, IE write to file. Either or, I outlined how to fix it if that was not what he wanted with the brackets {}. But yea, given the context, I do not think he wants the variables to be parsed. I could be wrong, but that is just how I took this code.
  8. The issue is going to lie within the file.doc. Instead of doing a location redirect, why not just use headers and readfile to deliver the file from the php page? That way the headers work, the file is delivered without being cached and it is a win / win. The other option, if you are using apache with mod_header is to set the .doc extension to not be cached, which would also prevent it from being cached.
  9. You need to escape any "$" you do not want to be parsed and arrays with associative indexes need be surrounded in {} if you want them to be parsed and not cause an error: $stringData2 = <<<EOF <?php \$name_first = \$_POST['name_first']; \$name_last = \$_POST['name_last']; \$phone = \$_POST['phone']; \$email = \$_POST['email']; \$message2 = 'First Name: " . \$name_first . " \n Last Name: " . \$name_last . " \n Phone: " . \$phone . " \n Email: " . \$email . "'; \$to = '" . \$receive_email . "'; \$subject = 'Registration to " . \$company_name . "'; \$message = \$message2; \$from = '" . \$receive_email . "'; \$headers = 'From:' . \$from; mail(\$to,\$subject,\$message,\$headers); echo 'Mail Sent. Click <a href="register.php">here</a> to go back!'; ?> EOF;
  10. Using the header function, you can tell the browser not to cache it, for some information on that: http://lab.artlung.com/anti-cache/ The code to do it in PHP: <?php Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); ?> Not sure why the above site posted that with short_open tags assumed to be on, I would use the version I just pasted here over that as an fyi.
  11. I ran the same test, and I only get 1 error stating the exact line under where it is at. I am confused as to what you are getting at with the error message. Can you post the full context of the code (Without line numbers preferably) so we can run exactly what you are running and see what you are seeing? Just giving us a function without the real context, does not help us figure out what you are talking about.
  12. This just made me cry a little, first he posts an absurdly long post, without code tags to break it down and make it formatted a bit better and then you quote it. *premiso is ashamed and crawls into a hole to try and easy the shame. Sorry about that, the link givin is to the wrong database. I updated my actual php without updating this one the real link is http://hiscore.runescape.com/index_lite.ws?player=69b which would still imply that 51 is the correct interger. let me make a few modifications to my php, and update the image. Edit: i tried with 51 and didnt float the numbers, and nothing.
  13. Order of operations, you need to use parenthesis. SELECT * FROM SA_CUST_ITEM_CLS WHERE (ITEM_CLASS = 'YKP' or ITEM_CLASS = 'YKU' or ITEM_CLASS = 'YKT') AND CUSTOMER_NUM='1592' The reason is, the customer_num is only associated to the last ITEM_CLASS code, YKT, and it will pull all the other items with YKU / YKP as they are not associated to a customer number. Using the Parenthesis it groups them up. You could also have used the IN() function. SELECT * FROM SA_CUST_ITEM_CLS WHERE ITEM_CLASS IN('YKP', 'YKU', 'YKT') AND CUSTOMER_NUM='1592'
  14. What you are going to want to use is called "Push Technology". There is a plugin / tutorial if you want to use jQuery to do this here: http://www.leggetter.co.uk/2010/06/16/jquery-real-time-push-kwwika-plugin-v0-1-released.html
  15. There are ways to do it all crazy and with some cool functions, but why not just do it the old fashioned way: header("Location: {$_SERVER['PHP_SELF']}?c={$_GET['c']}&tab={$_GET['tab']}"); Since you know the two you want, I would just do that, as the order could even potentially change, this way you know that the right values are getting passed in.
  16. Did you take a look at the link I posted? It is just a function that you can copy and paste and it will work.
  17. Both URL's look valid. Why are you getting a page error? What page error are you getting? Does it not like the extra variables to be passed through? Need a bit more information.
  18. I thought this was only true if the allow_url_fopen were turned off. Just did a test, looks like you are right Either or, I would do it with cURL Check here for a function that should do what you want: http://php.net/manual/en/function.file-exists.php#85246
  19. Your database character set needs to be UTF8, as well as the tables character set, as well as the page that the data is being input from and output on. Universal charset is the key. Somewhere along the line, probably the tables in the database, the charset is different.
  20. If the html is valid, you can use simplexml to load the data and loop through it and pull it out. It can be a bit tricky, but the man page should help. If the HTML is not valid, then a form of preg_match will be your next step to scrape the data. And finally you would use some form of mysql_query to insert the retrieved data into a database. If you show the code that you attempted to do this with a few weeks ago, it will help motivate people to give you some bigger pushes in the right direction. You will notice that since the posting of that w3schools has actually gone through and update the content. It is not nearly as bad as it used to be.
  21. My usage was messed up: $userData = new get_user_data(1); Also in the get_un function, you need to change $this->var to be $this->_var
  22. I guess I need to do a bit more reading.
  23. You are confusing LIKE with REGEX, LIKE uses a simple wildcard, %. That is it. If you want to be more definitive in your selection, MySQL has a REGEX method. Which would be able to do what you want. If you do not have REGEX in your version of MySQL, you will be stuck with using multiple likes for each letter you want to test against (unless I am missing some unknown function to me).
  24. Yes, with using explode and end $path = trim($path, '/'); // remove any trailing slashes $path = explode('/', $path); $last = end($path); echo $last; Should do it.
  25. What isn't wrong? You really need to read up on the class syntax. // Usage: $userData = get_user_data(1); echo $userData->get_un(); class get_user_data { private $_var; public __construct($id) { $id = (int)$id; $query = "SELECT * FROM users WHERE id = {$id} LIMIT 1"; $result = mysql_query($query) or trigger_error('Query Failed: ' . mysql_error()); $this->_var = mysql_fetch_object($result); } public function get_id(){ return $this->_var->id; } public function get_un(){ return $this->var->username; } } Should get you started.
×
×
  • 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.