-
Posts
15,230 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Testing the first dimension of an array for arrays
requinix replied to youngstorm's topic in PHP Coding Help
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); -
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?
-
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.
-
What's str_get_html()? How about just calling $doc->loadHTML()?
-
RewriteRule ^*$ site.php?s=$1 [L] That's not quite what I wrote.
-
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...
-
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.
-
Cant seem to unlink a session variable
requinix replied to bob_the _builder's topic in PHP Coding Help
What's your code? -
Converting relative path to real path in database
requinix replied to Agreaves's topic in PHP Coding Help
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. -
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]
-
And what does that number mean?
-
Have you looked for errors? print_r($_FILES['addcar_fileupload']['error']);
-
header("Content-Type: image.jpeg") not working
requinix replied to krash11554's topic in PHP Coding Help
Are you trying to output something besides the raw image data? That overallheader.php sound suspicious. Don't. Just the image. -
Little help on refactoring or simplifying my code
requinix replied to spertuit's topic in PHP Coding Help
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), ...); -
Little help on refactoring or simplifying my code
requinix replied to spertuit's topic in PHP Coding Help
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). -
Little help on refactoring or simplifying my code
requinix replied to spertuit's topic in PHP Coding Help
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. -
Keeping 2 decimal points even if they are zeros.
requinix replied to njdubois's topic in PHP Coding Help
Or you could tell Excel to format the number as you want it. -
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]
-
The array is named "types_array" but you passed "type_array".
-
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
-
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.
-
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...
-
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.
-
No. Those attributes are bad. Even inline CSS is better than those.