Jump to content

requinix

Administrators
  • Posts

    15,230
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. I'm not sure what you're trying to do, and the code you have doesn't help at all (why you're using an object, what that each() in arrayCount() is supposed to be for, why you use func_get_arg(0) in the constructor when you could just use a normal parameter...), so I'll just throw out $counts = array_map("count", $a1);
  2. Have you done any debugging yet? Printed out values and made sure they're right? Made sure your php.ini has error_reporting = -1 display_errors = on and looked for error messages?
  3. So can you post the code you have right now, then? What I assume you have seems right: make sure your php.ini is right for a development environment with error_reporting = -1 display_errors = on and make sure you're getting some sort of error message that we can work with.
  4. What's str_get_html()? How about just calling $doc->loadHTML()?
  5. RewriteRule ^*$ site.php?s=$1 [L] That's not quite what I wrote.
  6. Use a second JOIN right after the first one. SELECT fields FROM first table INNER JOIN second table ON condition INNER JOIN third table ON condition...
  7. Or you could just structure the HTML so that you don't need an ID. Like and CSS like .spoiler > .spoiler-content { display: none; } .spoiler.revealed > input { display: none; } .spoiler.revealed > .spoiler-content { display: block; } To answer the question, use preg_replace_callback and provide a function to do the replacing.
  8. What's your code?
  9. Do it at runtime when you need the absolute path. Storing that in the database means you have to update everything if the path ever changes.
  10. That will rewrite itself into a loop. Add a condition that the file must not exist. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ site.php?s=$1 [L]
  11. And what does that number mean?
  12. Have you looked for errors? print_r($_FILES['addcar_fileupload']['error']);
  13. Do you not understand what the problem is? What the message is trying to say?
  14. Are you trying to output something besides the raw image data? That overallheader.php sound suspicious. Don't. Just the image.
  15. It'd be nice if you could do away with one of the variables (the three being $picN, 'photoN', and $targetB), then you could use key=>value pairs. Otherwise just use a multidimensional array. $photos = array(array($pic, 'photo', $target), ...);
  16. Then definitely refactor. Stuff what you need into an array and foreach over that, like $photos = array(...); foreach ($photos as $photo) { if (...) { success } else { failure } } (and get the values you need from $photo).
  17. For just two images with the two blocks of code right next to each other, I'd just keep that. You could refactor stuff out into an array and a loop but I'm not sold on it being worth the time. Three images? Sure. More. Definitely. But just two? Meh.
  18. Or you could tell Excel to format the number as you want it.
  19. The rewriting should only occur for things that don't exist. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)$ /career-profile/index.php?l=$1 [L]
  20. The array is named "types_array" but you passed "type_array".
  21. It shouldn't... Getting a 500 probably means there was a fatal error in the script. I don't know where but there's an option to turn on and turn off that "if the script has a problem then show a 500 error" setting; doing that means you'll get to see error messages right in the browser. Otherwise take a look at Apache's error log for more information about what went wrong. Your code will probably look something like include/require files that let you connect to the database run the first query stuff run the second query maybe disconnect but it's not required
  22. Uh... the same way you'd do one query, except you have another one in there too? Don't have to duplicate the connect and close stuff, but the actual query part you'd just copy.
  23. No: that's perfectly fine. Don't underestimate how well database systems can deal with large amounts of (properly indexed and normalized) data. When I've done work like this I've ended up using cursors. Export the spreadsheet as a CSV and import that into a temporary table, then loop through a SELECT and do whatever work you need. You'll have to clean up the spreadsheet first so it looks like a proper table: duplicate values across rows and whatnot. If you're lucky you might be able to INSERT into a view that pieces together the right tables, but it depends on stuff that I haven't looked into too much. [edit] Of course, as Psycho mentioned you can do this in PHP just as well. Surprised that wasn't my first thought...
  24. Then that customization should be a feature of the software. Flags that can be turned on or off as configuration settings, if the feature is generic enough, or otherwise extensions/modules/plugins that can be maintained separately. If you haven't realized yet, you're not just making a piece of software you sell to companies: you're developing a platform (in some sense of the word). The platform should be the same for everybody - it's the customizations that make it more relevant to a particular customer.
  25. No. Those attributes are bad. Even inline CSS is better than those.
×
×
  • 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.