Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Well this query isn't going to match any rows probably. SELECT id,firstname FROM `Members` WHERE id='%s' AND firstname='%s'
  2. Zurev has provided some really good advice -- casting to (int) is the best way to handle the integer parameter. The ereg routines only were deprecated recently, but with that said, the core of the ereg and preg_ routines are both the same -- regex. The main difference is that in the preg routines you need to add a delimitter around your regex. In his example he used the backslash, which is a common approach but you can use a different character if it suits you. Otherwise, it's not a big deal to take the regex you developed and tested and stick it inside: '/ /' Since ereg has just been deprecated, you might as well bite the bullet and familiarize yourself with the preg_ routines going forward.
  3. make a simple script that has: Navigate to this page, and look at the output, It will tell you the settings you have as well as the location of configuration files, extenstions loaded, etc. etc.
  4. The problem is probably here: //Formulate Query //This is the best way to perform an SQL query $query = mysql_query("SELECT id,firstname FROM `Members` WHERE id='%s' AND firstname='%s'"); //Perform Query $result = mysql_query($query); mysql_query returns a result. You then take that result and try and query again, passing the result as the query. //Formulate Query //This is the best way to perform an SQL query $result = mysql_query("SELECT id,firstname FROM `Members` WHERE id='%s' AND firstname='%s'"); if(!$result){ ...
  5. That strategy should work fine... just emit the
  6. I feel like this thread is going in circles. You started with a question on mechanics which I answered. I then showed you some other techniques which are useful in certain circumstances. At this point the problem you were trying to solve in the original question is now the thing that you don't like. Now that it's clear what you are really trying to do is derive some sort of "relevance" score to differentiate people in a list, I can tell you with certainty that you're on the wrong track. One other thing I feel needs to be added at this point, is that when you do a query like this: SELECT * FROM table WHERE subjects LIKE '%something%' That query can not use an index. So as an example, if your "table" has 10k rows that match city='Jaipur', every single one of those rows will have to be examined (scanned) to determine whether or not a match exists. I don't know if this is a solution or not for your application, but mysql does offer a fulltext search which does compute an internal relevance metric that can be used to order results. http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html#function_match As an alternative many people use sphinx http://sphinxsearch.com/about/sphinx/ Based on what you're actually trying to do, either of those are more likely to get you what you're trying to do, and also will provide some scalability and performance, whereas %word% queries simply can not.
  7. djscottyis, This community is not based on us being good Samaritans. It is based on developers helping less experienced developers or students to improve their expertise. Based on this thread, I have ascertained that you are out of your depth in regards to this technology and are just looking for a developer to hold your hand for you. This forum is not organized around the idea of providing free help for people who really should be employing someone, as I suggested to you previously. If I thought there was some overall beneift to continuing this thread, I might let it continue, but quite frankly anyone who is a competent PHP developer would have whatever your actual issue is, sorted out in an hour or less. I'm locking this thread, and once again, can only advise you to seek the help of a competent developer before you make matters worse for yourself by accidently screwing things up worse than they already are.
  8. 1. Yes. 2. PHP short circuits evaluation, so as soon as it is able to determine the result it will stop executing. For logical operators, it is evaluated going left to right. 2a. In order for another_function(argument 2) not be evaluated, the combination of another_function() && $compare must evaluate to true, but I'm assuming that is never the case, if another_function(argument 2) is always being run.
  9. Really what you want is a fall through rule for the 404 that follows the working rule, but otherwise broadly matches your pattern. The existing rule will match what you want, and anything else will be redirected. Trying to do a negative match is quite tricky and not really the strength of regex. In this case you what you're really saying is -I could have a valid character OR not -and some number of invalid characters -AND some valid characters OR not -etc This is probably why you're having a hard time crafting something that works.
  10. PHP has nothing specific to deal with transcoding real media video files. You could however use it as the basis for calling command line driven programs that will do the conversion.
  11. Once again you show that you don't have a clue what you're doing. That is not a screen showing you rows in the table. That would show up in the browse screen. The screen shot you attached is showing the structure of the table, where you went and added default values to the structure --- which is absolutely not what you wanted to do.
  12. Taiphoz: I got it from using firebug to look at the net connections. Probably in order to get the site to respond to your request you'll have to experiment with setting some headers. The curl library extension curl is often used for this type of thing. Here's a couple of headers in the request: Content-Type: application/x-www-form-urlencoded X-Requested-With: XMLHttpRequest Referer: http://game.worldoftanks.eu/clans/500000156/ They also might require that you have acquired a session cookie by visiting the refered page.
  13. You might want to explore this: The actual url being called in their ajax is: http://game.worldoftanks.eu/clans/500000156/members/?type=table&offset=0&limit=100&order_by=name&search=&echo=1&id=clan_members_index This returns this json which is the actual data you seek: {"request_data":{"items":[{"member_since":"19.04.2011","role":"Recruit","account_id":500516908,"name":"Ashfur"},{"member_since":"20.04.2011","role":"Recruit","account_id":500302252,"name":"Babalou"},{"member_since":"24.04.2011","role":"Recruit","account_id":500511100,"name":"Brison"},{"member_since":"05.05.2011","role":"Recruit","account_id":500623661,"name":"Brutstorm"},{"member_since":"19.04.2011","role":"Recruit","account_id":500479102,"name":"Burningwaflz"},{"member_since":"17.04.2011","role":"Recruit","account_id":500153964,"name":"captainbob"},{"member_since":"17.03.2011","role":"Recruit","account_id":500027201,"name":"Crookshanks"},{"member_since":"08.05.2011","role":"Recruit","account_id":500407454,"name":"Dalen"},{"member_since":"13.04.2011","role":"Recruit","account_id":500494914,"name":"Darazun"},{"member_since":"08.05.2011","role":"Recruit","account_id":500473624,"name":"dourdog"},{"member_since":"15.03.2011","role":"Commander","account_id":500022488,"name":"Dvalin"},{"member_since":"16.03.2011","role":"Recruit","account_id":500058767,"name":"DyslexAcon"},{"member_since":"27.04.2011","role":"Recruit","account_id":500569624,"name":"frakkedup"},{"member_since":"16.04.2011","role":"Recruit","account_id":500397254,"name":"guardsmanlee"},{"member_since":"17.04.2011","role":"Recruit","account_id":500210482,"name":"He11Bringer"},{"member_since":"22.04.2011","role":"Recruit","account_id":500517696,"name":"horror"},{"member_since":"20.04.2011","role":"Recruit","account_id":500061931,"name":"Janoowawawa"},{"member_since":"22.04.2011","role":"Recruit","account_id":500030603,"name":"jazeera"},{"member_since":"09.05.2011","role":"Recruit","account_id":500348886,"name":"Kinglewis"},{"member_since":"15.04.2011","role":"Recruit","account_id":500071210,"name":"M3ssi"},{"member_since":"01.04.2011","role":"Recruit","account_id":500024655,"name":"MISGUIDED"},{"member_since":"16.04.2011","role":"Recruit","account_id":500162520,"name":"mixiarse"},{"member_since":"18.04.2011","role":"Recruit","account_id":500526022,"name":"MortisLock"},{"member_since":"06.05.2011","role":"Recruit","account_id":500497558,"name":"ninjagordy"},{"member_since":"20.04.2011","role":"Recruit","account_id":500298061,"name":"pastykiller"},{"member_since":"21.04.2011","role":"Recruit","account_id":500086666,"name":"purazz"},{"member_since":"17.04.2011","role":"Recruit","account_id":500510102,"name":"RB26DETT_CZ"},{"member_since":"16.03.2011","role":"Recruit","account_id":500027254,"name":"remmster"},{"member_since":"16.04.2011","role":"Recruit","account_id":500399768,"name":"Tomasu41"},{"member_since":"08.05.2011","role":"Recruit","account_id":500635276,"name":"Whoepsie"}],"total_count":30,"filtered_count":30,"offset":0,"echo":1},"result":"success"}
  14. -write a function and put the code that sets your session variables upon login. You should call this function after login or after the LoginCookie matches, so that you are sure you're doing the exact same thing in both cases. -I don't see you redirecting to where the user should be after a successful login. -why would you want to allow people to login multiple time from multiple different pc's? You could accomodate that, but at the cost of a substantial increase in complexity. Is that a use case you really want/need to support?
  15. So you have a seperate umpires table? Does the current ump1..umpN columns have names in there? If so what you'll need to do is do a query for each umpire to see if they are already in the umpire table, and if so, get the row, so you have their umpire_id to store in the scheduled_umps row. If you don't find them, then you instead need to insert them into the umpire table, and call mysql_insert_id. I can't help you with your row number discrepency ... we don't have access to your database, but I'm guessing there's a logic error or the data in some of the rows is incomplete and some of your inserts are failing.
  16. You got some bad code from someone who doesn't know php well enough to be giving anyone advice. Unfortunately it happens here. You don't have to load everything into an array first in this case because there is nothing complicated that you're doing with the table. You simply need to output the table and table header outside the loop. Inside while .. fetch loop, output your .... Something like this: echo '</pre> <table>'; echo 'TitleCover'; $result = mysql_query("SELECT * FROM xbox_games order by gameid"); while ($row = mysql_fetch_assoc($result)) { echo "{$row['title']}{$row['cover']}"; } //close out table echo '</table>';<br>?&g [/code]
  17. WRONG ... wrong wrong wrong wrong wrong wrong wrong wrong. No. Not right, incorrect, ahem, no sir. If one really wanted to do that then outside the while loop: $rows = array(); Inside the loop: $rows[] = $row;
  18. allusers is just an alias for the union'ed result I don't really know what you mean by the ordering. A group by requires the elimination of duplicate rows, and in this case you're trying to get users and a count of the number of times they come up as a match for the criteria. If you want to then have access to individual information about a user, you would need to inner join this result to the user table by user_id. You have never provided information about the actual table structures, so these are all educated guesses. This seems to be made a lot more difficult than it needs to be, as it is unclear why you are doing a union of 4 seperate tables in the first place, when a query of a single table would work if the design was typical.
  19. gizmola

    Help me

    Sunfighter, if you don't have anything meaningful to add, please don't post. Not only is what you posted nonsense, it actually suggests that the function doesn't work as described which it most certainly does. It is not a search and replace function, it only removes things from the beginning and end of a string. If the characters in the list are at the beginning or end of the tring it will remove them, if not then it doesn't. This is clear from the examples.
  20. gizmola

    elseif

    Take a look at in_array
  21. Make the fetching into a while loop. mysql_fetch_assoc. This is shown in the examples of the manual page for mysql_fetch_row, which mysql_fetch_assoc is an alias for with a parameter that only returns the values key'd by the column name.
  22. Here you go: http://www.webresourcesdepot.com/9-open-source-microblogging-applications/
  23. When you're in the Browse screen for the admin table look at the tabs at the top, and click on INSERT tab. Fill out the form and save it to make an admin row. Then try your login as admin. This is obvious stuff, sorry. We're a site for developers and if you can't get this going I can only suggest at this point that you hire someone to help you who understands php/mysql websites, and can help you out.
  24. What type of response are you looking for? "Here's how you clone Twitter!" It's a ridiculous question. Twitter was written in Ruby. Does that help?
  25. You don't want to alter the structure of your table! Go to the Browse view. Are there rows in the table?
×
×
  • 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.