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




Format Data Into A Table


Managed to get this script to out put data and put it into table format. But the idea is to be able to limit the number of data into 3 columns.

I put a border = 1 into the table to see whats happening. It seems that the first entry gets into the table and the rest gets listed one after the other with no table around it.
Check out the code ! PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Format Table With PHP Result
I have to create some kind of dynamic page, logic is next: i have integer in variable and i need to create certain number of fields based on that int. example
$variable = 6 and I need to have table with 6 fields, 4 in one row and 2 in second....my problem is how to do that, how to get new <tr> when number in bigger than 4.

Select DATETIME Table Row As Certain Format?
How do I select a DATETIME row from a MySQL table as a certain format?  Since in MySQL, it's displayed as 2007-05-25 13:44:00  How would I get it to display as May 25, 2007, 1:44 P.M.?

$news = mysql_query("SELECT newsID,posterID,headline,message,datetime as date(M j, o, g:i A) FROM news ORDER BY newsID DESC LIMIT 5") or die("Unable to connect to news database.");

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.

Data Format
I'm building a site for a client, and the access database they've given me wasn't formatted in any specific way. I've converted the database to MySql, but I'm running into a problem with one of the fields. The field contains a list of items that I'll need to output to a list when processed by the script I'm writing.

The problem I'm having is the list of items wasn't formatted in any special way. Other then entering all the data by hand, does anyone have any ideas on transforming the data in the field to an array? There are 700+ records and I really don't want to have to edit each one by hand unless it's a last resort.

Format Example:
Item1
Item 2, continued
Item 3 has 6 - parts
Item 4 has 7, parts

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]

Using Split To Format Data?
I've read all the forums and can find anything like what i'm trying to do when formatting a date. So tell me if this is possible and if so maybe how I could go about it. I have a csv file to upload to my db. The date is in the format of 8/20/2001.

Is there any way that I could split the date with the (/), assign is section a variable name and then format it properly in the db via the variable names?

Export SQL Data Into CSV Format
can any one help me make a function that take in a query then output the results in CSV format ?? i have found here a sample but its not working for me:

<?
$db = new MyDb;
$db->db_connect($host, $dbuser, $password);     # connect to database
$db->db_select($database);
$csv_output = '"column 1","column2"';
$csv_output .= "

Data Format In Application Or Database?
I have found that by far the easiest way to store dates in my LAMP
application is in a text string in the database in Unixtime format.

First of all, what would be the most efficient data type to store this as?

Secondly, in terms of translating into a human readable format, is it
quicker to format the date in the application using date() or in the
database in the select query?

Change Data Time Format
when I retrieve my date and time from database and display as follow: 2003-03-14 14:42:18
How can I easily change the format into : Mar 14th, 2003, 2:42pm

Forms Data Format (FDF Functions)
Anyone used FDF functions in PHP like to share ideas how to populate, say a HCFA1500.PDF file from a MySQL database? Where do I start :-O ? Do I need to install the PDFlib at all? Or is it included in the PHP libraries already?

How To Send Data In Xml Format To PHP Script
Say I have a web page that uses XForms, which puts the result of the
form in XML format. How do I send the result that is in XML format to
a PHP script for processing? Do I still use GET or POST? What does
the result look like when it gets to the PHP script?

PHP Array Email Data In CSV Format
I have a web form which collects data and then does a POST action to call a PHP file which takes the data and sends it to an email address. This all works fine, but right now when I get the data in my email I get it back as follows:

Date Submitted: 7/28/07
Name: Mark Jones

I do not want the Labels with the : (I just want the data emailed) Basically what I need to be able to do is easily copy this data into an Excel file when I get it. With the labels include with the :, the data all gets put into the same column in Excel, so I need to remove the labels. I'm pretty sure I have to modify something in my code listed in Red below, but not sure what or if thats the only thing. Code:

Date Format When Inserting Data
I am getting a date entry through POST by a form byt the format enetered by the user is 'dd/mm/yy' .... how could i use MYSQL PHP syntax to insert the proper format as it is default in the table in my database. which function is it?

Format SQL To Display Data In A Group?
Can any one tell me if there is a way to display data from a MySQL DB in groups?

For example:

May:
Item 1             1/05/2007
Item 2             2/05/2007
Item 3             3/05/2007

June:
Item 4             1/06/2007
Item 5             2/06/2007
Item 6             3/06/2007

And so on...

Obviously i would be after having a title of that current month etc. But would need the data to go and update on its own, so once may has gone, June would be he first month, if you see what i mean?

