Jump to content

error with my php script


naggih

Recommended Posts

hello there,

i need some help,i'm using wampser, i've written my php scripts to collect and update data in mysql server but when i try to load the php page, i get such kind of eror messages as below

 

hello, here are the currently registered students

Invalid query: No database selected

 

 

i intend to display the records of table of registerd students, below is the code i used <html>

<head>

<title> the result for the requested records

</title>

</head>

<body>

<h3> hello, here are the currently registered students</h3>

<?php

 

 

$db = mysql_connect("localhost");

mysql_select_db("regsys",$db);

$query = "select * from stdnt_record";

$result = mysql_query($query);

 

while ($record = mysql_fetch_assoc($result))

{

while(list($fieldname,$fieldvalue) = each($record))

{

echo $fieldname.":".$fieldvalue.":<br>";

}

echo "<br>";

}

 

 

?>

 

</body>

</html>

thakyou.

 

naggi

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/205260-error-with-my-php-script/
Share on other sites

hello there,

i need some help,i'm using wampser,

Sorta sounds like wankster use


for your code.

<html>
<head>
<title> the result for the requested records 
</title>
</head>
<body>
<h3> hello, here are the currently registered students</h3>
<?php


$db = mysql_connect("****");
mysql_select_db("****",$db);
$query = "select * from stdnt_record";
$result = mysql_query($query);

while ($record = mysql_fetch_assoc($result))
{
while(list($fieldname,$fieldvalue) = each($record))
{
echo $fieldname.":".$fieldvalue.":<br>";
}
echo "<br>";
}


?>

</body>
</html>

 

What is the error you get?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.