troubleshooting Question

PHP MYSQL Select

Avatar of Nathan Riley
Nathan RileyFlag for United States of America asked on
Web DevelopmentPHPMySQL Server
11 Comments2 Solutions362 ViewsLast Modified:
I'm not getting any results returned, can't figure out why.  The query works and returns the result in phpmyadmin.

<?php
//Connect to the Database
$host = localhost;
$username = db_user;
$password = 'pass';
$connect = mysql_connect($host,$username,$password);

//Select the Database
$db = 'db_pm';
mysql_select_db($db);

//Query the needed data
$query = "select id,userid,title,description from projects where id=1";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
?>
<link href="../assets/front.css" rel="stylesheet" type="text/css" />
<?php include("header.php");?>
    <div class="workplace">
		<div class="newprojectbox">
		<h1><?php echo($query['id']); ?><h1>
		</div>
	</div>
<?php include("footer.php");?>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros