-
Posts
4,704 -
Joined
-
Last visited
-
Days Won
179
Everything posted by kicken
-
If you select fields that you are not using, then it requires a bunch of extra processing and memory that may not be necessary if you limit the selection to only fields you need. The more you select, the more work mysql has to do in order to locate the data and pull it out of the database initially, then your result set is larger and requires more time and memory to transfer from mysql to your PHP script. So by listing out only the fields you need your scripts would likely work quicker w/ less memory, and having the fields listed also provides some implicit documentation about what fields the script uses and what their names are (so you dont have to reference the db table structure when you work on the script in the future). It will work fine, you can have non-parameterized values along with parameterized values in the same query if you want. Constant values like the 1 in that query should just be left as it is and not converted to a parameter.
-
Having a negative crop setting doesn't make sense to me. Your crop rectangle should be within the bounds of the original image's size. The top should be between 0 and the original height, and the left should be between 0 and the original width. If I am mis-understanding what it is you are attempting to do, you'll need to explain better, possibly with a visual aid.
-
Compiling PHP for Windows - Linking Error
kicken replied to street9009's topic in PHP Installation and Configuration
I've never tried compiling PHP on windows before, so I can't be of too much help but one thing I do know is that the php_mssql extension is old and no longer maintained. If your trying to compile anything newer than PHP 5.2.x it may just be that the extension is no longer compatible. It was officially removed in PHP 5.3. You should be using the SQLSRV extension instead for modern PHP versions. -
Sure, it is fine. A lot of apps will route all requests through a single .php file (known as a router) or will have a common .php file that is included at the top of every script. These common php files are where the session_start() (and other initilization type stuff) happens usually so it will happen on every request, regardless of whether the resources being initialized are actually needed for that request or not. Starting a session (or connecting to a DB) is generally needed more often than not in apps that use them so it is convinent to have them initialized in a common location somewhere. The overhead of intializing them is generally small enough that it is not worth worrying about trying to skip them for a few odd pages that may not need them.
-
var someElement = document.getElementById('element'); someElement.value = 'some data'; That is the vanilla JS equivilent (excluding error checking) of the jQuery code var someElement = $('#element'); someElement.val('some data');
-
Greater than Less Than - Not working... IF statements.
kicken replied to loren646's topic in PHP Coding Help
= is the assignment operator. It assigns the value on the right to the variable on the left. If to you want to compare the values, you need to use the equal comparison operator, which is == (two equal signs). -
MaxMind GeoIP City on MySQL database has stopped working?
kicken replied to MrTIMarshall's topic in MySQL Help
I would say most likely the problem is just that the IP you are using to access the site at the time when it is blank does not exist in the version of the database you have. Have you tried looking up the IP manually using something like PHPMyAdmin to see if it exists? -
-
For the latest SQL Server (2012) they did add an equivilant of mysql's LIMIT feature. It looks like: SELECT * FROM blah ORDER BY someField OFFSET X ROWS FETCH NEXT Y ROWS ONLY For older versions of SQL server, you have to do a few sub-queries using TOP to emulate it. Looks something like this:SELECT * FROM ( SELECT TOP Y * FROM ( SELECT TOP X+Y * FROM blah ORDER BY someField ASC ) t1 ORDER BY someField DESC ) t2 ORDER BY someField ASC Top X+Y means you have to do the sum of your # of desired records and the offset. So if you wanted to start at record 100 and get 10 records, the TOP X+Y would be 'TOP 110'
-
We'd have to know more details about the api to be of any use really. What you've provide is not much to go on. From the sounds of it you probably need to wrap your socket_accept in a loop to keep accepting new connections. while ($client=socket_accept($sock)){ //... process data ... socket_close($client); }
-
max_input_vars Yes, there is a configurable limit on how much data PHP will accept. The default is 1000 but yours may be lowered. Note that despite the manual saying This limit applies only to each nesting level of a multi-dimensional input array.", the limit is actually an overall total, not a per-array-level total.
-
There ya go. Complex, hard to understand, and in complete violation of the KISS principal, just like you ordered.
-
According to the docs you quoted, the parameters are QuoteID, URL and Secret, but you are giving it quote_id, URL, Secret. Notice the difference?
-
Is $filelocation a local file, or a remote URL? Based on the naming, I am guessing the latter. Can you be more descriptive of how exactly the script fails? Does it end the download prematurely? Are there any PHP error messages if you look at the downloaded file in a text editor? Does the download not start at all? Also you shouldn't have the \n at the end of your header() lines. Try increasing the timeout using set_time_limit
-
Most likely explanation: You're requesting the page twice.
-
Look at the Exception class in the manual. There are various methods available for getting the property data.
-
How can I use isset() to solve this Undefined Offset error?
kicken replied to PHP_Idiot's topic in PHP Coding Help
$arr[] = $r + array_fill_keys(range(1,,null); The array_fill_keys bit will generate an array with indexes 1-8 and their values set to null. Then $r gets union'ed with that array so any of the entries missing from $r will be filled with the null values from the generated array. The result is the value stored in $arr will always have keys 1-8 set either with what was contained in $r, or NULL if the entry was missing. -
using Prepared Statement's to Insert data into a Database
kicken replied to chinds's topic in PHP Coding Help
You are not using prepared statements properly for your INSERT query. You need to use placeholders instead of the variables for the values, then bind the variables using bind_param. Same as you did with the above SELECT statement. -
You have seen the error: It "goes away" because you told PHP to ignore it, not because you fixed it. You still have the error, you just told PHP you don't care. That's the exact same logic as if you had a broken window in your house and you just hung a painting over it to "fix it", then in the winter you complain because the inside of your house is freezing cold when you obviously "fixed" the broken window.
-
How does PHP store data in RAM..? Variables, output, passwords etc..?
kicken replied to KingNeil's topic in PHP Coding Help
PHP does not provide the necessary tools to ensure you remove data from RAM. The only way to ensure a piece of data is removed is to re-write that memory location with a new value. With PHP re-writing a variable would most likely just allocate a new memory slot while leaving the old one intact (just unreferenced). For that level of control you need to use different language. C or C++ for example would let you re-write the memory where a value is stored. An alternative would be to develop an extension to PHP that offers a secure-erase function. There might be one that I don't know about, you could try doing some research. -
You need to join to the species table in order to gain access to the name column. SELECT angler ,team_id ,dt.species_id ,length ,image ,yyyy ,mm ,dd FROM submit join (SELECT species_id, max(length) as mlength FROM submit WHERE submit.region_id = 1 GROUP BY species_id ) dt ON (submit.species_id,submit.length) = (dt.species_id,dt.mlength) INNER JOIN species ON species.species_id=submit.species_id WHERE submit.region_id = 1 ORDER BY species.species_name
-
If you are interesting in the first two letters specifically rather than GB appearing anywhere in the string, then use substr. if (substr($_attributeSelection['backp1'], 0, 2)=='GB'){ }
-
Conversion is mostly complete. (larger photo) Right now it's standing at about 35 inches high, I should try and raise it another 4-6 inches though. Right now when I use the mouse my hand ends up odd angle which is uncomfortable. The keyboard is not so bad but it should be up a bit higher also I think. For now I'm just going to stick a few thick books under the mouse, at some point I'll try and set the desk on something probably. Only had a couple issues setting it up. My keyboard's coord is not long enough to reach the computer now, so I had to plug it into my USB hub for now. Going to grab an extension later today. My Hub's coord is short also, had to move it to the left-edge of the desk for it to reach rather than have it in the center between the monitors like I prefer. Making the change gave me a good excuse to do some much needed cleaning and wire-management down there also. Despite how messy it may look in the picture, it's way better now than it was before lol.
-
Step one would be figuring out what sort of protocol you need to implement to talk to the devices you want to control. Once you've got that all figured out, the rest is relatively easy.
-
I don't see any issues. You'll need to describe what you want it to look like vs. how it actually is appearing for you. Until you do that, nobody can really do anything for you.