![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Back Office Guy- ![]() | Laggin behind in my sql knowledge at present any one know any good hints & tips sites. Or very good in depth tutorials | ||
| | |
| Advertisements |
| | #2 | ||
| MK PitStop Member | Try www.php.net , http://www.w3schools.com/sql/default.asp , http://www.mysql.com/ Thats all my favourites for sql help.
__________________ web development Free diggs for your stories bags of fashion - the latest in fashionable handbags | ||
| | |
| | #3 | ||
| Back Office Guy- ![]() | Yer got the links, good for the basic stuff but sorry to say find mysql.com manual one of the most mind boggling manuals ever. would like to try and find some with examples to semi complex queries i.e. insert into mailing list * from (select unique email from users) etc reading examples gives me ideas on streamling and automation | ||
| | |
| | #4 | ||
| MK PitStop Member | Well I personally built my own database connection functions which I use all the time. They go like this; // Function to open a database connection function OpenDB(){ $dbh=mysql_connect ("localhost", "$username", "$password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$db"); return $dbh; } // Function to close a database connection function CloseDB($dbh){ mysql_close($dbh); } // Then I set an includes to the file with the function list as follows; include 'includes/functions.php'; // Then I call my OpenDB function $dbh = OpenDB(); // Then I run my mysql query and extract the data $query = "SELECT * FROM table WHERE id >5"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $fieldname = $row['fieldname']; $fieldname2 = $row['fieldname2']; echo $fieldname . ' - ' . $fieldname2 . ' <br> '; } // Then I close the database CloseDB($dbh);
__________________ web development Free diggs for your stories bags of fashion - the latest in fashionable handbags | ||
| | |
| | #5 | ||
| MK PitStop Member | One fantastic method for searching for keyterms I've found is SELECT * FROM table WHERE fieldname LIKE '%keyword%' This returns all the results from the table where the value in the field has the keyword somewhere in the text.
__________________ web development Free diggs for your stories bags of fashion - the latest in fashionable handbags | ||
| | |
| | #6 | ||
| Website Owner ![]() Join Date: Mar 2006 Location: UK
Posts: 3,888
My Photos: (46)
iTrader: (3) Banked: MK Cash: $3.06 I am Worth: MK Cash: $1.92 Donate Recent Blog: Reliable and responsive web hosts ![]() ![]() ![]() | I am not that great on sql my self but that tip is a good tip I would probably give it a go if I ever need to, thank you | ||
| | |
| | #7 | ||
| MK PitStop Member | SQL isn't that difficult to learn. Once you get the whole idea of sets and the correct terminology its fairly straight forward. I did advanced databases at university using Oracle. Now that was tough!! I think I had 1 query which recurred from about 8 seperate queries and was about 250 lines long lol.
__________________ web development Free diggs for your stories bags of fashion - the latest in fashionable handbags | ||
| | |
| | #8 | ||
| Website Owner ![]() Join Date: Mar 2006 Location: UK
Posts: 3,888
My Photos: (46)
iTrader: (3) Banked: MK Cash: $3.06 I am Worth: MK Cash: $1.92 Donate Recent Blog: Reliable and responsive web hosts ![]() ![]() ![]() | LOL weirfire, I hate database's I am getting there I think but Whatcha will have to say if I am or not here does all the db and php stuff and is really fast and good | ||
| | |
| | #9 | ||
| MK PitStop Member | Yeah, I might have a few jobs for him soon. I reckon there's about 6 big jobs starting shortly which is a bit too much to take on at one time. My main helper is exam (David) though as he's a great reliable PHP programmer.
__________________ web development Free diggs for your stories bags of fashion - the latest in fashionable handbags | ||
| | |
| | #10 | ||
| Member Level 1 | One commonly used sql query is finding the nth largest record from a table. For example, you may require 5th largest number from an id column. In that case, in Oracle you would have to solve it by using a subquery. In SQL Server, the following query would work. select top 1 empno from employee where empno not in (select top 4 empno from employee order by empno) order by empno I think the query is the same in My SQL also. Please let me know. | ||
| | |
| Featured Websites | ||||
|
![]() |
| Tags: handy, queries, sql |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| Featured Websites | ||||
|