teongkia Posted November 29, 2006 Share Posted November 29, 2006 Hi i have this code:Menu1_1=new Array("Member Listing","admin_database.php","",0,20,109);How can i make it fetch the data from the column name from the database?How can i insert <?php echo $row_rs7['name'];?> into it?I tried on this Menu1_1=<?php echo $row_rs7['name'];?> but it doesn't work.Can anyone guild me?Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/ Share on other sites More sharing options...
fert Posted November 29, 2006 Share Posted November 29, 2006 mysql_query Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131904 Share on other sites More sharing options...
teongkia Posted November 29, 2006 Author Share Posted November 29, 2006 I have this:mysql_select_db($database_mConn, $mConn);$query_rs7 = "SELECT * FROM example1 WHERE id='3'";$rs7 = mysql_query($query_rs7, $mConn) or die(mysql_error());$row_rs7 = mysql_fetch_assoc($rs7);$totalRows_rs7 = mysql_num_rows($rs7);but my problem is how to insert the <?php echo $row_rs7['name'];?> into the Menu1_1=new Array("Member Listing","admin_database.php","",0,20,109);I tried Menu1_1=<?php echo $row_rs7['name'];?> and the column name i put new Array("Member Listing","admin_database.php","",0,20,109); but it doesn't work..Plz help.. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131907 Share on other sites More sharing options...
fert Posted November 29, 2006 Share Posted November 29, 2006 you forgot a $ in front of Menu1_1 and Array isn't a class Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131908 Share on other sites More sharing options...
teongkia Posted November 29, 2006 Author Share Posted November 29, 2006 Er..I dun get what you mean.Anyway i have this:Menu1=new Array("<img src='../frontpage-admin/menu-bar-wcm.gif'>","admin_theme.php","",7,48,108); Menu1_1=new Array("Member Listing","admin_database.php","",0,20,109); Menu1_2=new Array("Home","admin_home.php","",0,20,108); Menu1_3=new Array("News & Events","admin_news.php","",0,20,108); Menu1_4=new Array("About Us","admin_about.php","",0,20,108); Menu1_5=new Array("Contact Us","admin_contact.php","",0,20,108); Menu1_6=new Array("FAQs","admin_faq.php","",0,20,108); Menu1_7=new Array("e-Education","admin_edu.php","",0,20,108);I just want to set for Menu1_1 where i can change the link page(admin_database.php) from the database itself and do not need to go into code and change it.But i could not get what i wanted..Plz help..Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131914 Share on other sites More sharing options...
fert Posted November 29, 2006 Share Posted November 29, 2006 you only use new when using classes, but array isn't a class it's a function and you need to change Menu1_1 to $Menu1_1 Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131918 Share on other sites More sharing options...
teongkia Posted November 29, 2006 Author Share Posted November 29, 2006 Er sorry i still blur..Can you write me out the code?Actually i know nothing much about java but my task is to set the link from the database.For the case menu2[1]='<?php echo $row_rs6['name'];?>' i am able to link it to database.But for this one Menu1_1=new Array("Member Listing","admin_database.php","",0,20,109); i tried out Menu1_1='<?php echo $row_rs7['name'];?>' but couldn't work.. help me..Thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131919 Share on other sites More sharing options...
fert Posted November 29, 2006 Share Posted November 29, 2006 wait, do you connect to the database in admin_database.php? Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131939 Share on other sites More sharing options...
teongkia Posted November 29, 2006 Author Share Posted November 29, 2006 ya.. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131940 Share on other sites More sharing options...
fert Posted November 29, 2006 Share Posted November 29, 2006 insert this at the top of your code:[code]require("admin_database.php");[/code]that should solve your problem Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131943 Share on other sites More sharing options...
teongkia Posted November 29, 2006 Author Share Posted November 29, 2006 Er don't think so is the problem.The main problem is i don't know how to insert <?php echo $row_rs7['name'];?> into Menu1_1=new Array("Member Listing","admin_database.php","",0,20,109); for example: Menu1_1=<?php echo $row_rs7['name'];?> to get the data from the database.I tried this but failed and comes out the 'StartTop' is undefined problem when i load the page.The drop down list also become unavailable.Maybe am wrong with ' or " signs.. Quote Link to comment https://forums.phpfreaks.com/topic/28813-java-and-database-again/#findComment-131958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.