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




How To Fetch The Structure Of A Table


Well can anybody tell me how to fetch the structure of a table and also the values specified for a patiular field type. Well what i exactly want is to retrieve the value set for teh enum field but have no idea as of how to get that values.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DB Table Structure Assistance
I'm currently developing a booking in system, which is going really well. However I'm a bit stuck on how to go about defining a table structure.

What we have is 3 engineers doing assessments on each day of the meeting, but we have 6 engineers in total so therefore we will be rotating for each of the days, but what I'm trying to do is to create a table so that each day has 3 engineers.

Table structure I already have:

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

PHPMYADMIN Upgrade Caused Table Structure To Change
My host provider recently upgraded the phpmyadmin to 2.9.2 and mysteriously there were then problems with my website.

First of all, in some tables enum fields were changed. For example Paragon 1,2,3,4 got changed to Paragon 1ÿ2ÿ3ÿ4.  Replaced the , commas with y with 2 dots. Also, my cart whcih uses cookies starting to act very strange.

Has anyone ever experienced anything like this. Host provider cannot understand this. I did spot an error when I logged into phpmyadmin that the mbstring was not installed so the host porovider fixed this and all seems to go back to normal but I would like to find out what exactly happened.

Fetch?
If I want to retrieve a single row. I would make a query and than use msql_fetch_row. (If I use this in a loop it will fetch the next row until it becomes false).

If I want to retrieve multiple rows. I would make a query and than use msql_fetch_array etc..

Say I use a loop with msql_fetch_array and display the data in a table do I have to make a new query to display say the third row of the original table somewhere else on the page?

Fetch & Process
I doing a straight forward webpage fetch and saving it to a file: CODE:

$open = @fopen($url, "r");
$urlfile = @fread($open, 50000);
@fclose($open);
$page = split("",$urlfile);
$datafile = fopen($tempfile, 'w');
foreach ($page as $line) {
echo($line);
fwrite($datafile,$line); }
fclose($datafile);

So I basically just write the fetched HTML line by line to a local file. The weird thing is I'm getting a bunch of ^M characters in the final file after every $line is written to the file.

Fetch A Column
Is it possible to fetch a column from a queryresult?

Fetch A Php File
In my HTML I want to fetch a php file (the php file is a form for a user to fill out) but I want the form pasted on my page but instead it ries to open the form page in a new window of it's own... I tried href but also include.. I don't know that I am using the include properly..  any ideas?

Select On Updated Value During The Fetch
Hi i have a table with all value at 4
i select all lines in a fetch
i update one with a value of 7

i update all the row in the fetch with a value 5

the result is that all my row are at 5
and the only line which should be at 7 is at 5 too.

i see that the problem is at the first mysql_db_query, and i don t know
how to solve it

$query="SELECT * FROM val WHERE str=Ɗ'";
$result=mysql_db_query($datamysql,$query);
$query7="UPDATE val SET str=ƍ',updated=Ƈ' WHERE val=ƈ'";
$result7=mysql_db_query($datamysql,$query7);

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

$str=$row["str"];
$val=$row["val"];
$query2="UPDATE val SET str=Ƌ' WHERE val='$val'";
$result2=mysql_db_query($datamysql,$query2);
}

PHP Fetch 6 Letter Strings
How would I go about fetching only 6 letter and more words from my string. Say the string was from a database, and is formatted like this. Code:

Fetch Object Using Oracle API
I cannot fetch object using oracle functions defined for php3.

If Fetch Array Is Empty ?
I'm doing a fetch_array and I would like to display a "no records
found" message to screen. For some reason this is not working:

here's my Postgres SQL as proof:
surveys=# select othermore from table where othermore <> ''
othermore
-----------
(0 rows)

