Search the Community
Showing results for tags 'connecting to 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.</p> If someone sees that there might be something wrong please please help me and at least point me in the right direction.<br /> 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. <!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 = '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. This is what it looks like on the server now. http://wcet2.waketec...es(1)/index.php
- 11 replies
-
- connecting to server
- php
-
(and 1 more)
Tagged with: