Page 1 of 3
Help
Posted: Tue Nov 17, 2009 6:03 pm
by Kintama
ok so im on the 2nd tutorial at the end of it and when i shud get player1's email all i get is {no db}
this is my scripts
________________________Connect.php______________________________
Code: Select all
<?php
$db = mysql_connect ("localhost" , "usernam" , "password") or die ("Could not connect to db");
if ( $db)
die ("no db");
if ( mysql_select_db ("tutorial",$db))
die ("No Database Selected");
?>
_________________________________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'];
?>
i have triple checked the vidoes and my scrips and its all correct on what i can see
Re: Help
Posted: Tue Nov 17, 2009 6:22 pm
by SpiritWebb
In your test.php file on the line $playerinfo="select ' from...
It should read:
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");
?>
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'];
?>
You used ' instead of *. You also need to make sure you created the db in MySql that says "tutorial." If you used another name other then tutorial, then you need to change "tutorial" over to whatever you used.
Re: Help
Posted: Tue Nov 17, 2009 6:26 pm
by Kintama
oooo i see thanks againe

ill check it now
Re: Help
Posted: Tue Nov 17, 2009 6:26 pm
by SpiritWebb
Sure thing...hope that helps you out!!

Re: Help
Posted: Tue Nov 17, 2009 6:27 pm
by Kintama
ooo i still get the same text no change in it
can we speak on MSN
kintama@live.co.uk
Re: Help
Posted: Tue Nov 17, 2009 9:03 pm
by hallsofvallhalla
missing a 'e' on username in the first script...
Re: Help
Posted: Tue Nov 17, 2009 9:10 pm
by SpiritWebb
Oh hell, I didn't even see the "e" on username...blah
Re: Help
Posted: Wed Nov 18, 2009 9:35 am
by Kintama
username and password on my DB database bit it not the real info cuz i have other stuff on my database

so i dont no what is wrong with it
Re: Help
Posted: Wed Nov 18, 2009 10:01 am
by Kintama
is this 100% right
Code: Select all
<?php
$db = mysql_connect ("localhost" , "my username" , "my password") or die ("Could not connect to db");
if ($db)
die ("no db");
if ( mysql_select_db ("tutorial",$db))
die ("No Database Selected");
?>
and were it ses
Code: Select all
if ($db)
die ("no db");
if ( mysql_select_db ("tutorial",$db))
is looks think there is somethink on your video were it ses
if ({look like there some think here}$db)
Re: Help
Posted: Wed Nov 18, 2009 1:40 pm
by SpiritWebb
in your connect.php file should look:
Code: Select all
<?php
$db = mysql_connect("localhost","my username","my password") or die("Could not connect to db");
if(!$db)
die("no db");
[b]if(!mysql_select_db("tutorial",$db))[/b] //You left out the ! in front of the mysql_select_db statement //
die("No Database Selected");
?>
You can try taking out all the spaces in your code on each line, except between the $db = mysql part. Thats how I have on mine, but then again, I dont have a username or password on my localhost. I just use ("localhost","root","")