Jump to content

printing values in a web browser from values in a mysql table


doogles

Recommended Posts

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.

 

 

 

 

 

 

 

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.