cleary1981 Posted June 30, 2008 Share Posted June 30, 2008 Need help cos my heads to sore to think. lol I want to set the height and width value from a database function generate_module() { //when generate button is pressed var h="50"; var w="50"; document.getElementById("object").src="box.gif"; document.getElementById("object").border=1; document.getElementById("object").height=h; document.getElementById("object").width=w; } </script> Link to comment https://forums.phpfreaks.com/topic/112543-solved-setting-a-variable-using-value-from-database/ Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 <?php $query = mysql_query("SELECT * FROM table WHERE whatever = 'whatever'"); $row = mysql_fetch_assoc($query); $height = $row['height']; $width = $row['width']; ?> function generate_module() { //when generate button is pressed var h="<?=$height;?>"; var w="<?=$width;?>"; document.getElementById("object").src="box.gif"; document.getElementById("object").border=1; document.getElementById("object").height=h; document.getElementById("object").width=w; } </script> something along those lines... needing help with PHP because your head hurts isn't a very sympathetic excuse. ACE Link to comment https://forums.phpfreaks.com/topic/112543-solved-setting-a-variable-using-value-from-database/#findComment-577933 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.