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.

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.