PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 300,358 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,897 people online right now. Registration is fast and FREE... Join Now!




How to add style in mysql output

 

How to add style in mysql output

hadi_php

3 Jul, 2009 - 07:00 PM
Post #1

D.I.C Regular
***

Joined: 23 Aug, 2008
Posts: 259



Thanked: 5 times
My Contributions
CODE
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hello", $con);

$result = mysql_query("SELECT * FROM world where name = 'test'");

while($row = mysql_fetch_array($result))
  {
  echo $row['name'];
  echo "<br />";
  }
?>  


this code outputs

test


Q: how i can add css style on that output?

is it the way?

CODE
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hello", $con);
?>

<html>
<body>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<?php
            $result = mysql_query("SELECT * FROM world where name = 'test'");

            while($row = mysql_fetch_array($result))
                {
                    echo "<div id = 'php'>";
                    echo "Your name is " . $row['name'];
                    echo "</div>";
                }
                ?> .

</body>
</html>


i want better solution or perfect solution......

User is offlineProfile CardPM
+Quote Post


noorahmad

RE: How To Add Style In Mysql Output

3 Jul, 2009 - 08:34 PM
Post #2

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
your code is correct and working fine!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 07:38PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month