introduction screenshots faq forum blog modules components download
Please use the search function and/or read the FAQ first.

Go to Topic: PreviousNext
Go to: Message ListNew TopicSearchLog InPrint View

please help!!!!



Posted by: l3g0m&n
April 22, 2008 04:12PM
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>
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 03:52AM
James,

I'm sorry it's not working for you. I created your database and your php code runs perfectly.

I guess I would make sure that you can connect as root, with no password. I would also, after each mysql_...() call, print out the value of mysql_error().

Good Luck,
-HJ
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 04:23PM
hi there thanks for the reply could you pls assist me then in creating a new user and password?
is this done through apache? im not sure :/

sorry and thanks
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 04:32PM
i also tried to put error messages in but nothing seems to show up

echo mysql_error();

tahts the line i used but nothings showing up
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 06:22PM
Can you log into [home] as root, with no password?
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 06:26PM
sorry...

[localhost]

-HJ
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 07:10PM
hi thanks again

ie cant seem to display the page, im not sure if that means the page isnt running or i dont have access
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 07:12PM
says its a 404 error

can i ask what exactly i need to do in order to get my database online apart from uploading my database .sql file into myphpadmin?

i think i may not be using wampserver properly
thanks again!
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 08:51PM
If h t t p : / / localhost/home/mysql results in a 404, something is wrong. What happens when you try h t t p : / / localhost/home ? Did you change any config files? what version are you running?
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:03PM
404 for /home too,
wampserver2.0

ive not touched any settings apart from add new users to myphpadmin
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 09:08PM
I'm not sure what wampserver is. You realize you're on the EasyPHP2.0 forum?
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:21PM
ive tried using easyphp too

easyphp 2.0.0.0.0 on vista

neither seem to work
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:22PM
although localhost/home/mysql works with easphp
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:30PM
wampserver is another WAMP like easyphp, sorry.

ive gone back to trying with easyphp now and local/host/mysql brings up the phpadmin thing that i used to import my sql file with.

that seems to be ok.

but the code tha ti was using still isnt bringing back anything, i havent changed any settings and the priveledges still says root no password.

did you change any of your settings when you tested my code?

maybe ive got some settings wrong?
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 09:43PM
I didn't change any settings. It just worked. You can browse the data in your table with localhost/home/mysql? Perhaps it's a vista problem. I'm running XP. Sorry. I can't think of anything else to try. You just get a blank page? Does other PHP code work? I guess it must, since phpmyadmin works.
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:56PM
i havent changed any settings.. did you use the same root password combo?
i can browse the data with home/sql no problem.
ive tried on xp too , ive tried other code with no avail.

i just get a blank page im really lost :S
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 09:59PM
should i be loading the html file with the php data in it from the same directory?
(as in local/home/mysql?)

i think ive tried that too but it didnt work from what i remember.

as im just opening the html file with i.e from explorer.

or should i be loading it via internet explorer via the address?
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 10:03PM
im unstuck!

finally its working...
renamed the html file .php and put it in /home directory... its working now.

orz at last!#

thank you for all your help!
Options: ReplyQuote
Posted by: hjonez
April 23, 2008 10:52PM
Makes sense. .html files are not php processed. Nice work hanging in there and figuring it out.
Options: ReplyQuote
Posted by: l3g0m&n
April 23, 2008 05:51PM
can someone please help?
im not sure why im having this problem.
ive tried this using easyphp and wampserver
im currently using vista which ive tried on both and also tried using easyphp on my laptop which is running xp but nothing seems to work
ive not changed the settings so root should be able to connect with no password.
and when i use the mysql command prompt in wampserver and query the database it works

<!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
$link = mysql_connect("localhost", "root", "");

mysql_select_db("nonexistentdb", $link);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";

mysql_select_db("snapshare", $link);
mysql_query("SELECT * FROM photo", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?>
</pre>
</body>
</html>

ive also tried the above code for testing but the echos dont bring back anything.

should i be editing my settings?
Options: ReplyQuote


Go to: Message ListSearchLog In
Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.