Page 7 of 13
Re: Video#2
Posted: Sun Nov 01, 2009 9:14 am
by RolsenRoyce
Warning message!
Notice: Use of undefined constant db - assumed 'db' in D:\wamp\www\NUKE\connect.php on line 4
$playerinfo ="select * from players where name = 'Mike Rophone'"; //this is my line 4
Code works, but I want to remove the warning message, it looks so unprofessional :>
Can I "define" this "constant db"?
Re: Video#2
Posted: Sun Nov 01, 2009 2:38 pm
by hallsofvallhalla
what is your line 4 in your connect.php? you may have to define the db variable in the beginning of the code.
like $db = 0;
Re: Video#2
Posted: Sun Nov 01, 2009 11:17 pm
by RolsenRoyce
$playerinfo ="select * from players where name = 'Mike Rophone'"; //this is my line 4
$db = 0; // does nothing, since it is already:
$db = mysql_connect("localhost","root","") or die("Could not connect to DB");
Notice message still stands.
And it is copypasted from videotutorial
Re: Video#2
Posted: Sun Nov 01, 2009 11:24 pm
by Lord Strife
if you get one of those notices you can do 2 things , first put @ in front of the db var. or two incase the db var with ' '
examples:
Re: Video#2
Posted: Mon Nov 02, 2009 2:26 am
by RolsenRoyce
<?php
$db = mysql_connect("localhost","root","") or die("Could not connect to DB");
if(!db) // I forgot a $ on the fecher. Added it, now works (Line is now: if(!$db)
die("No DB");
if(!mysql_select_db("Silos",$db))
die("No DB Selected");
?>
I found the error.
I removed empty lines and then I got the real line number? Now it pointed at three.
Re: Video#2
Posted: Mon Nov 02, 2009 2:35 am
by hallsofvallhalla
nice work on the catch
so its fixed completely?
Re: Video#2
Posted: Mon Nov 02, 2009 11:59 am
by RolsenRoyce
Yes indeed, the notice is gone.
Re: Video#2
Posted: Sun Nov 08, 2009 10:52 pm
by ZeroComp
nice tut helped a lot more than my stupid book
Re: Video#2
Posted: Sun Nov 08, 2009 11:04 pm
by ZeroComp
my result page says this
Player1's email is
player1@indie-resource.com
Notice: Undefined index: id in C:\wamp\www\Tutorial\test.php on line 9
Player1's id is
Re: Video#2
Posted: Sun Nov 08, 2009 11:06 pm
by hallsofvallhalla
check your database and make sure all feilds and data are exactly like they should be, capital letters and all. Post a screen if you need to.