Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/3898-php512-mysql-problem/
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.
Link to comment
https://forums.phpfreaks.com/topic/3898-php512-mysql-problem/#findComment-13552
Share on other sites

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.