Database Connections
Posted by: jibber4568 (---.swan.cable.ntl.com)
Date: May 02, 2008 06:09PM

I am relatively new to the development world and was hoping someone could help me with my database connections.

I used phpadmin to create a database named ajax.

I then addded a table to this database with the following query

CREATE TABLE chat
(
chat_id int(11) NOT NULL auto_increment,
posted_on datetime NOT NULL,
user_name varchar(255) NOT NULL,
message text NOT NULL,
color char(7) default '#000000',
PRIMARY KEY (chat_id)
);

Now i noticed that this is then added to the folder wamp/bin/mysql/mysql5.0.51a/data/ajax


Now i am trying to connect to this using a php script in the folder wamp/www/test

The example i have been following provides the database connection as follows.

<?php
// defines database connection data
define('DB_HOST', 'localhost');
define('DB_USER', 'ajaxuser');
define('DB_PASSWORD', 'practical');
define('DB_DATABASE', 'ajax');
?>

Is this correct??? Or am i missing something in order to determine my connection.

All help is very much appreciated.

Jibber4568

Options: ReplyQuote
Re: Database Connections
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 02, 2008 06:14PM

all wrong lol

<?php
mysql_connect("localhost", "ajaxuser", "practical"winking smiley or die(mysql_error());
mysql_select_db("ajax"winking smiley or die(mysql_error());
?>

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Database Connections
Posted by: jibber4568 (---.swan.cable.ntl.com)
Date: May 02, 2008 06:26PM

Great!! Thanks alot for that. ALthough i was hoping that was where the problem was with my example, it hasn't helped. Back to the drawing board i guess

Options: ReplyQuote
Re: Database Connections
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 02, 2008 06:28PM

whats the priblem ur having?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.