How To Get Oracle Table Field Definition
from SQL*Plus, i use:
DESCRIBE MyTable
and I get this result (example):
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Fetching Field Information From Oracle Db
as I am trying to write a recordset class, I am interested in fetching field information from an oracle db. Several information on the fields are very simple to request. So I already receive the field properties name, max_length, type not_null, has_default and defaul_value. This is achieved by using functions like oci_field_name(). But I am not able to request the information on if the field is primary key or marked as unique key. Is there a way to fetch the properties unique and primary key?
ORACLE Describe Table
Is it possible to execute the DESC tablename command using PHP to a Oracle DB or is that a *SQLPlus command?
Getting Field Count From A Table.
I've searched through devshed but haven't found a reference to how to query a database for the contents of a table, then count the number of fields in that table. Can someone help? Say, for instance, the call was FileName.php?table=Vendors In FileName.php, once you'd done all the happy connect stuff, $result = mysql_query("SELECT * FROM $table",$db); how would you count the fields in the result, regardless of the number of rows? I thought I could use mysql_fetch_row($result), then, with a single row selected count through the $myrow[] until they ceased to exist. Is this doable? It seems this would be fairly straightforward. Is there an easier/faster/better way? I'm still thumbing through my php/mysql tomb working on the problem but haven't found an obvious solution. Your thought are sincerely appreciated.
Get Max Value In MySQL Table Field
I have a 2-field table "pageref". The fields are: "pagerefno" - which is index and primary key, and "url". I need to find the max value in "pagerefno", so wrote the following code: $query ="SELECT max(pagerefno) FROM pageref"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); echo row[0]; But this results in a blank screen. I'd be grateful for a steer, here.
Nonexistant Field In Table
I have a script that updates some mysql tables using input from a text file. The query that's giving me trouble is this one: "UPDATE $table SET `$f` = '$v' WHERE id = '$new_id'" where $f is the name of the field and $v is the value. The problem is, some of the information in the file is outdated, so some fields don't exist anymore. If I try to run the update with a field that doesn't exist, the script halts and I get an error. Is there any way to have the script ignore this and just keep going?
How To Get A Field In The Last Row Of Mysql Table.
There is a certain field that I wish to get in the last row (it will always be in the last row, even if I add to the table) of my mysql table. How do I output this? I assumed that I would be using a LIMIT command and a DESCRIBE command, however I looked at mysql.com and couldn't find anything .
Set Variable Name Use Field Name From Table
I have a query string that sets the value of Variables below: if ($DB == "Departments") { $tracking_id = $data22['tracking_id']; $dept_name = $data22['dept_name'];} simple and straight forward. Now I would like to set a loop that would set the variable name and value based on the field names in the table queried. if ($DB == "Departments") { $querystring = "Select * from ".$DB; $result=mysql_query($querystring); while(($field = mysql_fetch_field($result))) { $field->name = $data22[$field->name];}} can I set the variable name using the $field->name if so how? I have tried this code with no luck and no luck searching. This is a small example. I have queries with fifteen plus fields. This would also remove the need to modify this code if a field needs to be added to the table. And yes I have had to add fields to the tables.
Select From Table Where Field = String
How to select all lines containg a string (located in $pastmove) in the moves column. I tried several ways, for example: $requete="SELECT moves, opening_id FROM suitemove where moves like '%".$pastmove."%'"; but did not succeed;
Syntax For MIN And MAX Values Of A Field In A Table
I wish to assign a variable name to the MIN and MAX values of a field in a table. The type is int(7). I am extracting the field with many others with the following code from a php call. $ml_collect='SELECT * FROM ml_lopp LEFT JOIN scfmforening ON (scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ml_newtidplats ON (ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY date1, ml_lopp.loppnum' $ml_upg=mysql_query($ml_collect); mysql_close(); The field is contained within the table ml_lopp and it is called loppnum I have been trying combinations of this to extract the min and max of the field from the $ml_upg variable which includes all of the data to be processed. $lownum=mysql_result($ml_upg,MIN('loppnum')); $hghnum=mysql_result($ml_upg,MAX('loppnum'));; Which does not work.
Pulling Data From The Last Field Of A Table
What is the command to view the last result in a table using a DB query? Table Example TABLE PEOPLE >ID >NAME >POINTS one thing, it cant be ORDER BY id DESC If at all possible it has to be SELECT * FROM people WHERE name=jon && id=**last id** **last id** = Last id where the name jon was found.
Displaying Table Field List
I got a function that displays a list of the fields in a certain mysql table. I got it off of this site. The problem is that it only displays the word Array and I'm not sure why. This is the code for the function: Code:
Iinsert The Auto_increment Field Into Another Table?
I have 2 tables ('customer' and 'regcustomer') and 1 form. The user fills in the form with all their details and the script should insert their credentials into the 'customer' table, which has an auto_increment field for the 'customerid'. I then want the script to take the 'username' and 'password' specified in the form, AND the 'customerid' generated in the 'customer' table and insert it into the 'regcustomer' table. The credentials are inserting successfully into the 'customer' table and the 'customerid' is automatically being generated there. I just can't get the generated 'customerid' to insert into the 'regcustomer' table. Here's the code that's generating the error: $query1 = "SELECT last_insert_id(customerid) FROM customer"; $result1 = mysql_query($query1); //echo $result1; $row = mysql_fetch_array($result1); $result2 = $row['customerid']; $datapoint = mysql_result($result2, 0, customerid); $result3 = "INSERT INTO regcustomer (username, password, $datapoint) VALUES ('$_POST[username]','$_POST[password]','$_POST[customerid]')"; The error message i'm getting is: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in....in line 25 Line 25 is the [$datapoint = mysql_result($result2, 0, customerid);] line. I think it doesn't like the '0' argument here as it's turned to red in my editor!
Table Display Grouped By Specific Field
I operate a youth sports website and i display my current alignments in a long running list of teams (one field within my table) with association divisions (another field within table). I would like to group them by divisions, like a two column table for better clarification.
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.
Inserting Data Into A Table With Auto Increment In One Field
i have a table with several fileds in and with the first one being an auto increment field. I want to know what my SQL query should be when inserting data. Here's my current one: Code: $SQL = mysql_query("INSERT INTO $usertable2 VALUES('$subject', '$newstext', '$date', '$usrname')"; The auto increment field is the first in the table and is called 'postid'. can someone give me the correct query please? also do i need the first entry in the table to be a blank one with just the postid entered at one?
RFC Definition Syntax
Can anyone tell me where the RFC definition syntax is documented? I am referring to such things as the use of <...>, [...], 1*, etc. I find this sort of thing in the RFC's for POP3, MIME, etc.
Require Variable Definition
is it possible to require variables in PHP to be defined by the author? I'm used to this from C, and like this "strict" behavior, as otherwise very easily typos in variable names can lead to bugs... Basically, I'm looking for the PHP equivalent of VBA's "Option Explicit".
Any Way To Force Implict Variable Definition Etc?
A lot of languages you can force implict variable definition, where you must declare your variables at the top of the function/code before it's used. This way you create less bugs using the wrong variable name, which may not crop up until later on....
Dictionary Search Definition Replace Of Text
I'm trying to search a weather report for matches to the keys in my associative dictionary array and replace them with the $term => $definition. following is my code. again, any advise appreciated. REF: full php source PHP Code:
Save Date To Table Field Date Type
I have a calendar picker on a form that fills a text box with XX/XX/XXXX date format. If I run a insert statement the date field in the database shows 0000-00-00. If i change the field type to varchar the correct format displays. What is the correct way to save a date to a mysql database? Furthermore to query on the date how about a select * from db_name where servicedate >= $startdate and servicedate >= $enddate I supose this will not work Any pointers?
Can A Field Communicate To A Server And Return Information To Another Field Without Retrieving The Whole Html Code Again?
I´ve got a sql table which has 3 fields. Their relation to each other is like this example. | CARS | YEAR | PRICE | ford 2000 ford 2001 ford 2003 volkswagen 1999 volkswagen 2000 I am developing an ASP web page that modifies a specific registry. So, it loads the information to some fields, but the user will be able to change only the "PRICE" field. I have to create two selects, one for "CARS" and other for "YEAR". But the "YEAR" field will only contain the correspondent years for each car the user selects. Example: selecting "ford" in the "CARS" <select> box, only the years "2000", "2001", "2003" would be automatically loaded in the "YEAR" <selec> box. How could i implement it?
How To Update A Table's Field With Another Tables Field?
I need to take the state field from dt_profile table and update the dt_matchfinder with this state making sure the member_id field matches. the problem is the dt_matchfinder table has null set for many of the state field but in the dt_profile each member ID has a specific state and I need the same to be true in the dt_matchfinder table.
Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?
Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for. Can anyone help me get the Agreed? table's background color to the colors above? Code:
Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field. I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?
Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table is to fields on is ID and the other is critiera. Now I want to filter out all the one that don't apple to the list and move the one that match to a different database. I know how to open a connection, close, select but I don't know how I would inside of a database use another one as the way to create the list of critieras....
Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias' the mysql_fetch_field function returns a value $result=>table which will contain the alias, not the actual table name. Is there a way to get the actual table name ? I am running mysql 4.1 and php 4.4
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.
Php And Oracle
What would be the best way to EXPORT data from Oracle to an internet php application? Some guys though it would be good to use XML, but im not sure.
Php And Oracle
hi. is there any package to work with php and oracle as like xampp, phptriad?
Oracle/php
Can anyone refer a site with tutorials for using Oracle with PHP?
PDO And Oracle
Anyone have any recent experience in using the PDO functions with oracle? Early users have complained that it was buggy, but I was wondering if this is still an issue with oracle or not.
PHP + Oracle = ?
I was wondering if PHP works fine with an Oracle db or do I have to use mysql/postgre ? If it does, where can I find documentation/guides about it?
PHP & Oracle
I just got a VM box. 2.6.9-22.ELsmp, Oracle 10gr2_client This works: # sqlplus user/pw@machine connects right up. But this doesn't: putenv ("ORACLE_PATH=/opt/oracle/10gr2_client/bin"); putenv ("ORACLE_HOME=/opt/oracle/10gr2_client"); putenv ("PATH=$PATH;/opt/oracle/10gr2_client/bin"); $conn = ora_logon ("user@machine", "passwd"); $cur = ora_open($conn); Gives: PHP Fatal error: Call to undefined function: ora_logon() in /var/www/html/tst.php I've been searching the web - nothing, well nothing that fits my case. On the old machine oci8 was in /etc/php.ini. phpinfo says oci8 is supported. /etc/php.d doesn't have a oci8.ini and web searching doesn't return anything (that exists). So what am I missing? doing wrong?
PHP And Oracle
Just a query about the use of Oracle with PHP. I see PHP has a list of functions built in to deal with Oracle and I was wondering if anybody out there had used this combination of technologies and what their experience with them was? Obviously MySQL and PHP work together well, but as we all know if you get up to 300 concurrent users (which is a hell of a lot) you need something a little stronger. Options I see are Oracle and Sybase (MS is never an option for me, no matter what ).
Oracle With Php
this is not working Code: $test=཈-03-2007' insert into DBtest(startdate,customerid) values('TO_DATE('$test','DD-MM-YYYY'),123); i need to insert to this data to oracle database.
Oracle TAF And Php
Just wondering if anyone has got Transparent Application Failover to work with PHP. I've compiled the php using --with-oci8-instant-client and the TNS_NAMES environment variable is has been set to the path of my tnsnames.ora. I've also installed sqlplus. This works as I am able to connect using names given in the tnsnames.ora file. Using sqlplus I connect and do a SELECT host_name from v$instance; this returns node1 i then shutdown the database on node 1 from a remote host and execute the query the result is now node2 I'm also able to shutdown the dbmid query and the correct result is returned. This is all handled by OCI8 When i try to replicate this in php I get an end of communication channel which is correct really, but Oracle TAF should handle this for me. As it does in SQL plus is this correct ?
Oracle
I have SuSE 9.1, Apache2 and PHP installed. I want to use it against an existing Oracle database on the same server, but when SuSE installs PHP, it is only with mysql support. I am reading that I need to recomplile PHP with "--with-oci8" option. SuSE does not have the PHP source on their website, just the binaries. Does this mean that I have to wipe clean my PHP and Apache install, download the source, and recompile it? I am not an advanced Linux user so this sounds daunting to me. Is there another way around it? I was reading that I might just be able to put a line for Oracle similar to "extension=mysql.so" in my /etc/php.ini file. Of course I would need the Oracle .so from somewhere.
PHP & Oracle DB
I'm an italian programmer and i have a very big problem: i must connect to Oracle DB. The error log is: Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /var/www/phpnuke/html/modules/FAQ/index.php on line 266 Code:
|