Hi all !
I am new in the world of PHP....and ask you to help me with a problem.
I have a page named view.php with this code :
********
HTML>
<?php
$db=mysql_connect("localhost","root","") ;
mysql_select_db("test",$db) ;
$result=mysql_query("select * from subcat where scatid=$scatid",$db) ;
while ($myrow=mysql_fetch_array($result))
{
echo "<br>First Name: ".$myrow["subcatid"] ;
echo "Last name: ".$myrow["sname"] ;
}
?>
</HTML>
******
In browser calling localhost\view.php?scatid=1 i get an error :
****
Note: Undefined variable : scatid in c:\inetpub\wwwroot\teste\view.php on line 5
****
my php is in c:\inetpub\wwwroot\teste .....
thank you very much
[mail_search][/mail_search]
Undefined variable
Moderator: General Moderators
-
alina_costin
- Forum Newbie
- Posts: 5
- Joined: Fri Mar 05, 2004 1:02 am
- Location: Romania
- Contact:
you need to call in the variable like this
Rwad here for more info on this solution - http://uk2.php.net/variables.external
Mark
Code: Select all
HTML>
<?php
$scatid = $_GET['scatid'];
$db=mysql_connect("localhost","root","") ;
mysql_select_db("test",$db) ;
$result=mysql_query("select * from subcat where scatid=$scatid",$db) ;
while ($myrow=mysql_fetch_array($result))
{
echo "<br>First Name: ".$myrow["subcatid"] ;
echo "Last name: ".$myrow["sname"] ;
}
?>
</HTML>Mark
-
alina_costin
- Forum Newbie
- Posts: 5
- Joined: Fri Mar 05, 2004 1:02 am
- Location: Romania
- Contact: