Re: Re: [PHP-DB] Store more than 1 piece of information in a single variable
El mensaje ha llegado correctamente pero... estoy de vacaciones hasta el próximo 20 de Agosto. Atenderé tu correo a la vuelta. Si por el motivo que fuere necesitas ponerte en contacto con ADIMEDIA puedes hacerlo en [EMAIL PROTECTED] o en el Telf. 934 63 57 37. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Store more than 1 piece of information in a single variable
> First.. You're using mysql_fetch_array when you wanted > mysql_fetch_assoc.. .. select user_id from whatever .. and then $row = > mysql_fetch_array($res) .. youd have a $row[0].. mysql_fetch_assoc > would allow $row['user_id'] mysql_fetch_array($res) will fetch both associative and numerical indexes, so it will have $row[0] and $row['user_id'] in it. It has an optional second parameter to indicate associative, numerical or both, defaulting to both. mysql_fetch_row only fetches numerically indexed arrays -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Store more than 1 piece of information in a single variable
(see below) -Original Message- From: Arena Servers [mailto:[EMAIL PROTECTED] Sent: Friday, August 03, 2007 10:44 AM To: php-db@lists.php.net Subject: [PHP-DB] Store more than 1 piece of information in a single variable ok, firstly here's my script... Now, the script's task is to select loginnames from one database1, compare them to database2, select the user_id associated with the loginnames in database2 and send a private message to each of those loginnames. Just now, the script selects only the last loginname from database1 and then sends a private message to that 1 person. I need it to select all the loginnames which currently there are 25. So what do I need to change for this to work? Thanks in advance. Paul Arena Servers - Web Hosting http://www.arenasmithster.co.uk -End Original Message- Comments are in original message. I hope at least some of them help. -- N/A -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Store more than 1 piece of information in a single variable
First.. You're using mysql_fetch_array when you wanted mysql_fetch_assoc.. .. select user_id from whatever .. and then $row = mysql_fetch_array($res) .. youd have a $row[0].. mysql_fetch_assoc would allow $row['user_id'] Secondly.. You can use one query to select all the info.. select e107.user_id FROM db2.e107_user as e107 left join db1.clanmembers as clan on e107.user_loginname = clan.user_loginname You'll still want to mysql_select_db($db2) for your insert query Thirdly.. I'd change the insert query to: $user_id = mysql_real_escape_string($user_id); $query = "INSERT INTO e107_private_msg VALUES (NULL, '1', '$user_id', NOW(), '0', 'Clan War 2', 'Clan War Arranged', '0', '0', '', '+rr+', '0')"; mysql_query($query) or die('Query 3 failed. ' . mysql_error()); Where the entire query is surrounded by double quotes, so you dont have to back slash singles.. $user_id is escaped, so its safe.. using mysql's NOW() function instead of php's time().. On 8/3/07, Arena Servers <[EMAIL PROTECTED]> wrote: > mysql_select_db($db_name2); > > $query = "SELECT user_id FROM `e107_user` WHERE `user_loginname` = > '$user_loginname'"; > > $result = mysql_query($query) or die('Query 2 failed. ' . mysql_error()); > > while ($row = mysql_fetch_array($result)){ > > $user_id = ($row['user_id']); > > $query = 'INSERT INTO e107_private_msg VALUES (NULL, \'1\', \''.$user_id.'\', > \''.$time.'\', \'0\', \'Clan War 2\', \'Clan War Arranged\', \'0\', \'0\', > \'\', \'+rr+\', \'0\');'; > > $result = mysql_query($query) or die('Query 3 failed. ' . mysql_error()); > > } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Store more than 1 piece of information in a single variable
ok, firstly here's my script... Now, the script's task is to select loginnames from one database1, compare them to database2, select the user_id associated with the loginnames in database2 and send a private message to each of those loginnames. Just now, the script selects only the last loginname from database1 and then sends a private message to that 1 person. I need it to select all the loginnames which currently there are 25. So what do I need to change for this to work? Thanks in advance. Paul Arena Servers - Web Hosting http://www.arenasmithster.co.uk
Re: [PHP-DB] Store $_SESSION in MySQL table
[EMAIL PROTECTED] wrote: Greetings all. While trying to create a session-based advertising model that does not rely on the existence of cookies, I ran into trouble: I can't figure out how to place the entire $_SESSION array into a MySQL table row, then retrieve it and use the information from one page to the next. The best that I can do is copy the PHPSESSID into a MySQL row, then dissect the $_SESSION array so that each of its parts can be stored in a separate row of the same record. Then, with the $_GET variable, I am able to get the MySQL_last_id and retreive the information from the correct field, and it works across pages. The only problem is this: should the $_SESSION array grow with more data--say, adding a first name variable, and a time-of-day varaible--then I need to update the MySQL table whenever I do this. Not a big deal, I know, but I'm frustrated with this. One more thing: one of the variables in the $_SESSION array is an url, so it screws up the mysql insert, even when I use serialize. Thanks for any help you can give. --V .oO "Advertising? ack! - Should I help him or not? :P" serialize() and base64encode() are your friend. You can even create a class to store this information, if you wanted - so long as you have the class include()'d before you unserialize the object. In all likelihood, however, you'll prefer just the straight $_SESSION. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Store $_SESSION in MySQL table
serialize the array before insertion and unserliaze it when you retreive it from the db bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net (PHP) Subject: [PHP-DB] Store $_SESSION in MySQL table Date: Fri, 11 Feb 2005 17:25:34 + Greetings all. While trying to create a session-based advertising model that does not rely on the existence of cookies, I ran into trouble: I can't figure out how to place the entire $_SESSION array into a MySQL table row, then retrieve it and use the information from one page to the next. The best that I can do is copy the PHPSESSID into a MySQL row, then dissect the $_SESSION array so that each of its parts can be stored in a separate row of the same record. Then, with the $_GET variable, I am able to get the MySQL_last_id and retreive the information from the correct field, and it works across pages. The only problem is this: should the $_SESSION array grow with more data--say, adding a first name variable, and a time-of-day varaible--then I need to update the MySQL table whenever I do this. Not a big deal, I know, but I'm frustrated with this. One more thing: one of the variables in the $_SESSION array is an url, so it screws up the mysql insert, even when I use serialize. Thanks for any help you can give. --V -- 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] Store $_SESSION in MySQL table
Greetings all. While trying to create a session-based advertising model that does not rely on the existence of cookies, I ran into trouble: I can't figure out how to place the entire $_SESSION array into a MySQL table row, then retrieve it and use the information from one page to the next. The best that I can do is copy the PHPSESSID into a MySQL row, then dissect the $_SESSION array so that each of its parts can be stored in a separate row of the same record. Then, with the $_GET variable, I am able to get the MySQL_last_id and retreive the information from the correct field, and it works across pages. The only problem is this: should the $_SESSION array grow with more data--say, adding a first name variable, and a time-of-day varaible--then I need to update the MySQL table whenever I do this. Not a big deal, I know, but I'm frustrated with this. One more thing: one of the variables in the $_SESSION array is an url, so it screws up the mysql insert, even when I use serialize. Thanks for any help you can give. --V -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] store procedure on odbc-DB2
Hi there everyone, I use *nix-ODBC to connect DB2 server. When i called a store procedure within an iteration, i got some "no rows found" message (not all store procedure calling) on odbc_result_all. But actually that SP calling has a result when I tested it on BD2 command central. Then when I called again store procedure that give no result, I got the result. I don't know why it happen :( Maybe someone give me some explanation :) Thanks, foreach ($arr as $key) { $sql = "call mystore('".$key."')"; $res = odbc_exec($conn, $sql); $val = odbc_result($res, 1); odbc_result_all($res); // if no rows found if (!$val) { $sql = "call mystore('".$key."')"; $res = odbc_exec($conn, $sql); odbc_result_all($res); // --> this give result (with same SP) } } Tatang Widyanto -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Store e-mail in DB
Hi, i'm searching some script that can read e-mails with attachments from an account pop3 and that store them in a db. Someone can help me? Thanks, Heber. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Store a File (any type) in MySQL
As nobody seems to answer your question here, i will give you a pointer to an article i found i 30 seconds using google, i just searched for "insert blob mysql php" an i found this article in oReilly, and it seems that the article is based on a thread in the php mailing list. http://www.onlamp.com/pub/a/php/2000/09/15/php_mysql.html Be carefull with this because it can cause many troubles. If you got a message saying "mysql server gone away" or something like that is because your file if a little big, change the my.ini file and add: set-variable = max_allowed_packet=10M # or whatever you like i think that the default is 1 MB, You should consider changing the max upload size in your php.ini before asking questions about that and saying that it doesn't work :) if you really have to do this way do it if not consider doing this in another way. Any way of solving a problem is right if it is used in the right situation. - Original Message - From: "Daniel Crespo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 23, 2004 4:24 AM Subject: Re: [PHP-DB] Store a File (any type) in MySQL > Ok, I'll consider it... But just, please, could you give me an example code > of what I want to do? > > Thanks a lot. > > "Bruno Santos" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > > Daniel Crespo wrote: > > > > >Hi everybody... > > > > > >Anyone knows how to store a file (any type) in MySQL? > > > > > >Thanks > > > > > > > > > > > hello > > > > MySql has binary field types, but, are they long (in size) enough for > > your file ? > > if the file is small, i guess you could store the data in the mysql > > field, but, and if files are user choosen ??? > > > > why dont u consider storing the data, or the file, in some directory and > > just put the location (file name) in some field in the database ?? is > > more safe and overflow free > > > > cheers > > > > -- > > - > >.-'''''-. > > .' `. > > : : > >: : > >: _/| : Bruno Santos > > : =/_/ : [EMAIL PROTECTED] > > `._/ | .' > > ( / ,|...-'Pagina Pessoal > >\_/^\/||__ http://feiticeir0.no-ip.org > > _/~ `""~`"` \_ > > __/ -'/ `-._ `\_\__ > >/jgs /-'` `\ \ \-.\ > > > > > >"Written very small on the back poket of a girl's jeans > >- 'If you can read this, you're WAY too close.'" > > -- > 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] Store a File (any type) in MySQL
Ok, I'll consider it... But just, please, could you give me an example code of what I want to do? Thanks a lot. "Bruno Santos" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Daniel Crespo wrote: > > >Hi everybody... > > > >Anyone knows how to store a file (any type) in MySQL? > > > >Thanks > > > > > > > hello > > MySql has binary field types, but, are they long (in size) enough for > your file ? > if the file is small, i guess you could store the data in the mysql > field, but, and if files are user choosen ??? > > why dont u consider storing the data, or the file, in some directory and > just put the location (file name) in some field in the database ?? is > more safe and overflow free > > cheers > > -- > - >.-'-. > .' `. > : : >: : >: _/| : Bruno Santos > : =/_/ : [EMAIL PROTECTED] > `._/ | .' > ( / ,|...-'Pagina Pessoal >\_/^\/||__ http://feiticeir0.no-ip.org > _/~ `""~`"` \_ > __/ -'/ `-._ `\_\__ >/jgs /-'` `\ \ \-.\ > > >"Written very small on the back poket of a girl's jeans >- 'If you can read this, you're WAY too close.'" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Store a File (any type) in MySQL
Daniel Crespo wrote: Hi everybody... Anyone knows how to store a file (any type) in MySQL? Thanks hello MySql has binary field types, but, are they long (in size) enough for your file ? if the file is small, i guess you could store the data in the mysql field, but, and if files are user choosen ??? why dont u consider storing the data, or the file, in some directory and just put the location (file name) in some field in the database ?? is more safe and overflow free cheers -- - .-'-. .' `. : : : : : _/| : Bruno Santos : =/_/ : [EMAIL PROTECTED] `._/ | .' ( / ,|...-'Pagina Pessoal \_/^\/||__ http://feiticeir0.no-ip.org _/~ `""~`"` \_ __/ -'/ `-._ `\_\__ /jgs /-'` `\ \ \-.\ "Written very small on the back poket of a girl's jeans - 'If you can read this, you're WAY too close.'" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Store a File (any type) in MySQL
Hi everybody... Anyone knows how to store a file (any type) in MySQL? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] store whois requests
This is some code I already use... you may wish to change the way you retrieve you whois data. Ryan Whois Hostname: $host"; //backwards tick marks will run this command on the server and echo's it out to the screen echo `whois $host`; echo ""; //get the timestamp and ip $timestamp = date("YmdHis"); $ip = getenv(REMOTE_ADDR); //create your query $query = "insert into whois_log (domain, timestamp, ip) values (\"$host\", \"$timestamp\", \"$ip\")"; //run the query against the database with your variables for $server, $username, and $password $db = mysql_connect($server,$username,$password); mysql_select_db("your_database",$db); if (!$result = @mysql_query($query,$db)){ $error = mysql_error(); print("Error Processing Query: $error$query"); } } ?> document.theform.host.focus() -Original Message- From: IS [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 4:27 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [PHP-DB] store whois requests I want to store whois requests including the ip address and date/time stamp into a file or MySQL database (a database is what I prefer to use) for monitoring the PHP whois script. Anybody an idea of how I could do this? I'm a beginner in PHP so any help is welcome. --IS -- 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] store whois requests
I want to store whois requests including the ip address and date/time stamp into a file or MySQL database (a database is what I prefer to use) for monitoring the PHP whois script. Anybody an idea of how I could do this? I'm a beginner in PHP so any help is welcome. --IS -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Store images in postgres database
Hi everybody ! I haven´t could store images on my postgres database tables from my php form. I did it on mysql and this works but now I´m working on postgres,I created a table in my postgres db like this: "CREATE TABLE planos(id serial primary key, image OID, filesize int(8), filename varchar(50), filetype varchar(50)), description varchar(50);" how can I store images from my php form on postgres? Regards, Norma Ramirez
RE: [PHP-DB] Store
Mine :) Aaron -Original Message- From: Marie Osypian [mailto:[EMAIL PROTECTED] Sent: March 6, 2003 2:53 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Store I was wondering if anyone was using a good store that was open sourced in php. Marie O -- 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] Store
I was wondering if anyone was using a good store that was open sourced in php. Marie O -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] store an array in a mysqldb
If you are setting up a true relational database, arrays would be stored in a seperate table with a unique key. Each part of the array would be a seperate row. This is called normalization. If you are doing it for fun, then you could place some type of seperator (like a comma, semicolon, etc) between each array field. Here is an example: FATHER TABLE: COLUMNS:FIRST_NAME LAST_NAME AGE A father can have many children which would be your array. An Array is really a repeating group of information. CHILD TABLE: COLUMNS:FATHER_FIRST_NAME FATHER_LAST_NAME CHILD_FIRST_NAME CHILD_LAST_NAME CHILD_TITLE Your tables could have the following information: FATHER TABLE: FIRST_NAME LAST_NAME AGE johndoe 39 sam green 44 CHILD TABLE: FATHER_FIRST_NAME FATHER_LAST_NAMECHILD_FIRST_NAME CHILD_LAST_NAME TITLE johndoe robert doe [spaces] johndoe jennifer doe [spaces] johndoe sam doe [spaces] sam green sam green jr sam green kelly green [spaces] The index on the child table would be every column to make it unique. If you want to select each child for john doe, your query would look like this: select child_first_name,child_last_name_title from child where father_frist_name = 'john' and father_last_name = 'doe'; This is a very simiplified example. You would need to taylor it for your own needs. -Original Message- From: Jeroen van Bussel [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 30, 2001 10:43 To: [EMAIL PROTECTED] Subject: [PHP-DB] store an array in a mysqldb I would like to know if it is somehow possible to store an array in a mysql DB. Could somebody please help me. greetz Jeroen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] store an array in a mysqldb
Nothing comes to mind that isn't a bit of a "hack" really. You could try seperating the data with delimiters before putting it in, then splitting the data back up into an array at query time. You could setup some tables, one called 'arrays' and one called 'array_values". Arrays would pretty much be one column -- just the id. Array_values would be 4 columns (3 if order doesn't matter) with: array_value_id, array_id, value, sequence (optional). However, I should probably note last I knew PostgreSQL supports the insertion of arrays into a record natively... though I have never personally used it. Justin Buist Trident Technology, Inc. 4700 60th St. SW, Suite 102 Grand Rapids, MI 49512 Ph. 616.554.2700 Fx. 616.554.3331 Mo. 616.291.2612 On Thu, 30 Aug 2001, Jeroen van Bussel wrote: > I would like to know if it is somehow possible to store an array in a mysql > DB. > > Could somebody please help me. > > greetz Jeroen > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] store an array in a mysqldb
I would like to know if it is somehow possible to store an array in a mysql DB. Could somebody please help me. greetz Jeroen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Store Procedures
on slashdot.org today... ;) http://software.tangent.org/article.pl?sid=01/08/23/0817244&mode=thread&threshold= MySQL Gets Perl Stored Procedures (Embedded image moved to file: pic22355.gif)Posted by CmdrTaco on Friday August 24, @11:52AM from the well-isn't-that-special dept. ryarger writes "Woo Hoo! After a seeming eternity of wait, there is finally an implementation of stored procedures for MySQL. It uses Perl as the stored proc language, too!" Also note that this piece of work was done by OSDNs own Krow. Very cool work I must say. ( Read More... | 155 of 221 comments ) Rick Emery , .com>"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: 08/23/2001 Subject: RE: [PHP-DB] Store Procedures 10:08 PM no -Original Message- From: Francisco Carvalho [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 4:20 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Store Procedures Newbie question. I've been developing web application in IIS using ASP and Microsoft SQL Server 7.0. I use "Stored Procedures" quite extensible is there an equivalent in MySQL Thanks. Francisco Carvalho -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. Trinity Mirror plc is the holding company for the Trinity Mirror group of companies and is registered in England No. 82548, with its address at Kingsfield Court, Chester Business Park, Chester CH4 9RE. -- PHP Databas
RE: [PHP-DB] Store Procedures
no -Original Message- From: Francisco Carvalho [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 4:20 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Store Procedures Newbie question. I've been developing web application in IIS using ASP and Microsoft SQL Server 7.0. I use "Stored Procedures" quite extensible is there an equivalent in MySQL Thanks. Francisco Carvalho -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Store Procedures
Newbie question. I've been developing web application in IIS using ASP and Microsoft SQL Server 7.0. I use "Stored Procedures" quite extensible is there an equivalent in MySQL Thanks. Francisco Carvalho