hello,
sorry and thank you in advanced for me not knowing much and for all your replies.
ive installed easyphp 2.0.0
and im trying to create a webdatabase
ive uploaded my database into the myphpadmin thing and it seems to be working.
my problem is that i seem to be having trouble connecting to the database ive connected.
ive not changed any of the settings and im using this code to try connect ot the database and print out a short query of the data in photo
heres abit of my sql code
CREATE DATABASE snapshare;
USE snapshare;
CREATE TABLE photo (
photo_id int(10) NOT NULL auto_increment,
description varchar(500),
dateuploaded date,
format varchar(30),
price decimal(4,2),
user_id1 int(10),
photo blob,
PRIMARY KEY(photo_id),
FOREIGN KEY (user_id1) REFERENCES user(user_id)
) type=MyISAM;
INSERT INTO photo VALUES (1, 'photo1', '2003-12-12', 'jpeg', '01.01', '1', NULL);
INSERT INTO photo VALUES (4, 'photo4', '2003-12-12', 'jpeg', '01.04', '1', NULL);
INSERT INTO photo VALUES (7, 'photo7', '2003-12-12', 'jpeg', '01.07', '1', NULL);
INSERT INTO photo VALUES (2, 'photo2', '2004-12-29', 'jpeg', '02.00', '2', NULL);
INSERT INTO photo VALUES (5, 'photo5', '2004-12-29', 'jpeg', '02.05', '2', NULL);
INSERT INTO photo VALUES (8, 'photo8', '2004-12-29', 'jpeg', '02.08', '2', NULL);
INSERT INTO photo VALUES (3, 'photo3', '2004-10-10', 'jpeg', '03.00', '3', NULL);
INSERT INTO photo VALUES (6, 'photo6', '2004-10-10', 'jpeg', '03.06', '3', NULL);
INSERT INTO photo VALUES (9, 'photo9', '2004-10-10', 'jpeg', '03.09', '3', NULL);
but its not returning anything
please help!
james
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"[
www.w3.org];
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>photos</title>
</head>
<body>
<pre>
<?php
// (1) Open the database connection
$connection = mysql_connect("localhost","root","");
// (2) Select the winestore database
mysql_select_db("snapshare", $connection);
// (3) Run the query on the winestore through the connection
$result = mysql_query ("SELECT * FROM
photo", $connection);
// (4) While there are still rows in the result set, fetch the current
// row into the array $row
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
// (5) Print out each element in $row, that is, print the values of
// the attributes
foreach ($row as $attribute)
print "{$attribute} ";
// Print a carriage return to neaten the output
print "\n";
}
?>
</pre>
</body>