Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.