How To Format Data In A File Which Will Be Open In Excel?
I am trying to generate a file with php from a database extract that i would like to be open in excel.

What i need is to format the content of the file in CSV i guess. The 'fgetcsv()' can do the job by formating the content of an existing file.

Is there an other option than to create a file with my database content, save it on the server and open/format it with 'fgetcsv()'?

Change Format Style For Datetime Data Type
I don't know how to change the default format style for datetime data type.

When I retrieve data from a table the datetime fields are displayed as "day_number month_name Year" but I need it to be displayed as normal form: "month/day/year".

I have been trying to do it using setlocal, but I don't know how to use it.

How To Convert MYSQL Data Result To Csv File Format.
How to convert MYSQL data result to csv file format.

Processing Form Data And Emailing It In Html Format
I have a form that when submitted it just sends a regular email in plain text with all the information.  However I would like to be able to format the email so it is more organized with a table that contains the submitted information.  However all the tutorials I have gone over does not show how to pull information from the form fields and put them in the html message itself. 

They just show how to send an email in html format without any form data. My current code below is what I have been experimenting with and just sends plain text. Can anyone give me some assistance as to how to have the form data submit in html? Code:

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>?

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?

Suggestion Needed On Data Storage Format In Text File
The project I am developing doesn't involves database. I want to parse
the mailbox file (.mbx) and store the summary in the text file for fast
retrieval and display of information in the Inbox page.

The sugegsted format are as:

