First off, I am a MySql newbie and I just started teaching myself PHP.<br /><br />I am trying to figure out how to query a MySql database and I have no idea how to structure it. I have read a few things online, but the sites I found still left me confused. Does anyone good resources (either online or book) on doing MySql? The more examples of queries the better.<!--content-->
One nice site for tutorials is <a href="http://www.tizag.com/sqlTutorial/" target="_blank">Tizag.com</a><!--content-->
<!--QuoteBegin-TCH-Don+May 23 2005, 01:20 AM--><div class='quotetop'>QUOTE(TCH-Don @ May 23 2005, 01:20 AM)</div><div class='quotemain'><!--QuoteEBegin-->One nice site for tutorials is <a href="http://www.tizag.com/sqlTutorial/" target="_blank">Tizag.com</a><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131623"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Thanks Don, that looks very helpful.<br /><br />Of course if anyone knows of more sites, it wouldn't hurt. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->
<a href="http://www.php.net" target="_blank">php.net</a> is where I learned to merge php and MySQL. but then if you're tying to learn MySQL, a good site would be <a href="http://www.w3schools.com" target="_blank">W3 Schools</a>. I used that page for a lot of web related stuff (CSS and stuff).<br /><br /><a href="http://ca3.php.net/manual/en/ref.mysql.php" target="_blank">php.net -> more specific</a> there is a good example and a list of all the php functions useful to use mysql.<!--content-->
<!--QuoteBegin-bboyjay+May 23 2005, 11:09 AM--><div class='quotetop'>QUOTE(bboyjay @ May 23 2005, 11:09 AM)</div><div class='quotemain'><!--QuoteEBegin--><a href="http://www.php.net" target="_blank">php.net</a> is where I learned to merge php and MySQL. but then if you're tying to learn MySQL, a good site would be <a href="http://www.w3schools.com" target="_blank">W3 Schools</a>. I used that page for a lot of web related stuff (CSS and stuff).<br /><br /><a href="http://ca3.php.net/manual/en/ref.mysql.php" target="_blank">php.net -> more specific</a> there is a good example and a list of all the php functions useful to use mysql.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131708"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Thanks for the help.<br /><br />I don't have a problem with the PHP side, it is more the MySQL query structure I am confused with. PHP.net is a good source, if you know what you are looking for. Unfortunately, their examples of queries are limited and pretty basic.<br /><br />As for W3 Schools, they don't have anything on MySQL queries that I could find. It is an excellent site, I have used it before to learn CSS and as a basic HTML resource.<!--content-->
I've used the tutorials at <br /><br />Codewalkers -- ht*tp://codewalkers.com<br />and<br />PHP Builder -- ht*tp://phpbuilder.com<br /><br />They're a little pick-and-mix as to what they actually have tutorials on, but the ones they do have I used quite a bit when I was learning.<!--content-->
I don't recall seeing it, but is there a "MySQL for Dummies" out there? I love their books! They explain things in simple, down-to-earth terms that are easy to comprehend and remember.<!--content-->
Yes, there is a Dummies book for PHP/MySQL and I have a copy. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->
From the reviews I read online, the <i>PHP/MySQL for Dummies</i> book doesn't seem that good. I had one when I was learning Unix and wasn't to impressed. I learned more from the HP-UX reference manuals that came with the server then I did with the "Dummy" book.<br /><br />Based on some of the reviews I read, I ordered a copy of <i>"PHP and MySQL Web Development, Second Edition"</i> by Luke Welling & Laura Thomson. I probably am still going to need something that strictly focuses on MySQL, but I am going to wait and see if I can figure it using the sites people have mentioned and the book I ordered.<br /><br />Thanks for all the good suggestions! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Thats a very good book <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /> <br /><br />I got it for the PHP part, but the database section is good too.<br /><br /><br />We will be quizzing you later <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><!--content-->
<!--QuoteBegin-TCH-Don+May 23 2005, 10:32 PM--><div class='quotetop'>QUOTE(TCH-Don @ May 23 2005, 10:32 PM)</div><div class='quotemain'><!--QuoteEBegin-->We will be quizzing you later <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131785"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />I'll probably fail that test too. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blush.gif" style="vertical-align:middle" emoid=":blush:" border="0" alt="blush.gif" /><!--content-->
Well, with the site that Don gave me, it got me going. The book I ordered was no help, only since I haven't received it yet. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid="" border="0" alt="biggrin.gif" /><br /><br />Here is the query I needed (the names have been changed to protect the innocent).<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$sql = "SELECT s.table_row,<br /> Â Â Â Â COUNT(s2.shout_id) AS table_row_number<br /> Â Â Â Â FROM ".SQLTABLE." s, ".SQLTABLE." s2<br /> Â Â Â Â WHERE s2.table_row >= ".$somenumber."<br /> Â Â Â Â AND s.table_row = ".$somenumber."<br /> Â Â Â Â GROUP BY s.table_row<br /> Â Â Â Â ORDER BY s2.table_row DESC";<!--c2--></div><!--ec2--><br />Thanks again for all the help. This was fun, I can't wait until I get the book I ordered and I can learn to unlock the potential for using PHP & MySQL.<!--content-->
One nice site for tutorials is <a href="http://www.tizag.com/sqlTutorial/" target="_blank">Tizag.com</a><!--content-->
<!--QuoteBegin-TCH-Don+May 23 2005, 01:20 AM--><div class='quotetop'>QUOTE(TCH-Don @ May 23 2005, 01:20 AM)</div><div class='quotemain'><!--QuoteEBegin-->One nice site for tutorials is <a href="http://www.tizag.com/sqlTutorial/" target="_blank">Tizag.com</a><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131623"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Thanks Don, that looks very helpful.<br /><br />Of course if anyone knows of more sites, it wouldn't hurt. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->
<a href="http://www.php.net" target="_blank">php.net</a> is where I learned to merge php and MySQL. but then if you're tying to learn MySQL, a good site would be <a href="http://www.w3schools.com" target="_blank">W3 Schools</a>. I used that page for a lot of web related stuff (CSS and stuff).<br /><br /><a href="http://ca3.php.net/manual/en/ref.mysql.php" target="_blank">php.net -> more specific</a> there is a good example and a list of all the php functions useful to use mysql.<!--content-->
<!--QuoteBegin-bboyjay+May 23 2005, 11:09 AM--><div class='quotetop'>QUOTE(bboyjay @ May 23 2005, 11:09 AM)</div><div class='quotemain'><!--QuoteEBegin--><a href="http://www.php.net" target="_blank">php.net</a> is where I learned to merge php and MySQL. but then if you're tying to learn MySQL, a good site would be <a href="http://www.w3schools.com" target="_blank">W3 Schools</a>. I used that page for a lot of web related stuff (CSS and stuff).<br /><br /><a href="http://ca3.php.net/manual/en/ref.mysql.php" target="_blank">php.net -> more specific</a> there is a good example and a list of all the php functions useful to use mysql.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131708"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Thanks for the help.<br /><br />I don't have a problem with the PHP side, it is more the MySQL query structure I am confused with. PHP.net is a good source, if you know what you are looking for. Unfortunately, their examples of queries are limited and pretty basic.<br /><br />As for W3 Schools, they don't have anything on MySQL queries that I could find. It is an excellent site, I have used it before to learn CSS and as a basic HTML resource.<!--content-->
I've used the tutorials at <br /><br />Codewalkers -- ht*tp://codewalkers.com<br />and<br />PHP Builder -- ht*tp://phpbuilder.com<br /><br />They're a little pick-and-mix as to what they actually have tutorials on, but the ones they do have I used quite a bit when I was learning.<!--content-->
I don't recall seeing it, but is there a "MySQL for Dummies" out there? I love their books! They explain things in simple, down-to-earth terms that are easy to comprehend and remember.<!--content-->
Yes, there is a Dummies book for PHP/MySQL and I have a copy. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->
From the reviews I read online, the <i>PHP/MySQL for Dummies</i> book doesn't seem that good. I had one when I was learning Unix and wasn't to impressed. I learned more from the HP-UX reference manuals that came with the server then I did with the "Dummy" book.<br /><br />Based on some of the reviews I read, I ordered a copy of <i>"PHP and MySQL Web Development, Second Edition"</i> by Luke Welling & Laura Thomson. I probably am still going to need something that strictly focuses on MySQL, but I am going to wait and see if I can figure it using the sites people have mentioned and the book I ordered.<br /><br />Thanks for all the good suggestions! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Thats a very good book <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /> <br /><br />I got it for the PHP part, but the database section is good too.<br /><br /><br />We will be quizzing you later <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><!--content-->
<!--QuoteBegin-TCH-Don+May 23 2005, 10:32 PM--><div class='quotetop'>QUOTE(TCH-Don @ May 23 2005, 10:32 PM)</div><div class='quotemain'><!--QuoteEBegin-->We will be quizzing you later <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=131785"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />I'll probably fail that test too. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blush.gif" style="vertical-align:middle" emoid=":blush:" border="0" alt="blush.gif" /><!--content-->
Well, with the site that Don gave me, it got me going. The book I ordered was no help, only since I haven't received it yet. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid="" border="0" alt="biggrin.gif" /><br /><br />Here is the query I needed (the names have been changed to protect the innocent).<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$sql = "SELECT s.table_row,<br /> Â Â Â Â COUNT(s2.shout_id) AS table_row_number<br /> Â Â Â Â FROM ".SQLTABLE." s, ".SQLTABLE." s2<br /> Â Â Â Â WHERE s2.table_row >= ".$somenumber."<br /> Â Â Â Â AND s.table_row = ".$somenumber."<br /> Â Â Â Â GROUP BY s.table_row<br /> Â Â Â Â ORDER BY s2.table_row DESC";<!--c2--></div><!--ec2--><br />Thanks again for all the help. This was fun, I can't wait until I get the book I ordered and I can learn to unlock the potential for using PHP & MySQL.<!--content-->