[PHP-DB] storing image in a BLOB
how do i save a whole image in a BLOB ?? any ways to change the BLOB when editing Regards Myrage -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] storing image in a BLOB
Database? PHP Version? Server? David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com -Original Message- From: Myrage [mailto:[EMAIL PROTECTED]] Sent: 20 November 2002 12:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] storing image in a BLOB how do i save a whole image in a BLOB ?? any ways to change the BLOB when editing Regards Myrage -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php smime.p7s Description: application/pkcs7-signature
[PHP-DB] using php4 to connect to mysql (newbie question)
hi, I'm new to php and mysql and are trying to find some tutorials that i can work through so i can get my head round connecting php4 to mysql. I have been looking in all the usual places but keep finding php3 examples and also examples using globals on.. The one i have been looking at is http://www.devarticles.com/art/1/23 All fine until it starts using globals... My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd 4.7 stable. Can anyone recommend any good tutorials for my query? thanks mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 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] using php4 to connect to mysql (newbie question)
read this http://www.php.net/manual/en/ref.mysql.php and other stuff on http://www.php.net good lukck ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: mike karthauser [mailto:[EMAIL PROTECTED]] Sent: woensdag 20 november 2002 13:09 To: [EMAIL PROTECTED] Subject: [PHP-DB] using php4 to connect to mysql (newbie question) hi, I'm new to php and mysql and are trying to find some tutorials that i can work through so i can get my head round connecting php4 to mysql. I have been looking in all the usual places but keep finding php3 examples and also examples using globals on.. The one i have been looking at is http://www.devarticles.com/art/1/23 All fine until it starts using globals... My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd 4.7 stable. Can anyone recommend any good tutorials for my query? thanks mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- 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] using php4 to connect to mysql (newbie question)
Hi The latest PHP bible is now updated to 4.2 www.troutworks.com -Original Message- From: Snijders, Mark [mailto:[EMAIL PROTECTED]] Sent: 20 November 2002 12:18 To: 'mike karthauser'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] using php4 to connect to mysql (newbie question) read this http://www.php.net/manual/en/ref.mysql.php and other stuff on http://www.php.net good lukck ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: mike karthauser [mailto:[EMAIL PROTECTED]] Sent: woensdag 20 november 2002 13:09 To: [EMAIL PROTECTED] Subject: [PHP-DB] using php4 to connect to mysql (newbie question) hi, I'm new to php and mysql and are trying to find some tutorials that i can work through so i can get my head round connecting php4 to mysql. I have been looking in all the usual places but keep finding php3 examples and also examples using globals on.. The one i have been looking at is http://www.devarticles.com/art/1/23 All fine until it starts using globals... My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd 4.7 stable. Can anyone recommend any good tutorials for my query? thanks mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- 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] using php4 to connect to mysql (newbie question)
on www.php.net is the same info and more and it's free :-) ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: Steve Dodkins [mailto:[EMAIL PROTECTED]] Sent: woensdag 20 november 2002 13:25 To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] using php4 to connect to mysql (newbie question) Hi The latest PHP bible is now updated to 4.2 www.troutworks.com -Original Message- From: Snijders, Mark [mailto:[EMAIL PROTECTED]] Sent: 20 November 2002 12:18 To: 'mike karthauser'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] using php4 to connect to mysql (newbie question) read this http://www.php.net/manual/en/ref.mysql.php and other stuff on http://www.php.net good lukck ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: mike karthauser [mailto:[EMAIL PROTECTED]] Sent: woensdag 20 november 2002 13:09 To: [EMAIL PROTECTED] Subject: [PHP-DB] using php4 to connect to mysql (newbie question) hi, I'm new to php and mysql and are trying to find some tutorials that i can work through so i can get my head round connecting php4 to mysql. I have been looking in all the usual places but keep finding php3 examples and also examples using globals on.. The one i have been looking at is http://www.devarticles.com/art/1/23 All fine until it starts using globals... My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd 4.7 stable. Can anyone recommend any good tutorials for my query? thanks mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Storing picture into Sybse DB
Hello, all: I have one probelm about inserting picture into the image field in sybase db. Now, I could insert 15K picture into Sybase db, but just only 15K size. I have no idea how to make the size larger, at least expand it to be 60K. Does anyone have this experience? Does the image field in Sybase have size limitation? Or, does the sybase_query() have size limitation? Any suggestion would welcome. Thanks in advance. Jien-zhong Liu
[PHP-DB] Storing picture into DB
Hey, All: Does you have experience storing picture into DataBase? (experience about Sybase is better.) I have one question that what field in DB is suitable for storing picture/image. If the PHP call function, for example sybase_query(), I think that it has some bug, then who is the person that I could tell to. Or, do you anyone tell me what language could support Sybase DB perfectly, escaspecially in Image? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing picture into DB
Hi I do not have any experience with Sybase;-( If there is a field type available to store strings of unlimited length (or at least strings of your desired 60K) you could use the PHP functions base64_encode() to encode your image data and then store it as string in your table. If you retrieve it use base64_decode() to decode the string. Hope this helps Conni -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Client API version is wrong or am I?
I have installed the MySQL 4.0.4 client, but when I look at phpinfo() I see that it says: Client API version: 4.0.2-alpha Why? Regards, Jacob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] substituting for $id with globals off (newbie)
Hi, thanks for earlier replies regarding php resources. I am currently hitting a brick wall on the script below due to my lack of understanding of php coupled with my lack of knowledge about globals. I replaced $id with $_GET['id'] in line 5 which now allows the user to reach the script to evaluate when presented with testpage.php?id=n. It now falls over when it tries to run the query part : WHERE id=$id I tried to submit this instance with $_GET['id'] in the query which also fails. In the $_GET['id'] where is the value for id now stored? Can anyone see where i have gone wrong? thanks --- my source: ?PHP $db = mysql_connect(localhost, root); mysql_select_db(bsdb1,$db); // display individual record if ($_GET['id']) { $result = mysql_query(SELECT * FROM address WHERE id=$id,$db); $myrow = mysql_fetch_array($result); printf(Name: %s\nbr, $myrow[name]); printf(Address: %s\nbr, $myrow[address]); printf(Home Number: %s\nbr, $myrow[hnum]); printf(Work Number: %s\nbr, $myrow[wnum]); } else { // show employee list $result = mysql_query(SELECT * FROM address,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf(a href=\%s?id=%s\%s/abr\n, $_SERVER['PHP_SELF'], $myrow[id], $myrow[name]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo Sorry, no records were found!; } } ? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 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] substituting for $id with globals off (newbie)
-Oorspronkelijk bericht- Van: Davy Obdam [mailto:[EMAIL PROTECTED]] Verzonden: woensdag 20 november 2002 17:39 Aan: 'mike karthauser' Onderwerp: RE: [PHP-DB] substituting for $id with globals off (newbie) Hi Mike, $result = mysql_query(SELECT * FROM address WHERE id=.$_GET['id'].,$db); This should work. Best regards, Davy Obdam Obdam w e b d e s i g nC Webdesign, application and database development tel : +31(0)641 222 385 mailto:[EMAIL PROTECTED] -Oorspronkelijk bericht- Van: mike karthauser [mailto:[EMAIL PROTECTED]] Verzonden: woensdag 20 november 2002 17:18 Aan: [EMAIL PROTECTED] Onderwerp: [PHP-DB] substituting for $id with globals off (newbie) Hi, thanks for earlier replies regarding php resources. I am currently hitting a brick wall on the script below due to my lack of understanding of php coupled with my lack of knowledge about globals. I replaced $id with $_GET['id'] in line 5 which now allows the user to reach the script to evaluate when presented with testpage.php?id=n. It now falls over when it tries to run the query part : WHERE id=$id I tried to submit this instance with $_GET['id'] in the query which also fails. In the $_GET['id'] where is the value for id now stored? Can anyone see where i have gone wrong? thanks --- my source: ?PHP $db = mysql_connect(localhost, root); mysql_select_db(bsdb1,$db); // display individual record if ($_GET['id']) { $result = mysql_query(SELECT * FROM address WHERE id=$id,$db); $myrow = mysql_fetch_array($result); printf(Name: %s\nbr, $myrow[name]); printf(Address: %s\nbr, $myrow[address]); printf(Home Number: %s\nbr, $myrow[hnum]); printf(Work Number: %s\nbr, $myrow[wnum]); } else { // show employee list $result = mysql_query(SELECT * FROM address,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf(a href=\%s?id=%s\%s/abr\n, $_SERVER['PHP_SELF'], $myrow[id], $myrow[name]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo Sorry, no records were found!; } } ? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Deze e-mail is door E-mail VirusScanner van Planet Internet gecontroleerd op virussen. Op http://www.planet.nl/evs staat een verwijzing naar de actuele lijst waar op wordt gecontroleerd. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] multiple foreach loop?
Hi All, Trying to create a refer a friend script. User enters 10 names and email address of a friend to refer to a site. The following code SORT of works in that it will send the email, etc.. but problem is it duplicates - sends the email out twice to the same email address. **CODE*** foreach($nameRefered as $referedName) { foreach($emailRefered as $referedEmail) { if ($referedEmail != $referedName != ) { message body here /* To send HTML mail, you can set the Content-type header. */ $headers = Return-Path: $support_email\r\n; $headers .= MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $nameReferer .$emailReferer.\r\n; mail ($referedEmail,Your Order on Rinkrake.com, $message, $headers); } } } Any thoughts on why I get the email twice? Thanks all. Much appreciated! Aaron
[PHP-DB] INSERT question...
I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] INSERT question...
Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] multiple foreach loop?
Quoting Aaron Wolski [EMAIL PROTECTED]: Hi All, Trying to create a refer a friend script. User enters 10 names and email address of a friend to refer to a site. The following code SORT of works in that it will send the email, etc.. but problem is it duplicates - sends the email out twice to the same email address. **CODE*** foreach($nameRefered as $referedName) { foreach($emailRefered as $referedEmail) { if ($referedEmail != $referedName != ) { message body here /* To send HTML mail, you can set the Content-type header. */ $headers = Return-Path: $support_email\r\n; $headers .= MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $nameReferer .$emailReferer.\r\n; mail ($referedEmail,Your Order on Rinkrake.com, $message, $headers); } } } Any thoughts on why I get the email twice? Thanks all. Much appreciated! Aaron Lemmie, try that again, (darn webmail and TABS moving to next form element)... FYI - prob. better in the php-general list. But, I think your nested foreach() are the culprit. Assuming $nameRefered = ( 'Joe', 'Bob', 'Jane' ) Assuming $emailRefered = ( '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]' ) With your code, you would get emails to the following... Joe [EMAIL PROTECTED] Joe [EMAIL PROTECTED] Joe [EMAIL PROTECTED] Bob [EMAIL PROTECTED] Bob [EMAIL PROTECTED] Bob [EMAIL PROTECTED] Jane [EMAIL PROTECTED] Jane [EMAIL PROTECTED] Jane [EMAIL PROTECTED] I would consider using the following due to the name/email being stored in separate variable structures. for( $i=0, $i sizeof($nameRefered), $i++){ /* to get this name */ $thisname = $nameRefered[$i]; /* to get thisname's email */ $thisemail = $emailRefered[$i]; } Provided of course that the values in the slots of the array correspond perfectly. -- Ryan T. Gallagher -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT question...
Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron For the OP, you don't really want to insert the text TIMESTAMP(10) into a column, do you? If you want the current 10-digit timestamp, then you can just use NOW() or CURRENT_DATE, so long as your column is declared with a width of 10. In fact, if it's a timestamp, you don't need to do anything, it'll be updated with the current time upon insert. so you could probably just do this: $query = INSERT INTO accounts (accnts) VALUES (.$accnts[0].); ---John Holmes... -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] INSERT question...
Hmm You learn something new everyday :) Aaron -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:27 PM To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron For the OP, you don't really want to insert the text TIMESTAMP(10) into a column, do you? If you want the current 10-digit timestamp, then you can just use NOW() or CURRENT_DATE, so long as your column is declared with a width of 10. In fact, if it's a timestamp, you don't need to do anything, it'll be updated with the current time upon insert. so you could probably just do this: $query = INSERT INTO accounts (accnts) VALUES (.$accnts[0].); ---John Holmes... -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] INSERT question...
Quoting NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]: I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com I believe you will need to specify the target columns, and don't attempt to use comma delimited nothings! ;-) Example: INSERT INTO accounts (col1, col2) VALUES ('val1', 'val2') -- Ryan T. Gallagher [EMAIL PROTECTED] International Studies Abroad http://www.studiesabroad.com (512)480-8522 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple foreach loop?
Quoting Aaron Wolski [EMAIL PROTECTED]: Hi, Ok I understand your code... How about I error check to ensure that if any of the name/email pairs don't have a value to discount their entry? For example... If the user enters: Aaron [EMAIL PROTECTED] Rob blank Bob [EMAIL PROTECTED] blank [EMAIL PROTECTED] How would I disregard the 2nd and 4th pairs? Sorry for bugging. Aaron For validating that any string conforms to some expected pattern This will be alot to swallow but it's what you want, glance through the user added comments, maybe the email validation one is already there. http://www.php.net/manual/en/function.preg-match.php or http://www.php.net/manual/en/function.ereg-match.php If you need help, post a new topic in php-general for this one, you'll get plenty of responses for regex help. ;-) I hope you don't understand the first email, I sent it on accident before completion. That was the why you received two. --Ryan -Original Message- From: Ryan Gallagher [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:09 PM To: Aaron Wolski Subject: Re: [PHP-DB] multiple foreach loop? Quoting Aaron Wolski [EMAIL PROTECTED]: Hi All, Trying to create a refer a friend script. User enters 10 names and email address of a friend to refer to a site. The following code SORT of works in that it will send the email, etc.. but problem is it duplicates - sends the email out twice to the same email address. **CODE*** foreach($nameRefered as $referedName) { foreach($emailRefered as $referedEmail) { if ($referedEmail != $referedName != ) { message body here /* To send HTML mail, you can set the Content-type header. */ $headers = Return-Path: $support_email\r\n; $headers .= MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $nameReferer .$emailReferer.\r\n; mail ($referedEmail,Your Order on Rinkrake.com, $message, $headers); } } } Any thoughts on why I get the email twice? Thanks all. Much appreciated! Aaron -- Ryan T. Gallagher [EMAIL PROTECTED] International Studies Abroad http://www.studiesabroad.com (512)480-8522 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] INSERT question...
OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].'); Do I have to rename the column? I would rather not if I can avoid it. If I must, is this a problem with PHP or MySQL not understanding '-' in a column name? Thanks again. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 1:28 PM To: '1LT John W. Holmes'; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] INSERT question... Hmm You learn something new everyday :) Aaron -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:27 PM To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron For the OP, you don't really want to insert the text TIMESTAMP(10) into a column, do you? If you want the current 10-digit timestamp, then you can just use NOW() or CURRENT_DATE, so long as your column is declared with a width of 10. In fact, if it's a timestamp, you don't need to do anything, it'll be updated with the current time upon insert. so you could probably just do this: $query = INSERT INTO accounts (accnts) VALUES (.$accnts[0].); ---John Holmes... -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] INSERT question...
OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].'); Do I have to rename the column? I would rather not if I can avoid it. If I must, is this a problem with PHP or MySQL not understanding '-' in a column name? Thanks again. Try putting backtics (not single quotes) around the column name. $query = INSERT INTO accounts (`id-sys`) VALUES ('.$accnts[0].'); if that don't work, you'll have to rename the column. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT question...
Quoting 1LT John W. Holmes [EMAIL PROTECTED]: OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].'); Do I have to rename the column? I would rather not if I can avoid it. If I must, is this a problem with PHP or MySQL not understanding '-' in a column name? Thanks again. Try putting backtics (not single quotes) around the column name. $query = INSERT INTO accounts (`id-sys`) VALUES ('.$accnts[0].'); if that don't work, you'll have to rename the column. Are backtics the same for MYSQL that brackets are for other dbs? I would use [id-sys], but then again i'm stuck with MS-SQL. -- Ryan T. Gallagher -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] INSERT question...
Great. That is perfect. The last minor issue is that the timestamp is a datetime column, and needs to be such since I don't want this to change when the record is updated. This is correct, right? If the column were a timestamp data type, the value would change every time the record is updated? I am trying: $query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].', 'NOW()'); This is entering the array element properly, but not the time. The datetime field is coming up with all zeroes. -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 2:21 PM To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].'); Do I have to rename the column? I would rather not if I can avoid it. If I must, is this a problem with PHP or MySQL not understanding '-' in a column name? Thanks again. Try putting backtics (not single quotes) around the column name. $query = INSERT INTO accounts (`id-sys`) VALUES ('.$accnts[0].'); if that don't work, you'll have to rename the column. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT question...
$query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].', 'NOW()'); Remove the quotes around NOW(). It's a function, not a string. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] INSERT question...
Thanks a bunch. That fixed me right up. Still learning a lot about PHP and MySQL. Hopefully I will be able to remember this as I am sure this issue will come up for me again in the future. -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 2:47 PM To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... $query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].', 'NOW()'); Remove the quotes around NOW(). It's a function, not a string. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Access Violation in ISAPI version
Has anyone else had problems with the error PHP has encountered an Access Violation at 098029AE ... It's talked about at: http://bugs.php.net/bug.php?id=15333 The most frustrating thing is our ISP went above the call of duty to install PHP for me, and now his response is... well read for yourselves: I read through all the stuff at php.net. The long and short of it is this: Nobody really knows what is causing the problem. It appears to be a problem with a dual-processor machine (which is what you're using) It is believed that 4.2.3 solves the problem (that is the latest version and the version we are using) Setting the security model to low on the site helps in many cases (doesn't eliminate the problem, just reduces how often it occurs) Ergo, this has been my problem with public domain scripting languages such as PHP. There is not a single source that can be held accountable for ensuring a problem is solved. It is the reason that we have standardized on CF, because when it's bad, Macromedia HAS to fix it. All that being said, and consistent with our terms of installation, I will take some time to see if I can trim up the configuration and improve the situation. However, because this problem crashes the server completely, if we can't find a resolution soon, I will opt to remove it from the system. One of our key responsibilities is system stability and reliability. Again, I'll see if I can modify the config to alleviate this, however, the php resource was very little help. I'm pretty disappointed that this hasn't been fixed yet. Has anyone had any luck fixing it? Thanks! Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] General How-to Question...
Once again I am posting a bit off topic, so tell me to go away if this is bugging people... Thanks for all of the assistance so far in creating what will be a completely automated user account request system. I am now trying to figure out the mechanics of the account approval process. So far I have created a set of web pages that allows a user to login and select systems from a database populated list. These selections in turn populate another database table and include a timestamp as to when the request was made. I am working on a Perl script to query the database looking for new requests, and from this an e-mail will be sent to the user's supervisor for approval. The area where I am needing more help is getting the supervisor back to the approval web page. My intention is to provide the supervisor with a web link in the e-mail to take him directly to the approval page. The question is how do I actually make this occur. I am pretty sure I can figure out the Perl scripting to send the e-mail, but what is the URL that I am having him come back to? How do I create this new URL? Any suggestions ideas or pointers would be most helpful. Thanks again for all the help and sorry for the off-topic post. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help w/Multiple Joins
Hello, I'm trying to put together a little photo album section for a website. I have this query which returns the expected info from the command line. SELECT * FROM photo_album as p INNER JOIN images AS i1 ON p.img_1=i1.img_id INNER JOIN images AS i2 ON p.img_2=i2.img_id INNER JOIN images AS i3 ON p.img_3=i3.img_id INNER JOIN images AS i4 ON p.img_4=i4.img_id; The problem is when i try to display this on a page. Here is what i have ?php include includes/connect.php; $result = mysql_query(SELECT * FROM photo_album as p INNER JOIN images AS i1 ON p.img_1=i1.img_id INNER JOIN images AS i2 ON p.img_2=i2.img_id INNER JOIN images AS i3 ON p.img_3=i3.img_id INNER JOIN images AS i4 ON p.img_4=i4.img_id,$db)or die(mysql_error()); if ($myrow = mysql_fetch_array($result)) { do { print table tr tdimg src=$myrow[img_path]/td /tr /table; } while ($myrow = mysql_fetch_array($result)); } ? This displays only the last inner join image not four like i was expecting. How can i pull all the images from the array? I've tried lots of different ways like img src=$myrow[i3.img_path] with no luck. Any help would be greatly appreciated. Thanks in advance, Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] $_get 2 variables
Thanks Ryan, Ignatius. -Original Message- From: Ryan Gallagher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 20 November 2002 5:37 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] $_get 2 variables Quoting Gavin Amm [EMAIL PROTECTED]: Hi, I'm wanting to retrieve data from my database using 2 conditions in the WHERE clause. How do i pick up 2 different variables from the URL? i can get just 1 variable easily (eg: http://localhost/myscript.php?var1=blah) My question essentially is: what string do do i need to type into the URL to pick up the 2 variables like this: $var1 = $_GET['var1']; $var2 = $_get['var2']; Do I need to start messing around with strings? or is there an easy way? Thanks, Gav Try: http://localhost/myscript.php?var=foovar2=bar '' is the default url parameter seperator. The rest of your code looks fine. (course there are lots of other ways to go about it). --Ryan -- Ryan T. Gallagher [EMAIL PROTECTED] International Studies Abroad http://www.studiesabroad.com (512)480-8522 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe any Email sent by our system may contain a virus. It should be noted that most Anti Virus programmes can not scan encrypted file attachments (example - documents saved with a password). Thus extra care should be taken when opening these files. Liability limited by the Accountants Scheme, approved under the Professional Standards Act 1994 (NSW). Level 4 54 Neridah StreetPO Box 1290 CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Select Last row
dear All, I have data and I want to get the last row of my table. how to select the last row, with the id is timestamp? and the the result will display in the prompt? sorry if my question is sound stupid, but I really confuse how to start this code -- Warm regards, Afif mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Select Last row
Can you reverse your sorting order? In that case, the last row now becomes the first--making things much easier and faster! :-) Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! On Wed, 2002-11-20 at 20:48, Afif wrote: dear All, I have data and I want to get the last row of my table. how to select the last row, with the id is timestamp? and the the result will display in the prompt? sorry if my question is sound stupid, but I really confuse how to start this code -- Warm regards, Afif mailto:[EMAIL PROTECTED] -- 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] Check data exists in MySQL
Hi, I'd like to test to see if data exists in my table (count), and if not insert some: This is seudo code of what I'd like: $sql = SELECT num FROM count WHERE col1=$var1 AND col2=$var2; IF $sql returns an EMPTY SET { INSERT INTO count VALUES('$var1', '$var2', 0); } This is the code i have atm: $sql=SELECT num FROM count where col1='$var1' AND col2='$var2'; $page_count = mysql_query($sql,$db); if (!$page_count){ $sql = INSERT INTO count VALUES('$var1', '$var2', '0'); } Thanks, Gav This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe any Email sent by our system may contain a virus. It should be noted that most Anti Virus programmes can not scan encrypted file attachments (example - documents saved with a password). Thus extra care should be taken when opening these files. Liability limited by the Accountants Scheme, approved under the Professional Standards Act 1994 (NSW). Level 4 54 Neridah StreetPO Box 1290 CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
ok, here's an idea: Either use a script off the web, or write your own: During the initial SSL session setup: - send an e-mail to the client with a web page attached. (include instructions in the e-mail) Put javascript into the page to decrypt RC5 (apparently you can get a patch for MySQL to enable RC5 functionality) - During the session put the client's key encrypted login details into a text file have them save it to their hard disk - When the client wishes to view their login information, instruct the client to: - open the web page atached to the e-mail - use a form in the web page to browse for the text file they saved to their hard disk - use the RC5 decryption script embedded in the web page to decrypt the client login info or something like that... cheers, Gav -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 20 November 2002 1:01 AM To: 'Jeremy Wilson'; 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Hi All, I want to thank everyone for their suggestion. A short term solution we're simply going to remove the username from the email. This way if a hacker does obtain the email they don't have the complete details to gain access to the users account. I would like to know more about the code supplied below though. How does this work? As long as they HAVE a string that gets compared in the DB then what good is this? They can still gain access to the users account. Thanks again. Aaron -Original Message- From: Jeremy Wilson [mailto:[EMAIL PROTECTED]] Sent: November 16, 2002 1:08 PM To: 'Aaron Wolski'; 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? $encrypted_string = md5(base64_encode($var.'secret key')); Pass the user name or password to $var and place text in to replace the words 'secret key'. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 8:45 AM To: 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Well. Its not what they want.. it what one of their clients want (very big corporation with very unrealistic security standards - you'd think they were NASA or something *grumble*) Their thought is that someone could hack the received email, login to the store using the publically displayed logins details and reek havoc on the store, etc. *shrugs* Sadly this isn't open for debate as a solutions IS required. Any thoughts? Aaron -Original Message- From: Jason Vincent [mailto:[EMAIL PROTECTED]] Sent: November 15, 2002 11:42 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Why email? If the Admin tool uses SSL, that is all you need. Regards, J -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- 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 This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe
Re: [PHP-DB] Check data exists in MySQL
if (!$page_count){ $sql = INSERT INTO count VALUES('$var1', '$var2', '0'); } if (!mysql_num_rows($page_count)){ $sql = INSERT INTO count VALUES('$var1', '$var2', '0'); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FW: Selecting not on DB
Hi there, I have a problem that I cannot seem to solve. I'm using MySql and query it using PHP. I have create table ABC with field called number containing (1,4,6,10) How is to select all number form 1 to 10 which are not in that field so the output somehow like this : ++ | Number | ++ | 2 | | 3 | | 5 | | 7 | | 8 | | 9 | ++ Thanks, Hansen
RE: [PHP-DB] Check data exists in MySQL
Hi, for some reason i'm getting an error when I try to run this query: __ $sql=SELECT num FROM count where dept='$dept' AND deptsub='$deptsub'; $page_count = mysql_query($sql,$db); # If does not exist in the database, insert a new entry if (!mysql_num_rows($page_count)){ $sql = INSERT INTO count VALUES('$dept', '$deptsub', '0'); $result = mysql_query($sql,$db); } #Update the count in the database $page_count = $page_count + 1; $sql=UPDATE count SET num='$page_count' WHERE dept='$dept' AND deptsub='$deptsub'; $result = mysql_query($sql, $db); __ My table looks like this: count: dept VARCHAR(32) deptsub VARCHAR(32) num INT(10) __ I'm getting the following error message: Parse error: parse error in /home/./public_html/public/index.php on line 25 (Which is the line: $sql=UPDATE count...) Any thoughts would b most helpful. Thanks, Gav -Original Message- From: Tatang Widyanto [mailto:[EMAIL PROTECTED]] Sent: Thursday, 21 November 2002 3:33 PM To: PHP Database Subject: Re: [PHP-DB] Check data exists in MySQL if (!$page_count){ $sql = INSERT INTO count VALUES('$var1', '$var2', '0'); } if (!mysql_num_rows($page_count)){ $sql = INSERT INTO count VALUES('$var1', '$var2', '0'); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe any Email sent by our system may contain a virus. It should be noted that most Anti Virus programmes can not scan encrypted file attachments (example - documents saved with a password). Thus extra care should be taken when opening these files. Liability limited by the Accountants Scheme, approved under the Professional Standards Act 1994 (NSW). Level 4 54 Neridah StreetPO Box 1290 CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Check data exists in MySQL
$sql=SELECT num FROM count where dept='$dept' AND deptsub='$deptsub'; begin of replace -- $result = mysql_query($sql,$db); $page_count = mysql_num_rows($result); # If does not exist in the database, insert a new entry if (!$page_count){ -- end of replace $sql = INSERT INTO count VALUES('$dept', '$deptsub', '0'); $result = mysql_query($sql,$db); } #Update the count in the database $page_count = $page_count + 1; $sql=UPDATE count SET num='$page_count' WHERE dept='$dept' AND deptsub='$deptsub'; $result = mysql_query($sql, $db); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to clear the array
How to clear an array? i used unset. But it destroys the array property of the variablke itself. I just need to clear the contents. Pls tell me how THakns Karthikeyan.S - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
Re: [PHP-DB] how to clear the array
How about: $my_array = array(); // clears the whole array (and makes a new one) Or: $my_array[$i] = null; // clears a single entry in the array at index $i --Dave karthikeyan wrote: How to clear an array? i used unset. But it destroys the array property of the variablke itself. I just need to clear the contents. Pls tell me how THakns Karthikeyan.S - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] FW: Selecting not on DB
You could create an auxiliary table nb_1_10 containing a field nb with all integers from 1 to 10 Then perform a SELECT join: SELECT nb_1_10.* FROM ABC, nb_1_10 WHERE nb_1_10.nb NOT IN ABC.number AND some condition that returns only one row from ABC - like here (1,4,6,10) Ignatius - Original Message - From: milisphp [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 5:29 AM Subject: [PHP-DB] FW: Selecting not on DB Hi there, I have a problem that I cannot seem to solve. I'm using MySql and query it using PHP. I have create table ABC with field called number containing (1,4,6,10) How is to select all number form 1 to 10 which are not in that field so the output somehow like this : ++ | Number | ++ | 2 | | 3 | | 5 | | 7 | | 8 | | 9 | ++ Thanks, Hansen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php