#1
ID [4 bytes]: Subject [100 bytes]: To Address[100 bytes]: From
Address[100 bytes]...etc...
#2
Instead of preassining fixed size to variable (as actual data may be
much less or can grew to more), we can store the values continuously,
seperated by some unique seperator (#|#, *#*, ...)

1324#|#Hi, How are you#|#me@google.com#|#you@google.com#|# ... and so
on

Which of these will be the efficeint one (as there will be frequent
insert/delete/update of the individual information, eg. set message as
read ..., delete message ..., new message ...)

Also please suggest on how to determine the variable size (100 bytes as
in #1), and assign the size to the variable accordingly and read it
(differentiate multiple variables) when required.

Table Data
I have a table on a php page with the cells containing database data from a mysqldatabase.
what would be the easiest way to allow a user to change how the data is listed by clicking on the top of each data column? I have seen this feature on most applications but cant figure out how to doit??

Table Data Row
I have a script that pulls information from a table. This table contains foreign id keys for other tables. This code works just fine, but pulls id numbers. I would like to make a change to this file to convert the id numbers into their matching names. I have tried to use this type of code:

Data Into Table
I'm trying to get a neat and clean readout of all of the parasites that are in the MySQL table. Right now everything works except all of the info is all over the table and I can't seem to get the table to be clean and presentable for when I open my site to the public. Code:

Converting A Date Format (dd/mm/yyyy) Into A Time() Format
I want to convert a date in the format (dd/mm/yyyy) into a time() style format so I can compare it against the current time and only use information where its date is ahead of the current time.

Help Listing Data In Php From My Table.
I have a result set that came from the query "SELECT * FROM characters" and I want it to list on my php page the results like:

Name gender race
Name gender race
Name gender race

How could I do that?

Inserting Data Into A Table
I would like to know if there is anything strange about the script below(I have only just started to learn php so there may well be!)
Although it seems to work, occasionally it doesn't just insert a single row into the data base, instead 2 or 3 duplicate rows end up in the table. Could the explanation be that I tried this morning to create a table and forgot I already had one with this table name in the database. Would that have damaged the table in some way making it misbehave!
I have commented out the bit about creating tables as I only want to insert data with this script at the moment. One other thought occurs to me, is the problem due to my host freedom to surf as its only a free host and I expect you get what you pay for(or don't pay for in this case). I have subscribed to a pay host http://www.phpwebhosting.com but I am unable to use the database that they have provided because they have informed me that I must use a telnet shell to log into my database and I have absolutly no idea what this is(is it in my Win98?) or do I need to go and get one. I am still waiting for this host to email me back with some help. If there is anyone out there who could tackle all or some of my problems I would be very grateful indeed!
One last thought - I think there is something very strange going on as sometimes when I visit my database, there is less entries in this table than last time, some have been chucked away and my id entries are all out of order now, something like 1,2,3,11,5,7,12 - the last insert had id = 12 next to it and somehow another duplicate has sprung up id = 11????????
Whats going on please!

<html>
<head>
<title> Connecting to Mysql server at ISP host</title>
</head>
<body>
<?php
$Host = "db.davegraham.f2s.com:3306";// Set the variables for the database access:
$User = "p0c79";
$Password = "********";
$DBName = "p0c79";
$TableName = "Jokes2";

$link = @mysql_connect("$Host", "$User", "$Password");
if (!$link)
{
print("<P>Unable to connect to the " .
"database server at this time.</P>
"); //note how 2 strings have been concatonated
exit();
}
else
{
print("Your now connected to the Mysql server at the host ISP.<P>
");
}

if (! @mysql_select_db("$DBName") )
{
print("<P>Unable to locate the $DBName database at this time.</P>
");
exit();
}
else
{
print("The database $DBName has been located.</P>
");
}
/*
$sql = "CREATE TABLE $TableName (ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, JokeText TEXT, JokeDate DATE NOT NULL )";
if ( mysql_query($sql) )
{
print("<P>$TableName table successfully created!</P>
");
}
else
{
echo("<P>Error creating $TableName table: " .
mysql_error() . "</P>");
}
*/

$Query="INSERT into $TableName VALUES(&#390;', 'hello hello hello!', &#55614;&#57152;-08-08')";

if (mysql_query ($Query))
{
print ("The query was successfully executed!<br>
");
}
else
{
print ("The query could not be executed!<br>
");
}
mysql_close($link);
?>
</body>
</html>

Column Data From One Table To Another
im trying to get the vend_name column data from one table(manuf) into another table (products2) that has the same vend_name column which is empty but has a vend_code column as a key identifier.

im wondering if theres a way to put the data from the vend_code column and vend_name column from the first into an array so that i can populate the vend_name column of the 2nd table

this is what ive come up with below, it seems to be just puting the last record into those two array variables PHP Code:

Entering Data Into A Second Table:
Using a script, I able to insert the data into the first table of my mysql db, but when I try to insert the same into second table(duplicate, so same vars, etc.. no prob at that level), it doesn't go through. It doesn't even make an empty row(which would mean wrong vars) Someone told me to check in the logs of both PHP and mySQL. How do I do this?

Copy Table Data To Another
I've been searching in the PHP forums for this answer, and I've found something similar, and have used to this to the problem I have.

Anyway, when I do run this script I get an error line 5 which is the 'while' statement.

$query_newsfeed = "SELECT itemid,heading,news_date,content FROM newsfeed";
$query1_exec = mysql_query ( $query_newsfeed );

// Error here!
while ( $query_row = mysql_fetch_assoc ( $query1_exec ) )
{
$query2 = "INSERT INTO newsfeed_map ( itemid,heading,news_date,content ) VALUES ( $query_row[$itemid],'$query_row[$heading]','$query_row[$news_date]','$query_row[$content]' )"
$query2_exec = mysql_query ( $query2 );

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource

Any ideas where I could be going wrong?

How To Replace ID With Data From Another Table.
I'm working on a project where I have a MySQL table that contains
profile data. This data has 2 grouping fields one for group and one
for criteria. The client wants the flexibility to edit and rename
these grouping fields without having to go back and make changes to
each profile. With this said, I created 2 more tables one for group
and one for criteria. Tables would look like this:

Inserting Data Into A Table.
I keep getting a parse error with this code. What am I doing wrong? The SQL statement works in MySQL. Is there something wrong w/the way I'm decaring my PHP variables? Code:

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:

Insert Data To A Table
I just can't figure out why it isn't sending the data to the table, I've check the names over and over, all the info is parsed correctly, but it falls flat at: $result = mysql_query($sql);

Entering Data From One Table To Another
does anyone know how to write a statement where you are able to transfer data from one table to another?

I have got one table with user details. and I have another table for creating bulletins.

is there a statement which will put the ID of the user from user details to bulletins everytime they create a bulletin?

Converting Table Data From HTML To PHP
I have a problem converting data from a html file, to a 3 way split. (header.php index.php and footer.php, Reason being PHP won't parse the following line,
<table width="37%" border="0" cellspacing="0" cellpadding="0" height="163">
I think it all revolves around the % sign, does anyone have any ideas about how to fix it without limiting the width to X amount of pixels?

Grabbing Data From A Table And Displaying It
I'm grabbing data from a table and displaying it but I want to to spand out into multiple pages...I got it all setup but when I click on the next link nothing happens... I got it setup at "3" right now just for testing..I have 5 entries in the database.. anyways could someone help me out? here is the code:

<?php

// Get connection info
include "../connect.php";
// End connection info
if(!$rowstart) $rowstart=0;
// Start database select
$result = mysql_query(
"SELECT * FROM links WHERE notactive='$notactive' order by date desc limit $rowstart,3"); //Select Database
$result2 = mysql_query("select * from links");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>"); exit(); }
// Display the text of each host
while ( $row = mysql_fetch_array($result) ) {
if ($notactive = 1) {
echo ("<table width=500 height=57 border=0 cellpadding=0 cellspacing=0>");
echo ("<tr>");
echo ("<td align=left valign=top><strong>" . $row["name"] . "</strong></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top>" . $row["desc"] . "</td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top><a href=" . $row["url"] . ">". $row["url"] ."</a></td>"); }
echo ("</tr>");
echo ("<br><br>");
echo ("</table>");
}
if ($rowstart>$numrows)
{
echo "<A HREF=$php_self?rowstart=rowstart-3>";
echo "< Previous Page</A>";
}
echo "|";
$numrows=mysql_num_rows($result2);
if($rowstart+3<$numrows)
{
echo "<A HREF='$php_self?$rowstart=rowstart+3'>Next Page></A>";
}
?>

Grabbing Data From A Table And Displaying It
I'm grabbing data from a table and displaying it but I want to to spand out into multiple pages...I got it all setup but when I click on the next link nothing happens... I got it setup at "3" right now just for testing..I have 5 entries in the database.. anyways could someone help me out? here is the code:

<?php

// Get connection info
include "../connect.php";
// End connection info
if(!$rowstart) $rowstart=0;
// Start database select
$result = mysql_query(
"SELECT * FROM links WHERE notactive='$notactive' order by date desc limit $rowstart,3"); //Select Database
$result2 = mysql_query("select * from links");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>"); exit(); }
// Display the text of each host
while ( $row = mysql_fetch_array($result) ) {
if ($notactive = 1) {
echo ("<table width=500 height=57 border=0 cellpadding=0 cellspacing=0>");
echo ("<tr>");
echo ("<td align=left valign=top><strong>" . $row["name"] . "</strong></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top>" . $row["desc"] . "</td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top><a href=" . $row["url"] . ">". $row["url"] ."</a></td>"); }
echo ("</tr>");
echo ("<br><br>");
echo ("</table>");
}
if ($rowstart>$numrows)
{
echo "<A HREF=$php_self?rowstart=rowstart-3>";
echo "< Previous Page</A>";
}
echo "|";
$numrows=mysql_num_rows($result2);
if($rowstart+3<$numrows)
{
echo "<A HREF='$php_self?$rowstart=rowstart+3'>Next Page></A>";
}
?>

Grabbing Data From A Table And Displaying It
I'm grabbing data from a table and displaying it but I want to to spand out into multiple pages...I got it all setup but when I click on the next link nothing happens... I got it setup at "3" right now just for testing..I have 5 entries in the database.. anyways could someone help me out? here is the code:

<?php

// Get connection info
include "../connect.php";
// End connection info
if(!$rowstart) $rowstart=0;
// Start database select
$result = mysql_query(
"SELECT * FROM links WHERE notactive='$notactive' order by date desc limit $rowstart,3"); //Select Database
$result2 = mysql_query("select * from links");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>"); exit(); }
// Display the text of each host
while ( $row = mysql_fetch_array($result) ) {
if ($notactive = 1) {
echo ("<table width=500 height=57 border=0 cellpadding=0 cellspacing=0>");
echo ("<tr>");
echo ("<td align=left valign=top><strong>" . $row["name"] . "</strong></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top>" . $row["desc"] . "</td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top><a href=" . $row["url"] . ">". $row["url"] ."</a></td>"); }
echo ("</tr>");
echo ("<br><br>");
echo ("</table>");
}
if ($rowstart>$numrows)
{
echo "<A HREF=$php_self?rowstart=rowstart-3>";
echo "< Previous Page</A>";
}
echo "|";
$numrows=mysql_num_rows($result2);
if($rowstart+3<$numrows)
{
echo "<A HREF='$php_self?$rowstart=rowstart+3'>Next Page></A>";
}
?>

Grabbing Data From A Table And Displaying It
I'm grabbing data from a table and displaying it but I want to to spand out into multiple pages...I got it all setup but when I click on the next link nothing happens... I got it setup at "3" right now just for testing..I have 5 entries in the database.. anyways could someone help me out? here is the code:

<?php

// Get connection info
include "../connect.php";
// End connection info
if(!$rowstart) $rowstart=0;
// Start database select
$result = mysql_query(
"SELECT * FROM links WHERE notactive='$notactive' order by date desc limit $rowstart,3"); //Select Database
$result2 = mysql_query("select * from links");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>"); exit(); }
// Display the text of each host
while ( $row = mysql_fetch_array($result) ) {
if ($notactive = 1) {
echo ("<table width=500 height=57 border=0 cellpadding=0 cellspacing=0>");
echo ("<tr>");
echo ("<td align=left valign=top><strong>" . $row["name"] . "</strong></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top>" . $row["desc"] . "</td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td align=left valign=top><a href=" . $row["url"] . ">". $row["url"] ."</a></td>"); }
echo ("</tr>");
echo ("<br><br>");
echo ("</table>");
}
if ($rowstart>$numrows)
{
echo "<A HREF=$php_self?rowstart=rowstart-3>";
echo "< Previous Page</A>";
}
echo "|";
$numrows=mysql_num_rows($result2);
if($rowstart+3<$numrows)
{
echo "<A HREF='$php_self?$rowstart=rowstart+3'>Next Page></A>";
}
?>

Q. Data Not Posting Mysql Table
I am trying to post from a form to table using the code below from file2.php
and having two problems:

1. The data is not being posted to the table
2. After submit is pressed the following message comes up: "The page cannot
be displayed" - The browser can't find the file, because it is looking for
http://file2.php instead of http://teachercards.org//file2.php

HTML Table With Data From Two Recordsets
I have two MySQL tables, say one is author and one is books. Author contains a unique PK say author_id Books contains an author_id also which links across to the author table. Usual stuff. My problem is getting at the info.

If I wanted to display the info, in it's mnost basic format, I would set up a HTML table with the columns and repeat the row. PHP Code:

Extract Data From Table Html
I would like to extract data from the table attached.
Could someone help me to create the regular expression to grab that
informations?

Echoing 3 Types Of Data From 1 Table Row
I have this script where one of the rows in a mysql table is named "type" tinyint(3).

now when a person joins the site they have a basic membership and their data is 0 in the type row when they become silver members it is 1 and gold is 2 all 3 numbers are entered into that one row for each member depending on what kind of membership they have.

what I want to do is echo each type of membership on a page by the total number of each type so say there is 100 basic memberships then it would add up all the 0's within the row in the mysql database and then echo that total. I have already gotten it to display total number of users by adding. Code:

$query = "select id from user";
$result = MYSQL_QUERY($query);
$totalusers=mysql_num_rows($result);
@mysql_free_result($result);
if(($s=="")or($s>=$totalusers)or($s<0)){
$s=0;}

and then having <?print $totalusers;?> where ever I want it to echo. How can I do the same with the memberships? I have a feeling that it would have something to do with $totalusers=mysql_num_rows($result); i need to change mysql_num_rows to something else?

Simple Adding Of Data To A Table
I'm basically creating a system which add records to a pre made SQL
database built in SQLyog.
So far i'va had no problems actually connecting to the database and
displaying resulst but I just cannot make it add records. I know its
connected to the database as a I made a mistake with connection
details on purpose to see if it recognised it.
I just add data into a text field, click submit and the page goes to
a
new, blank page with no changes to the table when I check in SQLyog.

Here is the code I have tried (simple add before I code the proper
system):

HTML page
<form action="script.php" method="post">
Test: <input type="text" name="test2"><br>
<input type="Submit">
</form>

and the PHP script to add data:
<?
$host="localhost"
$username="root";
$database="test";

$test2=$_POST['test2'];

mysql_pconnect($host,$username);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO test2 VALUES ('','$test2')";
mysql_query($query);

mysql_close();
?>

Transfer Data From An Xls Spreadsheet Into A Table
Is there any way I can transfer data from an excel spreadsheet to my table?? Example:
I have an .xls spreadsheet called hello.xls and it has 5 columns with hundreds of rows of data in it. I want to copy all this data to my table instead of copying line by line which will take me eternity. I have a table called hello which has the same 5 columns.

Using An Array To Insert Data Into A Table.
This works:
$col1 = 2;
$col2 = 2;
$col3 = 2;
$col4 = 2;
$query = "INSERT INTO test (a,b,c,d) VALUES ($col1,$col2,$col3,$col4)";

and this does not

$col = array(2,2,2,2);

$query = "INSERT INTO test (a,b,c,d) VALUES ($col)";

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:


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