Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 12-06-2004, 02:06 PM   #1
Member (8 bit)
 
Join Date: Jun 2004
Location: South Bucks, England
Posts: 160
Send a message via AIM to longrawker Send a message via MSN to longrawker
Maybe a little PHP/MySQL help is needed...

Hey.

The code that I’m trying to get to work is as follows. The problem is with the 7th, 8th, and 9th lines...
PHP Code:
<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?

I have installed PHP and MySQL, and the MySQLadmin.exe prog doesnt provide much help...

Thanks a lot.
longrawker is offline   Reply With Quote
Old 12-06-2004, 03:05 PM   #2
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Contact your host admin, I only see a blog on that link.
aym is offline   Reply With Quote
Old 12-06-2004, 03:15 PM   #3
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Kind of confusing in your post. It looks like that you are wanting to test this on your local build before you upload it to your website. If so, host would be localhost. Default user would be 'root' and password would be blank ''.

$host = 'localhost';
$user = 'root';
$password = '';

You can't really run the script on your local computer using the database on the site.
__________________

Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row
mairving is offline   Reply With Quote
Old 12-07-2004, 10:04 AM   #4
Member (8 bit)
 
Join Date: Jun 2004
Location: South Bucks, England
Posts: 160
Send a message via AIM to longrawker Send a message via MSN to longrawker
Quote:
Originally Posted by mairving
Kind of confusing in your post. It looks like that you are wanting to test this on your local build before you upload it to your website. If so, host would be localhost. Default user would be 'root' and password would be blank ''.

$host = 'localhost';
$user = 'root';
$password = '';

You can't really run the script on your local computer using the database on the site.
Actually, it's quite the opposite. I'm looking to test the database which is on my computer. I'm trying to find out what is wrong with those three lines of code... I dont understand the section in the book which deals with this.

"{shows lines of code that i posted originally, i copied the file from the CD, that's how i know there's nothing wrong with the code...}

Lines 7, 8, and 9 of that program need to be changed. These lines are

$host = 'hostname';
$user = 'mysqlaccount';
$password = 'mysqlpassword';

Change host to the name of the computer where MySQL is installed - for example, databasehost.mycompany.com. If the MySQL database is on the same computer as your web site, you can use localhost as the hostname.

Change mysqlaccountname and mysqlpassword to the appropriate values. If your MySQL account does not require a password, then type nothing between the quotes"


-that's from the book i'm using...

I'm totally lost here...
longrawker is offline   Reply With Quote
Old 12-07-2004, 10:06 AM   #5
Member (8 bit)
 
Join Date: Jun 2004
Location: South Bucks, England
Posts: 160
Send a message via AIM to longrawker Send a message via MSN to longrawker
Quote:
Originally Posted by aym_7
Contact your host admin, I only see a blog on that link.
Yeah, i know, allbutnothing.com is the server... or the domain name if you rather.
longrawker is offline   Reply With Quote
Old 12-17-2004, 11:21 PM   #6
Member (6 bit)
 
Join Date: Dec 2004
Posts: 54
that is their domain, you need to contact them to get this info, the host, your username and password that they will issue you. the domain is different from where they probably keep the MySQL server. so will need to talk to them and input the correct values into those lines.
ltmccaul is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:13 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2