Jump to content

ajoo

Members
  • Posts

    871
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ajoo

  1. Hi Noel ! Thanks for the reply. Well as of now I don't have it on a remote server. I am just running localhost and trying things out on a local server. If there is no other way then i'll try and upload it soon and post this again. if there is anything else you can suggest i'll try and do so. Maybe someone else meanwhile might have those resources and would be able to help. Thanks so much.
  2. Hi barand, thanks for the response and yes this data is different from the earlier. I think there is a small mistake in the data in TABLE A ( the one in the previous post) so here's the new table again - TABLE B Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 6 2 --------- 700 -------- 4/12 -------- 7 3 --------- 400 -------- 7/12 -------- 4 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 500 -------- 10/12 ------- 5 7 --------- 600 -------- 14/12 ------- 6 8 --------- 500 -------- 14/12 ------- 5 ok so now I think its correct. Yes multiple dates are allowed. However I think that the dates got goofed in the sense that they should have followed order ( Ascending I mean.). Ok but your keen observation has led me to another few questions. 1. I would like to ask that in a system where a person;'s visits to the club are entered serially, is it possible for the table to store them in an un-ordered manner as in TABLE A. 2. Even if the system enters inputs these dates in order, is there any manner that the table may get jumbled on dates (again as in TABLE A). 3. How can the same output be achieved for both the tables. I think if you just do that for me for the earlier TABLE A, I'll try and do the simpler TABLE B one myself. Thanks very much.
  3. Hi Barand ( guru), I am here once again with another query that i wish to form from the same table clubvisits. The table of entries is as below. Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 6 2 --------- 700 -------- 4/12 -------- 7 3 --------- 400 -------- 7/12 -------- 4 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5 The last time you created a query which checked for last entry value of Dues and the found all the entries for which the dues were same. This time I wish to change that slightly so that it finds the latest dues value (500) and checks for all records with the same dues value as well as all the value of the next dues values. i.e. I want to make a query whose result would be 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5. I am able to get 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5. if i change " Where last visit > " to " Where last visit >= " but I am not able to get the rest of the entries for which the dues value = 600. Help sought. Thanks again !
  4. yes that's exactly correct. yes I don't want someone to go to secound.php from anywhere else except the hyperlink so i guess sessions is the best way to ensure it. Maybe You can suggest something else. Thanks
  5. Hi guys, please can someone look into this and provide a solution. if not, I'ld be thankful if someone can at least guide me where to go with this question, any relevant forum where I would be able to elicit some kind of response to this. Thanks you all.
  6. yea hi ! ok so this one file is not an included file. It's a PHP file, say second.php which is invoked by a hyperlink on the main webpage index.php. Now i don't want to give a direct access to it so i asked if something similar like defining a constant and then checking for it in the second.php , once the hyperlink was pressed in index.php, could be used to prevent direct access to this file second.php. I am actually thinking of using sessions to prevent direct accesss to this one - (a hyperlink invoked file). Thanks.
  7. Hey thanks ! yes I am now trying and using the define to define a constant. However what about a file that I have to access using a href defined hyperlink? What's the way to prevent direct access to that file other than what you suggested of putting the files into a folder other than the root. Please suggest something. Thanks !
  8. Hi, searching for this very common question as in subject, I CAME ACROSS THE FOLLOWING QUESTION:- I have a php file which I will be using as exclusively as an include. Therefore I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included. Basically I need to do a check as follows in the php file: if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted"); Is there an easy way to do this? AND THIS ANSWER:- The easiest way is to set some variable in the file that calls include, such as $including = true; Then in the file that's being included, check for the variable if (!$including) exit("direct access not permitted"); AND THESE COMMENTS:- 2 This is dangerous if register_globals is on. – jmucchiello Jan 3 '09 at 18:51 11 PHP is dangerous if register_globals is on. – David Precious Jan 3 '09 at 18:56 MY QUESTION IS that please can someone explain why and how this is a dangerous menthod and if it should be used or not. I have actually used this technique, There is a php file which is accessed as a hyperlink from the index file. When I use that link, it gives me an error saying that I cannot access that file directly. So does that mean that this technique won't work on hyperlinked files? If not then what is the best way to ensure that hyprelinked files are not accessed directly? Thanks a lot everyone on the forum.
  9. hi all, I am not sure if this is the best place for my query but I am sure I'll get the solution & the reply. I have attached a small zip file which contains files for a j-query slider login panel. I have not done anything much with it except may be tweak the css files a bit just for learning. However now when i run / load the demo.php in the browser, it works fine but when i press the login and register buttons on the slider panel, the panel distorts before the refresh and the distortion shows just for a second and then it comes back to the right place. I am not able to figure out how to remove this distortion. Can someone quickly unzip the files and try it out and take a look at the problem. Note: the distortion occurs not always but on one or two button presses of the Register button and sometimes with the login button. ( no form fields are to be filled at all) Just press the buttons. Just trying to learn, distort_demo.zip Thanks loads.
  10. hey Thanks ! but guess what I tried and got it too. SELECT count(last_visit) FROM clubvisit cv WHERE last_visit > ( SELECT MAX(last_visit) FROM clubvisit WHERE points <> ( SELECT points as lastpoints FROM clubvisit JOIN ( SELECT MAX(last_visit) as last_visit FROM clubvisit ) as latest USING (last_visit) ) ); So i was also trying it even after posting the query. Thanks loads cos I am learning too with your help.
  11. Hi Barand, I have achieved what i wanted with your help but I just want to confirm if there is a more elegant way to achieve it. So this query that you created initially to solve this issue returns the latest three rows with the points value 6. However if i did not wish to have have these rows listed and instead just wanted to know the count of rows that were returned, can the query be modified to achieve that? That's what I have been trying and thought I had managed but I had not. So i used the result in mysqli_affected_rows and indirectly counted the rows to be three. However I was wondering and trying to achieve the same with count in the query. I am sure it can be done and request you to show me how to do it. Thanks again !
  12. Hi Barand, The previous query that you were so kind to help me with, I have altered a little as follows : $sql = "SELECT COUNT(last_visit) as numcount FROM clubvisit WHERE points <> ( SELECT points as lastpoints FROM clubvisit JOIN ( SELECT MAX(last_visit) as last_visit FROM clubvisit ) as latest USING (last_visit) );" It works as desired in myphpAdmin. However now i am using this as $result = mysqli_query($link,$sql) and I am not sure how I may retrieve the value of numcount from this one. kindly guide. Thanks !
  13. Hi, Please can someone suggest if I need to connect to the database again and again if my main program calls subroutines which also need to connect to the SAME database or is there an alternative method by which I don't have to do this again and again. I read somewhere that connecting to the database time and again is a big waste of time resource. I'll also try and illustrate my problem ///////////////////////////// main.php ////////////// <?php mysqli_connect(host, user, pass, db) // makes a connection to a database DB get_field_1(); // a function in another file say functions.php ?> //////////////////// functions.php //////////// <? function get_field_1() { mysqli_connect(host, user, pass, db) mysqli_connect(...) get_field_2(); // calls another fucntion in functions.php return val1; } function get_field_2() { mysqli_connect(host, user, pass, db) mysqli_connect(...) return val2; } ?> //////////////// END /////////////////// Is there a way by which I can avoid calling the following two lines within each function? mysqli_connect(host, user, pass, db) mysqli_connect(...) In fact I would like to call it just once in main and not have to call it again and again. Thanks.
  14. Thanks Guru !! I did manage to find the explanation using the myphpAdmin by taking parts as you have also segregated. So I ran the SQL's and got the results of the portions. I have a few questions on this but i'll first try and read a bit more and hammer them out myself and if I cannot, then i'll come and ask them again. Thanks a lot.
  15. Hi ! I am not sure I get what you are saying, but I think you mean that I need to split the dynamic.php and take the header and other files and include that in the demo files html/ php section. If that was the case it would destroy the modularity of the dynamic.php file. Wouldn't there be a better more elegant way of doing this ? I am not sure I understand. Would you please do whatever you are suggesting to me and show me what you mean ? Thanks loads.
  16. Hi Guru ! Surely you must be one ( a guru ) to think of a query like the one above. I'ld be grateful if you can please explain the query that you have devised and also your modus operandi to think so straight while creating a query like this ! I'ld sure love to emulate your thought process. Please do explain how the query works by breaking it up like you have done . Thanks and very grateful. Ajoo
  17. Hi ! I am back with a set of files zipped neatly into one. Please find the project attached. The last line in the demo.php namely php include("dynamic.php"); attaches the dynamic website to the login page. But clicking on any of the buttons detaches the website from the login panel. I can see that it is wrong but i am unable to make out how else to attach the files so that they may be welded together. Thanks for any help. dynamic.zip
  18. hmmm ! Ok I'll see what i can do. I'll try and put the code in here in a little while. Thanks.
  19. Hi ! Ok so the dynamic web page is a simple web page which simply displays a message for the various buttons on the menu bar in a select area. so for e.g. if i press the contact button, it say "this is a contacts page" and another message for another button on a common message DIV area. So all these messages appear on the same DIV area for messages. Of-course any functionality can be provided instead of just displaying the message. So that's the simple dynamic website that's there for now. Different html pages hold the messages for the various menu buttons. In the main html file includes are used to get them all together. The body.html is where a conditional structure is used to check which menu button ( not button actually ) has been pressed and the corresponding message is displayed. Now I used this and placed it on the page for jquery login. The first time it displays great and all is well. But when i press any of the buttons, the query panel disappears and only the dynamic website page with all its functionality intact is left. I have no clue why and so I am making this request. Thanks again.
  20. Hello All ! I have been learning and doing at the same time. I came across a login design using J-query sliding panel, that i gratefully used. The rest of the query page was empty. Then I came across a tutorial on dynamic pages and so I thought it would be a good idea to put this dynamic page on the front of the login j-query page. I did so and it worked. When i use the J-query panel it worked fine. Then i implemented the dynamic pages and when i tried that out, the jquery panel vanished and the dynamic page appeared as a standalone website. Any ideas how I may retain my login and the dynamic page and let them work harmoniously together. Thanks all in advance.
  21. Hi all ! I am very new to mysql and i am trying to learn. I need a little help. I have a small table with 4 fields namely Day_ID, Dues, Last_Visit, Points. where Day_ID is an auto-increment field. The table would be as follows: Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 6 2 --------- 700 -------- 4/12 -------- 7 3 --------- 600 -------- 7/12 -------- 5 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 So this is the record of a person's visit to say a club. The last row indicates the last date of his visit to the club. His points on this date are 6. Based on this point value of 6 in the last row I want to retrieve all the previous BUT adjoining all records that have the same Points i.e. 6. So my query should retrieve for me, based on the column value of Points of the last row (i.e. Day_ID - 6 ), as follows: 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 Can someone show me how this may be achieved? Thanks all in advance for sharing their knowledge and time. P.S. I am not attaching a Table as its a very small example. I hope that's OK.
  22. Hi vinny, I checked what you said and its definitely something to watch out for. This is how i used it. I used seek to find the records with the LIKE command and then once i have the record i want to edit, I make changes to it based on its primary ID or email address which is again unique. SO that ways i get the editing done on the correct record. Do you see any issue in this now ? Your comments and thoughts are very welcome. Thanks loads.
  23. HI vinni, I guess you are right. I am rather new to mysql and it never occoured to me that the record would change while we are viewing the searched subset. I'll keep that in mind and think about it and get back. Thanks loads
×
×
  • 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.