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 trialJesse Thompson
2,115 PointsIssue 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:
<?php
$con = mysql_connect(localhost, langfx_admin, 0p9o8i7u6y);
mysql_select_db(langfx_joshkblog,$con);
?>
heres the code for the tables.php file:
<?PHP
include "mysql.php";
$table= "ENTRIES";
mysql_query ("CREATE TABLE IF NOT EXISTS '$table' ('ID' INT NOT NULL AUTO_INCREMENT , PRIMARY KEY ( 'id ) )");
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
Jesse Thompson
2,115 PointsHmm, 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?
James Barnett
39,199 PointsNow might be a good time to brush up on some SQL in the Database Foundations course here on Treehouse
Randy Hoyt
Treehouse Guest TeacherRandy Hoyt
Treehouse Guest TeacherIf you want to build your own blogging engine, I would definitely recommend using a framework. Go for it!