Jump to content

bobicles2

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bobicles2's Achievements

Member

Member (2/5)

0

Reputation

  1. Select * FROM "Patient" INNER JOIN "GP" ON Patient.GP_Name = GP.GP_Name ORDER BY Patient.Name My Tables are Patient ( "N.I.Number" character varying(100) NOT NULL, "Name" character varying(100) NOT NULL, "Address" character varying(200) NOT NULL, "GP_Name" character varying(100) NOT NULL, GP "ID" serial NOT NULL, "GP_Name" character varying(100), "Practice" character varying(100), CONSTRAINT "GP_pkey" PRIMARY KEY ("ID") Want to create a query that produces an alphabetic list of all patients for a GP been stuck for hours now thanks
  2. This is my table Admissions - ID , Patient_Name, Institute_Name, Ward, Surgeon, Date im trying to find out which patients have been admitted to the same ward more than once....so Patient_Name and Ward need to both occur more than once and display. i think i need to use COUNT and HAVING but really unsure of how to tackle this Query Thanks Rob
  3. Eerm...the report its for says "The implementation should include appropriate use of the advanced features of PostgreSQL" But ive just implemented the tables using phpmyadmin? so im not 100% of the differences? perhaps this could be something i may need to learn more about?
  4. Thes are my Tables Patient - ID, Name, Address, GP GP - ID, Name, Hospital Specialisation Looking to produce a query that selects all the Patients for a particular GP, im not sure how to Query Multiple tables Thanks Rob
  5. i enjoy it as much as its humanly possible to enjoy a programming language haha! i think i enjoy it because i understand it! at university ive had to learn things like haskell/prolog/java and i could never properly get my head around them whereas with php i have.
  6. function clean($input) { $input = @trim($input); if(get_magic_quotes_gpc()) { $input = stripslashes($input); } return mysql_real_escape_string($input); } i orginally had this function, shown above to clean up my inputs and prevent SQL injection. However, Magic_quotes_gpc is no longer supported. and this method although clear to me seems a little long winded! is there an easier way for me to clean up my inputs thoroughly? and to avoid SQL injection thanks rob
  7. Regular users may have noticed over the past couple of months i have consistently been posting in this particular forum looking for PHP help, and as expected you guys have continued to give me fantastic support and help me through doing my final year project! My project and documentation is now complete and my understanding of PHP has improved ten fold! on top if this im not actually starting to enjoy PHP since i am getting an understanding for it To the point ; i would like to say a massive thank you to the users here, if it wasn't for your help i wouldn't of gotten to where i am and i thank you all for continually taking the time to help me, and others like me! some of us want to learn but don't know where to begin! and your help i know is appreciated by not only myself but obviously a lot of other posters here THANK YOU!
  8. Actually, it's saying if the variable does not NOT contain any text, then perform the code. It's essentially the same as if( !empty($login) ) now it makes perfect sense, so long as the field has an entry, we check the database for multiple entries thanks man!
  9. How would this have any reference to this script though, because if the login field which is defined as $login has no text, then it has nothing to look up in the database and compare against (as the script below is designed to checked for duplicate log in names) if($login != '') { $qry = "SELECT * FROM members WHERE login='$login'"; $result = mysql_query($qry); if($result) { if(mysql_num_rows($result) > 0) { $errmsg_arr[] = 'Login ID already in use'; $errflag = true; } @mysql_free_result($result); } else { die("Query failed"); }
  10. if($login != '') what is this saying? its the last part im unsure about thanks in advance rob
  11. slightly confused, so your revised version should work fine?
  12. The code below after Inserting into my table echos either "error:" or "Thank you.." where have i gone wrong here? the intention was to echo an error if there was one...otherwise if it works fine and adds to the table echo "Thanks etc" $sql="INSERT INTO Events (Event, Genre, Date, Price, Venue, Tickets, Postcode) VALUES ('$event','$genre','$date','$price','$venue','$tickets','$postcode')"; $result = mysql_query($sql, $con); if ($result) { echo "Error :" . mysql_error(); } else { echo "Thank You, Your Event has now been added to our Records"; } mysql_close($con);
  13. sorry i meant it to mean it doesnt work... but when i used Select * From Events it works fine.. so theres a problem with the query ive solved this now though using a different method..i have a field for ID which is set to auto increment so just changed it to display the 10 highest ID's (which are obviously the most recently added events) thanks for the help though much appreciated!
  14. mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM Events ORDER BY timestamp DESC LIMIT 10"; $result=mysql_query($query); $num=mysql_numrows($result); i use this, and it works and echo's everything fine when i used the query SELECT * FROM Events but doesnt work with the new query despite me having a timestamp field in my database having the default as timestamp i checked my databse and when i add an entry the timestamp is added so im not sure whats going wrong
  15. just adding the field now, does it need any particular variables, or will it be added naturally ive set the field type to TIMESTAMP
×
×
  • 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.