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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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.




View Complete Forum Thread with Replies

Related Forum Messages:
Format The Result Like This, 16:13:22 ?
Im pulling information from an xml file tha returns the time formatted like this 161322, how would i format the result like this, 16:13:22 ? Code:

View Replies !
Format Result Text Using Passthru Of System
I tried to use the Passthru and System function to resolve some whois
information.

echo passthru('whois 62.69.168.12') .'<br>'
-or-
$whois = system('whois 62.69.168.12', $retval);

It works fine, but all the result text is at one line. How can i format this
output correctly ?

View Replies !
Changing Array Format From Result Of MySQL
here is what MySQL returns in a visual way..

game_id | team_id | stat_id
1 | 1 | 1
1 | 2 | 3
1 | 3 | 7
1 | 3 | 6
2 | 1 | 1
2 | 4 | 3

in records with the same game_id, there will be no repeating team_id
in records with the same team_id, there will be no repeating stat_id

so, after I got the query, I made them into this format

PHP Code:

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

View Replies !
Saving A Result To Another Table
I have a script that will print out the results of a table and make a
calculation of a total of one of the columns. See example:

<?php

/* Database connection */
include(MYSQL_CONNECT_INCLUDE);

/* Select all pilots */
$query = "SELECT * FROM pilots ORDER BY pilot_num ASC";
$result = mysql_query($query);

/* Determine the number of pilots */
$number = mysql_numrows($result);

