Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Dynamic Table


I'm working on creating a dynamic table generator. The data is read from a database via mySQL. The table sample is: Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Table
I am trying to create a table dynamically- meaning that a user will be able to add or delete rows via an admin tool. For now, the number of columns will be a fixed number. I figure I can store each row of information in a database and then keep some type of index to keep track of column inserts, deletions, etc. Does this make sense? Does any one have any ideas on how to accomplish this?

Dynamic Image Table
I have a problem that I believe is pretty simple to solve, but I have been beating my head against the wall. What I want to do is just display images from a mysql database into a dynamic table.

For example, I want the images to fill up 5 cells on one row and then create a new row, and so forth until all the images are displayed. I have tried several diffent scripts but with now luck.

The database fields are 'id', and 'image'. The 'image' field just has the image names (like example.jpg), and are linked to images in a folder like this:

Dynamic Data In Table
Trying to display dynamic data in a table. The code spits out the table just fine, but won't display the $name variable at all, I just get table cells w/ broken links. I must be missing something but can't get it, thanks. my code:

Dynamic Table Generation
I have a database, and I am using PHP to retrieve data from the database. Now I know I can format that data into a table easily using loops and everything, but I was wondering how I could stagger the colors of the table rows. That is, every other row is a darker or lighter color than the row above or below it, so that the user can easily discriminate between rows of separate, usually somewhat unrelated data.

Printing Problem With Dynamic Table
In my Project I need to generate large report from database. But I am
facing problem with tables. Some table are splitting across the pages
What I don't want and really embracing. I used css code
"page-break-inline:avoid" but Internet Explorer do not work with this
code.

Variable Data In Dynamic Table.
What I'm trying to do is list the values of an array into different table rows while alternating the color of the table rows. Simple enough right? It makes the table fine. Creates the proper ammount of rows. It even alternates color (yay!). The only thing that it doesn't do is list the values in the array. PHP Code:

Dynamic Checkboxes From Mysql Table
tearing my hair out over this!

I have 2 tables:

PTable which lists all traits
pid,ptype
1,good
2,bad
3,neutral

UserP Table which records user and traits
uid,pid
1,2
1,3
9,1
9,2
9,3

For a certain user UID, how can I get php to automatically create html
checkboxes listing ALL traits from PTable and check each trait based
on the UserP table on a webpage?

Hence, if UID is 1

it should show
good - unchecked
bad - checked
neutral - checked

Making Dynamic Table Sortable
I'm doing a small project right now where I create a table from a
database. This is the code, which Dreamweaver, for the most part,
has written:

***

<?php
mysql_select_db($database_tdream, $tdream);
$query_rstdream = "SELECT * FROM albums ORDER BY `year` ASC";
$rstdream = mysql_query($query_rstdream, $tdream) or die
(mysql_error());
$row_rstdream = mysql_fetch_assoc($rstdream);
$totalRows_rstdream = mysql_num_rows($rstdream);
?>

***

<table cellspacing="0">
<thead>
<tr>
<td>Album</td>
<td>Year</td>
<td>Era</td>
<td>Type</td>
</tr>
</thead>
<tbody>
<?php do { ?>
<?php
$class = ($class == 'odd') ? 'even' : 'odd'
?>
<tr class="<?php echo $class ?>">
<td><?php echo $row_rstdream['Name']; ?></td>
<td><?php echo $row_rstdream['Year']; ?></td>
<td><?php echo $row_rstdream['Era']; ?></td>
<td><?php echo $row_rstdream['Type']; ?></td>
</tr>
<?php } while ($row_rstdream = mysql_fetch_assoc($rstdream));
?>
</tbody>
</table>

***

Sorry for the length of the examples. I have a basic
understanding of what the code is doing, so I should be able to
modify it if I knew I was heading in the right direction. My
object is to make this table sortable, by clicking on the column
headers. I have an additional column in my database table which
is an auto_increment counter. Would anyone have some ideas or
code that could help me figure this out? I'm not sure how to
approach it, and was hoping that there was a simple answer to the
problem.

