Click to See Complete Forum and Search --> : MySQL in php question.


Windchill
11-17-2003, 02:12 PM
:confused:

I am now moving from confuzing mangled masses of text files to MySQL and creating a Blog engine.

I have the user ID number in $who (MySQL, blog_ID), and I want to get the blog_1st_name (MySQL table name) into the variable $name. I am connected to the MySQL database.

Jona
11-17-2003, 07:34 PM
$query = "SELECT `blog_1st_name` FROM `table_name` WHERE `blog_ID` = '". $who ."'";
$result = mysql_query($query);
if(!$result){
echo("MySQL database error: ".mysql_error()); exit;}

$row=mysql_fetch_assoc($result);
$name = $row["blog_1st_name"];


[J]ona

Windchill
11-18-2003, 04:53 AM
Thanks :)

Jona
11-18-2003, 03:50 PM
Welcome.

[J]ona