I cant connect to the data base.[resolved]

Location of the Videos
Post Reply
gridan
Posts: 6
Joined: Sat Aug 13, 2011 5:29 pm

I cant connect to the data base.[resolved]

Post by gridan »

Hey folks, i got a problem.

I cant connect to the data base. I use Xammpp. I followed the second video of Browser MMO. It just says "cant find players".

And i copied the code exactly. Thanks for the helpers.
Last edited by gridan on Sun Oct 02, 2011 6:06 pm, edited 1 time in total.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: I cant connect to the data base.

Post by Jackolantern »

Even though you copied the code, please post it.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: I cant connect to the data base.

Post by hallsofvallhalla »

yes we will actually need to see what you are using.
gridan
Posts: 6
Joined: Sat Aug 13, 2011 5:29 pm

Re: I cant connect to the data base.

Post by gridan »

this is test.php

Code: Select all

<?php
include 'connect.php';

$playerinfo ="select * from players where name = 'player1'";
$playerinfo2 = mysql_query($playerinfo) or die ("could not select players");
$playerinfo3 = mysql_fetch_array($playerinfo2);

echo "Player1's email is " . $playerinfo3['email'];
echo "<br>Player1's id is " . $playerinfo3['id'];


?>

and thats connect.php

Code: Select all

<?php

$db = mysql_connect("localhost","root","") or die("Could not connect to db");
if(!$db)
die("no db");
if(!mysql_select_db("tutorial",$db))
die("No Database Selected");

?>
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: I cant connect to the data base.

Post by hallsofvallhalla »

i always recommend everyone watch up to video 14 before doing code but check to make sure you have a table in your DB called players. Check spelling.
gridan
Posts: 6
Joined: Sat Aug 13, 2011 5:29 pm

Re: I cant connect to the data base.

Post by gridan »

It works. I started a new data base and it works. Thanks i think i wrote something wrong.
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: I cant connect to the data base.

Post by Callan S. »

Sometimes I think the skill required isn't so much programming - what you don't know at the start is how to debug - where to look, what the usual problems are, etc.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: I cant connect to the data base.

Post by Jackolantern »

And for the most part, PHP does not make debugging easy. It is a far cry from all the tools you have at your disposal in some other environments like .NET or Flash.
The indelible lord of tl;dr
Post Reply

Return to “Older Browser MMO Videos”