Jump to content

maxiscool1994

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by maxiscool1994

  1. I just found this awesome resource: http://www.oreillyschool.com/courses/ This is oreilly's online school, where you take online courses, that aren't too expensive, on all different kinds of programming! My dad has agreed that I can do a few of these courses, and I am asking if anyone here recommends a specific programming language. Does anyone have any input? I think that by the time I will take the course, I should be at least a bit proficient in PHP/MySQL...
  2. Would you recommend getting Sam's after I finish this book, or get it now and forget about the one I am using?
  3. Helraizer, please realize that I am doing this as an example out of a book, so as long as I can work through it, its good.... Does anyone have any good books on learning PHP/MySQL they'd recommend?
  4. Wow...I'm freaking retarded...There used to be a ton of jokes in there...what happened to them?
  5. @Neon: That code didn't change anything. It still doesn't display any jokes... @wsantos: Here is the result for the first query: The second...:
  6. My website might only get a few users per day. I might end up hosting a really small businesses site there too...Mostly, I want to do this as a learning experience on how servers work etc. How did you make your computers servers? What linux distro?
  7. I have been, and none of the stuff works... Here are the structures: Joke: Author:
  8. Yes, I have, as it told me to do in the book. It is moving on into relational database design, and it said that it is easy to display info from more than one table with a join...This book seems to be pointing me in a bad direction. None of the code works...I think I will drop by the book store and pick up Sam's or something...
  9. That is another page... It seems that this book is contradictory to a lot of things people on this forum are saying. None of the stuff in it works..
  10. I've got a new issue: I am trying again to connect to my jokes database, this time with a few added things: an author name and e-mail address. The PHP is connecting to my database, but none of my jokes are showing up... Here is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Our List of Jokes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'new password'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the jokes database if (!@mysql_select_db('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } ?> <p>Here are all the jokes in our database:</p> <blockquote> <?php $jokelist = @mysql_query( 'SELECT joketext, name, email FROM joke, author WHERE authorid=author.id'); if (!$jokelist) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } while ($joke = mysql_fetch_array($jokelist)) { $joketext = $joke['joketext']; $name = $joke['name']; $email = $joke['email']; // Display the joke with author information echo "<p>$joketext<br />" . "(by <a href='mailto:$email'>$name</a>)</p>"; } ?> </blockquote> </body> </html>
  11. Thanks so much! I will continue to work through this book, and I will report back here when I am done. Hopefully I will have some more knowledge... You have been most helpful!
  12. ok. But what should I do about this entire mess that we just went through? It doesn't work!
  13. OK...do you have any idea on where I should start?
  14. This is the first example in the book... The thing is, all of what you are saying isn't sinking in that much. Should I just bear through this project and do it again to understand it, or should I find a better book?
  15. That works, except that there is an error when I try to submit a joke. Should I just dump this book and use the one that you recommended?
  16. What I am trying to do is make a form that will insert a joke into my MySQL joke database. This is a project from Yank's book. Do you suggest that I just scrap that book and learn from that link you gave me? Is there a way I can download that entire website?
  17. It said that the DB connection was successful, but the textbox and the jokes were not displayed.
  18. I am using Kevin Yanks Book, and it has taught me all of these things that you seem to be confused about. Here is a link: http://www.sitepoint.com/books/phpmysql1/ I am an absolute beginner, so I really don't know where to start... Is there a better book?
  19. I have been looking around the internet, and I have come across the topic of hosting your own website, by making a server. Does anyone here have any experience doing this? If so, do you think that it is a worthwhile experience?
  20. I get this error now: \ Here is the code with the different connection method: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>The Most Basic Web Page in the World</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> </head> <body> <?php if (isset($_GET['addjoke'])) : //User Wants to add a Joke ?> <form action="<?php echo $_SERVER['PHP_SHELF']; ?>" method="post"> <label>Type your joke here:<br /> <textarea name="joketext" rows="10" cols="40"> </textarea></label><br /> <input type="submit" value="SUBMIT" /> </form> <?php else: //Default page display //connect to the database server error_reporting(E_ALL); $conn = mysql_connect("localhost","root",''); $db=mysql_select_db("db_name"); if($conn=="") { trigger_error('Unable to connect to database: ' . mysql_error()); } //Selects the jokes database if (!@mysql_connect_db('ijdb')) { exit('<p>Unable to locate the joke '.' database at this time.</p>'); } //If a joke has been submitted, add it to the database. if (isset($_POST['joketext'])) { $joketext = $_POST['joketext']; $sql = "INSERT INTO joke SET joketext= '$joketext', jokedate=CURDATE() "; if (@mysql_query(@sql)) { echo '<p>Your joke has been added.</p>'; } else { echo '<p>Error adding submitted joke: '. mysql_error() . '</p>'; } } echo '<p>Here are all the jokes in our database:</p>'; //Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query '. mysql_error() . '</p>' } //display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>'; } //When Clicked, this link will load this page with the joke submission form displayed. echo '<p><a href="' . $_SERVER['PHP_SHELF'] . '?addjoke=1">Add a joke!</a></p>'; endif; ?> </body> </html>
  21. I took both of your guy's advice and none of it worked. I have already uncommented the extension in PHP.ini, and leaving the password blank changed nothing. Will PHPmyadmin work on a local machine? I have it on my web host, but what I am doing is not online.
  22. I fixed that last problem, but now I have a new one. This is a revised version of that page, but with a whole bunch of new functions, and it is not showing up as it should. It says that it can't connect to the MySQL server.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>The Internet Joke Database</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php if (isset($_GET['addjoke'])): // If the user wants to add a joke ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label>Type your joke here:<br /> <textarea name="joketext" rows="10" cols="40"> </textarea></label><br /> <input type="submit" value="SUBMIT" /> </form> <?php else: // Default page display // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'new password'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the jokes database if (!@mysql_select_db('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } // If a joke has been submitted, // add it to the database. if (isset($_POST['joketext'])) { $joketext = $_POST['joketext']; $sql = "INSERT INTO joke SET joketext='$joketext', jokedate=CURDATE()"; if (@mysql_query($sql)) { echo '<p>Your joke has been added.</p>'; } else { echo '<p>Error adding submitted joke: ' . mysql_error() . '</p>'; } } echo '<p>Here are all the jokes in our database:</p>'; // Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>'; } // When clicked, this link will load this page // with the joke submission form displayed. echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?addjoke=1">Add a Joke!</a></p>'; endif; ?> </body> </html>
  23. I am learning with Kevin Yanks book, "Build you Own Database Driven Website," and I have run into a problem. I have uploaded a PHP file to my local server, and none of my content is being displayed from my database. According to the book, the jokes that I have entered into my database should be displayed using this code. Here is the error I am getting: Here is my PHP file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Our List of Jokes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'new password'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the jokes database if (!@mysql_select_db('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } ?> <p>Here are all the jokes in our database:</p> <blockquote> <?php // Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>'; } ?> </blockquote> </body> </html> Note: I have MySQL installed and running on my machine...
×
×
  • 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.