
optikalefx
Members-
Posts
363 -
Joined
-
Last visited
Never
Everything posted by optikalefx
-
I know this won't be possible with DOC, but it should be with DOCX. Basically I want to have someone write up a docx file using special tokens in certain places. Then my PHP would find and replace those tokens when the users needs to. It would create and serve a NEW docx file with the tokens replaced. Any ideas on this? I'm reading up on a ton of libraries, but nearly all of them, their examples don't work out of the box. Thanks!
-
Your stealing a game thats meant to run within the walls of facebook.
-
sure np. A little extra tip. For yes or no type storage, you should really use TINYINT(1) and store 1 or 0 instad of yes or no. Your database will be smaller and all your code will be simpler. Instead of checking WHERE blah ='yes' you will be able to just do WHERE blah. and if you want to display yes or no, you can do that with SELECT IF(blah,'yes','no') as blah
-
Should be easy logic: how do I store a duration in a MSQL table?
optikalefx replied to endouken's topic in MySQL Help
Seriously - just calculate the end date and store that. There is an awesome mysql date function called DATE_DIFF that you can use in all your selects to return the duration without ever going to PHP. If you REALLY wanna store duration, you need to store a concatted string. 1:Y would be 1 Year. and you can use Y from the php date functions. So in PHP you would explode(":","1:y") to get that as an array. Or just store 2 fields. Either way you should just store the end date. -
Couldn't you use IF as well? $q1 = "UPDATE Events SET HPselected = IF(ID IN ( '{$eID}', '{$eID2}', '{$eID3}'), 'yes' , 'no')";
-
replace would replace all of them. Which should be fine for your case. Paste the code you couldn't get to work.
-
Should be easy logic: how do I store a duration in a MSQL table?
optikalefx replied to endouken's topic in MySQL Help
Again don't store the duration. calculate the end date in PHP and store that. The logic is much more refined that way. -
SELECT Sales.*, otherTable.USQuantity, otherTable.USDollars, otherTable.MXQuantity, otherTable.MXDollars FROM Sales LEFT JOIN otherTable ON (Sales.Product = otherTable.Product) basically your using the Product field on both tables to JOIN those 2 tables together. Left join means i dont care if the join results in null values, just give me the row no matter what. JOIN alone (without the left) would do the same but not give you the row if the key did not exist on the other table.
-
you don't have a database named "examples". double check all your spelling.
-
Should be easy logic: how do I store a duration in a MSQL table?
optikalefx replied to endouken's topic in MySQL Help
Store the start and end date. If you want to adjust the duration, just adjust the end date. Because in reality that is what changing the duration means, it means its going to end later, or end sooner. Again using date_sub to figure out the actual duration if you want to know that specific information. -
Knowing the primary keys of each row you want to update - you can use REPLACE to do multiple Updates just like you would use INSERT to do multile inserts. REPLACE INTO table (primaryKeyColumn, col2, col3) VALUES ('primaryKeyValue','val2','val3')
-
left join is hanging but join works fine - i need null rows
optikalefx replied to optikalefx's topic in MySQL Help
Ok, can you explain why that worked? I put an index on userpermissions.UserID and now it works. So... why? -
left join is hanging but join works fine - i need null rows
optikalefx replied to optikalefx's topic in MySQL Help
Well now that i understand what its telling me - this result makes sense. It is a 1 to many relationship. Its not the left join alone that is causing the problem. Its left joining with the aggregate function like count or group by that is causing the issue. -
left join is hanging but join works fine - i need null rows
optikalefx replied to optikalefx's topic in MySQL Help
Thats odd. users is type: index key: Primary key_len:4 rows: 16016 extraL Using index: using temporary; using filesort userpermissions however has type: all key:null rows: 27000 But i have a primary key auto increment set on the table... I wonder why none is showing up here... hmm -
I have a users table, and I have a table of videos that a user has permission for. So there are many rows in the permissions table for 1 user. I want to show all user info including a count() on the number of videos for all users in 1 list. doing select * from users works fine of course. but doing select users.UserID, COUNT(userpermissions.`UserPermissionsID`) FROM users LEFT JOIN userpermissions ON (userpermissions.UserID = users.UserID) GROUP BY users.UserID LIMIT 200 hangs and never finishes. Even with a limit of 1. There are 16,000 users and 27,000 total permissions. What does work - kind of. Is doing JOIN instead of LEFT JOIN. But that obviously won't grab users that have no videos. So what can i do to make the LEFT JOIN query work? Do i have an index problem? Or are these tables too large for the left join?