PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 23rd, 2013, 11:22 AM
dlmagers dlmagers is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Location: Rocky Mount, NC
Posts: 16 dlmagers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 11 sec
Reputation Power: 0
Send a message via Yahoo to dlmagers
Facebook
PHP-DB - Connecting to phpmysqladmin school server

I didn't want to have to post this question. I need someones professional help with connecting to my school phpmysql server. I have my code here. If someone sees that there might be something wrong please please help me and at least point me in the right direction. What I need to do is extract data from a table that I have created employee_directory that I need to display in a table on a responsive site.


Code:
<!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <title>Phone Directory</title>
        
        <!--Mobile specific meta goodness :)-->
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<!--google fonts-->
	<link href='http://fonts.googleapis.com/css?     family=PT+Sans:400,700|PT+Serif:400,700,400italic' rel='stylesheet' type='text/css'>
	
	<!--css-->
	<link rel="stylesheet" type="text/css" href="main.css" />

	<!--[if lt IE 9]>
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
    
    <!--[if !IE]><!-->
	<style>
	
	/* 
	This query will take effect for any screen smaller than 760px
	and also iPads specifically.
	*/
	@media 
	only screen and (max-width: 760px),
	(min-device-width: 768px) and (max-device-width: 1024px)  {
	
		/* Force table to not be like tables anymore */
		#employeedb	{
	border:1px solid #000;
	border-collapse:collapse;
	font-family:Vollkorn;
	font-size:12px;
	text-align:right;
	}
	
      #employeedb th	{
	border: 1px solid #333;
	padding: 3px 6px;
	color: #e9edd5;
	}

     #employeedb td	{
	border:1px solid #999;
	padding:3px 6px;
	}

		
		table, thead, tbody, th, td, tr {
	display: block;
	color: #c6f104;
	font-family: Vollkorn;
	margin-right: auto;
	margin-left: auto;
	padding-left: 5px;
	
		}
		
		/* Hide table headers (but not display: none;, for accessibility) */
		thead tr { 
			position: absolute;
			top: -9999px;
			left: -9999px;
		}
		
		tr { border: 1px solid #ccc; }
		
		td { 
			/* Behave  like a "row" */
			border: none;
			border-bottom: 1px solid #eee; 
			position: relative;
			padding-left: 50%; 
		}
		
		td:before { 
			/* Now like a table header */
			position: absolute;
			/* Top/left values mimic padding */
			top: 6px;
			left: 6px;
			width: 45%; 
			padding-right: 10px; 
			white-space: nowrap;
		}
		
		/*
		Label the data
		*/
		td:nth-of-type(1):before { content: "ID"; }
		td:nth-of-type(2):before { content: "Last Name"; }
		td:nth-of-type(3):before { content: "Cell Number"; }
		td:nth-of-type(4):before { content: "Email"; }
	
	}
	
	/* Smartphones (portrait and landscape) ----------- */
	@media only screen
	and (min-device-width : 320px)
	and (max-device-width : 480px) {
		body { 
			padding: 0; 
			margin: 0; 
			width: 320px; }
		}
	
	/* iPads (portrait and landscape) ----------- */
	@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
		body { 
			width: 495px; 
		}
	}
	
	.wrapper .background-illusion h2 {
	color: #d4f24e;
	font-family: Vollkorn;
	font-size: 29px;
      }
      body table tr th h3 {
	color: #c6f104;
      }
      body div table tr th {
	color: #B0F104;
      }
  
    </style>

    </head>


    <body>
    <div class="wrapper">
    <header class="background-illusion">
         <h2 align="center">Phone Directory</h2>
         <p align="center">for Student Admin Department at WTCC<br>
           WEB 000 | Assignment 7<br>
         </p>
    </header>
    </div>
    <nav class="nav right">
	  <ul>
		<li class="current"><a href="index.php">Home</a></li>
                    <li><a href="#">Assignments</a></li>
                    <li><a href="#">Discussion Board</a></li>
		<li><a href="#">Support</a></li>
		<li><a href="#">Contact</a></li>
	  </ul>
	</nav>
    
      <table width="85%">
      	<tr>
        	  <th>ID</th>
            <th>Last Name</th>
            <th>Cell</th>
            <th>Email</th>
        </tr>
                  
        <tr>    
     <?php

	 $dbhost = 'http://198.86.244.3/phpmyadmin/';
	 $dbuser = 'XXXX_dbXXXXXX';
	 $dbpass = 'DxXxXxX';
	
	// Connect to database server
	$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass") 
		or die (mysql_error ());
	echo "You are now connected to MySQL<br /><br />";
	
	// Select database
	$dbname = 'employee_directory';
	mysql_select_db($dbname);

	// Get data from the database depending on the value of the id in the URL
	$query = "SELECT * FROM employee_directory ORDER BY lastname";
	$result = mysql_query($query) or die(mysql_error());
	
	?>
	<?php while($row = mysql_fetch_array($result)); ?>
		<td><?php echo $row['id']; ?></td>
        <td><?php echo $row['lastname']; ?></td>
        <td><?php echo $row['cellphone']; ?></td>
        <td><?php echo $row['email']; ?></td>
        
        </tr>              
               
       </table>  <footer class="background-illusion">
            <div class="container">
                <div align="center">
                  <p>Copyright © 2013 | <a href="http://dianamagers.com">XXXXXXX</a> |              Spring        Semester 2013 </p></div>
            </div>
        </footer>
          </div>
 
        </body>
      </html>


Of course, I couldn't provide my username and password ..... Sorry. I don't need to know that.

Reply With Quote
  #2  
Old February 23rd, 2013, 12:33 PM
ptr2void ptr2void is offline
I haz teh codez!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2003
Posts: 2,476 ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 4 h 42 m 37 sec
Reputation Power: 2194
First off, you're not connecting to mysqladmin, you're connecting to the MySQL server, so you need to know the IP address of the actual server (it's not necessarily running on the webserver where mysqladmin, an HTML front end to the MySQL server, is running). You are NOT connecting to a webserver at all, so using http:// in the host name is wrong.

In addition your school will at the very least need to have to have setup their network to allow inbound connections to the MySQL server on port 3306 (in the usual case). And your user will likely also have to be granted privileges to connect to the MySQL database from your server's IP address/machine name.
__________________
I ♥ ManiacDan & requinix

This is a sig, and not necessarily a comment on the OP:
Please don't be a help vampire!

Reply With Quote
  #3  
Old February 23rd, 2013, 08:23 PM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,791 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 14 h 53 m 20 sec
Reputation Power: 6112
Like ptr said, the first step is clarifying your vocabulary:

PHP - A web programming language

MySQL - A database technology

PHPMyAdmin - A PHP application which allows you to administer a MySQL instance

phpmysqladmin & phpmysql - Nothing.

And also: in order to connect to a MySQL server you must have permission, as well as the server's IP (not the PHPMyAdmin address), port number, username, and password. In some cases, you must also register your server/computer's IP with the MySQL server's administrator.
__________________
HEY! YOU! Read the New User Guide and Forum Rules

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-DB - Connecting to phpmysqladmin school server

Developer Shed Advertisers and Affiliates



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap