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




Extracting Database And Building A Table


I have a mySql database with

tblDiary
DateEmployeeClient
1/1/04SmithBloggs
2/1/04JonesUnited
2/1/04SmithCentral
.....etc

tblEmployee
NumberName
1Smith
2Jones
....etc

Thing is I need to get it to display HTML in a date table like this:

MondayTuesdayWednesday...etc
1/1/042/1/043/1/04
SmithBloggsCentral_____
Jones______United_____
....etc

and if the user clicks on say Bloggs it takes them to the booking so
it can be amended or if they click on _____ it sets up a new entry in
tblDiary.

I will be using tblDiary.Data and tblDiary.Employee as a compound
primary key.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Building Table By Column Rather Than By Row
I'm currently looking for a way to populate some html tables of varying lenghts and widths, pulling the data from arrays. I want to achieve this with a function in order to make this as dynamic as possible. example: function build_table($data){ ... }

$data would be an array containing a varying number of sub-arrays, the first array would populate the first row (column headings) and each subsequent array would be the data for each column rather than each row. Code:

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:

Extracting Database Entries
I have a non-profit's web site that wishes to allow their members to
fill out information regarding summer camp information (name, contact
info, mailing info, physician's name, etc) online and submit it. I can
handle taking the info with PHP and putting it into a mySQL database easily.

But what has me stuck is that they want the ability to print out hard
copies of selected submissions (their choice) if they need to.

Would I have to display all the database entries in a form on a new page
with a select box next to each entry and have them pick that way, then
loop through and print out the selected ones or is there a better, more
direct (read: easier) way to accomplish this?

Does this sound like something for which there may be a pre-written PHP
script that can be altered?

Extracting Data From Database Using Three Strings
I am a complete newbie. I have been working on a self-learning project that will ask users for three strings (i.e. name,dob and number. If details are correct, will vector to a new page and display all their other information unique to their name,dob and number. The second page will then display their school,work,address, etc. which is editable. They will then click the submit button at the bottom to save the displayed data (or any changes they made to it) in the database from where it was initially extracted from.

Here is the php for the first page which asks the name,dob and number:

Saving And Extracting Forms, PHP To Database
I'm having to save HTML forms that include PHP strings into a database
so that I can display them upon request. The HTML/PHP is entered into a
<textarea> and written to the db in the usual way.

One note: Because this is an Oracle db, I've written my own little
"stripslashes" function for Oracle (because Oracle doesn't care for the
standard stripslashes() function for some reason), so you'll see that
in the following code.

Here's how I'm writing it to the db:

$code = addoracleslashes(htmlentities($_POST['code']));

and then I use

echo stripslashes(html_entity_decode($code))

to display it on the page. However, the embedded PHP (fwiw, <?php echo
$_POST['formdata']; ?> in the value of each field) is displayed as
text, so that my form fields are filled with my PHP code. Furthermore,
html_entity_decode doesn't seem to be working when I try to echo the
data back into a <textarea> for editing.

Building An Array From A Database
Just a quick questions. I'm retrieving two fields from a database one being "id" and the other "name". I am currently using this to load the results

$i=0;
while($row = $db->fetchArray($results)) {
nameArray[$i] = $row;
$i++;

Which fetches the results by Association and gives me these results:

Array (
[0] => Array ( [id] => id1 [name] => FirstName )
[1] => Array ( [id] => id2 [name] => SecondName )
)

is there some way to modify the code so I get this result:

Array (
[id1] => FirstName
[id2] => SecondName
)

It seeem like it should be possible but I just can't seem to work it out.

Why Is My MySQL Table Building An "Overhead"/what Is That/how Can I Prevent It?
I hope you'll be nice to me and let this post go through even know its
mysql and not directly php. But of course my script is php.

The problem is, that my Table (1,8 MIO entries/100 MB/MyISAM) is not
working anymore. Everytime my script wants to write in something the
number of entries decreases, and at the "Overhead" column the number is
growing.

How can I make my table work without that overhead problem, without any
further crashes and without loosing my data?

If I use the repair or optimize function (phpmyadmin) the overhead is
deleted, but the data is still lost, and the next time my script trys
to put in something more entries will be deleted.

What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

Content Of Database Table Twice?
Why does this code repeat the content of the database table? It connects O.K. but display table contents twice (I only need it once) Code:

Table Name In Ms Access Database
I'd like to know how can i get and store the table names of an ms access database. I use odbc_result_all but i don't know how to exctract and store information about the table name.

How To Search More Than One Table In A Database
Say I have a user input a search string and they click search.  What would my mySQL string look like if i wanted it to search TABLE:'set_01' and TABLE:'set_02' at the same time for the same information?

Delete A Row From A Database Table
I'm trying to delete a row from a database table.  I've made a connection yet it's not working.  Is there something wrong with the following code?

mysql_query("DELETE * from  `contactinfo` WHERE Submission_Number = 1 ");

Changing A Database Table
Is it possible to change a table in a database without just dropping it and recreating it.  As example, I have a photo column which stores an URL, but it seems to only be accepting about 25 characters.  Is there a way I can update the table without starting it over?  Also, when I made the photo column I think I put, photo varchar(25), is there any reason I don't want to make it like varchar(1000), although I know that varchar only accepts 255, so what do I change varchar to?

Selecting Whole Database VS One Table
In querying a regular DB you use the following code: $query = "SELECT * FROM table_name";

Well I want to be able to do something like this: $query = "SELECT * FROM database_name";

Here is my reasoning:

I have built and intranet for the company I work for. I have imported all of the data requested from an Excel Spreadsheet into the corresponding SQL tables. Now for the page I am wanting to pull off my weird select db_name code works like this:

I want to be able to go there and display the Table names within that DB and when a user clicks on one of the links it will reload the page displaying the results for the corresponding Table. Make sense?

How Does One Retrieve All Table Names From A Database...
I'm trying, through an SQL statement, to retrieve table names and column names from a selected database.

Something like...

**PSUEDO CODE**

GET all_table_names FROM $db

->returns(table1, table2, table3, table4)

Import CSV File Into Database Table
Are there any programs like phpmyadmin, that allow you to import CSV files without first converting them into mysql statements? mysql front?

I've created the table and fields, and it should be easy enough to import the data into its respective columns.

Script Not Inserting To Database Table
I submit the form to insert the data into the table, when I submit the form for this script to process, The "if" statement is true because the "echo" statement in the else says so, but the else is what the script is doing. Can't figure out why. PHP Code:

HTML Table Fetched From A Database
I want to generate a HTML table based on names fetched from a database. The tricky part is that I want to generate the table so that the names is written on both the top row and the left collumn. Should look something like this

----------------------------------------------
| ||NAME 1 | NAME 2| NAME3|
|NAME 1| | | |
----------------------------------------------
|NAME2| | | |
----------------------------------------------
|NAME3| | | |
----------------------------------------------

Hope that anybody has a idea how to solve this.

Putting Database Results In A 5x1 Table
I have a db of tens of thousands of entries. It's not too hard to pull
all the entries and build a table that displays them one at a time, but
in my case, that will be a huge waste of space. What I want to do is
put one record in each of the columns. I thinks it's possible to do
because I have seen very elaborate thumbnail gallery scripts to do this.
I just want to be able to put two or three strings of text from each
record into each row, and a checkbox. Here's sample of what I mean:

<table width="76%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td>$record1Line1<br>$record1$Line2<br>
<input type="checkbox" name="$record1checkbox" value="checkbox"></td>
<td>$record2Line1<br>$record2$Line2<br>
<input type="checkbox" name="$record2checkbox" value="checkbox"></td>
<td>$record3Line1<br>$record3$Line2<br>
<input type="checkbox" name="$record3checkbox" value="checkbox"></td>
<td>$record4Line1<br>$record4$Line2<br>
<input type="checkbox" name="$record3checkbox" value="checkbox"></td>
<td>$record5Line1<br>$record5$Line2<br>
<input type="checkbox" name="$record5checkbox" value="checkbox"></td>
</tr>
</table>

I want to pull about 200 records at a time from the db and display as
described above. How can I tell php to take five records from my result
set and display above, then loop through the result set until I'm done?

Table With Weekly Schedule From A Database?
I'm designing a site for a community radio station and the schedule needs to be generated from the list of programs that are in the database the shows table has the following colums show_id, show_name, day, start_time, end_time (i didn't list the non-relevant ones for this portion of the site)

because a table has to be built left to right instead of top to bottom (cell for monday 8am then tuesday 8am instead of all the monday then tuesday etc) and not all the programs are the same length (i think i can use row span="x" depending on the length of the show)

I'm quite lost. should i have other colums? how do i query the database to pull the data out in the proper order and build the table?

Deleting A Table From A MySQL Database
I've looked at the manual and a few other php resources, but yet I couldn't find a simple and easy way to delete a table using php. I noticed there is a destroy() function within the MySQL class, but I'm not sure how it's used.

Output Database Entries In A Table
I'm trying to display the entries in a table of two columns, one entry per table cell - in other words, two entries per row, number of rows based on number of entries in the database. But it still doesn't seem to work. It displays one entry per row... I don't know where the problem is. Here's my code:

Obtaining Info From Database Table
How do you obtain fields from a table and assign each field to a variable to be used as needed.
An example:

Say i had:

table name : user

Field 1 : User name
Field 2: Password

then i wanted:

$username = field 1
$password = field 2.

Database P0c79 - Table Personaldetails Error
I can't create a table in my database. I get the following message: Database p0c79 - table personaldetails Error SQL-query:

CREATE TABLE personaldetails (id TINYINT not null AUTO_INCREMENT, firstname VARCHAR (15) not null , surname VARCHAR (15) not null , password VARCHAR (10) not null , teacherstatus ENUM not null , PRIMARY KEY (id))
MySQL said: You have an error in your SQL syntax near 'not null , PRIMARY KEY (id))' at line 1.

I can't see what is wrong with this - it looks perfect to me, and there is no room for error as all I am doing is ticking boxes in phpMyadmin.

Error Checking For Unique Value In Database Table?
I am inserting data into user table which contains 5 fields, sounds simple
enough normally but 2 of the fields are designated as UNIQUE. If someone
does enter a value which already exists, how do I capture this specific
error?

Would it make more sense to actually run a SELECT query first and if that
returned a result, then I use that for error checking and don't run insert
until select returns nothing?

Getting The Number Of Items In MySQL Database Table.
Is there an easier way to get the number of items in a database table than
selecting all the records in it and then running mysql_num_rows on the
result?

How To Delete A MySQL Database Table Without System()
I want to delete a MySQL table without using functions of the OS, so
that my php script can run on any webserver. Can I use a command like

$sql = "DELETE FROM tablename";

or are there better ways to do the job?

PHP Function To Display A Database / Table Structure?
My webhosts cpanel is down for maintenence, including phpMyAdmin, and I need to view my database structure... Is there any function in PHP to display the database structure (like the "Export" function in PHPMyAdmin)?

Display Items From A Mysql Database In A Table
I am trying to display items from a mysql database in a table but I need it to start a new table row each time multiples of 3 rows of the database table have been displayed like the following example:

item 1   item 2   item3
item 4   item 5   item 6

Does anybody know how I can make this work using php.

Putting An Array In A Mysql Database Table Field
I want to insert an array into my database but i've got a problem with it.

Before i insert the array into the dbase i check if everything is in the array with print_r($array). Everything that should be in the array is in there so i insert it into the dbase.

When i check my dbase with phpmyadmin the field that should contain my array has the word array in it so i assume the array is in the dbase. But when i retrieve the data from my dbase and check my array with print_r i get the following error: Warning: Argument to array_values() should be an array in.

Error In Generating Table From Database Select Statment
I am trying to dynamically create a table with the results from a select statement. Below is the code that is not working. Any help would be oh so greatly appreciated. This is for a final at school which is due in an hour. This is the only thing I can't seem to make work. Code:

Valid MySQL Database/table/column Name Regexp
regular expression in PHP which could be used to
check that a proposed (My)SQL database/table/column name is valid, i.e.
shouldn't result in an SQL error when created?

The user of my (hopefully to be opensourced) program has the ability to
create database/table/column names on the fly.

I'm aware of obvious characters such as ., [space], things like >, etc.,
which won't work, but haven't been able to source a definitive list,
including having googled the MySQL site.

Obviously certain characters need to be filtered out, as noted above, but
I want to be as unrestrictive as possible; hence just [a-z]* isn't good
enough because things like _ are acceptable.

Ideally, I'd prefer a regexp that applies to _all_ vendors' databases, not
just MySQL as I'm about to migrate the program to being
database-independent, probably using PEAR DB, but even a MySQL-specific
regexp would do the job.

In the longer term, I plan some sort of entity conversion script so that
theoretically any character could be used, using some sort of escaping
mechanism probably.

Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database.

Suppose a table "address" contains the following records

-------------------------------------------------------
| name | address | phone |
-------------------------------------------------------
| mr x | 8th lane | 124364 |
| mr x | 6th lane | 435783 |
| mrs x | 6th lane | 435783 |
| mr x | 8th lane | 124364 |
-------------------------------------------------------

Quote:

Read Data From A Table In Pdf File And Store It To Database
I have to populate MySQL database where data will come from a PDF file. This PDF file has a well formatted table and I have to make a similar replica of the table data into MYSQL Database. Is that possible at all?

Get A Table In My Database To Updae Everytime The Page Loads
I am trying to get a table in my database to updae everytime the page loads, it will count how many times a video has been watched. I need to update 'no_of_times_viewd.
How is this done?

Automatic Delete From MySQL Database Table Expired Records?
I have a question . . .

how can i delete from MySQL database table automatic expired records ?
?

One think is to make a service that deleting the expired records . . .

Any other method ?



Display Database Output In Mutli Column Html Table
I am building an HTML form using data from a mysql query. The data to be displayed on the form is 1 column from the db - but multiple rows. Because there are many rows (well, only about 100+) in the table I want to be able to put 2 or 3 (space permitting) rows from the result on each row of the HTML table with a checkbox beside each entry from the db table. The idea is that the user will scroll down the list and check up to 4 or 5 boxes before submitting the form and I didn't want them to have to scroll ALLLL the way to the bottom (100+ rows). I understand how to get data from a db table and put it into an html table, but I cannot figur out how to put more than 1 row from the result on to the same row of the html table.

I hope I haven't confused anyone reading this -- If I am way off base with what I am trying to do please give me alternatives. I am trying to avoid paginating the data for a couple reasons a) clicking a next and/or prev button is more hassle than just scolling down a list and b) the data in the column being displayed is only about 35 - 40 characters and it seems to be if i only placed one result row on each html table row, there would be a lot of wasted space.

Extracting Tar.gz
is it possible to extract tar.gz files on a remote server through PHP? Or do i need to use telnet or something?

Extracting Data From XML ?
The following is the sample XML file from which I want to
extract the data of which availabity ="Available" using php.

The XML file will be generated dynamically from the URL http://www.upc.nl/zipcode.php?zipcode=3565BG

<UPC-Results>
<DateTime>05-12-2005 02:08:26</DateTime>
<Errors/>
<Products>
<Product name="CaTV" availability="NotAvailable"/>
<Product name="Chello Starter" availability="NotAvailable"/>
<Product name="Chello Easy" availability="NotAvailable"/>
<Product name="Chello Light" availability="NotAvailable"/>
<Product name="Digitale telefonie FreeTime" availability="NotAvailable"/>
<Product name="Chello Classic on DSL" availability="Available"/>
<Product name="Chello Plus on DSL" availability="Available"/>
<Product name="Chello Extreme on DSL" availability="Available"/>
<Product name="Digitale telefonie Basis on DSL" availability="Available"/>
<Product name="Digitale telefonie FreeTime on DSL" availability="Available"/>
</Products>
</UPC-Results>
 
from the
above XML, I need to get data of Product name which has the status of
"Available"

Extracting First Character
I was wondering how would I extract the first letter or number of a string. Like if the string was "Goat Chesse" only extract the "G".

Extracting Words
I'd like to extract the first 5 words from a blurb of text. I can't find an easy way to do that. Example. If I were to do that for this message I'd extract "I'd like to extract the"

Extracting XML & RDF Data Using PHP
I have an XML file that contains metadata in the form of RDF. The file
is something like this:

<?xml version="1.0" encoding="utf-8" ?>
<xmpData>
<WavXmpInfo path="C:.....................................")
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/
DynamicMedia/" xmlns:xap="http://ns.adobe.com/xap/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/" xmlns:dc="http://
purl.org/dc/elements/1.1/" xmpDM:audioSampleRate="16000"
xmpDM:audioSampleType="8-bit"
xmpDM:audioChannelType="1"
..........
..........
..........
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">HHHHHHHHHHHHHH</rdf:li>
</rdf:Alt>
</dc:rights>
</rdf:Description>
</rdf:RDF>
</WavXmpInfo>
</xmpData>

I want to extract data such as audioSampleRate, audiosampleType etc,
so that i can insert them into a database. I'm having problems
accessing this data.
I'm using DOMXML. Can this type of data be extracted using DOMXML? If
not how would one go about accessing it?

Help With Extracting Please Folks.!
I have this:
a variable like: <a href="http://www.some_html.com/text.html" >some
text</a><br>

I heed to extract the "http://www.some_html.com/text.html " and put
it in var "link"
And extract "some text" and put it var "text",.

So basically extract all between <a href=" and " >
plus extract all between " > and </a><br>.

Extracting Value From A Drop Down Box
I am having problems extracting the values from a drop down box and based on the value obtained there are some operation done. Code:

Extracting Text From Pdf
I have to index the text of a pdf document.

Does any of you know of a PHP script/extension or a binary that is able
to extract the text ?

The pdf extension mentioned in the php.net docs seem to indicate that
it's for _creation_ of documents only, is that so? Same with all the
PHP classes i have found.

Extracting Information
Does anyone know where I should start with this. Im trying to extract the
information in:
$_SERVER['HTTP_USER_AGENT'

But I dont know how to get the information out? What functions should I be
looking at. I want to get the OS, Browser, IP etc..

Extracting A Rar File
i try to extract a rar file via php but i get an error:

Fatal error: Call to undefined function: rar_open() in --parksdiary.com/httpdocs/rar2.php on line 8 Code:

Extracting Data From XML
What I want to do is extract data from an XML file and store it as a variable for writing to a MySQL database. I have read many google-found tutorials, but none of them seem to work/do what I want.

Extracting Url In Array
I am working on some projects and need some on php. and this is best place for me ever. I need to extract range-url values in an array. The range-url may contains multiple range. Code:


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