[PHP-DB] Query problem
I have done this in the past, but for some reason it isn't working now (maybe a moron). I am trying to select all of the empty or NULL fields in a column. This is what I have select * from ticket where Type = 'Line' and Closeddate = ' empty space' and have tried the following select * from ticket where Type = 'Line' and Closeddate = 'Null' select * from ticket where Type = 'Line' and Closeddate = 'NULL' any clues -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query problem
Am Dienstag, 22. Juli 2003 11:29 schrieb Ron Allen: This is what I have select * from ticket where Type = 'Line' and Closeddate = ' empty space' and have tried the following select * from ticket where Type = 'Line' and Closeddate = 'Null' select * from ticket where Type = 'Line' and Closeddate = 'NULL' use isNULL(Closedate) instead of Closedate = 'NULL' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Apache / PHP / ODBC / Oracle disconnect problems
I am hoping someone maybe has come across this problem before as it is driving me up the wall! My web server is RH 7.3 / Apache 1.3.27 / PHP 4.1.3 / unixODBC 2.2.0 / ODBC dirve 0.5.1 (ex of Easysoft) When the web site accesses the database it connects correctly fetchs the data and then closes - only it leaves the connection open. Oracle reports no sessions, but the oputput from netstat -a show the connections as 'Established', and you can see the session processes on the Oracle server. When the apache server is restarted these connections disappear. Of course as soon as oracle reaches it's limit of connections it freezes the web site. I have tried PHP 4.2.3 / Apache 2 / unixODBC 2.2.5 in all cobinations, but still get the same problem. I am trying 4.3.2, but I am having trouble compiling with odbc support, although it is enabled I get Call to undefined errors for the odbc_connect. The oracle database is on a seperate Solaris server and is 8.1.7. The connection is closed in PHP using odbc_close(). This is the script we are using to test : ? set_time_limit(0); // Change these vars putenv(TWO_TASK=dev02); putenv(ORACLE_SID=dev02); putenv(ORACLE_HOME=/www/oraclient); putenv(ODBCINSTINI=/usr/local/etc/odbcinst.ini); putenv(ODBCINI=/usr/local/etc/odbc.ini); $counter=0; $loop = true; while($loop){ $counter++; sleep(1); echo Counting... $counter ; flush(); $test = odbc_connect(dev02, username, passsword, SQL_CUR_USE_DRIVER); echo Resource Identifier... $testbr\n; flush(); odbc_close($test); unset($test); echo ClosedBR; flush(); ($counter 1) ? $loop = false : $loop = true; } ? Can anyone shed light on what I am doing wrong? Many thanks, Neil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Apache / PHP / ODBC / Oracle disconnect problems
I am hoping someone maybe has come across this problem before as it is driving me up the wall! My web server is RH 7.3 / Apache 1.3.27 / PHP 4.1.3 / unixODBC 2.2.0 / ODBC dirve 0.5.1 (ex of Easysoft) When the web site accesses the database it connects correctly fetchs the data and then closes - only it leaves the connection open. Oracle reports no sessions, but the oputput from netstat -a show the connections as 'Established', and you can see the session processes on the Oracle server. When the apache server is restarted these connections disappear. Of course as soon as oracle reaches it's limit of connections it freezes the web site. I have tried PHP 4.2.3 / Apache 2 / unixODBC 2.2.5 in all cobinations, but still get the same problem. I am trying 4.3.2, but I am having trouble compiling with odbc support, although it is enabled I get Call to undefined errors for the odbc_connect. The oracle database is on a seperate Solaris server and is 8.1.7. The connection is closed in PHP using odbc_close(). This is the script we are using to test : ? set_time_limit(0); // Change these vars putenv(TWO_TASK=dev02); putenv(ORACLE_SID=dev02); putenv(ORACLE_HOME=/www/oraclient); putenv(ODBCINSTINI=/usr/local/etc/odbcinst.ini); putenv(ODBCINI=/usr/local/etc/odbc.ini); $counter=0; $loop = true; while($loop){ $counter++; sleep(1); echo Counting... $counter ; flush(); $test = odbc_connect(dev02, username, passsword, SQL_CUR_USE_DRIVER); echo Resource Identifier... $testbr\n; flush(); odbc_close($test); unset($test); echo ClosedBR; flush(); ($counter 1) ? $loop = false : $loop = true; } ? Can anyone shed light on what I am doing wrong? Many thanks, Neil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Apache / PHP / ODBC / Oracle disconnect problems
I am hoping someone maybe has come across this problem before as it is driving me up the wall! My web server is RH 7.3 / Apache 1.3.27 / PHP 4.1.3 / unixODBC 2.2.0 / ODBC dirve 0.5.1 (ex of Easysoft) When the web site accesses the database it connects correctly fetchs the data and then closes - only it leaves the connection open. Oracle reports no sessions, but the oputput from netstat -a show the connections as 'Established', and you can see the session processes on the Oracle server. When the apache server is restarted these connections disappear. Of course as soon as oracle reaches it's limit of connections it freezes the web site. I have tried PHP 4.2.3 / Apache 2 / unixODBC 2.2.5 in all cobinations, but still get the same problem. I am trying 4.3.2, but I am having trouble compiling with odbc support, although it is enabled I get Call to undefined errors for the odbc_connect. The oracle database is on a seperate Solaris server and is 8.1.7. The connection is closed in PHP using odbc_close(). This is the script we are using to test : ? set_time_limit(0); // Change these vars putenv(TWO_TASK=dev02); putenv(ORACLE_SID=dev02); putenv(ORACLE_HOME=/www/oraclient); putenv(ODBCINSTINI=/usr/local/etc/odbcinst.ini); putenv(ODBCINI=/usr/local/etc/odbc.ini); $counter=0; $loop = true; while($loop){ $counter++; sleep(1); echo Counting... $counter ; flush(); $test = odbc_connect(dev02, username, passsword, SQL_CUR_USE_DRIVER); echo Resource Identifier... $testbr\n; flush(); odbc_close($test); unset($test); echo ClosedBR; flush(); ($counter 1) ? $loop = false : $loop = true; } ? Can anyone shed light on what I am doing wrong? Many thanks, Neil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Hackers?
Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. While I'm curious to know who did this, I guess my priority os to recover the lost data... is this possible...? I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required Help! Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
[PHP-DB] WHY need to query 2x to get results
Hi, I have a code that goes like this. Scroll down to the -- sign. How come I need another $result = mysql_query($sql) at that location? If I don't have it, the results coming out will only start printing from the 2nd Row.. Omitting the 1st. Results as wanted row 1 value1 row 2 value2 row 3 value3 Getting this instead row 2 value2 row 3 value3 Pls Help. $result = mysql_query($sql); $num_results = mysql_num_rows($result); $row = mysql_fetch_row($result); echo 'ph4There are ' . $num_results; echo ' FA entries found/p/h4' . \n; echo 'table border=2 cellpadding=5' . \n; echo 'td colspan=' . sizeof($row) . ' align=center '; echo '/td' . \n; # === # Print out the Table Field Names # === echo '!-- Results Table Header Field Names --'; echo \n; echo 'tr' . \n; for ($k = 0; $k sizeof($row) ; $k++) { echo \t . 'td'; echo mysql_field_name($result,$k); echo /td \n; } # === # Print out the Table Results # === $result = mysql_query($sql); ---==WHY Is THIS needed for ($i = 0; $i $num_results ; $i++) { echo tr\n ; $row = mysql_fetch_row($result); for ($j = 0; $j 12 ; $j++) { echo \t . 'td'; echo $row[$j] ; echo /td \n; } echo /tr\n; } Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Wrapper classes
I use Pear DB http://pear.php.net/manual/en/package.database.php its probably already installed in the pear/includes directory as it comes with the php distribution pete Mohammad Saad wrote: Hello all, I would like to know what is the best wrapper class for Mysql database interface. I need a kind of class which will return me results of query in an array and take care of all the cleaning of resources Thanks all Mohammad Saad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHY need to query 2x to get results
Because you have already fetched one row before outputting the record count. Therefore the row pointer is at the second record before you 'print out'. Try putting mysql_data_seek($result,0); in place of your second $result = mysql_query($sql); This should return the pointer to the first retreived record. Hope that helps Terry --Original Message- Hi, I have a code that goes like this. Scroll down to the -- sign. How come I need another $result = mysql_query($sql) at that location? If I don't have it, the results coming out will only start printing from the 2nd Row.. Omitting the 1st. Results as wanted row 1 value1 row 2 value2 row 3 value3 Getting this instead row 2 value2 row 3 value3 Pls Help. $result = mysql_query($sql); $num_results = mysql_num_rows($result); $row = mysql_fetch_row($result); echo 'ph4There are ' . $num_results; echo ' FA entries found/p/h4' . \n; echo 'table border=2 cellpadding=5' . \n; echo 'td colspan=' . sizeof($row) . ' align=center '; echo '/td' . \n; # === # Print out the Table Field Names # === echo '!-- Results Table Header Field Names --'; echo \n; echo 'tr' . \n; for ($k = 0; $k sizeof($row) ; $k++) { echo \t . 'td'; echo mysql_field_name($result,$k); echo /td \n; } # === # Print out the Table Results # === $result = mysql_query($sql); ---==WHY Is THIS needed for ($i = 0; $i $num_results ; $i++) { echo tr\n ; $row = mysql_fetch_row($result); for ($j = 0; $j 12 ; $j++) { echo \t . 'td'; echo $row[$j] ; echo /td \n; } echo /tr\n; } Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hackers?
On Tuesday 22 July 2003 18:14, [EMAIL PROTECTED] wrote: Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. Hmm, you have several databases missing, you suspect hackers, yet you continue to run the server so that ... This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. ... they can delete ALL your databases? The golden rule is, at the first sign of any suspicious activity (yes having several databases deleted does count as suspicious activity!), take the server off-line, backup all your important data, and investigate. While I'm curious to know who did this, I think a better question to be asking is *how* they did this. Knowing that would stand you in good stead to prevent it from happenning in the future. Depending on the ability of the 'hacker' the logs may be a source of info. I guess my priority os to recover the lost data... is this possible...? See what you can salvage from the directory where MySQL keeps the databases. If there's nothing there then your only salvation are in the backups. I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required 1) The RAQs and its siblings seems to be notoriously insecure. You really need to keep up with any new security updates. 2) A default installation of MySQL is also insecure in that you do not need a password to use the root account. As with all break-ins or suspected break-ins, to be on the safe side you should recover any data that you can (making sure that they haven't been tainted) then format the hard-disk (or better still, put in a new hard-disk, keeping the old one for analysis) and re-install. -- 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 -- /* Cats are intended to teach us that not everything in nature has a function. -- Garrison Keillor */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hackers?
I know... live and learn... and learn I have... Good advise there... We're gonna be moving hosts in a few weeks anyway, to relieve the burden on little me in these kinda areas... Passwords are being changed, and patches are being checked for updates etc... I have full backups of the site, and most of the databases, so it's not a major crisis, but it is a major pain in the arse... I just LOVE data entry...! ;-) I think I've still got a job, so that's good... but I'll listen to the advise I've been given today and act on it... Roll on Friday... Tris... Jason Wong [EMAIL PROTECTED] 22/07/2003 12:52 Please respond to php-db To: [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Hackers? On Tuesday 22 July 2003 18:14, [EMAIL PROTECTED] wrote: Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. Hmm, you have several databases missing, you suspect hackers, yet you continue to run the server so that ... This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. ... they can delete ALL your databases? The golden rule is, at the first sign of any suspicious activity (yes having several databases deleted does count as suspicious activity!), take the server off-line, backup all your important data, and investigate. While I'm curious to know who did this, I think a better question to be asking is *how* they did this. Knowing that would stand you in good stead to prevent it from happenning in the future. Depending on the ability of the 'hacker' the logs may be a source of info. I guess my priority os to recover the lost data... is this possible...? See what you can salvage from the directory where MySQL keeps the databases. If there's nothing there then your only salvation are in the backups. I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required 1) The RAQs and its siblings seems to be notoriously insecure. You really need to keep up with any new security updates. 2) A default installation of MySQL is also insecure in that you do not need a password to use the root account. As with all break-ins or suspected break-ins, to be on the safe side you should recover any data that you can (making sure that they haven't been tainted) then format the hard-disk (or better still, put in a new hard-disk, keeping the old one for analysis) and re-install. -- 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 -- /* Cats are intended to teach us that not everything in nature has a function. -- Garrison Keillor */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
[PHP-DB] why script only updating one table?
Hi All, I have a form that passes to select box array to my script. Select boxes are named: patternThreads[] and patternFabrics[] My Script: //Check to see if Threads were selected for this pattern if ($patternThreads) { if (is_array($patternThreads)) { $str_threads = implode(,,$patternThreads); } else { $str_threads = $patternThreads; } $threadsArray = explode(,,$str_threads); for ($i=0;$isizeof($threadsArray);$i++) { //Grab a listing of all threads currently in the DB //associated with the pattern $allthreadsQuery = db_query(SELECT id FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index=.escapeValue($threadsArray[$i])); //Does a record already exist? if (db_numrows($allthreadsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternthreads (id,pattern_index,thread_index,avail) VALUES ('','$id',.escapeValue($threadsArray[$i]).,'0')); } } //Check to see if a thread was unchecked. //If so, delete entry from DB $db_threads1 = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while($db_threads2 = db_fetch($db_threads1)) $db_threads[] = $db_threads2[thread_index]; foreach($db_threads AS $thread) { if(!in_array($thread, $threadsArray)) db_query(DELETE FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index='$thread'); } } //Check to see if fabrics were selected for this pattern if ($patternFabrics) { if (is_array($patternFabrics)) { $str_fabrics = implode(,,$patternFabrics); } else { $str_fabrics = $patternFabrics; } $fabricsArray = explode(,,$str_fabrics); for ($i=0;$isizeof($fabricsArray);$i++) { //Grab a listing of all fabrics currently in the DB //associated with the pattern $allfabricsQuery = db_query(SELECT id FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index=.escapeValue($fabricsArray[$i])); //Does a record already exist? if (db_numrows($allfabricsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternfabrics (id,pattern_index,fabric_index,avail) VALUES ('','$id',.escapeValue($fabricsArray[$i]).,'0')); } } //Check to see if a fabric was unchecked. //If so, delete entry from DB $db_fabrics1 = db_query(SELECT * FROM kcs_patternfabrics WHERE pattern_index='$id'); while($db_fabrics2 = db_fetch($db_fabrics1)) $db_fabrics[] = $db_fabrics2[fabric_index]; foreach($db_fabrics AS $fabric) { if(!in_array($fabric, $fabricsArray)) db_query(DELETE FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index='$fabric'); } } The scrip is supposed to see if either select box contains data and then process the data. Does anyone understand why it would be updating only one table at a time and not both at the same time? It should be updating both at the same time! NOTE: if I remove the processing code for either select box it works without problem. They just don't seem to work together. Thanks! Aaron
[PHP-DB] PHP oci : undefined function ocilogon
Hi, I just installed apache 1.3.12, php 4.2.3 and oracle 8.1.7 on Linux RedHat 7.3 Apache and PHP work fine, oracle works fine. I copied oci.h from $ORACLE_HOME/rdbms/demo/ to ./php/ext/oci8/ I have configure php to supporte oci8 functions : configure --with_oracle=$ORACLE_HOME --with_oci8=$ORACLE_HOME -with-apache.. .. No error ! But when I want to use ocilogon function I have this message : Fatal error: Call to undefined function: ocilogon() Have somebody had this sort of problem ? How can I solve it ? Stf -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Condition for Adding data
Well, you're initializing $food to ; then testing to see if it has a value, which it never will. If you're getting the $food variable from a POST or a GET op, you'll need to grab it from the appropriate array, $food = $_POST['food']; echo $food; to see what is being passed. Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: gatimu [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 7:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Condition for Adding data Hi I need help!, I am quite new to php and I am trying to create a condition that will load a specific page after a form has been submitted to enter data in my database, I have tried using this code (I created it) but it wont work, all I get is a messege on the browser that says the page address incorrect Here is how i have scripted the code ?php $food=; if($food==milk) { $pgload=milk.php; } if ($food==eggs) { $pgload=egg.php; } if ($food==ham) { $pgload=ham.php; } echo form name=appForm method=post action=.$pgload. ? any ideas on how i can go around this problem? Gatimu -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] why script only updating one table? SOLVED
Hi Guys, No need to think about this. I solved the problem by putting both scripts under one check If ($patternThreads || $patternFabrics) { //DO STUFF HERE } Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: July 22, 2003 10:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] why script only updating one table? Hi All, I have a form that passes to select box array to my script. Select boxes are named: patternThreads[] and patternFabrics[] My Script: //Check to see if Threads were selected for this pattern if ($patternThreads) { if (is_array($patternThreads)) { $str_threads = implode(,,$patternThreads); } else { $str_threads = $patternThreads; } $threadsArray = explode(,,$str_threads); for ($i=0;$isizeof($threadsArray);$i++) { //Grab a listing of all threads currently in the DB //associated with the pattern $allthreadsQuery = db_query(SELECT id FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index=.escapeValue($threadsArray[$i])); //Does a record already exist? if (db_numrows($allthreadsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternthreads (id,pattern_index,thread_index,avail) VALUES ('','$id',.escapeValue($threadsArray[$i]).,'0')); } } //Check to see if a thread was unchecked. //If so, delete entry from DB $db_threads1 = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while($db_threads2 = db_fetch($db_threads1)) $db_threads[] = $db_threads2[thread_index]; foreach($db_threads AS $thread) { if(!in_array($thread, $threadsArray)) db_query(DELETE FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index='$thread'); } } //Check to see if fabrics were selected for this pattern if ($patternFabrics) { if (is_array($patternFabrics)) { $str_fabrics = implode(,,$patternFabrics); } else { $str_fabrics = $patternFabrics; } $fabricsArray = explode(,,$str_fabrics); for ($i=0;$isizeof($fabricsArray);$i++) { //Grab a listing of all fabrics currently in the DB //associated with the pattern $allfabricsQuery = db_query(SELECT id FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index=.escapeValue($fabricsArray[$i])); //Does a record already exist? if (db_numrows($allfabricsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternfabrics (id,pattern_index,fabric_index,avail) VALUES ('','$id',.escapeValue($fabricsArray[$i]).,'0')); } } //Check to see if a fabric was unchecked. //If so, delete entry from DB $db_fabrics1 = db_query(SELECT * FROM kcs_patternfabrics WHERE pattern_index='$id'); while($db_fabrics2 = db_fetch($db_fabrics1)) $db_fabrics[] = $db_fabrics2[fabric_index]; foreach($db_fabrics AS $fabric) { if(!in_array($fabric, $fabricsArray)) db_query(DELETE FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index='$fabric'); } } The scrip is supposed to see if either select box contains data and then process the data. Does anyone understand why it would be updating only one table at a time and not both at the same time? It should be updating both at the same time! NOTE: if I remove the processing code for either select box it works without problem. They just don't seem to work together. Thanks! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wrapper classes
DB.php of http://pear.php.net You can get a very good description of the methods available in the pear documentation. It should be installed with recent versions of PHP. If not you can install it with the go-pear script at http://pear.php.net/go-pear. HTH On Tue, 22 Jul 2003, Mohammad Saad wrote: Date: Tue, 22 Jul 2003 10:56:53 +0500 From: Mohammad Saad [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Wrapper classes Hello all, I would like to know what is the best wrapper class for Mysql database interface. I need a kind of class which will return me results of query in an array and take care of all the cleaning of resources Thanks all Mohammad Saad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hackers?
Is your database a shared database? Permissions might have been set incorrectly so that you saw them; then someone realized that the permissions were wrong, changed them, and thus you couldn't see them anymore. If the database is a shared system, then you might have just seen a misconfigured access list. If it isn't a shared system, then your instincts are probably correct; however, check with ANYONE who has or might have access to the database (via the web, via shell, etc) either locally or remotely and make sure they weren't just messing around with some new software. Peter On Tue, 22 Jul 2003 [EMAIL PROTECTED] wrote: I know... live and learn... and learn I have... Good advise there... We're gonna be moving hosts in a few weeks anyway, to relieve the burden on little me in these kinda areas... Passwords are being changed, and patches are being checked for updates etc... I have full backups of the site, and most of the databases, so it's not a major crisis, but it is a major pain in the arse... I just LOVE data entry...! ;-) I think I've still got a job, so that's good... but I'll listen to the advise I've been given today and act on it... Roll on Friday... Tris... Jason Wong [EMAIL PROTECTED] 22/07/2003 12:52 Please respond to php-db To: [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Hackers? On Tuesday 22 July 2003 18:14, [EMAIL PROTECTED] wrote: Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. Hmm, you have several databases missing, you suspect hackers, yet you continue to run the server so that ... This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. ... they can delete ALL your databases? The golden rule is, at the first sign of any suspicious activity (yes having several databases deleted does count as suspicious activity!), take the server off-line, backup all your important data, and investigate. While I'm curious to know who did this, I think a better question to be asking is *how* they did this. Knowing that would stand you in good stead to prevent it from happenning in the future. Depending on the ability of the 'hacker' the logs may be a source of info. I guess my priority os to recover the lost data... is this possible...? See what you can salvage from the directory where MySQL keeps the databases. If there's nothing there then your only salvation are in the backups. I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required 1) The RAQs and its siblings seems to be notoriously insecure. You really need to keep up with any new security updates. 2) A default installation of MySQL is also insecure in that you do not need a password to use the root account. As with all break-ins or suspected break-ins, to be on the safe side you should recover any data that you can (making sure that they haven't been tainted) then format the hard-disk (or better still, put in a new hard-disk, keeping the old one for analysis) and re-install. -- 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 -- /* Cats are intended to teach us that not everything in nature has a function. -- Garrison Keillor */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately
[PHP-DB] silly problem
$sql = UPDATE dagensfraga SET nej = '$nej' WHERE id = '$iid' AND aktuellfraga = '1'; mysql_query($sql); $sql = INSERT INTO dagensfragaip (aid, ip) VALUES('$iid', '$REMOTE_ADDR'); mysql_query(sql); when i run this only the first line is recorded into the databse?, when i run the second line in a mysql_prompt it adds just fine, so why dosent it add when the script runs? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Query problem
you can't use COL_NAME = NULL or COL_NAME = 'NULL' and get the desired results , you have to check for IS NULL/ IS NOT NULLSo, change the query to SELECT * FROM TABLE WHERE MY_FIELD IS NULL or, SELECT * FROM TABLE WHERE MY_FIELD IS NOT NULL From my understanding when you check for COL_NAME = 'Null' you're actually checking to see if your field contains a _string_ 'Null' hth jeff Boaz Yahav [EMAIL PROTECTED]To: Ron Allen [EMAIL PROTECTED], [EMAIL PROTECTED] .net.il cc: Subject: RE: [PHP-DB] Query problem 07/22/2003 03:16 PM Assuming you run MySQL, why don't you just remove the ' ? SELECT * FROM MyTable WHERE MyField=NULL Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. Share your code : http://addexample.weberdev.com -Original Message- From: Ron Allen [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Query problem I have done this in the past, but for some reason it isn't working now (maybe a moron). I am trying to select all of the empty or NULL fields in a column. This is what I have select * from ticket where Type = 'Line' and Closeddate = ' empty space' and have tried the following select * from ticket where Type = 'Line' and Closeddate = 'Null' select * from ticket where Type = 'Line' and Closeddate = 'NULL' any clues -- 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] silly problem
Because you forgot a $ before $sql in the second? Regards, Matthew Moldvan System Administrator Trilogy International, Inc. -Original Message- From: Patrik Fomin [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] silly problem $sql = UPDATE dagensfraga SET nej = '$nej' WHERE id = '$iid' AND aktuellfraga = '1'; mysql_query($sql); $sql = INSERT INTO dagensfragaip (aid, ip) VALUES('$iid', '$REMOTE_ADDR'); mysql_query(sql); when i run this only the first line is recorded into the databse?, when i run the second line in a mysql_prompt it adds just fine, so why dosent it add when the script runs? -- 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] silly problem
Typo in your second query call. Should be: mysql_query($sql); Rich -Original Message- From: Patrik Fomin [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] silly problem $sql = UPDATE dagensfraga SET nej = '$nej' WHERE id = '$iid' AND aktuellfraga = '1'; mysql_query($sql); $sql = INSERT INTO dagensfragaip (aid, ip) VALUES('$iid', '$REMOTE_ADDR'); mysql_query(sql); when i run this only the first line is recorded into the databse?, when i run the second line in a mysql_prompt it adds just fine, so why dosent it add when the script runs? -- 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] silly problem
yeah ofcourse, sometimes u can go blind stairing at the code and still not see it :D thanks Edward Peloke [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] you are missing the $ sign on your second mysql_query call -Original Message- From: Patrik Fomin [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] silly problem $sql = UPDATE dagensfraga SET nej = '$nej' WHERE id = '$iid' AND aktuellfraga = '1'; mysql_query($sql); $sql = INSERT INTO dagensfragaip (aid, ip) VALUES('$iid', '$REMOTE_ADDR'); mysql_query(sql); when i run this only the first line is recorded into the databse?, when i run the second line in a mysql_prompt it adds just fine, so why dosent it add when the script runs? -- 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] passing array data back to form in header?
Hi Guys, the topic pretty much covers it. I have a script and if it errors out.. I send a bunch of values back to the form. I'm having difficulity figuring out how to pass array data that is/was selected back to the form. I can send the non array values no problem - eg: header(Location: patternsedit.php?error=1id=.rawurlencode($id). designer=.rawurlencode($designer). name=.rawurlencode($name). overallDesc=.rawurlencode($overallDesc). patternsColumn=.rawurlencode($patternsColumn). patternsName=.rawurlencode($patternsName). price=.rawurlencode($price). alt1Title=.rawurlencode($alt1Title). alt1Desc=.rawurlencode($alt1Desc). alt2Title=.rawurlencode($alt2Title). alt2Desc=.rawurlencode($alt2Desc). alt3Title=.rawurlencode($alt3Title). alt3Desc=.rawurlencode($alt3Desc). alt4Title=.rawurlencode($alt4Title). alt4Desc=.rawurlencode($alt4Desc). alt5Title=.rawurlencode($alt5Title). alt5Desc=.rawurlencode($alt5Desc)); exit; No clue how to add array data to the above and then integrated it back with a form? Any thoughts? Thanks! Aaron
RE: [PHP-DB] PHP5.0, MySQL4.1, Apache2 on WinXP
PHP 5.0 doesn't come with mysql support... You have to get the libraries yourself... I think u can get them from mysql.com Might have to pay? I haven't totally figure out the implications of the no mysql in PHP 5.0 yet, but I know its not there. Ben -Original Message- From: Kai [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 4:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP5.0, MySQL4.1, Apache2 on WinXP I am having the hardest time getting PHP to install it's MySQL dll handlers, even tho it's supposed to be embedded, it refuses to do anything with MySQL. (Constant PHP Fatal error: Call to undefined function: mysql_connect() in C:\apache\Apache2\htdocs\example\index.php3 on line 8 killing the test script) I am kinda new to the php language, but I know I have it coded right in the file I am using, any clues on where/how I can get the MySQL PHP dlls to work right in this situation? oh, PHP works fine otherwise, as does apache and mysql in any other respects. the by-hand-install directions in the install.txt that came with php5 have been followed and double checked multiple times. Thanks for any help I can get, -Kai -- 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] pg_lo_read_all problems
Hi, I'm writing because I'm having trouble with the pg_lo_read_all function in PHP. Specifically, on my Mac OS X (latest stable PHP for Mac OS X) when I try to download a file with pg_lo_read_all it downloads fine but a few bits are different. I know this because the cmp(1) command tells me that the first line has changed. I'm sending headers first to set file type (Content-disposition) and file name (content-type I think). Any other experience with this problem? Can someone tell me if this works on another platform? Thanks! Justin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: passing array data back to form in header?
hi guys, why don't you store all this array data in the session cookies, unset it when you r not using it anymore? Because session can store object (include array) Aaron Wolski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Guys, the topic pretty much covers it. I have a script and if it errors out.. I send a bunch of values back to the form. I'm having difficulity figuring out how to pass array data that is/was selected back to the form. I can send the non array values no problem - eg: header(Location: patternsedit.php?error=1id=.rawurlencode($id). designer=.rawurlencode($designer). name=.rawurlencode($name). overallDesc=.rawurlencode($overallDesc). patternsColumn=.rawurlencode($patternsColumn). patternsName=.rawurlencode($patternsName). price=.rawurlencode($price). alt1Title=.rawurlencode($alt1Title). alt1Desc=.rawurlencode($alt1Desc). alt2Title=.rawurlencode($alt2Title). alt2Desc=.rawurlencode($alt2Desc). alt3Title=.rawurlencode($alt3Title). alt3Desc=.rawurlencode($alt3Desc). alt4Title=.rawurlencode($alt4Title). alt4Desc=.rawurlencode($alt4Desc). alt5Title=.rawurlencode($alt5Title). alt5Desc=.rawurlencode($alt5Desc)); exit; No clue how to add array data to the above and then integrated it back with a form? Any thoughts? Thanks! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] write to word..
hi, I'm just wondering if it is possible to write to a word document or any other file type that would allow for easy editing(besides txt) with out having to copy and past everything in? I'm looking to have a template perhaps in word and have the code insert variables from the database. If it is possible, could some one point me in the right direction. Like where to look in the manual. Thanks, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Passing n variables to a module
I'm trying to work out an application using the modular example of Post-Nuke, etc. But I'm having difficulty understanding how to pass any number of variables back to the modules. For example, to send data collected in a user registration form I might use: user_register($name, $address, $phone); with a function: function user_register($name, $addr, $phone) { ... } But in the Post-Nuke model everything is routed through gateway pages in the top-level directory and sent on to the modules. The function as called on the gateway page makes no mention of the individual variables - in fact the function call is universal, and the actual call is built on the fly from other variables in the URL string. There is a collection of $GLOBAL variables, e.g.: $var = array_merge($GLOBALS['HTTP_GET_VARS'], $GLOBALS['HTTP_POST_VARS']); but this does not seem to gather the variables from a form (at least I'm not seeing them when I test). Does anyone know what I'm missing here? Is there any way to generically collect the fields from a form and pass them with their keys (i.e. it should work for any number of fields). I'm sorry if this isn't perfectly clear - it may need someone conversant with Post-Nuke or similar apps. Thank you, Nelson I think I'm going to have a follow up to this one, but I'll wait and see if my understanding increases. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] WHY need to query 2x to get results
It worked like a charm. (initially I was trying to use reset() guess it was the wrong call) One other thing, The 1st call was supposed to get the Column Headers and the second to get the results. I thought they are independent of each other?? Guess not? thanks very much. Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -Original Message- From: Terry Riley [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 7:33 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] WHY need to query 2x to get results Because you have already fetched one row before outputting the record count. Therefore the row pointer is at the second record before you 'print out'. Try putting mysql_data_seek($result,0); in place of your second $result = mysql_query($sql); This should return the pointer to the first retreived record. Hope that helps Terry --Original Message- Hi, I have a code that goes like this. Scroll down to the -- sign. How come I need another $result = mysql_query($sql) at that location? If I don't have it, the results coming out will only start printing from the 2nd Row.. Omitting the 1st. Results as wanted row 1 value1 row 2 value2 row 3 value3 Getting this instead row 2 value2 row 3 value3 Pls Help. $result = mysql_query($sql); $num_results = mysql_num_rows($result); $row = mysql_fetch_row($result); echo 'ph4There are ' . $num_results; echo ' FA entries found/p/h4' . \n; echo 'table border=2 cellpadding=5' . \n; echo 'td colspan=' . sizeof($row) . ' align=center '; echo '/td' . \n; # === # Print out the Table Field Names # === echo '!-- Results Table Header Field Names --'; echo \n; echo 'tr' . \n; for ($k = 0; $k sizeof($row) ; $k++) { echo \t . 'td'; echo mysql_field_name($result,$k); echo /td \n; } # === # Print out the Table Results # === $result = mysql_query($sql); ---==WHY Is THIS needed for ($i = 0; $i $num_results ; $i++) { echo tr\n ; $row = mysql_fetch_row($result); for ($j = 0; $j 12 ; $j++) { echo \t . 'td'; echo $row[$j] ; echo /td \n; } echo /tr\n; } Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Pros/Cons Database vs Excel
Hi, I'm having a problem convincing my boss of the benefits of using a database vs just using excel as a way of tracking events. The boss' stance is that excel is more 'simple' columns can be expanded as and when it's wanted. You can put links into excel that points to files residing in the system (within the web server's reach), can be mailed out to distribution lists (some ppl are lazy to need to open up a browser, log on etc.. to view the data). It can be stored on the web server for retrieval later etc.. For a database, actually a database can do all of the above but to me, it's makes more sense as it can store all the above and provide additional functionality (as long as The code is written to make it more functional). Can anyone help me out and give me a few pointers on why using a database makes more sense then excel. What's needed: 1. Method for tracking sequence of events (sort of like experiment results) 2. Links embedded inside to relevent files (results of experiment) 3. Can be mailed around 4. additional fields can be added whenever wanted something like that.. Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php