doogles Posted June 7, 2007 Share Posted June 7, 2007 MySQL version 5.0.22 I want to take a table in mysql and virtually print it in the web browser. BUT I also want to add columns that manipulate the values already in the MySQL table. The user (me) enters their desired table name to be displayed in a small form... <html><head><title>View gradelogs</title></head><body> <h1>View grades</h1> <?PHP $class=$_POST['class']; if ($class =="") { echo "<form method=post> <p>Type the name of the class you want to view:</p><input type=text name=class><input type=submit value=view></form>"; } else { //This is where I want to fetch the MySQL table and display it.} If it helps, here is the table that is created and the script that inserts it (on another file and another form) : $createtable="CREATE table $class ( title varchar (25), points_earned varchar (4), points_possible varchar (4))"; mysql_query($createtable); if ($grade1 !=="") {$ins="insert into $class values('$grade1', '$g1e', '$g1t')"; mysql_query($ins) or die(mysql_error()); //and etc. for $grade2....$grade3..} It's not really a problem. I just want to know how to do it. It'd be easy if it was just one row, but its a whole table. Also, if you could tell me how to save each value in the table to a specific variable, that'd be easier. I can make the table, its just getting the table's values from mysql into a workable variable. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/54524-printing-values-in-a-web-browser-from-values-in-a-mysql-table/ Share on other sites More sharing options...
doogles Posted June 7, 2007 Author Share Posted June 7, 2007 let me simplify the question: How do I take values in a mysql table and convert them to readable, changeable PHP variables? Quote Link to comment https://forums.phpfreaks.com/topic/54524-printing-values-in-a-web-browser-from-values-in-a-mysql-table/#findComment-269700 Share on other sites More sharing options...
fenway Posted June 7, 2007 Share Posted June 7, 2007 let me simplify the question: How do I take values in a mysql table and convert them to readable, changeable PHP variables? Sounds like you want PHP to "edit" your DB records... this is pretty standard stuff, must be many tutorials out there. Quote Link to comment https://forums.phpfreaks.com/topic/54524-printing-values-in-a-web-browser-from-values-in-a-mysql-table/#findComment-269942 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.