1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Rocky Mount, NC
    Rep Power

    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.

        <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'>
    	<link rel="stylesheet" type="text/css" href="main.css" />
    	<!--[if lt IE 9]>
    		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <!--[if !IE]><!-->
    	This query will take effect for any screen smaller than 760px
    	and also iPads specifically.
    	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;
          #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;
        <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>
        <nav class="nav right">
    		<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>
          <table width="85%">
                <th>Last Name</th>
    	 $dbhost = '';
    	 $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';
    	// 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>
           </table>  <footer class="background-illusion">
                <div class="container">
                    <div align="center">
                      <p>Copyright &copy; 2013 | <a href="http://dianamagers.com">XXXXXXX</a> |              Spring        Semester 2013 </p></div>
    Of course, I couldn't provide my username and password ..... Sorry. I don't need to know that.
  2. #2
  3. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Rep Power
    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!
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    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.

IMN logo majestic logo threadwatch logo seochat tools logo