php in html - not showing

This is a discussion on "php in html - not showing" within the Web Page Design section. This forum, and the thread "php in html - not showing are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 6th, 2005, 21:54
Junior Member
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
php in html - not showing

i am trying to display a mysql table in my html page have managed to round up the code to display the table data, i have saved that into a file called "mysq.php"

i have then created a very simple page just to test whether/how i get this into html....

here is what i have:

Code: Select all
<html>
<body>
This is a test to show this can be done
<?php
include(mysql.php);
</body>
</html>
however my mysql data is not displayed........the text saying test is there but nothing else...

here is my data from the "mysql.php" file

Code: Select all
<html>
<head>
<title>PHP/MySQL example</title>
</head>
<body bgcolor="white">
<center>
<table border="1">
<tr><th>Reg_No</th><th>DOB</th></tr>
<?php
$host="hostname";
$user="username";
$password="password";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
   or die(mysql_error());
# Select the database
mysql_select_db("uxellaleague", $conn)
   or die(mysql_error());
# Send SQL query
$sql = "SELECT players_200506.reg_no, players_200506.dob
FROM players_200506
WHERE (((players_200506.reg_no)>0))
ORDER BY players_200506.reg_no;";
$result = mysql_query($sql)
   or die(mysql_error());
# Fetch table rows, one by one, and display as HTML table rows
while ($row = mysql_fetch_assoc($result)) {
   echo "<tr><td>", $row['reg_no'], "</td><td>", $row['dob'],
      "</td></tr>\n";
}
?>
</table>
</center>
</body>
</html>
please advise

Andy
Reply With Quote

  #2 (permalink)  
Old Dec 6th, 2005, 23:14
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php in html - not showing

You forgot to close your php...
PHP: Select all

<html>
<body>
This is a test to show this can be done
<?php
include(mysql.php);
?>
</body>
</html>
Reply With Quote
  #3 (permalink)  
Old Dec 7th, 2005, 07:16
Junior Member
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php in html - not showing

whoops!!!!! silly beginners

many thanks
Reply With Quote
  #4 (permalink)  
Old Dec 7th, 2005, 11:36
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php in html - not showing

I think we all make these mistakes at beginning. Usually from tiredness.
Reply With Quote
  #5 (permalink)  
Old Dec 7th, 2005, 22:43
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php in html - not showing

or in my case, stupidity...lmao
Reply With Quote
  #6 (permalink)  
Old Dec 9th, 2005, 00:13
Tim356's Avatar
Reputable Member
Join Date: Nov 2003
Location: Australia
Age: 25
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php in html - not showing

That's why I find it really helpful to use colour-coding editors like dreamweaver. If you leave the tage out, you can easily tell that way.
Reply With Quote
Reply

Tags
php, html, showing

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nav bar not showing kaz Web Page Design 7 Jan 25th, 2008 07:12
Photos not showing? xkatx21x Web Page Design 4 Oct 22nd, 2007 00:34
Why my signature is not showing??? alance Webforumz Cafe 5 May 5th, 2006 15:52
Preload flash file in one html and start showing in other vikaspa Introduce Yourself 1 Apr 19th, 2006 15:36
background image not showing up in Firefox but showing in other browsers! eskymo Web Page Design 21 Jan 19th, 2006 23:10


All times are GMT. The time now is 05:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43