Re: [PHP-DB] multiple queries in the same "request"
Gabriel B. wrote: You can't send multiple queries in an SQL statement. You can just split that in two separates queries. It's not really slower by any I'm not really concerned about performance. i'm *really* concerned about race conditions. I have more than 3mi hits per day. the chance that two pairs of queries will run consecutively is imense. Then you need to use transactions, which fill your purpose :) I presume you're using MySQL or Postgres, google for START TRANSACTION and COMMIT. -- Bruno Ferreira
Re: [PHP-DB] multiple queries in the same "request"
Gabriel B. wrote: SELECT (@category_id:=id) FROM categories WHERE description = "cat1"; REPLACE INTO data VALUES( 10, @category_id); i send this as a single query in PHP and it returns an error quoting everything after the first ";" anyidea if i can't send several queries at once? any workaround? You can't send multiple queries in an SQL statement. You can just split that in two separates queries. It's not really slower by any practical means because the DB system would have to execute them both anyway. -- Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Issue with date() function...
Chase wrote: I have a variable: $rec2day = date("Y-m-d"); that displays correctly when echoed to the screen, but when I write it to my DB, I get the mathmatical answer to the equasion (1989 (2005-06-10)). What do I need to do to correct this?? Just use $rec2day= date("Y/m/d"); You database system doesn't like using "-" as a separator in dates, thus thinking it's a minus sign and doing the appropriate math. Just use slashes and you'll probably be OK. -- Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Ora 10g, PHP 4 and Apache 2
[EMAIL PROTECTED] wrote: Now, the script may be a bit off since I was not using my oracle classes and was just writing straight OCI functions, but still this fails at the connection level. Though I've never used Oracle myself, I've read in the manual that the old Oracle extension is deprecated, and that php_oci8.dll (or .so, in your case) should be used. See http://www.php.net/manual/en/ref.oracle.php, that's were I looked. -- Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
Miguel Guirao wrote: First, I do not have that line in my php.ini file. In what section should I add it? Anywhere, but best place as long as organization is concerned would be under the "Dynamic extensions" label. Bruno Ferreira PS - You should check the default php.ini that comes with your PHP distribution and customize from there. --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
Miguel Guirao wrote: I'm receiving this error: Fatal error: Call to undefined function: mssql_connect() in e:\inetpub\wwwroot\sitio\TMP5w3gxy2pnf.php on line 9 This is line 9:if (!( $con = mssql_connect($maquina, $usuario, $password))) $maquina = "SERVIDOR"; $usuario = "sa"; $password = ""; $BDnombre = "ProyectoRMA"; So, basically, any ideas of the source of this error? Probably the mssql extension isn't loaded. Open the php.ini file and see that the line reading "extension=php_mssql.dll" isn't commented out. Things should go back to normal. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date and time problem
Kim Jacobs - MWEB wrote: I have a script which pulls a date(date default NULL) and a time (time default NULL) from a MySQL database, now I would like to display that date and time in a 'pretty' format. I've been able to show the date nicely with the help of this: $ntime=strtotime($row['date'] $row['time']); $ndate=date('D d F Y H:i',$ntime); This shows the date in a 'nice' format (2004-05-10 20:40:00 is shown as Mon 10 May 2004 00:00), however, it shows the time as 00:00 for all of the games no matter what the time is. How do I get it to show the date as 20:40 or 20h40 or 8:40 PM? If I change the lines to this: $ntime=strtotime("$row[date] $row[time] GMT"); $ndate=date('D d F Y H:i',$ntime); the only difference is that it now shows Mon 10 May 2004 02:00 (probably because we are 2 hours ahead of GMT) Any ideas please? Thanks K Well, a solution could easily be arranged to use both fields, but really, the best thing to do is to just use a DATETIME field in MySQL instead of using both DATE and TIME fields. That will save you a lot of headaches now and in the future. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
Alex Gemmell wrote: Yep - I could do that... Or I could use this: http://www.cynergi.net/exportsql/ I haven't tried "exportsql" yet, it probably will fall over or be a nightmare to get going knowing my current run of luck! Let's all put our hands together and pray that it works (and for world peace or something). Alex |:| Reply-to: [EMAIL PROTECTED] |:| May I suggest you look at the Firebird DBMS as well? Doesn't require drivers and is self-contained. Check it out at http://firebird.sourceforge.net/ The latest versions of PHP have a built-in extension for it, so it should be relatively smooth sailing, as long as you don't have much trouble converting the DB. For the task of converting the database, I suggest you write a script that you will run on your local machine, which reads all the records in the Access db and then inserts them in the Firebird db (SELECT from one side, INSERT into the other). Should be pretty painless to do this every once in a while. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] looking for a variable
Robbie Staufer wrote: Hi, In a statement like: $result = mysql_query ("SELECT * FROM testdb WHERE Code_Name IN ('CLM', 'CAM', 'CSIM', 'cpl5', 'POP')",$connection) is there a php variable that holds the number of elements in the () after IN? No :\ What did you want to do with that number? Maybe there is some other way around Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Image / file uploader
Craig Hoffman wrote: Sorry to be a pest but I tried that. It giving me the same error. __ Change to double quotes for the HTML portion. action=\"$_SERVER['PHP_SELF']\" You'll find that the ultimate correct form is echo "etcetc action=\"$_SERVER[PHP_SELF]\" etcetc"; When you're using an associative array inside a string, you don't need to put quotes refer to its textual index. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple work mySql database search.
Martin E. Koss wrote: I have a product database which can be searched for a keyword in up to 3 fields; using this select query: $sql_select = "SELECT * from productlist WHERE (Name LIKE '%$SearchText%') OR (Description LIKE '%$SearchText%') OR (Keywords LIKE '%$SearchText%') ORDER BY Name"; What I really want to achieve is if someone enters more than one work in the search for, how can I get the select query to search for one, the other, or both? WHERE (field LIKE '%word1%' OR field LIKE '%word2%' [etc etc]) I've thought of putting an option on the search for the user to select 'All Words' or 'Any Word' so that the select query could deal with the search based on the full phrase they entered or any of the words. My problem is how to build the query. Join them either with ANDs or ORs like this: Searching for all words in a field: WHERE (field LIKE '%something% AND field LIKE '%other_thing') Searching for any of the words in a field: [read above in the previous question] Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using a define value
J. Alejandro Ceballos Z. wrote: [snip...] But while trying to be called based on parameter, is not possible to call them via: $myerror = "ERROR1"; That would be $myerror= ERROR1; echo "ERROR"._$myerror.""; ... and that would be echo "".ERROR."._$myerror.""; It not works. Does now ;) Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql multi-row insert limitations?
Tom Reed wrote: I have a lost of 25,000 unique words and I'd like to insert them into my database. Does anyone know if there is a limit to the number of rows you can insert in one statement? example insert: INSERT INTO table (word) VALUES ('tree'),('book'), 'apple') --> Enter's three rows in the database? The limit is probably set somewhere else, like the size of the string that you can pass to mysql_query() or something similar. Even then, why don't you just split the records in blocks of X and insert them one block at a time? Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] get rid of the HTML tags
Bruno Braga wrote: Is there any function that retrieves only the string without the html tags?! --> Hello world this is a test link with a image strip_tags() --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Large Arrays in a batch procedure
antonio bernabei wrote: The work is to apply a formula to some fields of each record and update another field of the same table. If this is the case, why don't you simple use an UPDATE query? Example: [ UPDATE table SET some_field= 100*0.1/other_field+yet_another_field ] No PHP involved here, you just use some SQL interface to your server... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Arrays
Martin Oettinger wrote: Does anyone know up to which level arrays in variables are possible? Is there a limit? $foo[1][2][3][4][5][6] ... ? I feel the right answer is "why do you ask"? It's either some very complex thing you're doing there, or you're doing it the wrong way :) Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] v4.2.3 compliant sybase_set_message_handler
Nils Kehrein wrote: [snip] php_sybase_ct.c:1729: structure has no member named `callback_name' php_sybase_ct.c:1730: structure has no member named `callback_name' [snip] What have i done wrong? Thanks for reading this message :-) Well, you didn't do anything wrong, but just pasting the function doesn't seem to work because some other data definition is missing/outdated as well. Look in those lines in the php_sybase_ct.c file and see what structure it's talking about. Then you have to search for the recent version of the file where it is defined and copy-paste that as well into your PHP 4.2 sources. Anyway, I should mention that you're treading on very thin ground there... there's a lot that can go wrong :) Bruno Ferreira PS - I am not a PHP-source programmer, so someone here might have better advice than mine. --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] An if-statement in a "while(list("
Henning Olsen wrote: I have a search on my page, which presents all the adresses one after all. I would like to present a graphic icon representing the mailaddress, but only when ther IS a mailaddress. Not everyone has a mail address. But I cant put an if-statement in the "while(list(..." Any suggestione to me on showing a graphic with a link when $mail is different from null? Build the inside of your loop like this... print("$navn "); if ( $mail!='' ) then [print the icon here] else echo "$mail"; Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Processing a fetched external page
Donovan Hutchinson wrote: I'm working on a project that takes the content of a URL and does stuff with the content. I've managed to extract the target url's html, and am using str_replace to fix links, stylesheets etc. However, i'm stumped when it comes to processing the text content. Would anyone know how to isolate displayed text (anything in the body, paragraph text, headings etc) and then manipulate this text on a word by word basis? Sure... use strip_tags()/fgetss() and then some regexps (preg_replace()) to clear up any remaining cruft. If you want, I can post you my own brute-force "get all text from a webpage" script :) Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OK, ahí voy...
Felipe Eduardo Ortiz López wrote: My first question: Has PHP some editor or IDE kinda HTML has? I'll be clear: for instance i can work with FrontPage, or text edito to generate the HTML files, it does exist something similar for PHP? Look, I'll be straight and blunt here... If you're asking that question, then you haven't understood what PHP is. PHP is a programming language that _creates_ documents, it's not a document itself. I suggest that you look up some basic tutorials on the web first and then come back when you have gathered some orientation as to what you'll do next. Spamming the same questions to several lists doesn't help the matter, either. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySql query
Matt Matijevich wrote: This is probably a question for for a mysql list but I figured someone out here knows the answer. [snip] SELECT * FROM sometable WHERE 1 SELECT * FROM sometable Just that :) (do I hear you slapping your forehead? :) Bruno Ferreira. --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server Query Failed
david wrote: Hello there! I have just about driven myself crazy with an odd intermittent problem. [snip] I'd first start by turning on all logging I could in the SQL server so that I could see what's happening straight from the horse's mouth... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to redirect after a valid login
Larry Sandwick wrote: Here is the error I get when I use the include below: include "MainMenu.php"; Fatal error: Cannot redeclare class db in /tmp/disk/home/webmaster/Files/WWW/pearDB/DB.php on line 211 // Larry Seems that MainMenu.php (or a file included by it) re-includes the DB.php file. Look into that, and replace require() and include() with require_once() and include_once() to avoid this kind of conflict. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sending a hashed password on mysql_connect
Andre Matos wrote: Is it possible to send a already hashed password on mysql_connect? Usually when I use mysql_connect (host, user, password), for example mysql_connect("myhostaddres", "userabc", "12345"), I use a text password. I tried to hash a password and then sent it but my connection failed. Is this possible? Any Ideas? You don't really need to have an encrypted connection to MySQL unless your webserver and MySQL server are on different machines *and* those machines are not behind the same switch/firewall/router/etc. Otherwise, I guess you could create an IPSec (or maybe an SSH) tunnel to the other machine and redirect it to a local port. As far as I can tell, there's no way to create a secure MySQL connection via PHP... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Sort Order Description
[EMAIL PROTECTED] wrote: [snip...] The following is at the beginning of the script: # get sort order (if any) passed to script $sort_field = $_REQUEST['sort_field']; if (! $sort_field) {$sort_field = "(ssa1202.total/vapall.vapall)*100";} $sort_order = $_REQUEST['sort_order']; if (! $sort_order) {$sort_order = "desc";} First things first. That code (it seems to me) is vulnerable to SQL injection. Better fix that first... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC support
Galbreath, Mark A wrote: Yes, I'm a newbie to PHP, but I got a phpBB2 BBS online in a day and I'm psyched. My problem is, the PHP docs and API mention that ODBC is built into PHP 4.x but I can't figure out how to use it. I would like to access the M$ Access JET engine directly from a PHP page. Any clues? tia, Mark ODBC function reference is present at http://pt.php.net/manual/en/ref.odbc.php (you can choose a closer mirror if you want). Scroll down to the bottom of the page to look at the functions list and some immediate examples. Re-post if you need further information. Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php