if ($number > 0) {
/* Print roster header
Change this HTML to fit your webpage layout */
print "<table>";
print "<tr>";
print "<td bgcolor=#000080 width=85 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>NUMBER</b></font></td>";
print "<td bgcolor=#000080 width=120 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>NAME /
EMAIL</b></font></td>";
print "<td bgcolor=#000080 width=130 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>CITY</b></font></td>";
print "<td bgcolor=#000080 width=93 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>COUNTRY</b></font></td>";
print "<td bgcolor=#000080 width=93 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>FLIGHT
TIME</b></font></td>";
print "<td bgcolor=#000080 width=75 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b><center>STATUS</center></b></font></td>";
print "<td bgcolor=#000080 width=75 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b><center>LOG
BOOK</b></center></font></td>";
print "</tr>";


View Replies !
Mysql Table Result
I have a product page which grabs a product, lets say the ID = 1. At the bottom of the page it grabs the 2 latest products created by that user. I would like it to grab the next 2 products in the database instead of the latest. So,

Product 1

Other Products

Product 5 and Product 6.

View Replies !
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 Replies !
Format Data From SQL Table
This might be a basic question, but I can't see anything on the forums for it. I'm creating a small jobs database where our coordinator can input data from employers - company, job role, job description etc. I've got it looking how I want pretty much, but the job spec/person spec needs to be more flexible.

Is there anything I can do to make the data extracted look the same as the way it's typed in (like in this box for example!) eg. when the user enters a new line it automatically displays the new line as opposed to a continuous string of text.

View Replies !
Output Table Format
I need to retrieve the data from the MySQL table using PHP. Code:

View Replies !
Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email
addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so
on.

View Replies !
Select Result On Empty Table?
can't remember how to do this, doing a select on a db like so.

$query = "SELECT user_id FROM tool_user WHERE user_name = '$user_name'";
$query = mysql_query($query) or die("eek");

which will work if there is at least one entry in the database table, however how do i return a result id the table is empty? do i need to use @mysql_query($query) and then something after that?

View Replies !
Display Of Mysql Table Result...
I have a mysql table of articles with fields:

- recordID
- department
- articleTitle
- articleText

Using PHP, I'm attempting to get the results of the table to display as follows:

Department 1
- articleTitle 1
- articleTitle 2
- etc....

Department 2
- articleTitle 1
- articleTitle 2
- etc..

I figure I should use a while loop but can't figure out how to exit/reset the loop when a new 'department' is encountered in the $result.

View Replies !
Strange Result From Table Query
I have a simple query that I am restricting to the first 4 character, however instead of the first 4 characters I am getting only the characters from the end of the field.

The information in the field resembles: 4285-002

My result should be: 4285

What I am getting is: -002

The following is the code to pull the dat from field 'Dest':
    $dest=odbc_result($rs1, 'Destination');
        $deststrcount=1;
        $deststr = $dest;
        $deststr = str_split($deststr,4);
        foreach($deststr as $destv){
          if ($deststrcount<="1"){
            $desttext=$destv;
            $destnew = "DEST[1,$deststrcount] $desttext";
 
            $strcount=$strcount+1;
            }

View Replies !
Link Result Table Of 2 Queries
If I have 2 table, I can easily linked them with where something = something. But I have 2 tables that I generated from complicated queries, and now I want to link them together too with where something = something. How will the MYSQL query look like?

View Replies !
Problem Displaying Result In Table
im trying to display some data in a table (php + mysql) this is the code to create the table Code:

View Replies !
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.");

View Replies !
Query Result Displayed In HTML Table
I have a few queries that run fine & return the results I'm after. However I am unable to get them to display in rows/columns. I am sure that the results could be passed into a table using html.

$data_p = mysql_query("SELECT * FROM download WHERE dance LIKE '%$search%' OR name LIKE '%$search%'$max") or die(mysql_error());

This displays the results in one long list:

while (list($id, $name, $type,$size,$content, $dance) = mysql_fetch_array($data_p))    {

 echo "<a href="download3.php?id=$id">$name$dance</a></br>";
 }

Anyone?

View Replies !
How To See The Files View In Table Format After I Upload?
how to see the files view in table format after i upload? i mean how to create like

user file uploaded date time
ali abc.xls 05-11-05 09:08am

View Replies !
Output Table Rows Format Question
I have scripts that output data in seperate row for each record.

$query = "SELECT * FROM table";

  while ($row = mysql_fetch_array($result) ) {

  print"<tr bgcolor=$color>";

               print"<td>$row['data'];</td>";
        
  print"</tr>";

}

how would you format the html to output this same data in say in table row with a limit of 5 records and then start a new table row.

<tr>
<td>Data</td><td>Data</td><td>Data</td><td>Data</td><td>Data</td>
</tr>

<tr>
<td>Data</td><td>Data</td><td>Data</td><td>Data</td><td>Data</td>
</tr>

View Replies !
Store Result Of SELECT Stament To Be Used To UPDATE Another Table
im trying to update a field of a table which is done through the results of a select statement. I need to be able to a store the results of the select statement which can then be used to determine if an update another table is initiated. This is where i have got so far: Code:

View Replies !
Creating Table Rows Based On Query Result
I am trying to create a simple table with a fixed number of columns (5) but the number of row will depend on the results of the query. I have tried various examples found here or there and I can't get them to work. Code:

View Replies !
Recreate The Query For Each Day In Order To Show The Result In A Table
I would like to get a count for every element filled on that day but however i am unsure how to make this query to the mysql db. for example every thing filed on a monday or for each given day of the week may be better. table field is called date and is in datetime format Y-d-m H:i:s

how would i complete this query to get it to look for each even if i had to recreate the query for each day in order to show the result in a table. PHP Version 4.3.11 being used
PHP Code:

Select count (something) as total from database where ?

View Replies !
Send Mysql Query Result Displayed In A Table
I have just created a shopping cart and I would like to send my user the receipt of there order by email. The receipt is generated by a mysql query and is displayed within a table. I have worked out how to send a html using simple HTML code as my “$messageâ€&#65533; variable: $success = mail($to, $subject, $message, $headers);

But I can not get it to send my mysql query result displayed in a table. How can i create the result of my mysql query and make it a simple variable i.e $message.

View Replies !
Code To Make Table Rows Of A Result Appear In Alternating Colours...
How can I get it so that when I run a search, and the results come back in table format, the rows are alternating colours, like on Devshed's forums? I believe there was some code here some time ago saying how to do it..

View Replies !
Displaying Last Result From A Mysql Table With A Limit Of 10 Results Per Page
I want to show the last post in a mysql table. And i am displaying them with a limit of 10, i.e. 10 results per page. Now i have a problem figuring it out what would be the starting point of the results display in this case. Code:

View Replies !
How To Convert UK Date Format (DD/MM/YYY) To A Format That Will Be Accepted By MySQL (YYYY-MM-DD)
I am trying to work out how to convert UK date format (DD/MM/YYY) to a format that will be accepted by MySQL (YYYY-MM-DD), so far I have been almost successful by using the following:- PHP Code:

View Replies !
Convert UNIX Format Into An Hours:Minutes:Seconds Format
I have a a UNIX format number that I want to convert into an Hours:Minutes:Seconds format for a stopwatch/countdown timer script I'm writing.

I used date("H:i:s", ($time)), but the problem is, if the period I'm counting is above 24 hours, the Hours reset to 0. So If I was counting down 49 Hours, It's be displayed as 01:00:00 instead of 49:00:00.

View Replies !
Format The Date And Time Entered By The User To The Mysql Format
I am trying format the date and time entered by the user to the mysql format which is: yyyy-mm-dd hh:mm:ss for example the user enters 25-8-2007 16:20:00 I want to convert it to 2007-08-25 16:20:00 and insert to the database. Code:

View Replies !
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.

View Replies !
Changing Date Format To Mysql Default Format
i hve a date variable in mm-dd-yyyy format how can i change it to mysql default format i.e., yyyy-mm-dd format ...

View Replies !
Date/time Format To Be A Normal Format
i want my date/time format to be a normal format... ex. 1-11-2006 9:20pm..

it comes out for me like 2006-1-11 21:00:30

code i have is... how could i have it so it displays it normally...

<?php echo $filelist_array["date"]; ?>

View Replies !
Format Currency - Dollar Format
I want to take a variable and make sure that I output to the browser in dollar format ie if I set $price=100. I want to make sure that $price appears as 100.00. in turn make sure that when $price=100.97 is outputted as 100.97

View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this.

<? while ($row = mysql_fetch_array($prod_result)) {
$small = $row[0];
echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?>

But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?

View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results).

I have checked that both queries return info.

I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates).

So, IS it possible to nest one query's output loop within another, or am I doing something wrong?

View Replies !
Creating A Result Page From A Result Page...
I have a contact management database (4500 records) where each record contains many columns = a lot of data to look at in one go.

So... I have created a search page to look for "Company" or "Name" which then returns a recordset with a primary ID number and a summary of 5 other fields.

This recordset is then displayed on a results page in a dynamic repeating table which just shows simple record lines.

My aim is to then be able to go from the results page to another detailed result page based on the ID of a specific selected record.

I understand how to generate the recordset from a text box but cannot find out how to create a recordset from a dynamic repeating table.

View Replies !
Find All Of The Rows In The Primary Table That Doesn't Exist In The Foreign Table
i have 2 databases, one uses the primary key of another as the foreign key. I want to find all of the rows in the primary table that doesn't exist in the foreign table. e.g:

table jobs:

job_id
company_id
job_name
job_text
date
...

table companies
company_id
company_name
...

from the example above i want to find all companies that have NOT had any jobs between one date and another.

View Replies !
Create A Mysql Query That Will Look In A Table And Come Back With The Most Used Phrase In A Certain Cell In The Table?
How can I create a mysql query that will look in a table and come back with the most used phrase in a certain cell in the table?

4|Truck|Chevy
5|Car|Honda
6|Car|Toyota
7|Van|Chevy
8|Car|Mitsubishi
9|Truck|Toyota

I want a print out from mysql to be like this:

Car 3
Truck 2
Van 1

Is there any way to have it count up how many of each unique things there are in a cell in a table, and have it decending from the first one being the highest number?

View Replies !
Integrate A VBulletin Board User Table With Another Software Projects Table.
I'm trying to figure a simple query out but for some reason I can't think of how to do it? It's been a while since I've played with the two and I couldn't even find anything on Google either. What I'm trying to accomplish is fairly simple. I'm trying to Integrate a vBulletin board user table with another software projects Table.

View Replies !
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?

View Replies !
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:

View Replies !
How To Select Count From 2ndary Table On Matches In Primary Table?
I'm coming back after about a 4 year break, so even basic stuff is taking forever to re-learn - I have a feeling that this is going to be a dumb question. Any suggestions on the best way to:

SELECT count(<other table entry id>) FROM <other table> WHERE <the entries in this table referencing other table id> = <entries in other table by other table entry id>

Basically, I just want to construct multiple rows of data that say: "here's the details of a Topic, and there are 10 (or whatever) Entries for this Topic" It seems like it should be simple enough. Code:

View Replies !
Create A Table Say 3 Rows 3 Cols And Put An Include In Each Table Cell
I have been playing with php includes and thought it would be interesting to create a table say 3 rows 3 cols and put an include in each table cell pointing to other sites, i thought make each cell 500px wide and i would have a page with say four news sites from different countries, so i built my table added this in
<?php include("http://www.cnn.com")?>

plus others uploaded it then sat back to watch my master peice in action, but hey guess what! includes dont quite work like that, the sites all loaded under each other and the page was veery wide, and even my nav table include had the same rollover effect as the first site in the includes.

Is there a way this can be done easily or should i forget this idea now, I have no need for this on my site I am just at the start of learning php so have tried this just for education reasons.

View Replies !
Drop Down A Table Is Suppose To Show Up To Give You The Geocache Table
Under the drop down a table is suppose to show up to give you the geocache table when I had the drop down setup as html it worked fine which leads me to believe something is conflicting in my code. I need an extra pair of eyes to look at it, cause I just cant catch what Im missing. PHP Code:

<?php
//include files to configure db and open it
include 'config.php'
include 'opendb.php'
//pull name for drop down
$query  = "SELECT name FROM geocache";
$result = mysql_query($query);
$options = "";
// find the selected geo name
$result2 = mysql_query("SELECT * FROM geocache WHERE name = '" . $_POST['name'] . "'");
?>
........

View Replies !
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?

View Replies !
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....

View Replies !
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

View Replies !
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:

View Replies !
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.

View Replies !
How Can I Update/insert One Complete Table Into Mysql Table
How can I update/insert one complete table into mysql table. Input data will be from another page (a form html/php) and data will be update/insert into mysql table. table would be like this : total coloum-- 11 , total row -- 7. I want update in one go.. it may be using loop or otherwise.

View Replies !
Displaying Data From One Table But Ordering By Info From Another Table
I have two tables. One table (we'll call it 'table1') is set up like this:

email address userinfo
email@email1.com userdata1
email@email3.com userdata3
email@email2.com userdata2
etc... etc...

In the above table, the email addresses are in no particular order cause the row is created when someone adds their userinfo. Code:

View Replies !
How Create A Temp Table As A Copy Of A Existing Table?
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? .....

View Replies !
Showing Data From A Table Based On Infos From Another Table!
i have 2 tables in my database : THREAD, and POST

THREAD's rows are: THREADID, TITLE + FORUMID + REPLYCOUNT + VIEWS
POST's rows are: THREADID, PAGETEXT and PARENTID

i'm a big php newbie... I want to display the LAST TWO messages (highest THREADID) of my forum number 99 (FORUMID=99).

I can probably do that, but the problem is that the text of the message is located in another table.. and it's getting too hard for my low-skilled brain lol

so basically I would like to check in "THREAD" for the highest THREADID where FORUMID=99, display the TITLE, REPLYCOUNT and VIEWS, and then check in POST for the same two THREADID's where PARENTID=0 (meaning it is the first message in the thread) and finally display the PAGETEXT !

Could anyone give me a PHP code that would display that?

View Replies !

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