scepanmali Posted March 27, 2008 Share Posted March 27, 2008 How to make the whole MySql table as variable? Like, I have a table named section_metal for example! I want to make it into variable: $table = ??? It reports an error! I am a beginner, so please forgive me if this is stupid question! Thank You in advance. Link to comment https://forums.phpfreaks.com/topic/98237-how-to-make-the-whole-mysql-table-as-variable/ Share on other sites More sharing options...
sstangle73 Posted March 27, 2008 Share Posted March 27, 2008 whats the error? lets see the code Link to comment https://forums.phpfreaks.com/topic/98237-how-to-make-the-whole-mysql-table-as-variable/#findComment-502628 Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 a MySQL table exist on so many varying levels that an array wouldn't suite it. If you are trying to "recreate a table" you would want to use something similar to what phpmyadmin does to create a MySQL dump of it Link to comment https://forums.phpfreaks.com/topic/98237-how-to-make-the-whole-mysql-table-as-variable/#findComment-502629 Share on other sites More sharing options...
scepanmali Posted March 27, 2008 Author Share Posted March 27, 2008 No, I didn't explain it well! I have 5 tables and I want to make variables so I can use it later for $_GET function! You know, like, if someone clicks on 1st table, I want to extract only results from that table. Tables are: metal, rock, pop, hip_hop, domaca. I have 5 scripts with these tables and I want to make variable to unite this 5 tables into one variable "$table" Here is one of the scripts: <?php $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); echo "<br>"; $selected = mysql_select_db("spotovi1", $dbhandle) or die("Could not select DB"); $row['Artist']=$Artist; $row['Song']=$Song; $id= $row['id']; $row['id']= $id; $id = $_GET['id']; $Artist = $_GET['Artist']; $Song = $_GET['Song']; $sql = mysql_query("SELECT * FROM oblast_metal WHERE ID = '$id'"); #variable from this!!! while ($row = mysql_fetch_array($sql)) { ?> <?php $zajedno=$row['Artist']."- ".$row['Song']; echo "<font size=3><font color=white><b>Download </b></a> </font></font>"; echo "<font size=4><font color='#A49F8B'><a href=\"{$row['Link']}\"><font color='#A49F8B'>$zajedno</font></font></a>"; echo "<font size=3><font color=white><b> Music Video</b> </a> </font></font>"; } php?> Link to comment https://forums.phpfreaks.com/topic/98237-how-to-make-the-whole-mysql-table-as-variable/#findComment-502638 Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 I'm done trying to help you because you refuse to combine these tables as everyone said is the easiest way to do this. Link to comment https://forums.phpfreaks.com/topic/98237-how-to-make-the-whole-mysql-table-as-variable/#findComment-502639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.