Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > MySQL > Help with my script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-01-03, 10:42
Samia1667 Samia1667 is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Help with my script

Dear All,

I am trying to learn mysql on my own and I was following an example. I have everything installed apache/php/mysql on win2k and working fine. I even managed to create a database jokes thru command prompt start>programs>accessories>, and I can display very well. However tryong to display in my browser using
PHP Code:
<html>
<head>
<title>Our List of Jokes </title>
</head>
<body>
<?php

   
// Connect to the database server
   
$dbcnx = @mysql_connect('localhost''root''myne');
   if (!
$dbcnx) {
   die( 
'<p>Unable to connect to the ' .
          
'database server at this time.</p>' );
   }

   
// Select the jokes database
   
if (! @mysql_select_bd('Jokes'$dbcnx) ) {
   die( 
'<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_querry('SELECT JokeText FROM Jokes');
   if (!
$result) {
     die(
'<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>');
   }
?>
</blockquote>
</body>
</html>
won't work. What could be the problem.
Reply With Quote
  #2 (permalink)  
Old 12-02-03, 05:42
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: Help with my script

Quote:
Originally posted by Samia1667
Dear All,

I am trying to learn mysql on my own and I was following an example. I have everything installed apache/php/mysql on win2k and working fine. I even managed to create a database jokes thru command prompt start>programs>accessories>, and I can display very well. However tryong to display in my browser using
PHP Code:
<html>
<head>
<title>Our List of Jokes </title>
</head>
<body>
<?php

   
// Connect to the database server
   
$dbcnx = @mysql_connect('localhost''root''myne');
   if (!
$dbcnx) {
   die( 
'<p>Unable to connect to the ' .
          
'database server at this time.</p>' );
   }

   
// Select the jokes database
   
if (! @mysql_select_bd('Jokes'$dbcnx) ) {
   die( 
'<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_querry('SELECT JokeText FROM Jokes');
   if (!
$result) {
     die(
'<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>');
   }
?>
</blockquote>
</body>
</html>
won't work. What could be the problem.


Got you some error message?
Reply With Quote
  #3 (permalink)  
Old 12-02-03, 07:32
Samia1667 Samia1667 is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Actually I finally got it to work, there were typos in querry and not query and @mysql_select_bd and not @mysql_select_db.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On