MySQL info

Status
Not open for further replies.

thecarver

New Member
Messages
110
Reaction score
0
Points
0
Hi,
I just wanted to know what my username and password were for my MySQL databases because I am trying to make a database and tables using php.
And also, what hostname should I use?

My subdomain is thecarver.x10hosting.com and my Cpanel username is taurin
 
Last edited:

Jacob

New Member
Messages
1,146
Reaction score
0
Points
0
What exactly are you asking? You create your own passwords/usernames for MySQL...
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
thanks, just one more question:
why does
Code:
while($row = mysql_fetch_array($result))
gives me an error, but when I view the page on my computer with EasyPHP1.8 it does what its supposed to do
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /backup/home/taurin/public_html/ton/login.php on line 13
(I dont know why it goes to my backup directories...)
 
Last edited:

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
its ok its supposed to be like that (the backup directory)

how many rows do you have in the database, and add this after the query and tell me what it says. and are you sure that its called $result,

PHP:
take
$result = (aklsdfjakldj);
and change to
$result = (afhakjsd) or die(mysql_error());
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
sorry for taking so long to answer, I was very busy...
Its for a login script, and I only made one account (so one row)
my login script looks like this
Code:
$result = mysql_query("SELECT * FROM users
WHERE Username='$_POST[username]'");

while($row = mysql_fetch_array($result))
{       
	if ($row['Password']==$_POST['password'])
	{
              login stuff
        {
}
and I cant add the code you want me to, I get the same error
I'm sorry, but I'm really confused, as this is only my third day at writing PHP.
 
Last edited:

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
try this

PHP:
$username = addslashes($_POST['username']);

$result = mysql_query("SELECT * FROM `users` WHERE `Username` = '$username'") or die(mysql_error);
$row = mysql_fetch_array($result))
	if ($row['Password']==$_POST['password'])
	{
              login stuff
        {
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
Ah now it prints the mysql_error you added in...
so I'm guessing its something wrong with this line
Code:
$result = mysql_query("SELECT * FROM `users` WHERE `Username` = '$username'")
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
It doesn't seem to be working right now, but I will try again after school
thank you for your help
 

thecarver

New Member
Messages
110
Reaction score
0
Points
0
Alright I fixed it. I really don't know what was causing that error, but I think i made some changes to the database that i forgot to change in the php, so thats what made the error
thank you for all your help
 
Status
Not open for further replies.
Top