Extracting Information from MySQL with PHP
Posted: Tue Oct 22, 2002 9:15 pm
Alright.
So I'm this PHP newbie who's just now getting into MySQL and the whole database deal. I think I've gotten modifying the database via the command prompt and adding to the database via PHP down pat, but it's getting information out and displaying it that really gets me. I see scripts i can just copy and paste, but I'd like to know what they actually mean. Here's a script i copy and pasted that works fine, but I'd like to know what it means.
Alright. So my first question is what's with the "[ ]" brackets? I've never seen those before now and i have no idea when/what they're used for.
Next, when i echo out the variable "description" (Which really is for email..I just edited the script), it displays every single email in the entire table. To just display the desired email, what would i do? I have a faint idea here..
But beyond that I'm clueless.
I know these questions are very "newbie-ish", but hey, how else will I learn?
Take it easy guys, - Tom
So I'm this PHP newbie who's just now getting into MySQL and the whole database deal. I think I've gotten modifying the database via the command prompt and adding to the database via PHP down pat, but it's getting information out and displaying it that really gets me. I see scripts i can just copy and paste, but I'd like to know what they actually mean. Here's a script i copy and pasted that works fine, but I'd like to know what it means.
Code: Select all
<?php
// Loop the results
// Note, results are returned as an
// Array - we cannot just print it out.
while($row = @mysql_fetch_array($result)) {
$id = $rowї"id"];
$name = $rowї"name"];
$description = $rowї"email"];
?>Next, when i echo out the variable "description" (Which really is for email..I just edited the script), it displays every single email in the entire table. To just display the desired email, what would i do? I have a faint idea here..
Code: Select all
<?php
$query = mysql_query("SELECT from userinfo where email='$search'");
?>I know these questions are very "newbie-ish", but hey, how else will I learn?
Take it easy guys, - Tom