I created the database named fdk126 and then I used the below commands to make the table
CREATE TABLE user (
user_firstname VARCHAR(25) NOT NULL,
user_lastname VARCHAR(25) NULL,
user_name VARCHAR(20) NOT NULL,
user_password VARCHAR(20) BINARY NOT NULL,
user_favorite_park VARCHAR(60) NULL,
user_sig TEXT NULL,
user_email VARCHAR(50) NOT NULL,
user_joindate DATE NOT NULL,
PRIMARY KEY (user_name, user_email),
UNIQUE username (user_name)
);
CREATE TABLE news (
story_date DATE NOT NULL,
story TEXT NOT NULL,
author CHAR(30) NOT NULL,
url TEXT NULL,
PRIMARY KEY (author)
);
then i inserted 2 rows of data into the user table and I tried to select data with this php code.
<?php
$link_id = mysql_connect("localhost", "fdk126", "kumro126");
mysql_select_db("fdk126");
$result = mysql_query("SELECT user_name,user_password from user", $link_id);
while ($data = mysql_fetch_object($result)) {
echo "'",$data["user_name"],"'";
// also tried
// echo $data["user_name"];
}
?>
and just '''' is returned. What is wrong?? I tried many different ways of doing this but none return results.
Thanks,
-Frank
CREATE TABLE user (
user_firstname VARCHAR(25) NOT NULL,
user_lastname VARCHAR(25) NULL,
user_name VARCHAR(20) NOT NULL,
user_password VARCHAR(20) BINARY NOT NULL,
user_favorite_park VARCHAR(60) NULL,
user_sig TEXT NULL,
user_email VARCHAR(50) NOT NULL,
user_joindate DATE NOT NULL,
PRIMARY KEY (user_name, user_email),
UNIQUE username (user_name)
);
CREATE TABLE news (
story_date DATE NOT NULL,
story TEXT NOT NULL,
author CHAR(30) NOT NULL,
url TEXT NULL,
PRIMARY KEY (author)
);
then i inserted 2 rows of data into the user table and I tried to select data with this php code.
<?php
$link_id = mysql_connect("localhost", "fdk126", "kumro126");
mysql_select_db("fdk126");
$result = mysql_query("SELECT user_name,user_password from user", $link_id);
while ($data = mysql_fetch_object($result)) {
echo "'",$data["user_name"],"'";
// also tried
// echo $data["user_name"];
}
?>
and just '''' is returned. What is wrong?? I tried many different ways of doing this but none return results.
Thanks,
-Frank