Solved

Problem showing tables using PHP

Posted on 2010-11-30
6
281 Views
Last Modified: 2012-05-10
Hi Experts,

Trying to display table names in a database and im getting this error.....

http://www.deans-place.co.uk/view_bookings.php

Code attached.

Thanks,
Dean.
<?php
mysql_connect("localhost", "XXX", "XXX") or die(mysql_error());
mysql_select_db("deano_database") or die(mysql_error());


$showtablequery = " SHOW TABLES FROM [deano_database] ";
 
$showtablequery_result	= mysql_query($showtablequery);

while($showtablerow = mysql_fetch_array($showtablequery_result)) 

	echo $showtablerow[0]."<br />";

	
}

 ?>

Open in new window

0
Comment
Question by:deanlee17
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 14

Expert Comment

by:sam2912
ID: 34237462

<?php
mysql_connect("localhost", "XXX", "XXX") or die(mysql_error());
mysql_select_db("deano_database") or die(mysql_error());


$showtablequery = " SHOW TABLES FROM [deano_database] ";
 
$showtablequery_result	= mysql_query($showtablequery);

while($showtablerow = mysql_fetch_array($showtablequery_result)) {

	echo $showtablerow[0]."<br />";

	
}

 ?>

Open in new window

0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 34237477
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Expert Comment

by:unclebackpack
ID: 34237498
As sam2912 stated, which might not be clear by looking at the code directly. You are missing a { in your WHILE statement
0
 
LVL 12

Accepted Solution

by:
sivagnanam chandrakanth earned 500 total points
ID: 34237687
<?php
mysql_connect("localhost", "XXX", "XXX") or die(mysql_error());
mysql_select_db("deano_database") or die(mysql_error());


$showtablequery = " SHOW TABLES FROM deano_database";
 
$showtablequery_result      = mysql_query($showtablequery);

while($showtablerow = mysql_fetch_array($showtablequery_result)) {

      echo $showtablerow[0]."<br />";

      
}

 ?>

check this, will surely work
0
 

Author Closing Comment

by:deanlee17
ID: 34237727
Thanks guys.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question