List:General Discussion« Previous MessageNext Message »
From:Eric Bergen Date:December 6 2004 10:36pm
Subject:Re: Newbie, MySQL test fails, spent hours, please help
View as plain text  
Aaron, 

You aren't trapping errors on mysql_connect(). 

Try this:
mysql_connect($host,$user,$password)
  or die(mysql_error());


-Eric


On Mon, 6 Dec 2004 19:13:49 +0100, Aaron Ford <aford@stripped> wrote:
> Hey.
> 
> The code that I'm trying to get to work is as follows.  The problem is
> with the 7th, 8th, and 9th lines...
> 
> <html>
> <head>
> <title>Test MySQL</title>
> <body>
> <!-- mysql_up.php -->
> <?php
> $host="";
> $user="";
> $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>
> 
> The server that I'm uploading to is www.allbutnothing.com.  I know my
> computer name, is the correct form for the host value
> computername.webserver.com??  How do I find my username and password,
> the only one I entered was the one when MySQLadmin.exe installed...  is
> that the username and password that should be used?
> 
> Thanks very much.
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 
> 


-- 
Eric Bergen
eric.bergen@stripped
http://www.bleated.com
Thread
Newbie, MySQL test fails, spent hours, please helpAaron Ford6 Dec
  • Re: Newbie, MySQL test fails, spent hours, please helpEric Bergen6 Dec