Solved

Problem showing tables using PHP

Posted on 2010-11-30
6
280 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
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
 

Author Comment

by:deanlee17
ID: 34237496
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP warning 4 40
PHP: Query an Sqlite3 Datatbase return in JSON 6 48
php convert date format 3 21
how to use 2 SELECT statements with prepared statements 19 24
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now