Just recieved my book! Looks good!
Worth every penny!
-Dan
| SitePoint Sponsor |



Just recieved my book! Looks good!
Worth every penny!
-Dan
-Daniel Kerton,
Humor



Does anybody know of a free host that suports PHP and SQL so i can practise?
-Dan
-Daniel Kerton,
Humor
If you are on eithe Windows or Linux you can practice on your own machine! Follow Kev's instructions in Chapter 1 on setting both PHP and MySQL up. If you're running Windows, chances are you have access to Microsoft's Personal Web Server or IIS, however if you wish to install the Apache webserver for your own use, KEv's given instruction on doing that too!
Good luck.
Sketch
My sentiments exactly, Sketch.
-Kev.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference



I'm having problems connecting to a MySQL data base as described in pages 52-54.
My code (no password for security reasons)____________
<?php
mysql_connect("localhost", "daniel", "pass");
$dbcnx = mysql_connect("localhost", "daniel", "pass");
$dbcnx= @mysql_connect("localhost","daniel","pass");
if (!dbcnx) {
echo("can't connect to database server");
exit();
}
mysql_select_db("jokes", $dbcnx);
if(! @mysql_select_db("jokes") ) {
echo( "unable to locate jokes database");
exit ();
}
mysql_query(query, connection_id);
?>
______________________________________________________
File called connect.php
-Dan
-Daniel Kerton,
Humor



I purchased using paypal how can i access the code archive?
-Dan
-Daniel Kerton,
Humor
Dan,
The code you posted has a very obvious problem -- you're trying to connect to the MySQL server 3 times. You can't just blindly type the code from the book in; you need to read my explanations that appear between them. I began by showing this line:Then I explained that the mysql_connect function returned a connection ID that we needed, so the updated line would look like this:PHP Code:mysql_connect("localhost", "daniel", "pass");
And finally I explained that we could suppress the ugly PHP error and display our own more friendly one in the case of a connection error by using the @ sybmol and an if statement, making the final connection code:PHP Code:$dbcnx = mysql_connect("localhost", "daniel", "pass");
You only need to type this last code fragment -- the first two were just steps on the way to this final code.PHP Code:$dbcnx= @mysql_connect("localhost","daniel","pass");
if (!dbcnx) {
echo("can't connect to database server");
exit();
}
As for the code archive, drop me a line via email and I'll set you up.![]()
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference





How many books have you now sold?
Or is that secret, like if you told me you'd have to kill me?![]()
I swear to drunk I'm not God.
» Matt's debating is not a crime «
Hint: Don't buy a stupid dwarf ö Clicky
Maybe not kill you... but I might get you to clean my bathroom.![]()
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference



Thanks for clarifying that Kevin,
I've sent you an email.
-Dan
-Daniel Kerton,
Humor



OK i'm really lost now i'm trying to connect to my localhost mySQL database heres my code:
_______________________________________________
<?php
$dbcnx= @mysql_connect("localhost","daniel","pass");
if (!dbcnx) {
echo("can't connect to database server");
exit();
}
mysql_select_db("jokes", $dbcnx);
$result = @mysql_query("select joketext from jokes");
if (!result) {
echo("<p>error performing query: " . mysql_error() . "<p>");
exit();
}
?>
_______________________________________________
All i get is a blank screen is my code right.![]()
Last edited by Dan_K; Jan 8, 2002 at 18:54.
-Daniel Kerton,
Humor
Looks fine to me. Where's the code to actually output someting on the page?
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Thinks Kev's hit the nail on the head there. If you just run that script....and it works...the result would be a blank page...
~The Artist Latterly Known as Crazy Hamster~
922ee590a26bd62eb9b33cf2877a00df
Currently delving into Django, GIT & CentOS



Yeah i fixed it now, i'm starting to understand the code more.
-Dan
-Daniel Kerton,
Humor

Just a quick note to Kevin.
I'd just like to say a big thank you for your excellent book. This is by far the best book on PHP and MySQL I've read (and I have read it a couple of times now - I'm sad I know!)
Finally someone has shown an example of php being used in a (semi) realistic environment and the tricks of the trade. Congratulations and keep up the work. If you ever expand on the book then count me in!!
Again, well done!
Martin
Thanks for the kind words, Martin!
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference


I assume you mean the difference between this indenting styleand this oneCode:if (condition) { // code here }Both styles have their proponents, but the former was chosen for the book for its compactness, so as to be able to fit more code on a single page of the book.Code:if (condition) { // code here }
I understand if you prefer the latter style (we've actually standardized on it here at SitePoint), but it hardly seems like a reason not to buy a book...
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference



Just want to let anyone who doesnt have the book know that it is really good for beginners! Ive only read the first few chapters so far but ive learned more than trying to over the internet. Shipping was fast too.
Congrats Kevin!
Wavelan

I didn't buy the book - not yet-, but I will say that Kevin as a technical writer rocks and that his articles are among the best I've read so far.
Hey Kev, you're from Montreal, parles-tu français un peu?
Mike
Dis donc, qu'est-ce qu'il dit ce mec? Hein? Je comprends rien...




Kevin, Just to let you know, your book has been shown in Intenet.au magazine on page 19.
Nice rap![]()
Mais oui je parle Français, mais ça fait longtemps depuis que j'ai utilisé mon Francais à tous les jours. J'en ai perdu beaucoup durant les trois ans que j'ai habité en Australie.![]()
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference





I think you're posting in the wrong thread here, KevOriginally posted by kyank
Mais oui je parle Français, mais ça fait longtemps depuis que j'ai utilisé mon Francais à tous les jours. J'en ai perdu beaucoup durant les trois ans que j'ai habité en Australie.![]()
![]()
I swear to drunk I'm not God.
» Matt's debating is not a crime «
Hint: Don't buy a stupid dwarf ö Clicky
No, I was answering ALSLG, who wrote:Hey Kev, you're from Montreal, parles-tu français un peu?
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference

Is the book about basic php and MySQL or more advanced stuff or just mainly Basic MySQL?
I want to setup a site using php and MySQL with these features: Users submit content, admins delete, edit, or post content, Member login, Some pages require a password, and that's about it. Probably pretty basic stuff, but I don't know php or MySQL.
I'll probably get kev's book, but any other books I should look into buying?
Bookmarks