home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

MySQL error

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1733
Discussions: 200,958, Posts: 2,379,502, Members: 246,328
Old December 3rd, 2003, 02:01 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jul 2003
Posts: 23
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 Thumbnails
mysql-error-error.gif  
data switch is offline   Reply With Quote
Old December 3rd, 2003, 06:08 PM     #2 (permalink)
Ultimate Member
 
davidamarkley's Avatar
 
Join Date: May 2002
Location: Joplin, MO
Posts: 2,353
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
davidamarkley is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2951)
The disrespect of Obama by Russian .. (41)
Making Health Care Worse (178)
Wireless Televisions. (12)
CPU fan stops spinning randomly (9)
Regular Build (11)
windows 7 problem (7)
Laptop with wireless problem. (5)
Is the PSU I received dead? (12)
Print spooler problem (15)
windows vista security holes (11)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Multiple Restarts Required at Boot (3)
Open With ..... Win7 (1)
Kingston Bluetooth Dongle Driver (0)
webcam (0)
upgrade for hp a6101 (0)
windows vista security holes (11)
Laptop with wireless problem. (5)
Modern Warfare 2: Who Bought It? (64)
tv not turn on-makes clicking sound (2)
CPU fan stops spinning randomly (9)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Point and Shoot Camera Suggestions. (4)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Hp Artist Edition + Matching Bag (0)


All times are GMT -4. The time now is 08:01 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28