Create A Dynamic Table Javascript?
I have picture section where users can upload pictures to my website and I have created a basic way viewing these pictures but this is not astheticaly pleasing. So i was wondering if i could populate a html table with these pictures.

The way this system works is that it uses a while loop that brings the date, url and also who uploaded the picture into the page. I was wondering if this information could be put into a table but i cannot see a way. Code:

Dynamic List Populated By MySQL Table
I am building my first php page and I've ran into problems trying to create a dynamic drop down list for an INSERT page. My page is based on this example from mysql.com.

I want to populate the list from a table in MySQL, but when I test the page the list only contains the first record. If anyone can help me out, or recommend an easy way to create dynamic menus/lists, I will be very grateful.

This code appears above the FORM ACTION:

$NearMajorCity = mysql_query("SELECT NearMajorCity_ID, NearMajorCity FROM NearMajorCity");

This code is within the FORM:

<SELECT NAME="NearMajorCity" SIZE=1>
<OPTION SELECTED VALUE="">Select One
<OPTION VALUE="">---------
<?php
while ($NearMajorCity = mysql_fetch_array($NearMajorCity)) {
$NearMajorCity_ID = $NearMajorCity["NearMajorCity_ID"];
$NearMajorCity = $NearMajorCity["NearMajorCity"];
echo("<OPTION VALUE='$NearMajorCity_ID'>$NearMajorCity
");
}
?>
</SELECT>

I want to be able to view the names of the Major Cities in the list, but I want the NearMajorCity_ID inserted into the table.

Building Dynamic Report Page On Table Data
I am posting this message to this forum because I need some advice and some help with building a page to produce a report from the database I am building. Firstly, however I will post the table structures for the involved tables..... Code:

Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?

Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for.  Can anyone help me get the Agreed? table's background color to the colors above? Code:

Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field.

I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?

Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table
is to fields on is ID and the other is critiera.

Now I want to filter out all the one that don't apple to the list and
move the one that match to a different database.

I know how to open a connection, close, select

but I don't know how I would inside of a database use another one as
the way to create the list of critieras....

Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias'
the mysql_fetch_field function returns a value $result=>table which
will contain the alias, not the actual table name.
Is there a way to get the actual table name ?

I am running mysql 4.1 and php 4.4

Grab Data From A Table, Echo, Then Insert It Into A New Table...
I'm trying to do is count the number of times usernames shows up in a table. I then want to reinsert that information into a different table with the Username in column1 & the occurrences in column2 for every user that is echoed on the page. Code:

Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'.

There is one of each item in products and each product has it's own unique 'prodno'

There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example:

id = 1
prodid = 7001
qty = 300
price = 12.5

id = 2
prodid = 7001
qty = 400
price = 15.5

I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table.

Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item..

This is all very confusing to me, and I'm the one writing it. Let's try one last time..

Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.

Update Table While Insert Data To Another Table
it seem like mine coding din work.
[php]<?

include("checkin.html");
$conn=mysql_connect('localhost','root','') or die ('Could not connect to server');
$today = date("Y.m.d");
mysql_select_db('hms', $conn);

$ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn);

if( $ok ){

$up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID');

if(mysql_affected_rows( $up ) == 1)
{
echo'Checked IN!'
}else { echo'No such student to check in' }}
else { echo'Check In FAILED, please check again'}?>[php]

How To Transfer A Data With An Id To Another Table From A Table?
how am i going to transfer let say a name identified using the suer id and copy the name to the other table having the same user id>?

How Can I Find A Name From One Table In A Text From Another Table?
I have one table with a description field and other info, and I also have another table with a list of names and picture url:s. When I display the text description on my site I'd like to know if there are a match with a name from the 'names' table in the text. Code:

Returning Table Name As Well As Fields From That Table
I am returning all fields from news and from regional, however I want to determine where the fields have come from when I ouput the data, therefore I need to return the table name with the fields. Is this possible? Code:

