[PHP-DB] Form-element for selecting data
Hello, I am looking for a Form-element for selecting data from one collection to another. You can see it as 2 multi-select boxes where you can move selected items from left to right or vice versa (Select 1 item select all, unselect 1 item, unselect all). Does anyone know some scripts that can do this for me? Kind regards, Erik
[PHP-DB] ODBC - PHP - Unicode problem
Hi all, I have an elusive problem with PHP and ODBC. I want to use ODBC to contact a MSSQL server on an NT box, from a linux machine. FreeTDS driver, no problem unixODBC, no problem I can contact the correct database on the NT box through isql and tsql, no problem I can make a command-line PHP script that queries the database, no problem BUT when I try to run the exact same script over a webserver (apache 1.3.34) I get the error Can't initiate unicode conversion and the db connection never gets made. Now I have no idea where to look. Any pointers? -Erik -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Struggling
Hope someone can help me. I have two tables: evt_details evt_sponsors The structure is as follows: evt_details evt_sponsors evt_detail_id (INT)(PK) evt_sponsor_id (INT)(PK) evt_detail_title(CHAR) evt_sponsor_name (CHAR) evt_sponsor_id1 (INT) NON-NULL evt_detail_date (date) evt_sponsor_id2 (INT) NULL evt_sponsor_id3 (INT) NULL evt_sponsor_id4 (INT) NULL Now, the event can have either 1 sponsor, 2 sponsors, 3 sponsors, or 4 sponsors. Is there a way where I can return a result whether it has 1, 2, 3, or 4 since some of the events will not have a 2d,3d, or 4th sponsor, a combination of 1 2, 1,2,3, or all 4 depending on the values in the table? Here is the query I have: SELECT e.evt_detail_title, a.evt_sponsor_name, b.evt_sponsor_name, c.evt_sponsor_name, d.evt_sponsor_name FROM evt_sponsors a, evt_sponsors b, evt_sponsors c, evt_sponsors d, evt_details e WHERE e.evt_detail_date = DATE_SUB(NOW(), INTERVAL 1 DAY) AND e.evt_sponsor_id1=a.evt_sponsor_id AND (e.evt_sponsor_id2=b.evt_sponsor_id OR e.evt_sponsor_id2=0) AND (e.evt_sponsor_id3 =c.evt_sponsor_id OR e.evt_sponsor_id3=0) AND (e.evt_sponsor_id4=d.evt_sponsor_id OR e.evt_sponsor_id4 =0) Thanks for the help, Erik W. Meyer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] headers and if statements
Have you tried: ?php if (!$login=1) {header(Location: loginerror.php);)? -Original Message- From: Daniel Clark [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 4:19 PM To: matthew perry Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] headers and if statements Hum. Is $logIn null at times?!?! ?if($logIn != 1) {header(Location: loginError.php);}? Why does this direct me to loginError.php even when $logIn = 1? - Matt -- 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] headers and if statements
I am testing now testing it with the ==, silly mistake -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 4:38 PM To: Erik Meyer; PHP-DB Subject: Re: [PHP-DB] headers and if statements From: Erik Meyer [EMAIL PROTECTED] Have you tried: ?php if (!$login=1) {header(Location: loginerror.php);)? Uhmm... Have _YOU_ tried that??? = vs == ? ;) ---John Holmes... -- 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] RE: [PHP] Adding a log file
Consider using this // // STDERR logging function // function warn( $msg, $die = 0 ) { $fp = fopen(php://stderr, 'w') or die(Failed to open STDERR); fwrite($fp, [.strftime(%Y-%m-%d %T).] $msg\n) or die(Failed to write to stderr); fclose($fp); if($die) die($msg); } This function will log all output to your Apache BASE error log. It's kind of like Perl's warn function for PHP. Also, it's good practice to use assertions... look into assert at http://php.net/assert Here is some sample usage... assert_options (ASSERT_ACTIVE, 1); assert_options (ASSERT_WARNING, 0); assert_options (ASSERT_QUIET_EVAL, 1); assert_options (ASSERT_BAIL, 1); // Create a handler function function assert_callback ($file, $line, $code) { $body = file($file); if(empty($code)) $code = trim($body[$line-1]); print hrfont color=redAssertion Failed:/fontbrul File '$file'br Line '$line'br Code '$code'br/ul; warn(Assertion failed ($code) in $file on line $line '$code'); print hr; } // Set up the callback assert_options (ASSERT_CALLBACK, 'assert_callback'); Regards, Erik Osterman http://osterman.com/ -Original Message- From: Robert Sossomon [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 7:38 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Adding a log file I am seeing some errors with a program I wrote and I need to write everything to a log file that the program is doing. The following syntax I KNOW is wrong, but not sure they are important to put here correctly yet. //script addtocart $Addcart (info1, info2) Mysqlquey($addcart) I am seeing random items NOT being added to my shopping cart. The reason, I have no clue. I can pull another catgory of items and the first 20 will do fine, I go back to the first category I have and the script seems to work correctly but the data is not written to the shopping cart. Problem with the shopping cart??? I wouldn't think so. Problem with the add page, I don't see how. So where is the error coming from? No clue, which is why I want to log everything. I use 3 different add pages so that each form uses a different way to add. This works for me, and seems to work rather well. But I need to log everything on the 3 forms to see where the errors are coming from. TIA! Robert ~~~ To rest is to rust. ~~~ -- PHP General 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] Retreive data from multiple columns by ['tablename.colname']
Hi, I use a query with multiple tables: SELECT * FROM cases,status,prio where cases.statusid=status.id . I retreive the data into my variable $line like this. while ($line = mysql_fetch_array($result)) {. How can I retreive data from $line without using the index value as integers for example $line[13] I would like to write $line['cases.id'] to retreive 'id' data from the table 'cases' in a SQL-manner. But I get an error message regarding unknown index 'cases.id'. Is there an easy solution to this? Is there another sign then '.' or should I use other names for my 'id'-columns such as c_id, s_id etc.? Regards Erik Björling -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Difficulty on how to extract data out of a text with string functions.
On Wednesday, March 6, 2002, at 01:49 PM, Andy wrote: I want to include some data into my website which covers malaria and yellow feewer related to each country. To each his own, I suppose... Now I have a table in a MySQL db naming all those countries. The goal is to extract the Yellow fever and Malaria line and put it into a mysql table related to the countries. I saw that PHP has some good functions on text, but do u guys think this could be done??? Doing it by hand could take alng loong while. You've got the right idea to write a script that can enter the data into the database, but PHP may not be the best language to do it. PHP is especially good at extracting data from text files or a database and then displaying it as HTML or any other format. If you want to enter the data into the database, take a look at the mysqlimport utility (which comes with most MySQL distributions). What I would do is write a Perl script that runs through the text file you made, and rearranges the data to be more acceptable to mysqlimport (I think mysqlimport requires its input in tab-delimited format). You could either write this rearranged data to a new file and run mysqlimport on that, or in Unix you can pipe the output from the Perl script directly to mysqlimport. The hard part is really going to be writing the Perl script, but I bet it won't be very hard. It really depends on how the data in your text file is arranged -- i.e., is it consistent, or random? I'm hoping that the actual file is a little more consistent than the examples you provided (i.e., not every entry has a malaria line or yellow fever line, and some entries have altitudes and capitals while others don't. If it's consistent, a Perl guru could probably help you with little trouble -- check out www.perlmonks.org. (Sorry, but I am far from a Perl guru.) Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] if variable is equal to 2 through 4
On Wednesday, February 6, 2002, at 04:10 PM, Jay Fitzgerald wrote: i am currently using this code: if ($variable == 2) || ($variable == 3) || ($variable == 4) { echo hello; } how would I write it if I wanted to say this: if $variable == 2 through 4 ??? if ($variable = 2) ($variable = 4) Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] PHP XML
I thought that short tags were illegal in XHTML and XML. But I could be wrong. On Friday, December 7, 2001, at 01:53 PM, Steve Haemelinck wrote: Hi Guys I am developing with PHP and XML. Now I experience some problem with the processing instructions of xml (?xml version=1.0 encoding=UTF-8?) which causes PHP to return a parsing error. This is logical because ? is also the short-tag processing instruction for PHP. Does anybody got an idea how to solve this problem without disabling the short-tags in the php.ini fiel ? Thx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
SV: [PHP-DB] mssql_connect() commandline problem
I wrote a script (? phpinfo(); ?) and executed it from the commandline (php script.php test.txt) turns out text.txt doesnt have sybase support listed at all - which the apache version of phpinfo has. could this be the problem? and if so, how do i enable sybase support for the commandline php? or can i setup so i run the apache configured php from the commandline also? thank you for your previous answer! Sounds like you might be working with 2 different versions of php: Mod-php for Apache in the web environment, stand-alone php operating in the shell. You might want to start by ensuring that the stand alone version is compiled -with mssql. Try running phpinfo() in the shell? Richard Erik wrote: When running a (php 4.0.6) script (on redhat 6.1) using mssql_connect() directly on the shell with php -q script.php i get a fatal error: Call to undefined function: mssql_connect() But this error does not occur when running the script through a browser (apache webserver) What's the deal here? Erik Kaber -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]