nothing works... host problem? *solved*
Posted: Sat Jun 09, 2007 3:42 pm
feyd | Please use
i did that and then went to the php myadmin thing and there was no table in the database. what is the issue?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am trying to do a user login system just as a test with justfree.com....
nothing i do works. I have resorted to literally copying and pasting stuff i googles and just putting in my info. i can't get the mysql database to work... is it a host problem? or something dumb i am overlooking?
here is one of the scripts i tried using that didn't workCode: Select all
<?
/**
* Connect to the mysql database.
*/
$conn = mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db('penguinflash_vibe', $conn) or die(mysql_error());
CREATE TABLE users (
username varchar(30),
password varchar(32));
?>i did that and then went to the php myadmin thing and there was no table in the database. what is the issue?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]
edit:
here is the code that made it work:Code: Select all
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='david';
$dbuserpass='mypassword';
$dbname='test';
// connect to the mysql database server.
$link_id = mysql_connect ($dbhost, $dbusername, $dbuserpass);
echo "success in database connection.";
// select the specific database name we want to access.
if (!mysql_select_db($dbname)) die(mysql_error());
echo "success in database selection.";
// add a table to the selected database
$result="CREATE TABLE users (username VARCHAR(25), password VARCHAR(25), email VARCHAR(30))";
if (mysql_query($result)){
echo "success in table creation.";
} else {
echo "no table created.";
}
?>