<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could Not Connect: '. mysql_error());
// This block grabs the whole list for viewing
$bilboard_list = "";
$bilboard_list0 = "";
$bilboard_list1 = "";
$bilboard_list2 = "";
$sql = mysql_query("SELECT * FROM database ORDER BY Operator");
$bilboardCount = mysql_num_rows($sql); // count the output amount
if ($bilboardCount > 0) {
while($row = mysql_fetch_array($sql)){
$Operator = $row["Operator"];
$Nama_Pemilik = $row["Nama_Pemilik"];
$Lokasi = $row["Lokasi"];
$Jenis_Iklan = $row["Jenis_Iklan"];
//for show
$bilboard_list .= "$Nama_Pemilik<br>";
$bilboard_list0 .= "$Lokasi<br>";
$bilboard_list1 .= "$Jenis_Iklan<br>";
$bilboard_list2 .= "$Operator<br>";
?>
<html>
<head>
</head>
<body>
<table width="686" border="1">
<tr>
<td width="69"><strong>NAMA PEMILIK</strong></td>
<td width="111"><strong>LOKASI </strong></td>
<td width="93"><strong>JENIS IKLAN</strong></td>
<td width="121"><strong>OPERATOR</strong></td>
</tr>
<tr>
<td><?php echo $bilboard_list; ?></td>
<td><?php echo $bilboard_list0; ?></td>
<td><?php echo $bilboard_list1; ?></td>
<td><?php echo $bilboard_list2; ?></td>
</tr>
</table>
<body>
</html>
16 Replies - 2042 Views - Last Post: 19 April 2012 - 01:49 AM
#1
How To Display Database on Table in PHP?
Posted 18 April 2012 - 11:47 PM
Hello guys..I've been troubling to compile this codes..i dont know what is wrong with it..it cant display in the table..i hope u guys can help me what is wrong with my code..
Replies To: How To Display Database on Table in PHP?
#2
Re: How To Display Database on Table in PHP?
Posted 18 April 2012 - 11:54 PM
that’s due to the syntax errors (you’re actually missing all closing braces)
#3
Re: How To Display Database on Table in PHP?
Posted 18 April 2012 - 11:56 PM
all? what do mean by all? can u show me?
#4
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 12:00 AM
every { needs a } to properly enclose a statement block.
add before line #2: error_reporting(-1); ini_set("display_errors", true);
add before line #2: error_reporting(-1); ini_set("display_errors", true);
This post has been edited by Dormilich: 19 April 2012 - 12:02 AM
#5
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 12:03 AM
it means that when you do something like this:
if (myValue != 0){
//code
//code
//code
/you have to have
}
at the end.
when you open them, you got to close them.
if (myValue != 0){
//code
//code
//code
/you have to have
}
at the end.
when you open them, you got to close them.
#6
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 12:10 AM
it still the same..cant display it..the output will become like this
0) { while($row = mysql_fetch_array($sql)){ $Operator = $row["Operator"]; $Nama_Pemilik = $row["Nama_Pemilik"]; $Lokasi = $row["Lokasi"]; $Jenis_Iklan = $row["Jenis_Iklan"]; //for show $bilboard_list .= "$Nama_Pemilik
"; $bilboard_list0 .= "$Lokasi
"; $bilboard_list1 .= "$Jenis_Iklan
"; $bilboard_list2 .= "$Operator
"; } } ?>
and some table will appear..
0) { while($row = mysql_fetch_array($sql)){ $Operator = $row["Operator"]; $Nama_Pemilik = $row["Nama_Pemilik"]; $Lokasi = $row["Lokasi"]; $Jenis_Iklan = $row["Jenis_Iklan"]; //for show $bilboard_list .= "$Nama_Pemilik
"; $bilboard_list0 .= "$Lokasi
"; $bilboard_list1 .= "$Jenis_Iklan
"; $bilboard_list2 .= "$Operator
"; } } ?>
and some table will appear..
#7
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 12:56 AM
how do you call that file in the browser?
#8
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 12:59 AM
i dont know..i'm just following the instruction on someoen tutorial..can u teach me how can i show all the database on the browser?
#9
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:02 AM
what do you mean, you don’t know how you call the file? if you have output (and I assume you got that output in a browser), all I want to know what’s displayed in the browser’s address bar.
that’s what I’m trying to do.
Quote
can u teach me how can i show all the database on the browser?
that’s what I’m trying to do.
#10
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:06 AM
ok its like this
i'm using a WAMP..this is for my system that i'm developing right now..i want to call the data from the database in phpmyadmin..i cant figure it out how to display it because i've tried to many attemp with different method by referring to someone else blog or website but it didnt work
u ask for a path at the address bar..this is what appear on the address
file:///C:/wamp/www/bilboard/test2.php
i'm using a WAMP..this is for my system that i'm developing right now..i want to call the data from the database in phpmyadmin..i cant figure it out how to display it because i've tried to many attemp with different method by referring to someone else blog or website but it didnt work
u ask for a path at the address bar..this is what appear on the address
file:///C:/wamp/www/bilboard/test2.php
#11
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:10 AM
no wonder nothing happened.
PHP is a server side language. that means, you need to process it through the server and you only do that when you call the server and the server usually is called via IP or DNS. in your case that would be http://localhost/
if you just open the file in the browser, only the HTML processor sees this file, which is not associated with PHP in any way and hence cannot process your PHP code.
PHP is a server side language. that means, you need to process it through the server and you only do that when you call the server and the server usually is called via IP or DNS. in your case that would be http://localhost/
if you just open the file in the browser, only the HTML processor sees this file, which is not associated with PHP in any way and hence cannot process your PHP code.
#12
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:18 AM
ahhhh...i see..i get it now..well i change the path to this
localhost/bilboard/test2.php
but i still get the error said
( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\bilboard\test2.php on line 14
and a table called "CALL STACK" with table Time, Memory, Function, Location..
localhost/bilboard/test2.php
but i still get the error said
( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\bilboard\test2.php on line 14
and a table called "CALL STACK" with table Time, Memory, Function, Location..
#13
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:19 AM
#14
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:27 AM
ahhh..i see..i will to figure it out if i got any problem,i will tell u ok..thanks for ur help Dormilich..nice to meet u..=)
#15
Re: How To Display Database on Table in PHP?
Posted 19 April 2012 - 01:29 AM
|
|

New Topic/Question
Reply




MultiQuote




|