scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
There's nothing in jQuery called $elem, so that is probably a user-created variable, which is expected to be a jQuery object. Sounds like whatever is passing that value has broken; perhaps a selector or something. If these are external dependencies breaking (like Bootstrap), you're going to want to make sure that they are the latest version, and that they even support jQuery 2.x. Make sure that jQuery is being loaded before anything else.
-
Yes, I suppose. I would have much higher expectations if I paid for it though. I would expect high-quality code, good documentation and good support. Otherwise, why the hell am I paying for it? I was mostly talking about free/opensource stuff.
-
Your solution is fine, but I just want to point out that in HTML5 there are two new elements for accomplishing this very thing: figure and figcaption. It's not as compatible as just using div and p though, but more semantic. Here is an example: http://jsfiddle.net/tvzvzw97/
-
We're not going to search through your site to discover which parts of it are causing errors. That is your job. Post the errors that you are getting, with relevant code snippets, and then we can help.
-
So do you actually have 800 physical "page" files? If so, why?!
-
Splitting dynamic content between two printed pages
scootstah replied to adrianle's topic in PHP Coding Help
I meant print to a PDF for the purpose of showing us what it looks like. But yes, writing the output to a PDF like you say is a very viable alternative. -
Splitting dynamic content between two printed pages
scootstah replied to adrianle's topic in PHP Coding Help
Can you show us an example? Maybe print to a PDF or something? -
How to get the name attached to an id in another table mysql php
scootstah replied to bambinou1980's topic in Applications
That is what this will do. This adds the "reseller_name" column to your result set. If you want the surname, you'll have to add that column to the SELECT statement. SELECT `orders`.*, `resellers`.`reseller_name`, `resellers`.`reseller_surname` FROM `orders` INNER JOIN `resellers` ON `orders`.`resellers_id` = `resellers`.`id` WHERE `orders`.`id` = '46'; -
Okay, so what is the value of $_SESSION['user_id']?
-
Remove Script Tag if Script contains "www.example.com"
scootstah replied to rama_ritwik's topic in Regex Help
I don't have time to mess with it right now, but my approach would be to strpos() for "www.example.com" and then find the previous <script and next </script> strings from that position. You shouldn't even need regex for this. -
That's pretty strange. I would turn on RewriteLog as described here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog This will tell you the actions that Apache is taking when rewriting. Might also be helpful to post your file structure that pertains to the URL's you're trying to access.
-
What does "breaks the page" mean? And where did you turn error logging on? If it is not turned on in the php.ini itself, then certain types of fatal errors will occur before the error reporting in the code is executed - thus you won't get any errors. Make sure that error_reporting and display_errors are turned on in the php.ini, and then restart apache.
-
Then you either have 0 rows with that ID, or you have multiple rows with that ID. The conditional is checking for exactly one. So inspect the values of $customers and $customer to see what they hold.
-
How to get the name attached to an id in another table mysql php
scootstah replied to bambinou1980's topic in Applications
You're using single quotes when you should be using backticks. SELECT 'orders'.*, 'resellers'.'name'Should be:SELECT `orders`.*, `resellers`.`name` ...Single/double quotes are only for values. Backticks are used for databases, tables and columns. Backticks are completely optional though, unless you are using reserved keywords as your table/column names. -
So, you're not even going to attempt?
-
Are you able to re-create the problem in JSFiddle? I have put your code in but nothing looks wrong to me. I added red borders to identify where the boundaries of each section are. http://jsfiddle.net/zbn3pvh8/
-
Yes, just specify the path. Absolute path is the best way, but you can also go upwards in the tree relative to your script.
-
How to get the name attached to an id in another table mysql php
scootstah replied to bambinou1980's topic in Applications
You didn't provide a query. -
Google will give you an error response if a message could not be sent. You should try logging your $result from the CURL request for later analysis.
-
Yes mysql_* is deprecated and will be removed entirely in the future.
-
30k usernames, need to remove all females, is this a good way?
scootstah replied to WinterSummer's topic in PHP Coding Help
Have you tried testing such a theory to see if it works? That's a huge part of being a programmer you know. We don't just know every solution to every problem, and we don't just know if a solution will even work. We get a problem, we think about it for a bit, and we go "Huh, I wonder if this crazy ass idea might work?" And then we try it out. -
No, similar is not stealing. That's called inspiration, and you're still creating something new yourself. When I hear "clone" in the context of a web site, I think copy&paste and call it your own.
-
Reverse words in a sentence without using PHP functions
scootstah replied to Dota2's topic in PHP Coding Help
I have edited my solution with comments, hopefully this will help you understand it better. function reverseString($input) { // initialize the currentWord with an empty string $currentWord = ''; // initialize the list of words $words = array(); // loop over every character in the input string for ($i = 0; $i < strlen($input); $i++) { // check if the current character is a space if ($input[$i] == ' ') { // if the current character is a space, then we know // we have completed a word. // add the current word to the words list $words[] = $currentWord; // reset the current word, so that we can make the next one $currentWord = ''; // break the loop and continue on the next iteration continue; } // append the current character to the current word $currentWord .= $input[$i]; // if we have reached the end of the string, // we need to add the current word to the list of words. if ($i == (strlen($input) - 1)) { $words[] = $currentWord; } } // make sure that there is a list of words // just some quick error checking. if a string // was provided with only spaces, we would not have any words if (!empty($words)) { // initialize the reverse list of words $reversed = array(); // loop *BACKWARDS* over the list of words. for ($i = (count($words) - 1); $i >= 0; $i--) { // since we are starting at the end of the // words list, and moving backwards to the beginning, // by appending the current word to the reversed array, // we will end up with the opposite of $words... // or, a reversed list of the words. $reversed[] = $words[$i]; } // initialize the output string $output = ''; // loop over the reversed array and build the output string // note that we could have skipped this step, // and just build the output in the previous for() loop. // but having the reversed array may help debugging or just // enable curious inspection. foreach ($reversed as $word) { $output .= $word . ' '; } // finally, return the output. return trim($output); } }In a nutshell, this is what is happening: - Take input string, and loop over every character. - Build a string with each character until a space is reached, in which case we add that string to a list of words. - After we have fully iterated the input and built the list of words, we will loop over the list of words backwards. That means we start with the last index and move backwards towards the first index. By doing this, we can build a string or array of the words in reversed order. EDIT: And requinix's approach is basically the same, just more condensed. -
What you are asking is not even possible. You could "clone" (AKA steal) the HTML, JS, CSS, and images that you see when you view the page, but you are only getting the static content that is generated by the backend. You cannot download the backend code unless you have physical access to it.
-
And then, never use <? or <?= again. That is by far the stupidest decision the PHP team has ever made.