Jump to content

Archived

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

kaustubhghag

PHP5.1.2 & MySQL problem

Recommended Posts

I have Installed MySQL on windows 2000 professional operating system and then i have created ijdb as new database in which i have created joke table.

so when i tried to connect to that table and try to retrieve values it shows me following message:

Fatal error: Call to undefined function mysql_connect() in e:\Inetpub\wwwroot\connect.php on line 6


Following is the code:

html>
<head>
<title>Our List of Jokes</title>
<body>
<?php
// Connect to the database server

$dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the jokes database
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here are all the jokes in our database:</p>
<blockquote>
<?php
// Request the text of all the jokes

$result = @mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo '<p>' . $row['joketext'] . '</p>';
echo "Hello";
}
?>
</blockquote>
</body>
</html>html>
<head>
<title>Our List of Jokes</title>
<body>
<?php
// Connect to the database server

$dbcnx = @mysql_connect('localhost', 'root', 'root');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the jokes database
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here are all the jokes in our database:</p>
<blockquote>
<?php
// Request the text of all the jokes

$result = @mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo '<p>' . $row['joketext'] . '</p>';
echo "Hello";
}
?>
</blockquote>
</body>
</html>


so can anyone guide what is problem

Share this post


Link to post
Share on other sites
You need to enable the MySQL extrension in the php.ini file. PHP5.x no longer provides MySQL Support inbuilt and so you need to manually enable the mysql extension in the php.ini

Click [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87276\" target=\"_blank\"]here[/a] to see how to do so.

Share this post


Link to post
Share on other sites

×

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.