Moving Data From One Table To Another Table
Does anyone know how to move one row from a table in a mysql database to another table using php?

Move Table Row To A New Table
I have a database of some information and it is in a table row by row.

I have a page that displays these in a table row by row, however I want to have a link to the side of each row allowing me to transfer that row to a new table.

How would I do this? I've tried a few ways but that was a random guess and didn't work.

Dynamic Nav Bar
I am trying to implement a dynamic navigation bar. My problem is as follows -

All of my scripts are located in various folders, and as you move to different areas of the site, the links to the other areas of the site will change. For example, I am currently at home.php and the nav bar has references to admin/manage_users.php and companies/view_employees.php, etc etc. If I go to manage_users.php, I am now executing a script in the admin folder. The nav bar still has a reference to companies/view_employees.php, which would make this a dead link.

There are lots and lots of directories and subdirectories that one can navigate to, so I don't want to have to write code for a nav bar every time. Is there something like $_SERVER['DOCUMENT_ROOT'] that I can use that will help?

Dynamic Variables In Php?
Hi,
I have a mySQL table that contains two columns
column one is 'feature' and column two is 'feature_value' - some of the data is for example

'hair_color' - 'blue'
'hair_color' - 'blonde'
'hair_color' - 'black'
'hair_color' - 'gray'

'eye_color' - 'blue'
'eye_color' - 'hazel'
'eye_color' - 'brown'

Yeah I know... definitely NOT third normal form. OK here's where it gets even better

On one web page, I build select controls from this data. The name of the control would be the value of the feature column. So from the data above I would have a select control whose name would be name="hair_color" and another select name="eye_color"

NO problems so far.... ok.
Now after the user selects from the selects (get it, sorry).... i am processing the data.

Although I use javascript for some client side validation... I also want to validate in php. (ok, just because I want to ok)

NOW.. the web page form will post these two variables $hair_color' and '$eye_color' as described above. But I don't know ahead of time what these variables are because they're based on data from a table.......

I go the table described above and select distinct on the feature column - I will return two rows.... see below

while($row = mysql_fetch_row($result_set)) {
$feature =trim($row[0]);
}

the value of feature in the first row is 'hair_color' and in the second row 'eye_color'--


What I'd like to do.... is to take the values in the $feature variable and create a literal variable that I can test for that was posted from the form........

so for example in the first row where $feature = 'hair_color' - I want to create a $hair_color variable...... because this is a variable of the select control from the form. Then for the second row where $feature = 'eye_color' - I want to create an $eye_color variable because again... this is the variable of a select control on the form.

Dynamic Links???
I’ve looked at several tutorials and searched the archives of this site. I found a few pointers, but I feel entirely daft and can’t seem to quite get it.

