can i use a variable as table name?
Posted: Tue Nov 28, 2006 10:15 am
Burrito | Please use 
Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
can i use like this---->
what changes needed?--->Code: Select all
<?php
$TableName="Student";
$connect=mysql_connect("localhost","root","");
$result=mysql_query("select * from $TableName",$connect);
while($row=mysql_fetch_array($result))
{
for($i=0;$i<mysql_num_fields($result);$i++)
echo $row[$i];
}
?>Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]