Browser MMO Video#2

Location of the Videos
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#2

Post by hallsofvallhalla »

please post your connect.php or at least line 3
Zorber
Posts: 102
Joined: Wed Jun 15, 2011 2:51 am

Re: Video#2

Post by Zorber »

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: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#2

Post by hallsofvallhalla »

Code: Select all

$db = mysql_connect(localhost","root","") or die ("Could not connect to db");
missing a "

Code: Select all

$db = mysql_connect("localhost","root","") or die ("Could not connect to db");
Zorber
Posts: 102
Joined: Wed Jun 15, 2011 2:51 am

Re: Video#2

Post by Zorber »

ah, I see it now , Thanks ;)
joedraco
Posts: 9
Joined: Wed Oct 05, 2011 9:05 pm

Re: Video#2

Post by joedraco »

why do i get this message when i try to go to phpMyAdmin: ?

Forbidden

You don't have permission to access /phpmyadmin/ on this server.


???
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#2

Post by Jackolantern »

Please only post a problem to one place. You already asked this question in one of the sticky threads in this forum section.
The indelible lord of tl;dr
kaitokid89
Posts: 3
Joined: Sun Aug 05, 2012 8:00 am

Re: Browser MMO Video#2

Post by kaitokid89 »

hi i'd like to say thanks for making this guide.
and i just recently tried it but i get stuck in the part where i should put http://localhost/tutorial/test.php
i got could not select player.

here is my code for connect.php

<?php

$db = mysql_connect ("localhost","root","130589") or die ("ga konek ke db");
if(!$db)
die("dbnya ilang");
if(!mysql_select_db("tutorial",$db))
die("no database selected");

?>


test.php

<?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'];

?>

another info
Field = data
ID = 1
Name = player1
Email = player1@indieresource.com
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

They would both need to be in the "tutorial" folder from how they are currently set up. What is happening when you try to run test.php? Are you getting an error?
The indelible lord of tl;dr
kaitokid89
Posts: 3
Joined: Sun Aug 05, 2012 8:00 am

Re: Browser MMO Video#2

Post by kaitokid89 »

Yep I put it in the tutorial folder.

when i run localhost/tutorial/test.php it said "could not select player"
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

That error means that you are connecting to MySQL, but the query is failing. Check the SQL query, and make sure it matches all table and column names exactly in your database. Right now it is assuming you have a record in a table called "players" with a "Name" of "player1". Check in phpMyAdmin to make sure that is all true.
The indelible lord of tl;dr
Post Reply

Return to “Older Browser MMO Videos”