The “ultimate” goal is to display members profiles, and not have to hard code all the bl**dy records, as I’ve done so far. (Current version http://www.internetbonsaiclub.org/c...y/profiles.html)

So, now I have the records in one table in my database. The profiles.php3 page takes all the records in that table, and displays the names in alphabetical order. So far, so good.

Now, I have viewprofile.php3, which should display only one record at a time, based on which name the visitor clicked on.

Dynamic Menus
how to have dynamic menu, say one option is selected from the first menu, and that option changes the 2nd menu options. ?

yeah i have seen it work in JavaScript, (onchange)
but what would the syntax be in php ?

Dynamic Communication
I am wondering if there is any way to use maybe XML to mimic another sites form on my site. For example, to use maybe Expedia's flight search form on my site and then post the request to expedia and have the results format back into my site. It is sort of the same concept as xml-rpc accept I am wondering if it can be done without setting up an xml-rpc server for the response. Essentially the script would allow you to take the user through the entire search process all the while making it formatted to the layout of your site, but using Expedia's engine.

Dynamic Notification
Is there a way for me to have an email sent to me anytime one of my users creates/uploads a new file in a specific directory on my website? Sorry if this is really basic.... I'm not sure where to start. Any help would be greatly appreciated.

Dynamic Content In A <div>, Using Php
i have a <DIV> block, and I want the innerHTML to change at the click of a button. for those who don't know some javascript, if you have a dive with an id, <DIV id="myDiv"></DIV> you can change the content inside with a function call

myDiv.innerHTML = "some stuff";

however, i need my data to come from a mySQL database and thus needs to be outputted via php. so ideally i want something like

myDiv.innerHTML = "<?php echo "some stuff"; ?>";

of course that does not work because php is not client side, this is just to illustrate what i want. any ideas on how to do this without iframes?

Dynamic Data
I have included a php script into my page
as <img src="plot.php">. That script just plot some time changing data. Now I have two questions that I cannot solve myself:

(1) When I press the reload button I expected
the plot reflected the changed data.
Instead of that plot remains unchanged
until I directly invoke the php script
from the browser...
Is there any method to avoid this
unwanted caching?

(2) That is a bit off topic but is there
any easy way to get a web page updating
after a certain period of time?
Once solve my first question I'd like
to offer mi visitors a automatically
changing graphic.

Dynamic Php Tables
As you'll notice, each new result appears in a new table, which is very annoying. I am trying to make it so that all ther results appear in 1 table.

This is what I have so far;

<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 ");
while ($row = mysql_fetch_array($query))
{
$variable1=$row["Model"];
$variable2=$row["Creator"];
$variable3=$row["Title"];
print ("$variable1, $variable2 ,$variable3");
}

//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>

Can anyone help please?

Dynamic Playlist In XML Using PHP
I want to build a dynamic playlist in XML using PHP.
can any body please help me by giving code,ideas and links?

Dynamic Variables
I am NEWBIE & trying to develop internal control system with PHP-MySql & have one problem.

I want to enter dynamic variable into MySql like :

"I have checked report of Mr. $userName from $previousDate to $currentDate…..”

Wherein - $username, $previousDate, $currentDate will be called from other table.

My codes :

PHP Code:

INSERT INTO `checkReport ` (`schID`, `schNo`, `noteNo`, `subschName`, `content`) VALUES (1, 1, 'a', '', ' I have checked report of Mr. ‘.$username.’ from ‘.$previousDate.’ to ‘.$currentDate.’ ….)

which is not working… Please guide me through.

Dynamic Thumbnails
ImageCopyResampleBicubic()

here is a modified version of the above code that will properly handle copying only portions of images (i.e. creating a square thumbnail from a rectangular image by cropping out the square rather than smashing to fit). Also a few breaks were added to avoid some unnecessary calculations that took place under some conditions: PHP Code:

Dynamic Playlist, From URL
I have many complex ASX playlist files and would like to cut my work down managing them by having one line in them dynamicly created on the fly depending on a link the visitor clicks.

Is there a pre made processor that will look in the URL for a variable, insert that variable into a pre made ASX script and return that modified ASX script back to the client?

Dynamic Form
I have one user table in my MySQL database and this is linked to a user type table containing 3 types of user. Each type of user will be required to give a different amount of data when registering.

Basically I want to create one registration form for all types of users but only show the form fields that are relevant to the individual user type. The user type will be selected from a pervious page containing a list menu with the 3 user types that is sent via GET to the registration page.

Dynamic FAQ Software
Can anyone suggest some PHP software for maintaining a FAQs page?

I want to include moderate user contributions, but I don't mind modifying something to get what I want.

(I have tried searching for this but can't seem to come up with a search string that weeds out are the FAQs pages out there)

Dynamic Maps With Php?
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Dynamic Grid
I'm attempting to make a dynamic grid (3 x 3, so 9 squares total) I'm currently using a table because I don't feel like dealing with some css issues i was having in IE.

Anyway what i have is a 3 x 3 square
(periods used for spacing) ....

Dynamic Array
Say I have a function that is used to open different flat-file databases and read them into arrays. The databases have a different number of field indexes, with different names.

Is there a way of creating an array within a generic function, but with the field indexes as keys instead of just numbers?

Dynamic Arrays
People come to my site, they choose the name of a car from a database. I want the name of the car to go into an array. I want to put it in an array and not just as a single variable because i want them to have the option of coming back to the page and choose the name of another car. They can have as many names of cars as they like. To make sure i retain the values of the array, i will put them in a session variable.

My question is how do i generate the dynamic array? When people come back to the page with the values of the array in the session variable will that cause a problem?

Dynamic Zipping
I'm working on a downloads site at the moment and need to have a sort of dynamic zipping system, i'll explain:

1. A user visits the site, they are given an individual ID

2. They browse through the files and can click on the 'Add to Download' button if they wish.

3. If they click on the 'Get Download' button, then they are sent to a page, which offers them all the files they selected in a .zip or .tar file for downloading.

Dynamic Pages
I am trying to create a page which will automaticlly change the size of
tables/graphics etc based on the screen resolution. Eg, if someone is using
a 800x600 the page layout will utilise this. If the same webpage is
diaplayed on a 1024x768 or 1280X1024 the cells are adjusted according. By
doing something like this could you make the logo change size by using a
percent size in a table cell or is there a better method than tables? If
anyone is able to help with tips or any examples (code or url reference) it
would be appreciated.

Also, what page layout is better to use.. eg.. html, php,asp, etc. The
site will be hosted on apache on a Linux Server.

Dynamic Menus
<?php
include('./common_db.inc');
$link_id = db_connect();
mysql_select_db("test_db");

?>

<form name=carform action=
<?php echo $_SERVER['PHP_SELF'];
?> method=post>
<?php


$query =mysql_query("select DISTINCT CQ_PROD_PLATFORM AS make_id from
CQ_data ORDER BY make_id");
echo '<select name=make
onchange="document.carform.submit()"'.">"."
";
if (!isset($make))
{
echo '<option value=null selected>Choose a Make</option>'."
";
}
while(list($make_id) = mysql_fetch_row($query))
{
echo '<option value='.$make_id;
if (isset($make)&& $make_id == $make)
{
echo " selected";
}
echo '>'."$make_id".'</option>'."
";
}
echo '</select>'."
";
echo '<select name=model
onchange="document.carform.submit()"'.">"."
";
if (!isset($make))
{
echo '<option value=null selected>Choose a Make First</option>'."
";
}
else
{
$result = mysql_query("select DISTINCT CQ_SUBSYSTEM AS name from
CQ_data where make_id='$make' ORDER BY NAME");
echo '<option value=null selected>Choose a Model</option>'."
";
while(list($model_id) = mysql_fetch_row($result))
{
echo '<option value=' . $model_id;
if ($model_id == $model)
{
echo " selected";
}
echo '>$model_id</option>'."
";
}
} echo '</select>'."
";
?>

Dynamic Links
I would like to create dynamic return paths as links on site pages. For example, there might be a link to the whet stone page on both the chisel and plane pages. If my viewer came from the plane page, I'd like the return path to indicate "home->planes->whet-stones", appropriately linked. Likewise if from the chisel page, "home->chisels->whet-stones".

Above the immediate back link, normal site layout logic would apply. Should the referer page be off site, site layout would rule. This doesn't appear to be particularly difficult.

Dynamic Forms
I would like to know if it is possible to make a dynamic form. I've got to do some reservation forms for car rental agencies. There are about thirty different input possibilities on these forms. eg. some want to have a form that asks for the pickup time, and some want radio buttons that say pickup time is AM or PM. Each company would like about 10 of these to be on their form. If I have a database (MySQL) and can keep each customer preference in there, could I dynamically make a form?

Dynamic Dropdowns
I got a script a while back that populates dropdowns from a database, Im using PHP with this, WHat I want to do with the dropdowns is populate the list boxes depending on a variable that is passed through the URL, I can do it for the countries ok, but it wont load the citys I hope some one can help me out.

Its the javascript Im having the problem with. Heres the script, you will need to run this on a PHP enabl server with a mysql DB. PHP Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved