Re: [PHP-DB] Working query not able to run with PHP script.
Jonathan Villa wrote: Sorry, I meant referenced in another table not database On Thu, 2003-09-18 at 16:09, Jonathan Villa wrote: I have several tables I want to delete as well as their reference in another database The query produced is this: === DROP TABLE xxx.zorder_47629403705b7e7f0c97387559d8c811; DELETE FROM orders WHERE table_name = "zorder_47629403705b7e7f0c97387559d8c811"; DROP TABLE xxx.zorder_17d991f48de0fdd157c31e77780d919e; DELETE FROM orders WHERE table_name = "zorder_17d991f48de0fdd157c31e77780d919e"; DROP TABLE xxx.zorder_b2709995c3d487b7e19e878ccbbd19cd; DELETE FROM orders WHERE table_name = "zorder_b2709995c3d487b7e19e878ccbbd19cd"; DROP TABLE xxx.zorder_7702fe78ee529c001ee989afc5471b94; DELETE FROM orders WHERE table_name = "zorder_7702fe78ee529c001ee989afc5471b94"; DROP TABLE xxx.zorder_1b0ee4e8d5d556debe217074ccc62bbc; DELETE FROM orders WHERE table_name = "zorder_1b0ee4e8d5d556debe217074ccc62bbc"; DROP TABLE xxx.zorder_d1d918c6231328c09dee573201e81102; DELETE FROM orders WHERE table_name = "zorder_d1d918c6231328c09dee573201e81102"; DROP TABLE xxx.zorder_8d9f0fc5e5f4e64d1207063de7abcff1; DELETE FROM orders WHERE table_name = "zorder_8d9f0fc5e5f4e64d1207063de7abcff1"; === If I run this query in PHPMyAdmin or MySQL CC, and echo out mysql_error I get the following message You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ';DELETE FROM orders WHERE table_name = "zorder_47629403705b7e7f Here is my script... $sql = 'SELECT table_name FROM orders WHERE completed = "-00-00 00:00:00"'; $objRecordSet = new RecordSet($sql); $sql = ''; while ($rows = mysql_fetch_array($objRecordSet->getResultID())) { //$sql .= ' DROP TABLE xxx.'.$rows['table_name'].';DELETE FROM orders WHERE table_name = "'.$rows['table_name'].'";'; } $dbConn = mysql_connect("localhost", "root", "new-password"); mysql_select_db("xxx", $dbConn); mysql_query($sql, $dbConn); echo "".mysql_error(); Any ideas php won't let you execute multiple mysql statements in one mysql_query -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem in executing linux command from PHP
Gnanavel wrote: $output=exec("cp file1 file2"); echo "$output"; does not works. can any one help me out of this problem When I was executing the "cp" command it doesn't return anything. But it returned the name of the last file when i executed the "ls" `cp file1 file2` doesn't return anything - so your script probably is working as it correctly returns nothing. Thanks for help The problem is the file is not copied to destination folder. I experience the problem for all file modification commands like "mv" etc.. I am unable run a shell script file from php which contains file modification commands. the scripts are probably running as a user with insufficient rights to perform those operations to find out which user you are running as try -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Join problem (Firebird)
Evan Morris wrote: Hi all Say you have two tables, TABLE1 and TABLE2. Each table contains (amongst others) a field called SOMEVALUE Now, in TABLE1 SOMEVALUE contains "string1", but in TABLE2 SOMEVALUE contains "string2". Now you join these tables (on SOMEOTHERVALUE) and you loop through the results set: while ($row = ibase_fetch_object($sth)) { echo "$row -> SOMEVALUE"; }; This only echoes the value of SOMEVALUE last referred to in your SQL statement (obviously, because it has no way of differentiating between the two versions of SOMEVALUE). However, it does not work to do echo "$row->TABLE1.SOMEVALUE"; This has unexpected results (it echoes the literal text SOMEVALUE). alias the columns to a different name using the keyword 'as' SELECT t1.SOMEVALUE as somevalue1, t1.SOMEOTHERVALUE, t2.SOMEVALUE as somevalue2, t2.SOMEOTHERVALUE from TABLE1 t1 JOIN TABLE2 t2 ON t1.SOMEOTHERVALUE = t2.SOMEOTHERVALUE echo $row->somevalue1 echo $row->somevalue2 -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem in executing linux command from PHP
Gnanavel wrote: I have problem in executing linux command $output=exec("ls -a"); echo "$output"; the above coding works, but $output=exec("cp file1 file2"); echo "$output"; does not works. can any one help me out of this problem When I was executing the "cp" command it doesn't return anything. But it returned the name of the last file when i executed the "ls" command try it on the command line .. `cp file1 file2` doesn't return anything - so your script probably is working as it correctly returns nothing. if you want to see output try `cp -v file1 file2` -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fw: Mysql Query
Mohammad Saadullah wrote: Hi guys, I am resending the same query again because still stuck on it. I have been working in php/oracle for quite some time now but recently had to shift myself to mysql and I am struggling with a particular query here. what is the query you would write for oracle ? Scenario is, certain researchers can submit their proposals > and those proposal are stored in a table researcher. [snip] -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] howto merge tables..
FB wrote: Hi, I have 3 similar tables. I want to merge them. The thing I use is 1) SELECT * 2) Make a while statement 3) INSERT each raw into the other table is there a easier way? FB if the columsn are identical insert into table1 select * from table2; insert into table1 select * from table3; if the column names are different insert into table12 (colname1, calname2) select colname3, colname4 from walks; the above works on mysql ... -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] array fill/sort question
Snijders, Mark wrote: hi, no the both sollutions won't work cause: I can't sort within a query cause subnetaddr is a varchar ("10.10.10.10") so it will be ordere like this 10.10.10.10 100.10.10.10 60.10.10.10 and that's not good cause 60 is smaller as 100, so with the function ip2long() i will first make an integer of it the second array solution you gave, won't work, cause I need ALL the query results in the array, and that's the problem I can't handle if I would do it like you said, I can sort it, but then I have a sorted array and for each element I have to do a query again to get the other fields of the table, and that's not good (2500 rows) so can please still somebody help me with this? can you change the database format ? store the address as four ints - then you can concatenate them when you need to, and sort as you wish SELECT s_id, subnet_name, concat(subnetaddr1, '.', subnetaddr2, '.', subnetaddr3, '.', subnetaddr4) as subnetaddr ,subnetmask,dnsdomain, location, contact, ccn FROM subnets ORDER BY subnetaddr1, subnetaddr2, subnetaddr3, subnetaddr4; -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] TIMESTAMP -> Y-m-d
nabil wrote: Please help me how to print a timestamp string retrived from the database, and print it as -MM-DD use the mysql date_format fumction DATE_FORMAT(date,format) select date_format(date_field, '%Y-%m-%d') from data; see the mysql docs for more details -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Access denied for user: '@localhost'
Hi, this problem seems to have appeared after a system upgrade ... command line works fine mysql -uschool -pbonfire school BUT /* Connecting, selecting database */ $link = mysql_connect("localhost", "school", "bonfire") or die("Could not connect : " . mysql_error()); print "Connected successfully"; mysql_select_db("school") or die("Could not select database". mysql_error()); ?> results in the following error Connected successfully Could not select database Access denied for user: '@localhost' to database 'school' the logfile shows this ... 030602 18:47:01 33 Connect [EMAIL PROTECTED] as anonymous on 33 Init DB Access denied for user: '@localhost' to database 'school' 33 Quit Any ideas why the connection is being made as anonymous instead of with the details supplied ??? I'm running debian/testing which is up to date and all relavent systems are default install with some config changes... I've tried re-building from scratch apache + php using the latest tarballs (installed to a different location) and still get the same error I've also tried connecting to a different mysql server (same error) - in fact php still tries to connect to localhost ! I'll try installing a new version of mysql ... but any other ideas would be much appreciated -- Sean -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php