Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Issue with setting up php mysql database

So Im following this tutorial http://www.youtube.com/watch?v=ZDhX9FMIcYc and Im trying to create a table in my sql database. I've uploaded all the files including the mysql.php and tables.php file, but when I go to phpmyadmin in the cpanel and go to the database it doesn't show that a table has been created.

Whenever I go to http://langfx.com/joshkblog/tables.php it shows Parse error: syntax error, unexpected T_STRING in /home/langfx/public_html/joshkblog/mysql.php on line 2

Heres the code for mysql.php file:

$con = mysql_connect(localhost, langfx_admin, 0p9o8i7u6y);

heres the code for the tables.php file:


include "mysql.php";

$table= "ENTRIES";
mysql_query ("ALTER TABLE '$table' ADD 'TITLE' TEXT NOT NULL");
mysql_query ("ALTER TABLE '$table' ADD 'SUMMARY' TEXT NOT NULL");
mysql_query ("ALTER TABLE '$table' ADD 'CONTENT' TEXT NOT NULL");

I dont get it, I followed the instructions exactly, whats wrong with my second line in the sql file?

I notice theres a "create" table option in phpmyadmin. Should I just use that instead of doing this manually? Im trying to create a blog similar to www.chanceraps.com

Or maybe instead of doing any of this manually I should just download a simple php blog script? Something like this? http://sourceforge.net/projects/php-blog-insert/

2 Answers

Hmm, instead of doing that I might just do this tutorial instead actually, seems to be on the level that I want the blog to be on http://maxoffsky.com/code-blog/tutorial-creating-a-blog-in-laravel-from-scratch-part-1-overview/

Just want to know if Im going in the right direction?

Randy Hoyt
Randy Hoyt
Treehouse Guest Teacher

If you want to build your own blogging engine, I would definitely recommend using a framework. Go for it!

James Barnett
James Barnett
39,199 Points

Now might be a good time to brush up on some SQL in the Database Foundations course here on Treehouse