»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 12-03-2003, 11:01 AM   #1 (permalink)
Registered User
 
Join Date: Jul 2003
Posts: 20
data switch is on a distinguished road
MySQL error

I just started learning MySQL and PHP. The book gave me a file to use to test to see if MySQL and PHP were communicating properly. When I load that file, I get an error. The error is on the image I have attached. Here is the code for it:

PHP Code:
<html>
<head>
<title>Test MySQL</title>
<body>
<!-- mysql_up.php -->
<?php
$host
="matts-comp.attbi.com";
$user="matt";
$password="*******";

mysql_connect($host,$user,$password);
$sql="show status";
$result mysql_query($sql);
if (
$result == 0)
   echo(
"<b>Error " mysql_errno() . ": " mysql_error() . "</b>");
elseif (
mysql_num_rows($result) == 0)
   echo(
"<b>Query executed successfully!</b>");
else
{
?>
<!-- Table that displays the results -->
<table border="1">
  <tr><td><b>Variable_name</b></td><td><b>Value</b></td></tr>
  <?php
    
for ($i 0$i mysql_num_rows($result); $i++) {
      echo(
"<TR>");
      
$row_array mysql_fetch_row($result);
      for (
$j 0$j mysql_num_fields($result); $j++) {
        echo(
"<TD>" $row_array[$j] . "</td>");
        }
        echo(
"</tr>");
    }
  
?>
</table>
<?php ?>
</body>
</html>
My password is not actually like that, I just replaced it with the asterisks.

So anyone have an idea what could be wrong?
Attached Images
File Type: gif error.gif (4.1 KB, 39 views)

data switch is offline   Reply With Quote
Old 12-03-2003, 03:08 PM   #2 (permalink)
Registered User
 
davidamarkley's Avatar
 
Join Date: May 2002
Location: Joplin, MO
Posts: 2,208
davidamarkley is on a distinguished road
Send a message via ICQ to davidamarkley Send a message via AIM to davidamarkley
It works perfectly for me on my mySQL/PHP/Apache web server.

First thing to check is your username and password, as well as your domain name.

Make sure all are EXACTLY correct.

It almost looks like your screenshot is showing a syntax error on the page, not a mysql error.

What I would do is to copy-and-paste the EXACT info you posted, and create a new .php file named something like 'test.php' (without the quotes)

Then, just open up IE/Mozilla/Netscape/Opera and shoot to that page.

HTH,

David
__________________
-David
davidamarkley is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 10:13 AM.