Then I have:
$result = pg_query($conn, "select othermore from table where
othermore <> ''");
while ($row = pg_fetch_array($result)) {
if (!$result) {
echo "no records<br>
";
} else {
echo "$row[0]<br>";
}
}

Strnage ? Can someone shed some light on what UI am doing wrong ?

How To Fetch Records In Div Listbox?
I found this code interesting and wish to use for my project, but i wondering how do i fetch records in this nested div tags. Code:

How Can I Fetch Files From Another Site
i wanna to catch html files from another web
how can i do it?

Fetch Url From Html File
basically this is no problem at all as i can use regex etc. etc. what i want to do though is: fetch the url from the source of a html file (still - no problem here) which is online in the web (the problem begins). the most simple way (imho) would be to essentially just do an PHP Code:

Fetch The Date From Timestamp
i have a mysql table with 3 fields

1.id  2.time 3.approved

values

1  1181237691  0
2  1181237703  0
3  1181237711  0

i want to fetch the distinct dates from this timestamp values using select statement.

i want to display like this
1  2007-06-07

second thing i want to update the approved value=1 where these distinct dates are equal to the above timestamps.

Using Mysql To Fetch And Display Document
I am currently building a library on the web, this library will consist of pdf-files, at least for now. To keep track of these files, I of course wanna use mysql to keep the information. The whole library itself is supposed to be viewed on a page, where you can sort the titles alphabetically, by author, year, etc.
The library will be completed with a fileupload-utility at a later time, but for now I just want to be able to display all titles from the db, that also should turn into a hyperlink. How do I do that?

Pausing And Initialising Fetch Statement
i need to know, is there any way of suspending OCIFetch function, however storing it in the buffer and than initialising it again, after some process.

PHP.ini File Enabling GET To Fetch Infro From URL...?
What should the contents of my PHP.ini file be if I want to enable "GET" to fetch infro from URL?

Fetch Maximum Amount Of Chars
I want to fetch a maximum amount of chars, 10 in this case, from my mysql dbase with php. For example: If there is 'Post new topic for forum' in the table, I want to output it to the screen like this: 'Post new..'

Fetch Row Data Where Column Value True
I am looking for some guidance here with something I have driven myself nuts over. I have a MYSQL table that holds site variables in three fields, a "varname" field, an "id" field, and a "value" field. I would like to fetch the "value" field where the "varname" field is true. Example Rows:

ID=1
varname=title
value= My Website Title

ID=2
varname=url
value= http://www.mysite.com

I would like to add the value into a template by using the code: $setting[title] or setting[url], etc. Can anyone tell me how I go about fetching a row ov values where a specific coumn value is true?

Function To Fetch Database Results
I have a function that is supposed to fetch all the results from my table "games". There are two database records in that table. My function is supposed to display all of the records, but it only displays one. I also use a function to display a certain template. Here is the coding for both functions and my index. Code:

V(oice)XML/MySQL/PHP, How To Fetch Out Variables ?
I have a question (hopefully someone in here have worked with VXML and server scripts with a back-end database). How do i write the php code that fetch out the variables i am storing in mysql with vxml tags ? I have tried (using bevocal cafe) the code below, but without any luck(i am sure there is something with the echo/print statment) Code:

How To Access Value's From The PDO Fetch Command
I am using the PDO fetch command to return a vlue from the database, now the problem I am having is being able to access the value,

$bob = $result->fetch(PDO::FETCH_ASSOC);
print_r($bob);

When I print it out on screen I get
Array ( [assessmentID] => 1 )

If I try $bob[0] it return nothing,

any ideas?

Mysql Fetch With Drop Down Menu
Im trying to do somekind of dropdown menu taking information from the database but im not quite sure how this could be done with my knowledge.

alright so lets say i have a table named: projects SELECT name FROM project. and it will put all the data found in a html drop down menu?

Restrict CURL To Fetch Gif,mp3,pdf And Etc Files ?
My curl script fetches all links from a html page , but it fetches the mp3,jpg,gif files. Is it possible to set "text/html" in curl_setopt

Using If/else Statments To Fetch Avatar From Mysql Db
i want to fetch a value from my user database table for the current logged in user. Then using the conditions, if $X equals 0 echo the default avatar location, else get the location from avatar_loc field and echo the avatar. Code:

Fetch Results For Specified Keyword From Google
just want to get the url for the first natural listing for a specified key word on google.com. not sure where to start, can any one give me some direction.

Displaying All Data From Fetch Array
I'm having a problem displaying more then 1 result from a mysql_fetch_array statement in my php application.....

ODBC: Fetch Results As Associative Array
Will PHP fetch the results of a query using ODBC as an associative array? I know that MySQL does that, but I couldn't find it for ODBC connections.

Mysql Fetch Row Data Without Moving The Pointer
Is there any way to get data from a row without moving the pointer?

Which Fetch Is The Fastest Mysql_fetch_ Array,assoc Or Another?
I think the title says it, but I'm wondering if i'm only using an associative key should i just use assoc or is the speed so minimal it don't matter?

Database Connections To Fetch Data, Best Practice?
I have many classes that use database connections to fetch data and manipulate on it. I also have database abstraction class that is handling all the database queries and so forth. Usually all my classes take instantiated database object as the first parameter to constructor so they know what database to use: ...

Mysql Fetch Array - Image Display If Available
I am using a HTML search form to give me the following result.  I can get everything to work, even get it to display images that are associated with particular search term, but can't figure out how to keep it from displaying that annoying little "There's not image here image" that explorer shows, the one with box and red "x". 

I know that an if statement would do the trick, but I can't do "if's" inside of the "echo" is it possible to accomplish this?  How? Code:

What Functions Should I Use To Fetch Data From A Flat File ?
What functions should i use to fetch data from a flat file ?

While Loop And If - Else Structure
Its simple code but I cant get it working. What I need is code for the following:
A while loop that runs 200 times, I want it to have an if-else statement inside it. This if-else will check a database entry to see if it is equeal to 1 or zero.

if it is equal to 1 it will return the text "booked", if it is equal to 0 it will return the text "available" the database is called "cinema" and the table is called "booking" with 2 fields: ID (which is an auto_increment primary key) and "status"

The loop wil be checking the value in "status" to see if it is equal to 1 or 0. Also, I want the loop to run 200 times and with each iteration it the control variable goes up 1. The loop control also will refer to the primary key ID. So, the loop will run through checking every table row up through each ID and the corresponding 'status' value. Also, I need the loop to go to a new line after every 20th iteration with a <p> tag or something.

Php Directory Structure
im a little worried about security in a site im designing and have a proposition.. i thought about keeping every single php and inc file in a directory beneath the web directory.. such that NONE of the files can be accessed from a web browser.. then.. when a user requests, for example, to use the built in login page which is entitled login.php.. i simply use apache to forward this page login.php in a different directory.. i can as well use mod rewrite to accomplish similar things..

im trying to think of the reasons that something like this would NOT be a good idea.. i imagine i could create all the php files in a seperate folder on the same level, perhaps title pseudoWWW, and have the entire web strucutre of phps' and incs' in there, and then, when someone requests www/login.html, it doesnt have to have a specific directive in apache to go to login.php, rather, go to the file in the pseudo directory with the same name, but a php extension, run the script, output the results.. then the user wouldn't have any idea that the php script even exists, let alone where it is and what it's doing.

FILE Structure
I've created a function with takes some files (input type="file") as
parameter.

Now, since this is an array of a structure, I'd like to fill this structure
with my own datas, as I'd like to use the same function but not from a form,
but from a self created PHP script.

my function has the file parameter;
myfunction($files)

I've seen there is a $file['file1']['tmp_name'] field. But how to save the
datas.

In my case, the files are actually on my server (a program upload files on a
directory of the server). I must use those files (actually images) to save
them somewhere else on the site, after renaming and putting some records in
the mysql database.

How to fill such $file structure with the different .jpgs ?

Page Structure
I have recently constructed a website using a lot of php script (self
taught). I now wonder if I should have construted the site in a different
way.

The page contains a header (a.php) and left column (b.php) that remain
constant. Depending upon which heading is clicked in a menu row the user
gets different information up in the main site area (three different
versions of "c"). And a footer (d.php).

What I think I have done is loading in the entire site again for each
different menu heading. I load a variable according to which the contents of
(c) is called.

This is the blueprint of the structure I have used.

indexc1.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "elephants"
Load c1.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

indexc2.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "lions"
Load c2.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

indexc3.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "tigers"
Load c3.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

So the only difference with each index file is the value of $var.

In the menu (m.php) the user can click the buttons marked "lions", "tigers",
or "elephants". (which loads in indexc1.php, indexc2.php or indexc3.php).
The problem with doing things the way I have is that the page is redrawn
everytime the user clicks on another heading in the menu.

I guess that I should be calling in a.php, b.php, m.php d.php just once and
then that the menu should just be changing the text displayed in the main
text area without redrawing the entire site. (Similar to a target tag in
frames).

How is this effect created with php?

Directory Structure
I have a directory structure on my server, for example until 7. sublevel of this structure. And i want to write this structure, directories and subdirectories on my website and i don't know write universal algoritmus about for it. I know what functions i have to use, but i don't know how should i write it.

While() Control Structure
I'm trying to insert a unique UserID into my database.  To do this I'm using the substring to get the first letter of the first name, then substring to get the first 8 letters of the last name, and then I want to append the concatenated string with 1, or if that is taken, the next hightest available number.

But I'm having a heck of a time getting it to work.  I had it working at one point for a single name, but it wouldn't deal with duplicate names, I'm pretty mixed up as to why it doesn't work now. The code:

Category Structure
This may sound like a stupid query and ive looked on the net for a tutorial. im trying to build a site that contains information stored in categories. to give an example if i wanted to store information about football i would want a structure like this

Football > English > Premiership > Liverpool > Steven Gerrard >

the problem im having is how do i store this in a database that links it all together i have an idea on how i can do it but it seems long winded and stupid, basically i want each category to be a link to that section so if they clicked liverpool thet would go to one page and if they clicked the parent category it would be another page.

i know this might seem a simple one and im not to bad with php coding would just like an explantion of the most efficent way to do this.

WASP, The Web Application Structure For PHP 5
is a powerful web application framework built on PHP 5. WASP strives to
allow web developers to make great applications with more fun and less
code, but in the familiar playground of PHP. The framework have been
written from the ground up in pure Object Oriented PHP5 and utilizes
all of the enhancements made to PHP in version 5.


Brian Fioca have written an interesting article in OnLamp about Simplify PHP Development with WASP, this will help you to introduce WASP usage for PHP5. WASP API documentation is available online also for more technical details. WASP is available under LGPL license and become a PEAR package since its version 1.1, currently the version 1.2 which includes functions to make form
validation automatic and easy to do. It also includes a library of
validation functions that you can use to validate common things like
phone numbers, zip codes and dates. These functions will conveniently
output standard error messages that you can easily override or
customize.

You can install WASP using PEAR :
pear install --onlyreqdeps http://wasp.sourceforge.net/WASP-1.2.tgz
Or upgrade if you have a previous version :
pear upgrade --onlyreqdeps http://wasp.sourceforge.net/WASP-1.2.tgz

PHP Switch Control Structure
I’m testing this control structure to serve content based on a variable but the square brackets are a problem… any suggestions?

<? switch ([VAR_NAME]) {
case 'FOO':
echo 'wooo'
break;
default: echo 'whoo'
}
?>

Control Structure (Basic)
I'm basically creating a chart system, where new entries into the chart are highlighted via a change in the background colour of their HTML table row.

The problem I have is that the following code generates a "Parse Error", please can someone tell me where I'm going wrong?

---------------------------------
$tablecolor = "000000"

if ($lastweek = "NE")
let $tablecolor = "0000ff";
---------------------------------

The error comes in the "if....." statement line.

Tree Structure Question.
Currently I'm using a tree like sections structure, e.g. Code:

Table: sections
+--------+------------+----------+
| sec_id | sec_parent | sec_name |
+--------+------------+----------+
| 1 | 1 | Home |
| 2 | 1 | News |
| 3 | 2 | Sports |
| 4 | 3 | Soccer |
| 5 | 4 | Teams |
| 6 | 5 | Arsenal |
| 7 | 1 | World |
| 8 | 7 | England |
| 9 | 8 | Economy |
+--------+------------+----------+

Also I'm using the function below to cover the tree: PHP Code:

PHP And XML - Read/Structure Help Wanted
I'm trying to implement a simple MVC app, and I want to have the site
map in an XML file.
Anyways, here is the test xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<site>
<page id="" name="Home">
</page>

<page id="music" name="Music">
</page>

<page id="pix" name="Pictures">
<page id="news" name="News">
</page>
</page>
</site>

And here is what I get in PHP:

Array ( [tag] => PAGE [type] => complete [level] => 2 [attributes] =>
Array ( [ID] => [NAME] => Home ) [value] => )

Array ( [tag] => SITE [value] => [type] => cdata [level] => 1 )

Array ( [tag] => SITE [value] => [type] => cdata [level] => 1 )

Array ( [tag] => PAGE [type] => complete [level] => 2 [attributes] =>
Array ( [ID] => music [NAME] => Music ) [value] => )

Array ( [tag] => SITE [value] => [type] => cdata [level] => 1 )

Array ( [tag] => SITE [value] => [type] => cdata [level] => 1 )

Array ( [tag] => PAGE [type] => open [level] => 2 [attributes] => Array
( [ID] => pix [NAME] => Pictures ) [value] => )

Array ( [tag] => PAGE [type] => complete [level] => 3 [attributes] =>
Array ( [ID] => news [NAME] => News ) [value] => )

Array ( [tag] => PAGE [value] => [type] => cdata [level] => 2 )

Array ( [tag] => PAGE [type] => close [level] => 2 )

Array ( [tag] => SITE [value] => [type] => cdata [level] => 1 )

Skipping the first and last tag and using the following code:

// convert to php array/parse
$this->siteMap = array();
for ($i=1; $i<count($xmlStruc)-1; $i++) {
$tag = $xmlStruc[$i];
print_r($tag); echo "<p />";
}

What I really want is something like this:

site = array(
"id1" => array("name"=>"namw1","options"=>"",...),
"id2" => array(...),
etc.
);

Tree Data Structure
I'm facing an issue concerning tree data structure in php.
In others languages, I just need to create a root node which I bind
pointers of instances representing others nodes.
But I couldn't find a way to do so in php language. Indeed, object
instances are "volatile" reaching the end of the script. How could I
build a tree with "volatile" address pointers in php ?
I could use arrays to store data like a tree structure but I'd like to
find another way..

Structure Of A PHP-driven Site
I've been managing a few websites, all built around the same
architecture, for several years now, but it's time to hand them off to
someone else and I'm trying to "clean them up" before I go. It got me
to wondering how other people structure their sites, and if mine is
optimal.

For instance, all of the pages on my site are accessible from one
navigation bar with several subcategories. Each page starts by
declaring $page_title, $page_category etc, and then including a
standard headers file, with our logo/banner/database connection/etc,
and finally including a second navigation bar for whatever category
the page is in. Then you put whatever content you want on the page,
and end it by including a standard footers file.

I was considering moving all of the data like $page_title,
$page_category, and the entire menu/category structure into a separate
XML file, or an array in PHP. Then, each page would just look like
"include(headers), page content, include(footers)", and PHP would
simply lookup the page's file name in the XML table/array, and render
the appropriate navigation bars, styles, whatever. Somehow the idea
of having the entire sitemap in one XML file or array seems really
elegant to me.

Does this sound like a good idea? How do you usually structure your
pages? Is it even remotely like this? I get the sense that what I'm
doing now is a sort of a beginner's technique for building dynamic
websites.

How To Remove Directory Structure
How to remove directory structure

How can I remove an intire directory structure?

Suppose I have this:
........./data/
........./data/blockeds/
........./data/blockeds/00/
........./data/blockeds/00/001.dat
........./data/blockeds/00/002.dat
........./data/blockeds/00/003.dat
........./data/blockeds/00/004.dat
........./data/blockeds/00/005.dat
....
........./data/blockeds/01/
........./data/blockeds/01/001.dat
........./data/blockeds/01/002.dat
........./data/blockeds/01/003.dat
........./data/blockeds/01/004.dat
........./data/blockeds/01/005.dat
....

I need to remove the 'blockeds' directory and all it's directory and files.
How can I do that?


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