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 trialPhil White
Courses Plus Student 9,519 Points*[SOLVED]* Trying to learn MySQL and PHP
Hi All im just starting to learn MySQL and PHP and im stuck at a early stage. Im trying to get the details from my database and print them into the browser. ive tried everything i can think of and have followed the tutors code exactly! Dont know whats going on!
<?php
$link = mysqli_connect ("confidential-details");
if (mysqli_connect_error()) {
die ("There was an error connecting to the database");
}
$query = "SELECT * FROM confidential-username";
if ($result = mysqli_query($link, $query)); {
$row = mysqli_fetch_array ($result);
echo "Your name is ".$row['email']."and your password is ".$row['password'].;
}
?>
Everything i have is above except the passwords etc to my database for obvious reasons. please help! Thank you in advance!
Phil White
Courses Plus Student 9,519 PointsHi Steven Parker ive tried to delete but cant work it out. what do i do?
Phil White
Courses Plus Student 9,519 Pointsyeah i've tried that but it only gives me an option to edit question and nothing within that to delete.
Steven Parker
231,261 PointsOdd, I thought the delete option was present until an answer was posted. But maybe comments count also. Delete all your comments and I will delete this one. I have already deleted the others.
Jason Anders
Treehouse Moderator 145,860 PointsHI Phil White
I marked your post as solved, as students do not have the ability to delete a question once posted to the Community. You can deleted comments and answers, but not questions... those you can only edit.
To add to the excellent learning one can achieve in the Community, it would be appreciated (as Steven pointed out) if you could just provide a quick answer to what the original problem was and how you solved it. This way, if another student runs into a similar issue, and they search the Forums, your post could be the "Ah-ha" moment they need.
Thanks. :)
Keep Coding!
Steven Parker
231,261 PointsJason Anders — has that changed recently?
I'm certain that previously it was possible for a student to delete a question as long as it had not been answered.
Phil White
Courses Plus Student 9,519 Pointsokay Jason Anders got ya. The problem was that on line 6 i had a username from my database and i actually didn't need a username at all, all i needed was the word users. like i said amateur mistake. hope it helps
Jason Anders
Treehouse Moderator 145,860 PointsI'm not 100% Steven Parker. I was always under the impression that once posted, it can't be deleted, but you may be right, but a "comment" probably counts as a response and that's why he couldn't deleted. I'll have to ask Jay about this one day. :)
Blayne Holland
19,321 PointsWhen you get a chance check out PDO. Once you go PDO its hard to go back to MySQLi.
Phil White
Courses Plus Student 9,519 PointsPhil White
Courses Plus Student 9,519 PointsDon't worry worked out the problem. amateur mistake lol