[PHP-DB] Search Query
Dear all, i need help with my search query statement.. what is wrong with my code? $word = split(" ", $keyword); $num_words = count($word); $word_str = ""; $criteria = ""; for ($i=0; $i<$num_words; $i++) { if ($i) $word_str .= "and colName like '%".$word[$i]."%' "; else $word_str .= "colName like '%".$word[$i]."%' "; } $word_str .= "and col2 = '$foo' "; $criteria .= "$word_str "; $table .= "db_table"; $query = "select * from ".$table." where ".$criteria; when i try to echo $query, i get --- select * from where and so of course MySQL gives me an error 1064 near ' where ' what happened? thanx thanx! hwee
Re: [PHP-DB] Retrieve data and column names from a table
On Wed, Dec 17, 2003 at 07:43:50PM -, Shaun wrote: > I need to retrieve the data and column names from a single row in a table, > i.e. 'SELECT * FROM Table WHERE Field_ID = 1' Maybe something like this: $result = mysql_query ("SELECT * FROM Table LIMIT 1",$db); $my_row = mysql_fetch_array ($result, MYSQL_ASSOC); foreach ( $my_row as $key => $value ) { echo "$key: $value"; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Retrieve data and column names from a table
Hi, I need to retrieve the data and column names from a single row in a table, i.e. 'SELECT * FROM Table WHERE Field_ID = 1' How can I get PHP to show the data and the column names? With reference to my earlier post and the replies I can't use DESCRIBE in conjunction with SELECT and I don't want to use a deprecated PHP function... Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] List-Unsubscribe
__ This communication is intended for the use of the recipient to whom it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communications received in error, or subsequent reply, should be deleted or destroyed. --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Get Names of columns of a table
From: <[EMAIL PROTECTED]> > > is there a PHP function that wil return the names of the columns for a > > given table? > http://www.php.net/mysq_list_fields Note: The function mysql_list_fields() is deprecated. It is preferable to use mysql_query() to issue a SQL SHOW COLUMNS FROM table [LIKE 'name'] Statement instead. Even if you're not using MySQL, the database should have a SHOW query or an equivilent. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating temp tables in MSSQL
Thanks for your response Frank, but this is still driving me nuts and making me look like a moron at the same time (-: This simplified query: $query = "SELECT distinct convert(varchar(36),a.traineeID) INTO #tempdata1"; $query .=" FROM tblSignIn_trainee a"; $queryresult = MSSQL_QUERY($query,$cn) or die ("Error in query: $query. " .mssql_get_last_message()); does not work. The databases connection which I am using connects with db_datareader rights to SQL Server - from what I understand no special rights are needed to create a temporary table. Using mssql_get_last_message() gives me the message:Changed database context to 'thedatabasenameisprintedhere'. What the heck is going on here? Frank M. Kromann wrote: Hi, Any table that starts with # is a temp table. You can use create table #mytemp (...) or you should be able to use the query you suggest. You just have to make sure you have enough space in tempdb (a system database) - Frank Hi all, I've been handed a query which I'm trying to get to work. I'm using PHP to talk to MSSQL 7. My question is this: Can I create temp tables with mssql without executing the code in a stored procedure? The simplified version of the query is as follows: $query = "SELECT distinct convert(varchar(36),traineeID)"; $query.=" INTO #tempdata1"; $query.=" FROMtblSignIn_trainee a"; Later on I could make a stored procedure, but at the moment I would like to just work with the query directly in the code if at all possible. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating temp tables in MSSQL
Hi Frank. When does this table get deleted? when the DB connection closes or does one have to run a process to clear the temp tables? Thanks, Matt On Tue, 2003-12-16 at 17:29, Frank M. Kromann wrote: Hi, Any table that starts with # is a temp table. You can use create table #mytemp (...) or you should be able to use the query you suggest. You just have to make sure you have enough space in tempdb (a system database) - Frank > Hi all, > > I've been handed a query which I'm trying to get to work. I'm using PHP > to talk to MSSQL 7. > > My question is this: Can I create temp tables with mssql without > executing the code in a stored procedure? > > The simplified version of the query is as follows: > $query = "SELECT distinct convert(varchar(36),traineeID)"; > $query.=" INTO #tempdata1"; > $query.=" FROMtblSignIn_trainee a"; > > > Later on I could make a stored procedure, but at the moment I would like > to just work with the query directly in the code if at all possible. > > Thanks, > John > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Matthew Vos Systems Analyst Product Development Techcom Software Solutions Inc. 416.398.5764 [EMAIL PROTECTED] * * * * * * * * * * This message contains information from Techcom Software Solutions Inc. which is confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify [EMAIL PROTECTED]. This message and any attachments have been scanned for viruses. This message has been digitally signed to ensure authenticity. Key ID: CFEA28EC Fingerprint: 009F E13D 0450 55AF DC1C 4D77 1FE9 0DBB CFEA 28EC signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] Get Names of columns of a table
> is there a PHP function that wil return the names of the columns for a given > table? You need to use an SQL function called DESCRIBE http://www.mysql.com/doc/en/DESCRIBE.html HTH -- Mike Karthauser Managing Director - Brightstorm Ltd Email >> [EMAIL PROTECTED] Web >> http://www.brightstorm.co.uk Tel >> 0117 9426653 (office) 07939 252144 (mobile) Snailmail >> Unit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Get Names of columns of a table
http://www.php.net/mysq_list_fields hth Jeff "Shaun" <[EMAIL PROTECTED]To: [EMAIL PROTECTED] .com>cc: Subject: [PHP-DB] Get Names of columns of a table 12/17/2003 08:30 AM Hi, is there a PHP function that wil return the names of the columns for a given table? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Get Names of columns of a table
Hi, is there a PHP function that wil return the names of the columns for a given table? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php mail() question
--- Actually I start a PHP script from the cron task that runs every 5 minutes using PHP CGI executable version. I just process upto 100 bounced messages per run avoid hogging the database server and blocking the POP3 mailbox for a long time, as this is not a prioritary task. --- Right, how do you get the address from the bounced email into the query? I know how to run a cronjob to update the database, I use 1 cronjob for the site currently that does all the tasks regarding accounts. Ran every 5 minutes to do updates, send emails etc. I guess I could run a cronjob to go into a temp table to log all the email contents than fetch the address back and flag the account. But thought I'd ask you how you get the bounced email to be ran in the query with the script? I am guessing some modifications need to be doen. This will be the last time I email regarding this matter to this list. So no answer is fine, I'll just run the long way about it. But thought you could, or someone, of pointed me in the right direction. But obviously your skipping my main question for some reason. Anways thanks for the help to date. Thanks in advance for any replies you give me also if you wish to reply. Jerry http://personals.yahoo.com.au - Yahoo! Personals New people, new possibilities. FREE for a limited time. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ...request synchronization error...
Hi , Does anyone know what could be the reason for an 'request synchronization error' ? It occurs after calling ibase_fetch_assoc(). The same thing going on with ibase_fetch_object() and ibase_fetch_row(). The resultset is being delivered correctly by ibase_query(). The SQL-String (SELECT) returns the one row i've expected when executing it inside IBConsole. I've written a class containing all database functions, e.g. 'db_fetchassoc()'. Now, the strange thing about this is: -Calling the ibase functions directly works fine and returns the expected row ( same as IBConsole). -Calling the ibase functions from another script, that includes my database functions(class), results in the error mentioned above. MY SCRIPT -- ... include('databasefunctions.php'); ... $database=new database; $sql='SELECT ID,NAME,SIZE'; $database->db_query($sql); // equals ibase_query($sql) $databaserow=$database->db_fetchassoc(); <- At this line I get the error !!! ... echo $databaserow[...] ... -- And this is how the function inside the class looks like : function db_fetchassoc() { ... // ibase_fetch_row() or // ibase_fetch_object() or $resultset=ibase_fetch_assoc(); return $resultset; } Does anyone know how to solve this problem ? Please help me ! P.S.: Let me know if further information is needed. DiZEM -- +++ GMX - die erste Adresse für Mail, Message, More +++ Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] method question
> I am looking to create a "comp-time" calculator of sorts using > PHP/MySQL. I am still in the learning process of how all of this > works. I want to be able to create a web interface where my employee > can login and enter her comp-time as she works extra. I also want to be > able to have an admin side where I can subtract her comp-time as she > takes it and keep a running total of her remaining time. My question is > - do you do the math in PHP or do you do it in MySQL. I am new to this > type of logic so any input would be helpful. I am sure that there is a > script like this that already exists but I want to try this one myself > for the learning factor. > thanks, > DF > > -- You can do the maths with either, although I find PHP easier. The thing to bear in mind is that MySQL saves the data so you can call it up again in other queries. Data in PHP, on the other hand, is gone as soon as you leave the page or end the session. So, it is important to design a programme that leaves the data you want to save in MySQL. With that in mind, it is normally easy to see where the maths should be done. Good luck, Jeffrey Baumgartner www.ungodly.com more fun than a visit to the dentist (almost) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hello
Welcome Rodrigo! Start checking php.net for object/clasess check out this mirror site of php.net http://php.oregonstate.edu/manual/en/ref.classobj.php By the way I don't know if we have from Brazil here... M. Mamedov - Original Message - From: "Rodrigo Kochenburger" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 16, 2003 10:33 PM Subject: [PHP-DB] Hello > Hi everybody, > i'm new in this list, so let me introduce my self. > My name is Rodrigo and i'm from brazil, so sorry if my english isnt > correct. > > let me know know if there's anothers brazilians here. > > And i'd like to starting using this to ask about some tutorial or > something like that to help me with Software Architecture in PHP using > Oriented Object Programming. > > Thanks a Lot. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php