Jump to content

ktsirig

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by ktsirig

  1. Hello, I have a webpage with several html anchors. The anchor part works ok, but when I click on the links, I only goto to the part of the page with all the anchors (all anchors are gathered low in the page) and I wanted to know if there is any way of highlighting the specific anchor that the user has clicked on. Thank you.
  2. Hello all I didn't know a good way of naming my question, so I am getting straight to the point: I have a string like the following: -----MMMMM------IIIII----MMM---OOOO---I---MMMM----- Is there any way I can gather and group my information and get, for example: 6-10:M 17-21:I 26-28:M 32-35:O 39:I 43-46:M Thank you in advance.
  3. Hello, I want to create an xml file from php. Is there a quick way of dealing with it? I used SimpleXML in order to extract data from xml files, but I only have a rather lame idea of creating xml files by hard-typing the elements myself... like: <root> <name>Jim</name> <age>23</age> </root> etc...
  4. Hello all, I need to parse some xml documents. I use Simple:XML and it works ok up to the point of matching elements that occur just once in my documents. How can I process something like: <PubmedArticle> <AuthorList CompleteYN="Y"> <Author ValidYN="Y"> <LastName>Wilde</LastName> <ForeName>A</ForeName> <Initials>A</Initials> </Author> <Author ValidYN="Y"> <LastName>Reaves</LastName> <ForeName>B</ForeName> <Initials>B</Initials> </Author> <Author ValidYN="Y"> <LastName>Banting</LastName> <ForeName>G</ForeName> <Initials>G</Initials> </Author> </AuthorList> </Article> </PubmedArticle> and print all Authors' names?
  5. Hello, I have a js function that is triggered with the onclick event. In particular, there is a <tr> in a table that is shown when the user clicks on the "Show" button. In HTML I have: <tr> <td> <img id="myimage" src="css/images/show.png" onclick="javascript:HideShow('myrow');"/> </td> </tr><tr id="myrow" style="display:none"> <td>Hello all! </td> </tr> and the JS part is: <script type="text/javascript"> function HideShow(myVar) { if (document.getElementById(myVar).style.display == 'none') { document.getElementById(myVar).style.display = 'inline' } else { document.getElementById(myVar).style.display = 'none' } } </script> The function works fine, that is, when the user clicks on the image, the tr appears and then, if the user clicks again, it disappears... BUT all these work perfectly with IE, whereas in Firefox, the contents of the tr appear and disappear when the image is clicked, however, when the user clicks twice, the "Hello world" data disappears, but a blank row remains...And, if you do that again and again, I end up with as much blank rows as the times that I click the button for the data to disappear... Is this something like a bug? Can I do anything else?
  6. Hello, I have a js function inside the head of a page of mine which takes 2 arguments that are created dynamically based on what I retrieve from a database. My question is whether I can set the attribute src of the <img> tag through the js function. What I have is: <script type="text/javascript"> function HideShow(myVar, mySecondVar) { if (document.getElementById(myVar).style.display == 'none') { document.getElementById(myVar).style.display = 'inline' -----> mySecondVar.src = "css/images/show.gif" } else { document.getElementById(myVar).style.display = 'none' -----> mySecondVar.src = "css/images/hide.gif" } } </script> The lines with the arrow in front of them do not work, presumably there is a mistake in the syntax because I see no image... I would greatly appreciate any help!
  7. Hello, I wanted to ask if anyone knows of a way to prevent injection in an SQL SERVER 2005. I mean, is there any way to do all the blocking in the server and not have to escape each special character one-by-one? For example, in PHP I used mysql_escape_string and automatically the string was OK to send to the database... Is there something similar in SQL Server? Thank you
  8. Hello all, I want to secure a page which uses the script of "phplist". Basically this script stores username, name, surname, email etc of users in order for the company to send newsletters to their clients. Except from stripping slashes,backslashes etc or special characters, are there any other ways to prevent the data stored in the db from somenone that wants to "lay their hands" on them? Thank you!
  9. Hello, I am supposed to construct a page that searches in specific websites to extract information, like those sites from where you can rent a car for example. There is a form in the site where the user selects some fields (for instance departure and drop-off date), then the data are submitted to the other page that searches 2-3 sites and finds which cars are available on those dates. I wanted to ask if there are ready scripts to do that, if not, some hints on how to start. I am familiar with PHP forms and data extraction from mysql databases, but when you extract data from other sites, I have no clue how I can begin and deal with it...
  10. Hello! I am having a problem that I think is solved by using sessions and page refresh. I have a page where the user enters data. The data are used as input for an external program that runs in the shell, irrelevant to PHP. When the program ends, all results are stored in a text file, which I open with PHP and parse the results so that the user sees them on screen. So I have : form.php => which contains the form [....] => external program that runs in the background and creates temporary text file with the results process.php => opens text file and prints the results What I would like to do is something I have seen in many websites. I want to have an 'intermediate' page that will say for example "Please wait, we are processing your request".... This page will automatically refresh when the external program ends and then it will redirect to process.php file to show the results. I think it is better to have such a page instead of 'stucking' to the initial page [form.php] during the processing time and then display the results. Note that the external program can end in 1 minute, but it can last for 4 or 5 minutes if the user has submitted lots of data. Any ideas on how to do this?
  11. Hi, I am using PHP to make a website related to biology. In this site I use PHP code to communicate with external programms (not in PHP, but some biological packages). These programms write their output in temporary files, which I then read using fread() or file_get_contents() functions. My problem is that these functions seem to have a restriction as to the size of the file that they can read. Is there any other way I read big files (for files close to 20-30MBs for example)? Please note that there is no other way for me to do this because these programs, by default, write their output to a text file, so I can't use PHP's system commands and read the output on the fly. The output file is first created and then I read it into a string and parse it according to what I need.
  12. Hi all! I have a php page which contains a form. The user enters data and then the data is processed to give some results. What I would like to have is a page inbetween, that says, for instance, "Your job is being processed" or something similar, and then, when the job is done, refresh itself to show the results. I have seen it in many websites, but I don't know what I need to get me started...
  13. Hi all! I have a page (generated with PHP) that has a list of employee names. What I want to do is, when the user hits on each name, a pop-up window (using Javascript) to appear which will say some more details on the employee (i.e his age, job experience etc). So I thought I make a form for each employee name, and use hidden fields to pass the info I want. For example <form> <input type="hidden" name ="age" value="23 years old"> <input type="hidden" name="experience" value="expert"> <input type="submit" value="John"> </form> With the above, I show a little example of course. What I have is a submit button with John's name written in it and I want, when the user clicks on John, a pop-up window to appear and contain the "hidden" values of age and experience in it. I don't know much about Javascript, i tried usind the document.write function, but no luck. I can only "send" data to the next page that are written in an input field, but not data that are written in hidden fields... Any thoughts?
  14. Hello all, my problem is the following: I have a page where the user enters some data, let's say : string1 = 'AGREHREHRHREHRE'; string2 = 'WEFEWGEWGEGEWGEGEGWG'; These data I use in another page, so I use the "<pre>" tag to display what the user has entered. The problem arrives when the user writes something like EWGEGEW EFGEGEW EGRGREGRE RGVFVDSVDS This string, when I pass it into a variable, it is stored with newlines. I don't want to make any substitution of the newlines, as I want to preserve the spaces in the next page, and display the user's sequence as entered and not with 3 <br>'s, because there were 3 spaces in the original string... any ideas?
  15. Hello all! I am starting to use JS a couple of days now and mainly I am interested in using it in form validation and to create pop-ups. I have 2 questions : 1) If a user doesn't have JS enabled, how will I check for empty fields in the form and show an alert box that prompts for corrections? 2) Also, I have seen sites that have the following : There is a link somewhere which works like this : [a] if you have JS enabled, it "recognizes" it and gives a pop-up window when clicked whereas [b] if you don't have JS enabled, it simply acts like a link and opens a new window (not a poup-up one). Because I am a bit confused, I am staring to think that maybe JS causes more problems than it solves... Should a programmer use it or ,for instance, do a form validation in another page and don't count on the user having JS enabled?
  16. Hi, I am trying a couple of days now to learn some things on SESSIONS,but I think I am not getting it very clearly. I have a PHP page tha contains a form. Users enter data in the form, which are then written in a file (the file is created at the time a user enters some data) The file is then given as an input to an external program The external program runs and gives some results which are then stored in another file (that is created when the external program finishes) What I want to do is to somehow create these files and, when the user exits from the browser, then both files that refer to this user, will be deleted. Most guys in the forums suggested I use sessions, and go like this : 1) User "nick" enters data in the form 2) Temporary file $nick_session_id.FILE is created and passed on to the external program as input 3) The external program saves the results in another temporary file, say $nick_session_id.RESULTS 4) When nick sees anything he wants to see in his browser, concerning the results etc and exits, then both $nick_session_id.FILE & $nick_session_id.RESULTS will be deleted automatically (so the administrator doesn't have to erase files from the hard disk all the time). Pls note that I am not describing any kind of user authentication system, ie there is no log in/out in my page. Also, the users, as described above,cannot write anything to the input file once they write their data in the form and push "Submit". Of course, they cannot write anything to the results file as well, as this file contains the results given by the external program. i apologize for the length of my message but I wanted to make it as clear as possible... Many thanks!
  17. Hi everybody! I have a problem and I was told to check out the sessions part in PHP. What I want to deal with is the following : I have a PHP page with a form, where the user writes some data. These data are then written into a file which is then used in a system command as input for an external program (NOTE: The data MUST be written into a file, it cannot be done elsewhise, because the external program takes a file as input). The thing is that I must somehow create a file everytime a user enters data into the form, so I must learn something on sessions I think. My question is, since I don't have a login system or something like that, but just want to create a different file each time (with the session_id being part of it, so that the file is unique), which session commands do I need?
  18. Hi everybody and Happy New Year! I have been dealing with this problem of my biology class lesson since yesterday, I believe it's some silly mistake I am making. I have these tables: [tabel1:protein] protein_id protein.name 1 PROTEIN_1 2 PROTEIN_2 3 PROTEIN_3 ############################################ [table2:protein_reference] protein_id[FK] reference_id[FK] 1 1 1 2 1 4 2 3 2 6 3 5 3 7 ############################################### [table3:reference] reference_id datab_id[FK] code 1 1 AAAA 2 2 BBBB 3 2 CCCC 4 3 DDDD 5 1 EEEE 6 3 FFFF 7 1 GGGG ############################################## [table4:database] datab_id datab.name 1 Yale 2 Oxford 3 Cambridge ############################################## If the user gives me code AAAA as input, I want to write an SQL statement that will retrieve all the other codes from table3 and all datab.name from table4 that belong to the same protein, that is: BBBB[+Oxford], DDDD[+Cambridge]. I hope it is not confusing.. The course that SQL must follow is: STEP1: Code AAAA is given from user STEP2: go to table2 and see(using reference_id) that protein_id#1 has also reference_id#2 +reference_id#4 STEP3: go to table3 and see which datab_id are placed in codes BBBB + DDDD STEP4: go to table4 and see (using datab.name) that the reffering databases are those of Oxford(datab_id#2) and Cambridge(datab_id#3) STEP5: print => BBBB[Oxford] DDDD[Cambridge] Any help?
  19. Maybe this will help you: http://mpcon.org/apacheguide/
  20. Hi, I have been messed up with array_intersect function. I have two queries sent to Mysql : Say: $query1 ='SELECT ... FROM ...'; $query2 ='SELECT ... FROM'; $result1=mysql_query($query1); $result2=mysql_query($query2); $line1 = mysql_fetch_array($result1, MYSQL_ASSOC); $line2 = mysql_fetch_array($result2, MYSQL_ASSOC); How will I use array_intersect in order to retrieve the common values of the two arrays? I seem to heve a bit of problem in the coding... Thanx a lot!
  21. ktsirig

    Arrays

    Hello everyone. Say you send MySQL two queries, and the two arrays that are created give these as results: a1 = { blue, red, green } a2 = { blue, yellow, green } I need to return 'blue' and 'green' to the user, that's my goal. Is in_array what I need? Can you please give me a hint as far as the coding is concerned? Thanx
  22. Hi everyone! I have the following problem: I ran 2 queries on my database using PHP. Each query returns its result. How can I check whether query1=query2 and print the final result to the user? I don't want the UNION syntax, because I am not interested in returning all the results. For example, if answer1='test' and answer2='job' , then nothing should be printed to the user. If answer1='test' and answer2='test' as well, then, the user will see test. If answer1='test','strange','orange' and answer2='apricot', 'test', 'curious' then the user will only see 'test' as final result. Any thoughts??? Is there something to do with string equations or not? Particularly I have trouble when it comes to compare 2 arrays with each other, such in the case of : If answer1='test','strange','orange' and answer2='apricot', 'test', 'curious' then the user will only see 'test' as final result.
  23. Hi everybody. I have created a rather complex query for my database, which works OK (I mean it brings the right results). The problem is that the results are brought to me 4 times. That means that if the query has one correct answer, I get the answer, but I get it in 4 times. What can be the fault? I have written my code here, but I don't think it's easier, since it would be difficult to explain the structure of the database SELECT refU.code FROM reference AS refU LEFT JOIN protein_reference AS prU ON refU.reference_id = prU.reference_id LEFT JOIN protein_reference AS prQ ON prU.protein_id = prQ.protein_id LEFT JOIN reference as refQ ON refQ.reference_id = prQ.reference_id LEFT JOIN protein ON protein.protein_id = prU.protein_id LEFT JOIN datab ON datab.datab_id = refU.datab_id LEFT JOIN protein_organism ON protein_organism.protein_id = protein.protein_id LEFT JOIN organism ON organism.organism_id = protein_organism.organism_id LEFT JOIN families_reference ON families_reference.reference_id = refU.reference_id LEFT JOIN families ON families.families_id = protein.families_id WHERE protein.name like '%ahh3%' AND datab.name='prnd'; So, if the correct answer is the code QWE234 for instance, mysql returns: QWE234 QWE234 QWE234 QWE234 I understand that it might be difficult to give me an answer, but I was wondering if there is any mistake in my syntax and therefore I get the result 4 times. The syntax as it is is correct for the job I need it to do.
×
×
  • 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.