Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Eric Lee
On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote:

 Hi all,

 I'm currently having a problem correctly formatting a table within a while
 loop.  I'm using an object to store the results of a query, and using the
 while to iterate through it each row to produce the output:

 $query = SELECT * FROM foo WHERE UserID =  .$uID .  ORDER BY bar;
 $result = mysql_query($query);

 while($obj = mysql_fetch_object($result))
 {
$obj-bar;
 }

 To properly format the table, I need to check the value of bar in the next
 iteration of the object (but have to do it on the current one). Using an
 array, I would do:

 next($obj);
 if($obj[bar] == something)
 {
//do things
 }
 prev($obj);

 Is there an equivalent to object?  I've tried the above method, but nothing
 happens.  I've also tried type casting it to an array, without success.

 Is there anyway to iterate through this?


Paul

Is this the one you want ?

$sql = 'select id, name from test';
$result = mysql_query($sql);
$rows = array();
$row = null;
while ($row = mysql_fetch_object($result))
{
$rows[] = $row;
}

reset($rows);

for ($i = 0, $c = sizeof($rows) - 1; $i  $c; $i++)
{
next($rows);
if (current($rows)-name)
{
// something to do
}
prev($rows);

echo current($rows)-id, ' ', current($rows)-name, \n;

next($rows);
}

if (current($rows))
{
echo current($rows)-id, ' ', current($rows)-name, \n;

}

Regards,
Eric,


 Thanks,
 Paul

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Eric Lee
On Sat, Feb 13, 2010 at 7:46 AM, Paul Hollingworth devine...@msn.comwrote:

 Thanks for the code Eric, it seems to loosely provide the functionality
 that I'm after.

 Just out of interest though, is there no other way to find the next result
 row in an object apart from dumping it into an array?


Paul

Apologize  !

I think no. The resource returned by mysql_query acts like a pointer (or
cursor on database side) that point to the current record
in result set. Before it is able advanced to the next the record must
retrieved first.

Might some design patterns  be help for your situation.
And wait for some php pros that master in this area.


Regards,
Eric



Thanks,
 Paul


 Eric Lee wrote:

 On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote:

  Hi all,

 I'm currently having a problem correctly formatting a table within a
 while
 loop.  I'm using an object to store the results of a query, and using the
 while to iterate through it each row to produce the output:

 $query = SELECT * FROM foo WHERE UserID =  .$uID .  ORDER BY bar;
 $result = mysql_query($query);

 while($obj = mysql_fetch_object($result))
 {
   $obj-bar;
 }

 To properly format the table, I need to check the value of bar in the
 next
 iteration of the object (but have to do it on the current one). Using an
 array, I would do:

 next($obj);
 if($obj[bar] == something)
 {
   //do things
 }
 prev($obj);

 Is there an equivalent to object?  I've tried the above method, but
 nothing
 happens.  I've also tried type casting it to an array, without success.

 Is there anyway to iterate through this?


 Paul

 Is this the one you want ?

 $sql = 'select id, name from test';
 $result = mysql_query($sql);
 $rows = array();
 $row = null;
 while ($row = mysql_fetch_object($result))
 {
$rows[] = $row;
 }

 reset($rows);

 for ($i = 0, $c = sizeof($rows) - 1; $i  $c; $i++)
 {
next($rows);
if (current($rows)-name)
{
// something to do
}
prev($rows);

echo current($rows)-id, ' ', current($rows)-name, \n;

next($rows);
 }

 if (current($rows))
 {
echo current($rows)-id, ' ', current($rows)-name, \n;

 }

 Regards,
 Eric,


  Thanks,
 Paul

 --
 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] Upload_File

2010-02-10 Thread Eric Lee
On Wed, Feb 10, 2010 at 7:35 PM, Gunawan Wibisono landavi...@gmail.comwrote:

 u should type the error here
 and attach the file not type in msgbox below

 what permision for upload folder?

 On Wed, Feb 10, 2010 at 6:16 PM, Bilal Ahmad 
 engg.bilalma...@googlemail.com
  wrote:

  Hi I am trying to make a form to provide option to user to upload a file
 on
  a server.Here is the code for my upload.php. It checks all the conditions
  etc.. . This code works fine on localhost , and file is uploaded
  successfully. But when I use this script online on my server, it gives me
  error. couldn't figure out what is error.
  What I think is error in move_upload_file, but it isn't returning any
  error.
  File permissions on upload folder are 755.
 
 
 
  if((!empty($_FILES['uploaded_file'])) 
 ($_FILES['uploaded_file']['error']
  == 0)){
 
   $ok = 0;
   $filename = basename($_FILES['uploaded_file']['name']);
 
   $ext = substr($filename, strrpos($filename, '.') + 1);
 
   if (($ext == jpg || gif || png) 
 ($_FILES[uploaded_file][type]
  == image/jpeg || image/gif || image/png) 
  ($_FILES[uploaded_file][size]  2097152) ){
 
   $newname = 'upload/'.$filename;
 
   if (!file_exists($newname)) {
 
 if
  ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
 $ok = 1;
   echo It's done! The file has been saved as: .$newname;
 } else {
   echo Error: A problem occurred during file upload!;   //This
 one
  executes when ever i try to upload file on server.
 }
   } else {
  echo Error: File .$_FILES[uploaded_file][name]. already
  exists;
   }
   } else {
 echo Error: Only .jpg images under 2MB are accepted for upload;
   }
  } else {
   echo Error: No file uploaded;
  }
 


 Bilal

hmmm .. Some advice
is the  $_FILES  filled correcly
check if the apache server user able access to the upload folder
Check if the tmp is writable by apache user


Regards,
Eric,




   Thanks
  Bilal Farooq Ahmad
 



 --
 akan ada dimana mulut terkunci dan suara tak ada lagi..
 saat itu gunakanlah HP untuk melakukan SMS!!
 - ini aliran bedul.. bukan aliran aneh.
 tertawa sebelum tertawa didepan RSJ..



Re: [PHP-DB] FW: Oracle Finalizes Acquisition of Sun

2010-01-28 Thread Eric Lee
hmm, that' true now !!

Shall the mysql db become paid software !!



Regards,
Eric,


On Thu, Jan 28, 2010 at 11:44 PM, Bastien Koert phps...@gmail.com wrote:

 [snip]
 [/snip]

 PS We will now proceed to fire some 20,000 employees as they will no
 longer be needed.
 --

 Bastien

 Cat, the other other white meat

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Need help in PHP file Management System

2009-09-17 Thread Eric

- Original Message - 
From: nagendra prasad nagendra802...@gmail.com
To: Vinay Kannan viny...@gmail.com
Cc: php-db@lists.php.net
Sent: Friday, September 18, 2009 2:16 AM
Subject: Re: [PHP-DB] Need help in PHP file Management System


 Thanks Vinay,
 
 I think you are right. I thought about it but then server will have to
 manage huge set of folders. I also thought that what if we give a unique ID
 for each file for each user. So, when user wants to access his file the code
 should first checks if the unique ID and the username is matched. I just
 have a rough idea. If someone got my points please explain it to me. Am not
 sure this may be a solution.

This may or may not need.

hash the file to prevent unauthenticated modified.
version controlling.
tagging 

pls correct me if I'am wrong !!!

- Eric

 
 Guys plz help me
 
 Best,


Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Eric


http://myprojects.srhost.info
eric{at}myprojects{dot}srhost{dot}info
- Original Message - 
From: bateivan [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, June 17, 2008 11:19 PM
Subject: [PHP-DB] PHP-MySQL connection for particular module


: 
: Hello,
: 
: First of all, please, have in mind that I am new in this business.
: 
: I have a problem connecting with data base in one particular module. That's
: right. The rest of the modules can connect to db, update tables with new
: info but this one is refusing giving me message like this:
: 
: Warning: mysql_query() [function.mysql-query]: Access denied for user
: 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
: Foundation\Apache2.2\htdocs\login.php on line 17
: 

This error message state that you have provided a wrong username and / or 
password
use the die also to ensure the connection was created.

: Warning: mysql_query() [function.mysql-query]: A link to the server could
: not be established in
: D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
: line 17
: 
: 
: It is a authentication module and this is the fragment of the code which is
: giving me a hard time:
: 
: 
***
: ?php
: include $_SERVER['DOCUMENT_ROOT'].
: '/layout.php';
: 

Let's your included page on the same directory. Say f:\webroot\docroot
As
f:\webroot\docroot\layout.php
f:\webroot\docroot\login.php

then try change the line from

 include $_SERVER['DOCUMENT_ROOT'].
 '/layout.php';

to

$app_root = './';
 include ($app_root . 'layout.php');


: switch($_REQUEST['req']){ 
:
: case validate:
: 
:$validate = mysql_query(SELECT * FROM members
:WHERE username = '{$_POST['username']}'
:AND password = md5('{$_POST['password']}')
:);
: 
: etc
: 
: 
***
: 
: My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
: my program files are on D:\. All this may not be important but I listed
: anyway.
: It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
: replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
: 
: I am using persisten connection which should be on until you restart the
: server. I have a file included in every page for connection with MySQL and
: data base.
: PHP manual says that mysql_query reuses the existing connection or try to
: create one if not present (I think, according to the warning is trying to
: create one).
: I had been checking after each step using phpinfo() if the connection is
: there and it's there but for some reason the above fragment does not work.
: As I mentioned above the rest of my modules are working fine with mysql.
: 
: I checked the php.ini file. I compared it to php.ini.recomended from the
: .zip distribusion package and they are almost identical exept couple of
: things for error reporting.
: I, also checked FAQ, mail listings and other forums but it does not seem
: anybody had a similar problem.
: 
: In one of my tests I included a line for connection just before the problem
: lines, as described below, and it worked but my intention is to keep such
: lines in a separate files and include them in every page instead.
: 
: 
***
: ...
: 
: $link = mysql_pconnect('localhost', 'root', 'testing');
: 
: 
:$validate = mysql_query(SELECT * FROM members
:WHERE username = '{$_POST['username']}'
:AND password = md5('{$_POST['password']}')
:);
: etc.
: 
***
: 
: As I metioned, this is an authentication module and, may be, that's why is
: behaving diferently from the rest or I need to do some setup changes in
: php.ini which I am not familiar with.
: 
: If anyone has had simmilar problem I would appreciate his/her input. Please,
: help me resolve this mistery.
: 
: -- 
: View this message in context: 
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
: Sent from the Php - Database mailing list archive at Nabble.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] Can't get PHP PGSQL module to load

2008-06-03 Thread Eric

- Original Message - 
From: Zimmerli, David [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, June 03, 2008 10:56 PM
Subject: [PHP-DB] Can't get PHP PGSQL module to load


: 
: 
: Hello all,
: 
:  
: 
: I am trying to use PostGreSQL with PHP (using Apache on Windows), but can't
: get the php_pgsql.dll module to load.  
: 
:  
: 
: phpinfo() reports that the loaded configuration file is C:\Program
: Files\PHP\php.ini.  (It also reports that the Configuration File (php.ini)
: Path  is C:\WINDOWS - I tried copying php.ini to that directory, but
: still no luck).  In php.ini, I have the lines
: 
:  
: 
: -- Begin php.ini excerpt
: --
: 
:  
: 
: extension_dir = .\extensions
: 
: ; I've also tried .\ext here, and am not actually sure what the . is
: relative to
: 
:  
: 
: extension=php_pgsql.dll
: 
: ; I've copied php_pgsql.dll to C:\Program Files\PHP\ext and C:\Apache
: Software Foundation\Apache2.2\htdocs\mediawiki\extensions
: 
:  
: 
: -- End php.ini excerpt
: --
: 
:  
: 
: I have tried various things in php.ini, and stopped and restarted Apache
: each time.  But each time phpinfo() and get_loaded_extensions() report that
: the module is not loaded.
: 
:  
: 
: I have also tried loading via dl():
: 
:  
: 
: if (!dl(php_pgsql.dll)) print load failed;
: 
: else print load succeeded;
: 
:  
: 
: but this reports that the load failed as well.  (I have enable_dl = On in
: php.ini.)
: 
:  
: 
: My set up is as follows:
: 
:  
: 
: WinXP Professional
: 
: Apache 2.2.4
: 
: PHP 5.2.6
: 
: PostGreSQL 8.3
: 
:  
: 
: I am installing everything from pre-built binaries.
: 
:  
: 
: Any help would be much appreciated.
: 
:  
: 
: Regards,
: 
: David Z.
: 
:  
: 
: 

PHP on windows does't support dl function except CGI and CLI.

Did you have an PHPIniDir in httpd.conf ?

It should point to a dir that specific the php.ini location as

PHPIniDir e:/winnt

and the extension_dir should be best specific with full path such as 

extension_dir = e:\webroot\php5\ext\

Also, please be sure you have followed all the steps from php manual's
installation chapter.

That have a new method for refering the php library.

Eric,


http://myprojects.srhost.info
eric{at}myprojects{dot}srhost{dot}info

[PHP-DB] phpexplorator has released phpexplorator

2007-02-08 Thread Tchouamou Eric Herve
Project phpexplorator ('phpexplorator') has released the new version of 
package
'phpexplorator'. You can download it from SourceForge.net by following this 
link:
https://sourceforge.net/project/showfiles.php?group_id=183073release_id=483795
or browse Release Notes and ChangeLog by visiting this link:
https://sourceforge.net/project/shownotes.php?release_id=483795


Description: phpexplorator is a web interface to remote explore, manage,
preview , edit, create, copy, rename, download, upload, zip, unzip ...etc,
files, images, and directory in the server site. Integrated with TinyMce,
useful for computer programmer and admin



Release Name: 2.0
Notes:
This new version can preview images in all your disk, and download a folder
in zip format. Explore your file remotely will be now very fast and will
more informations. Support preview of text files and images files. More than
50 new functionalities are available in this new version. All was write in
object oriented, you easily  use his file to be class and integrate it in
your personal application.
Thank and use with caution this admin appplication.
T.Eric.H




Changes:
- Better interface
- 4 differents login mode (challenge form, basic, url, apache, no)
- All object oriented
- More informations on files.
- More command to be use
- Preview of images
- Download directories
- Zip compression and download list of files and folders
- More configutions option
- Correct some bugs
- Move and copy array of folders and files with one click
- support apache icons, and apache configuration
- Icon internal saved in base64..etc


-- 
Eric Herve Tchouamou
http://www.tchouamou.homeunix.com
Via Portofino, 8 - 10135 Torino - Italy
phone: +39 011 3720145
Cel: +39 328 6928649
email: [EMAIL PROTECTED]



[PHP-DB] Re: Parsing CSV files into a MySQL Table

2004-11-02 Thread Eric McGrane
If what you have below is the exact SQL you have an error:

mysql_query (INSERT INTO 'footable' (foo1, foo2, foo3, foo4, foo5, foo6,
foo7) VALUES '$foo1', '$foo2', '$foo3', '$foo4', '$foo5', '$foo6',
'$foo7'));

should be

mysql_query (INSERT INTO 'footable' (foo1, foo2, foo3, foo4, foo5, foo6,
foo7) VALUES ('$foo1', '$foo2', '$foo3', '$foo4', '$foo5', '$foo6',
'$foo7'));

You are missing an opening paren after the VALUES keyword.  Using
mysql_error will help you catch these kinds of things.

E

Mark Benson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi, newbie here, go easy on me I'm learning this as I go ;)

 Got a bit of teaser here.

 //?php

 mysql_connect (localhost, foouser, foologin);

 mysql_select_db (footest1);

 $csvfile = file(http://foo.com/foolist.csv;);

 foreach($csvfile as $line_no = $datastring) {
 $data = explode (,, $datastring);
 $foo1 = $data[0];
 $foo2 = $data[1];
 $foo3 = $data[2];
 $foo4 = $data[3];
 $foo5 = $data[4];
 $foo6 = $data[5];
 $foo7 = $data[6];

 mysql_query (INSERT INTO 'footable' (foo1, foo2, foo3, foo4, foo5, foo6,
foo7)
 VALUES '$foo1', '$foo2', '$foo3', '$foo4', '$foo5', '$foo6', '$foo7'));
 }

 //?

 The result of the above is I get nothing INSERT-ed in 'footable'. No lines
of data at all. I looked in the table using phpMyAdmin and zilch.

 I have however dumped the contents of each variable in the 'foreach' loop
to the screen in a table and it all maps out correctly as i was in the CSV
file, so the CSV file is being parsed correctly. The fault seems to be in
the MySQL query I think.
 Privilages have no influence - I've tried both the database's 'regular'
users and also the 'root' user and it makes no odds.
 I've also tried dumping the list of single variables and using '($data[0],
$data[1] etc...) and that has no effect.

 It's probably something glaringly obvious to an expert but as I say I'm
learning as I go so any help would be great :)

 Thx.

 -- 
 Mark Benson

 http://homepage.mac.com/markbenson

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Database Design Recommendations

2004-11-02 Thread Eric Cranley
I tried to find this in the archives. If I missed it, my apologies in
advance.

I'm developing an intranet for my company, and we are planning on putting
sensitive information on it. I've already setup a login system using
sessions, but I'm not sure how to manage and store permissions, such as who
can view commissions, reset user passwords, etc. I've devised two methods,
but I have a feeling there's a better way to do this that I'm not thinking
of. I'll be storing these permissions in a MySQL database.

My first idea was a single field with the SET datatype. This allows for a
user to have multiple permissions, but makes it hard for other employees to
add permissions later, if they decide to restrict a previously open access
page. (I should mention that I'm the only person here who knows how to
adjust a table in MySQL, and I won't be around forever.)

My other idea solved the previously mentioned problem. I could create a
second table with employee permissions. It would have two fields,
employee_id and permission. Every employee would have one row for every
permission they had. I could also create a third table of page names and
required permission to view it, so if someone later decides that only
certain people should view a page, they can change it without coming to me.

What do people think of these ideas, and is there a better way to do this?
Thanks in advance.

Eric Cranley
IT Specialist
Willis Music Company

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Eric Schwartz
On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hello, I wonder if someone could point me in the right direction here.
 
 I have a table that is displayed that is also a form, and allowed a
 person to select a record to update using a radio button. With one of
 the fields of the form/table however, I would like it to display the
 value in the db (if there is one). If there is no value then I want the
 field to display the current time and then submit it to the db as a
 variable.
 
 I can get it to display the current time and submit it to the db, but I
 don't know how to do the IF bit of the form/table.
 
 Anyway, the code is below.
 Thanks
 
 ?
 $dbcnx = @mysql_connect( localhost, user, password);
 mysql_select_db(movements);
 $result = mysql_query(SELECT id, name, location, timein, timeout FROM
 workalone WHERE date=CURRENT_DATE()) or die (mysql_error());
 // Display the results of the query in a table
 print bCurrent Staff Working Alone/b;
 //below is the table/form with the id, name, location, timein and
 timeout taken from the db
 print table border=\1\ cellpadding=\3\ cellspacing=\0\\n;
 print
 trtd/tdtdbName/b/tdtdbLocation/b/tdtdbTime
 in/b/tdtdbTime Out/b/td/tr;
 while ($row = mysql_fetch_array($result, MYSQL_BOTH))
 {
 print trtd;
 print INPUT TYPE='RADIO' NAME='id' VALUE='.$row[id].';
 print /tdtd;
 print $row[name];
 print /tdtd;
 print $row[location];
 print /tdtd;
 print $row[timein];
 print /tdtd;
 //below is the IF thing I am having problems with
 ?input name=timeout type=text value=if {$timeout=null ?php
 echo date('H:i');?} else {?print $row[timeout];??
 print /td/tr\n;
 }
 print /table\n;
 
 ?input type=submit name=submit2 value=Select your name and click
 here to record your timeout/form   ?
 
 if ($submit2)
 {
 $dbcnx = @mysql_connect( localhost, user, password);
 mysql_select_db(movements);
 $result = mysql_query(UPDATE workalone SET timeout='$timeout' WHERE
 id='$id') or die (mysql_error());
 echo bThank you, your Time Out has been recorded./b;
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

You seem to have your php tags not around your if statement and you
are checking to see if $timeout rather than $row[timeout] has a
value.  I also think the proper way to check for NULL is to say IS
NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.


?php
if ($row[timeout] IS NULL) {
 echo date('H:i');
} else {
print $row[timeout];
}
?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Eric Schwartz
On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Thanks Eric,
 
 I have changed it somewhat but am just getting a parse error,
 unexpected T_STRING on that line.
 
 My revised code is below:
 
 
 print bCurrent Staff Working Alone/b;
 print /td/tr;
 print /table\n;
 print table border=\1\ cellpadding=\3\ cellspacing=\0\\n;
 print
 trtd/tdtdbName/b/tdtdbLocation/b/tdtdbTime
 in/b/tdtdbTime Out/b/td/tr;
 while ($row = mysql_fetch_array($result, MYSQL_BOTH))
 {
 print trtd;
 print INPUT TYPE='RADIO' NAME='id' VALUE='.$row[id].';
 print /tdtd;
 print $row[name];
 print /tdtd;
 print $row[location];
 print /tdtd;
 print $row[timein];
 print /tdtd;
 if ($row[timeout] IS NULL);
 {
 print input name=timeout type=text value=echo date('H:i');
 } else {
 print $row[timeout];
 }
 print /td/tr\n;
 }
 print /table\n;
 
 input type=submit name=submit2 value=Select your name and click
 here to record your timeout/form
 
 
 
 
 -Original Message-
 From: Eric Schwartz [mailto:[EMAIL PROTECTED]
 Sent: Friday, 6 August 2004 9:31 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Php if statement in a form
 
 On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  Hello, I wonder if someone could point me in the right direction here.
 
  I have a table that is displayed that is also a form, and allowed a
  person to select a record to update using a radio button. With one of
  the fields of the form/table however, I would like it to display the
  value in the db (if there is one). If there is no value then I want
 the
  field to display the current time and then submit it to the db as a
  variable.
 
  I can get it to display the current time and submit it to the db, but
 I
  don't know how to do the IF bit of the form/table.
 
  Anyway, the code is below.
  Thanks
 
  ?
  $dbcnx = @mysql_connect( localhost, user, password);
  mysql_select_db(movements);
  $result = mysql_query(SELECT id, name, location, timein, timeout FROM
  workalone WHERE date=CURRENT_DATE()) or die (mysql_error());
  // Display the results of the query in a table
  print bCurrent Staff Working Alone/b;
  //below is the table/form with the id, name, location, timein and
  timeout taken from the db
  print table border=\1\ cellpadding=\3\ cellspacing=\0\\n;
  print
  trtd/tdtdbName/b/tdtdbLocation/b/tdtdbTime
  in/b/tdtdbTime Out/b/td/tr;
  while ($row = mysql_fetch_array($result, MYSQL_BOTH))
  {
  print trtd;
  print INPUT TYPE='RADIO' NAME='id' VALUE='.$row[id].';
  print /tdtd;
  print $row[name];
  print /tdtd;
  print $row[location];
  print /tdtd;
  print $row[timein];
  print /tdtd;
  //below is the IF thing I am having problems with
  ?input name=timeout type=text value=if {$timeout=null ?php
  echo date('H:i');?} else {?print $row[timeout];??
  print /td/tr\n;
  }
  print /table\n;
 
  ?input type=submit name=submit2 value=Select your name and
 click
  here to record your timeout/form   ?
 
  if ($submit2)
  {
  $dbcnx = @mysql_connect( localhost, user, password);
  mysql_select_db(movements);
  $result = mysql_query(UPDATE workalone SET timeout='$timeout' WHERE
  id='$id') or die (mysql_error());
  echo bThank you, your Time Out has been recorded./b;
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 You seem to have your php tags not around your if statement and you
 are checking to see if $timeout rather than $row[timeout] has a
 value.  I also think the proper way to check for NULL is to say IS
 NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
 
 ?php
 if ($row[timeout] IS NULL) {
  echo date('H:i');
 } else {
 print $row[timeout];
 }
 ?
 
 --
 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
 
 

Try adding a quote on the line and escaping the other quotes, like this:

print input name=\timeout\ type=\text\ value=\.echo date('H:i').\;

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Eric Schwartz
Sorry.  Forgot to remove the word echo from that line.

On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
[EMAIL PROTECTED] wrote:
 On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  Thanks Eric,
 
  I have changed it somewhat but am just getting a parse error,
  unexpected T_STRING on that line.
 
  My revised code is below:
 
 
  print bCurrent Staff Working Alone/b;
  print /td/tr;
  print /table\n;
  print table border=\1\ cellpadding=\3\ cellspacing=\0\\n;
  print
  trtd/tdtdbName/b/tdtdbLocation/b/tdtdbTime
  in/b/tdtdbTime Out/b/td/tr;
  while ($row = mysql_fetch_array($result, MYSQL_BOTH))
  {
  print trtd;
  print INPUT TYPE='RADIO' NAME='id' VALUE='.$row[id].';
  print /tdtd;
  print $row[name];
  print /tdtd;
  print $row[location];
  print /tdtd;
  print $row[timein];
  print /tdtd;
  if ($row[timeout] IS NULL);
  {
  print input name=timeout type=text value=echo date('H:i');
  } else {
  print $row[timeout];
  }
  print /td/tr\n;
  }
  print /table\n;
 
  input type=submit name=submit2 value=Select your name and click
  here to record your timeout/form
 
 
 
 
  -Original Message-
  From: Eric Schwartz [mailto:[EMAIL PROTECTED]
  Sent: Friday, 6 August 2004 9:31 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Php if statement in a form
 
  On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
  [EMAIL PROTECTED] wrote:
   Hello, I wonder if someone could point me in the right direction here.
  
   I have a table that is displayed that is also a form, and allowed a
   person to select a record to update using a radio button. With one of
   the fields of the form/table however, I would like it to display the
   value in the db (if there is one). If there is no value then I want
  the
   field to display the current time and then submit it to the db as a
   variable.
  
   I can get it to display the current time and submit it to the db, but
  I
   don't know how to do the IF bit of the form/table.
  
   Anyway, the code is below.
   Thanks
  
   ?
   $dbcnx = @mysql_connect( localhost, user, password);
   mysql_select_db(movements);
   $result = mysql_query(SELECT id, name, location, timein, timeout FROM
   workalone WHERE date=CURRENT_DATE()) or die (mysql_error());
   // Display the results of the query in a table
   print bCurrent Staff Working Alone/b;
   //below is the table/form with the id, name, location, timein and
   timeout taken from the db
   print table border=\1\ cellpadding=\3\ cellspacing=\0\\n;
   print
   trtd/tdtdbName/b/tdtdbLocation/b/tdtdbTime
   in/b/tdtdbTime Out/b/td/tr;
   while ($row = mysql_fetch_array($result, MYSQL_BOTH))
   {
   print trtd;
   print INPUT TYPE='RADIO' NAME='id' VALUE='.$row[id].';
   print /tdtd;
   print $row[name];
   print /tdtd;
   print $row[location];
   print /tdtd;
   print $row[timein];
   print /tdtd;
   //below is the IF thing I am having problems with
   ?input name=timeout type=text value=if {$timeout=null ?php
   echo date('H:i');?} else {?print $row[timeout];??
   print /td/tr\n;
   }
   print /table\n;
  
   ?input type=submit name=submit2 value=Select your name and
  click
   here to record your timeout/form   ?
  
   if ($submit2)
   {
   $dbcnx = @mysql_connect( localhost, user, password);
   mysql_select_db(movements);
   $result = mysql_query(UPDATE workalone SET timeout='$timeout' WHERE
   id='$id') or die (mysql_error());
   echo bThank you, your Time Out has been recorded./b;
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
  You seem to have your php tags not around your if statement and you
  are checking to see if $timeout rather than $row[timeout] has a
  value.  I also think the proper way to check for NULL is to say IS
  NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
 
  ?php
  if ($row[timeout] IS NULL) {
   echo date('H:i');
  } else {
  print $row[timeout];
  }
  ?
 
  --
  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
 
 
 
 Try adding a quote on the line and escaping the other quotes, like this:
 
 print input name=\timeout\ type=\text\ value=\.echo date('H:i').\;


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problems switching from MySQL 3.23 - 4.0

2004-04-17 Thread Eric George
Bump?

[EMAIL PROTECTED] wrote:

Hi,
I have a page that grabs some data from a MySQL 3.23.58 database on a
RedHat 9 box.  I'm trying to migrate the db to a Suse box running MySQL 4.0.15.
When I connect to the MySQL 4.0 DB, I get strange results.  For example,
there's a certain query that just returns the number of records in one of
the tables:
   $c = $db-getOne(SELECT count(*) FROM tle);

   print($c);

Against the 3.23 DB, this works fine.  Against the 4.0 DB this prints out
Object.  Other queries return the same thing.
What gives??

Some more details:
Webserver Box:
RedHat 9
Apache 2.0.40
PHP 4.2.2
The MySQL 3.2.3 DB also runs on this box.  The MySQL 4.0 DB runs on a
seperate Suse box.
The Database structure  data is identical on both systems.

Ideas?
Thanks
Eric


-
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/
 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Curious if include_once will work better than include

2004-04-13 Thread Eric Girard
 Curious about include_once versus include.

 All my connection stuff is in conn.php3.

 I am planning on including it at the top of the page like this:
 include_once conn.php3;

 Now will that speed things up compared to just using a plain include. I
 call $connectionSDWIS(which is in the include) 5 different times?

IMHO the 'speed' difference between include and include_once will be
slight, probably with include_once being slower because of the overhead
needed to keep track of which files have been included already.  But this
isn't really what the question is about.  include and include_once will
not magically optimize the code for you, but if you include the same file
20 times that will be more that has to be parsed needlessly, so if you
can't keep track of your includes or if including a particular file more
than once will alter the result, than use include_once. Another
alternative is to use require() or require_once() to make sure that the
file is included.   Just my $.02,

Eric

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Distinct with Order By

2003-12-16 Thread Eric Blanpied
I'm looking for the last six different people to make entries to a table,
but this syntax:

SELECT DISTINCT Poster_ID FROM Posting ORDER BY Posting_Date DESC LIMIT 6;

Gives a result which is absolutely not ordered by date. Removing the
DISTINCT keyword results in a correct list of the last six people, but they
can all be the same person, which won't do.

I've found some reference on mysql.com to this being a tricky combination
(due to optimization), but there wasn't enough info there for me to go on.
It talked about using temporary tables, but that's out of my experience.

Can someone give me some advice on this?

-e

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Problem connecting with PostgreSQL in OS X

2003-03-09 Thread Eric Marsh
Good Morning,

I've got a J2EE program I've been working on for some time that has 
been connected to a FrontBase DBMS. Well as a result of my spending 
some time exploring the open source world I've decided to to change 
database to PostgreSQL.

I'm developing on Mac OS X and found a page on the Apple website 
describing how to set up PostgreSQL and then how to connect to it. I 
built and installed PostgreSQL and performed a couple simple operations 
to confirm that its working properly.

Next, to simplify administration I followed the instructions to install 
PHP and phpPgAdmin. Using the simple example script I was able to 
connect to the database with PHP. When I tried to use phpPgAdmin I was 
getting fail to login errors. Poking around the PHP code I discovered 
that if I commented out a line that added host=localhost  I was able 
to connect.

Does anyone have any idea why host=localhost is breaking my connection? 
Is there a configuration value I should be setting?

Thanks,

Eric Marsh

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] [[PHP-DB] Re: Get MySQL table schema for a dump

2003-02-26 Thread Eric Girard
Jonathan,
You can use Describe TABLENAME as a query and then use that information
to built you create statements.

Eric

Eric Girard
Varsity Crew Team
Computer Science major,
Management Information Systems minor,
Worcester Polytechnic Institute Class of '03

-Original Message-
From: Jonathan Villa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 26, 2003 6:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: Get MySQL table schema for a dump


Sorry, I should have explained that I want to do this via PHP.


--- Jonathan




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Fredrik de Vibe
Sent: Wednesday, February 26, 2003 5:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Get MySQL table schema for a dump

[EMAIL PROTECTED] (Jonathan Villa) writes:
 Is there was to get a database's table schema?

I don't think it's called schemas in mysql, but I'm not sure :-)

 So far, I have a simple function which will output
 INSERT INTO table (x,x,x,) VALUES(x,x,x);
 [ ... ]
 but what I'm missing is
 CREATE table blah, blah, blah

mysqldump is the tool you need.

e.g.
  $ mysqldump -u user [-p] Database  db_dump_file.sql

man mysqldump for more info.


--
--Fredrik
If God is dead, who will save the Queen?

--
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] Help with special characters in Oracle 8i

2002-09-12 Thread Eric John Seneca

 Hello All,
I am running PHP 4.2 with Oracle 8.1.7. I am trying execute the following 
statement. 

insert into job_application values 
(NULL,'Unix','Mobile','Alabama','http://www.google.com/search?q=php+insert+oracle+special+characters\hl=en\lr=\ie=UTF-8\oe=UTF-8\start=30\sa=N','12-SEP-02');

As you can see I am trying to insert a url into the database and it keeps dying on the 
special characters in the url. I have tried executing the following command in 
SqlPlus( set escape \ ) and this sql statement works from command line. I cannot make 
this work from my php script. Any insight into this problem would be appreciated.

Eric Seneca


RE: [PHP-DB] Struggling with PG SQL and Large Objects

2002-07-25 Thread eric . jones

CLASSIFICATION: UNCLASSIFIED

Do you have any examples of uploading via post and downloading via visiting
a download page for this?

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-Original Message-
From: Cornelia Boenigk [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 24, 2002 3:17 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Struggling with PG SQL and Large Objects


Hi Eric

 It was my understanding (from a friend) that I could actually store
the
 files in the database and thereby eliminate me having to setup
permissions

If you use the large-objects-interface then the files go somewhere else and
the references (OIDs) are stored in the tables.

Another way is to store large objects by using the PostgreSQL-datatype BYTEA
which is a octet-stream of your data. If you use this datatype the objects
will be stored in the tables directly. But you have to escape the stream
before storing and to unescape when you retrieve it. Since PHP 4.2 you can
use the function pg_escape_bytea() before inserting. To unescape the
selected data use stripcslashes(). I think this schould work.

Another way is to use base64_encode() to encode the data and then insert and
base64_decode() after you retrieved it. This way the data is also stored in
the table directly.

Greetings
Conni


-- 
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] Struggling with PG SQL and Large Objects

2002-07-24 Thread eric . jones

CLASSIFICATION: UNCLASSIFIED

I'm creating a script to upload documents (word, PDF, text, ppt, etc files)
to a PG 7.2 DB.

I currently can upload the file using pg_lo_import. I get back my OID which
I store in a separate table and I can remove the files using the unlink
command.

However for the life of me I cannot get the file to be downloaded from a
person's browsers. I keep getting an error that the file cannot be found.

Does anyone have an example or working script of how to download a file that
has been pg_lo_imported? I do not want to export the file unless I HAVE to..

Looking forward to your guidance!

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Struggling with PG SQL and Large Objects

2002-07-24 Thread eric . jones

CLASSIFICATION: UNCLASSIFIED

It was my understanding (from a friend) that I could actually store the
files in the database and thereby eliminate me having to setup permissions
for folders etc..

Am I wrong?

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-Original Message-
From: Cornelia Boenigk [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 24, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Struggling with PG SQL and Large Objects


Hi Eric

 I currently can upload the file using pg_lo_import. I get back my
OID which
 I store in a separate table
I think this is the point. PostgreSQL doesn't store the uploaded file
physically in the table but only the OID which is a reference to the file
which is stored in a system catalogue.

 and I can remove the files using the unlink
 command.
To remove the file you pass the OID and PHP does the rest. It means that you
do not access the uploaded file directyly but only its reference.

 However for the life of me I cannot get the file to be downloaded
from a
 person's browsers. I keep getting an error that the file cannot be
found.
Because you 'see' only the reference to this file and only PostgreSQL knows
the place on the harddisk where it is stored.

So if you want to make the uploaded files dowloadable why don't  you store
them somewhere in your filesystem and put the path into your database-table?

Greetings
Conni



-- 
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] PHP4 Not Seeing PostgreSQL 7.2

2002-07-22 Thread Eric

I completely understand what you are saying, thanks for the reply.

Here is what happen. We, first couldn't connect so someone asked if phpinfo
showed PSQL in the output and it did not.

This lead us to believe we had a compilation problem with PHP, Apache or
Postgres. So we stopped looking for problems in our php code and began
looking for problems in the way it was compiled our tools.

There are many references to pgsql.so and we could not get this shared
object to get created. We have pgsql.o however. Thus, we started renaming
the file and copying it to different strategic directories to try to get
PGSQL to show up in phpinfo.

Now, I assume PHPINFO is simply verifying the PGSQL connection by trying to
connect to it under the Apache account name?

The problem I have with all this, as a newbie and a long time C/C++ guy, is
that you have no idea where the problem lies. It would be better if PHPINFO
would at least show PGSQL is part of the environment but that it simply
couldn't connect, eh?  Maybe there is a way and I am just not seeing it
right now?

I am just getting my feet wet with PHP so I don't know how PHP libraries or
includes work yet. I chalk this up to the fact I am still GREEN in this
area. Under C/C++, DLLS always expose their inards regardless.

Thanks

Eric

Devrim Gunduz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 On Sun, 21 Jul 2002, Eric wrote:

 
  Our Apache web server runs under a unix account (of course).
 
  In the PostgreSQL world, you have to create a database user under the
  same name like so:
 
  ./createuser webserver
 
  Once we did this -- everything worked.
 
  What puzzles me though is that PHPINFO() doesn't even show that pgsql is
  compiled in when apparently it was there all along.


 Well, you are wrong... You do not need to use the same username of you web
 server...

 I mean, if you do NOT add a username parameter in your connection
 definition, then will use the username that you are running on.

 Let me explain like this:

 - If you connect via PHP and write
 pg_connect (dbname=mydb); -- PHP will think that you want to connect
 with the username that apache runs (maybe nobody, maybe another user)

 - If you connect via psql and write
 [devrim@oper devrim]$ psql mydb -- Then psql will assume that the
 username that it will use while connecting to PostgreSQL is devrim.

 So, use postgres user for your connections... Or use another username and
 grant access to that user.

 Best regards.

 --

 Devrim GUNDUZ

 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 Web : http://devrim.oper.metu.edu.tr
 -









-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] [PHP] pg_connect() unable to connect to PostgreSQL server :could not connect to server

2002-07-22 Thread Eric

I agree, Unix domain sockets very much faster.

You have to start POSTMASTER with the -i switch to get it to listen on the
designated port (5432 by default I think).

Eric
Devrim Gunduz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Hi,

 On Mon, 22 Jul 2002, Vincent wrote:

  Warning: pg_connect() unable to connect to PostgreSQL
  server: could not connect to server: Connection
  refused Is the server running on host localhost and
  accepting TCP/IP connections on port 5432? in
  /usr/local/apache/htdocs/postgresql.php on line 8
   Unable to connect to database

 Please avoid using host=localhost in pg_connect parameters.

 As far as I guess, you have not activated the TCP-IP port in
 postgresql.conf, and if you use host=localhost parameter, pg_connect will
 try to connect to PostgreSQL via TCP-IP. If you do not use that parameter,
 then it will connect to the database via Unix domain sockets, which is
 really faster than TCP-IP sockets (and more secure).

 HTH.

 Best regards.

  --

 Devrim GUNDUZ

 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 Web : http://devrim.oper.metu.edu.tr
 -








-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] ODBC MS SQL 7.0 Not closing connection

2001-12-12 Thread Eric Liedtke

I am not sure where this is going wrong so I am hoping to find an answer
on one of these 2 lists. I am using freetds/unixodbc in php to connect
to an MS SQL7 server. I was having some problems with the connection
hanging open, so I removed all me queries and trimmed my script down to
a simple db open and close, however my connection still stays open and
the odbc_close() fails. Here is the script...


?php
   putenv(ODBCINI=/usr/local/etc/odbc.ini);
   putenv(ODBCINSTINI=/usr/local/etc/odbcinst.ini);
   putenv(LD_LIBRARY_PATH=/usr/local/freetds/lib);
   $mydbhandle = odbc_connect(TroubleDB,,) or die (Could not
connect to the DBBR\n);
   odbc_close($mydbhandle) or die(Could not close db connection);
?
Any ideas on where to look? Thanks for the time

Eric Liedtke


-- 
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]




Re: [PHP-DB] unixODBC Question/Problem

2001-11-29 Thread Eric Liedtke

Eric Liedtke wrote:

 I am running PHP/Apache. I have installed unixODBC and inlinks tds 
 driver. I can succesfully connect and query an MS SQL db from the isql 
 command line testing tool provided with unixODBC. I recompiled php 
 with unixODBC support and it compiled and installed without a problem. 
 So it was onto writing the php. I can connect query and close the DB 
 fine. However my query results always have 1 of 2 things. Either they 
 are empty or the contain gibberish. At this point I don't know where 
 to start troubleshooting the breakdown. Any help would be greatly 
 appreciated. I don't know what info anyone might need from me, but 
 will be more than happy to provide it. Thanks in advance.
 Eric Liedtke

 p.s. on a google search I found only one other mention of this in a 
 dbforum website. sadly there were no replies to the posting there.


I just wanted to drop a note out that I got my problem fixed. This is what I did to 
fix it...

   putenv(ODBCINI=/usr/local/etc/odbc.ini);
   putenv(ODBCINSTINI=/usr/local/etc/odbcinst.ini);
   putenv(LD_LIBRARY_PATH=/usr/local/freetds/lib);

at the begining of the php script. Specifically the LD_LIBRARY_PATH did
it. Without it I get garbage. I have no idea why and would be curious if
there is any other solution, but regardless I just thought I'd point this
out. This actually came out of the example script in the iODBC php howto
page on iodbc.org.
Just and fyi
Eric Liedtke





-- 
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]




[PHP-DB] unixODBC Question/Problem

2001-11-21 Thread Eric Liedtke

I am running PHP/Apache. I have installed unixODBC and inlinks tds 
driver. I can succesfully connect and query an MS SQL db from the isql 
command line testing tool provided with unixODBC. I recompiled php with 
unixODBC support and it compiled and installed without a problem. So it 
was onto writing the php. I can connect query and close the DB fine. 
However my query results always have 1 of 2 things. Either they are 
empty or the contain gibberish. At this point I don't know where to 
start troubleshooting the breakdown. Any help would be greatly 
appreciated. I don't know what info anyone might need from me, but will 
be more than happy to provide it. Thanks in advance.
Eric Liedtke

p.s. on a google search I found only one other mention of this in a 
dbforum website. sadly there were no replies to the posting there.


-- 
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]




[PHP-DB] Re: Inserting CSV in MySQL

2001-10-05 Thread Eric Schmuttenmaer

1. Check for the special chars around the last entry as andre says.
2. Make sure your type and length of your type can hold the number of
records you are importing.

--
It's a good life, enjoy it. -  Jim Hensen

Eric Schmuttenmaer [[EMAIL PROTECTED]]




-- 
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]




Re: [PHP-DB] problem with WHILE loop

2001-10-01 Thread Eric J Schwinder

Thanks to everyone who replied either here or via e-mail... I got a lot of
great suggestions. I ended up solving the WHILE problem by changing this:

 $list = mysql_query(select id,title from table1);
 $list_row = mysql_fetch_array($list);
 $title = $list_row[title];

 while($list_row) {
 echo($title br\n);
 }

to this:

   $list = mysql_query(select id,title from table1);
   $title = $list_row[title];

   while($list_row = mysql_fetch_array($list)) {
   echo($title br\n);
   }


Eric Schwinder
eric.AT.bergencomputing.DOT.com
AT = @
DOT = (well... you know)



-- 
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]




[PHP-DB] problem with WHILE loop

2001-09-30 Thread Eric J Schwinder

I have the following code on a page:

?php
  $list = mysql_query(select id,title from table1);
  $list_row = mysql_fetch_array($list);
  $title = $list_row[title];

  while($list_row)  {
  echo($title br\n);
  }
?

For some reason, when I load the page, instead of a list of the titles from
table1, I get the title from the first row of table1 repeated over and over.

Obviously I'm doing something wrong, and it's probably something really
dumb, right in front of my face... but I can't find it!  help?

Thanks,

Eric Schwinder
eric.AT.bergencomputing.DOT.com
AT = @
DOT = (well... you know)



-- 
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]




RE: [PHP-DB] Sending text messages to cell phone with PHP?

2001-09-25 Thread Eric O'Connell

http://www.nextel.com/support/faq/textnumericmessagingfaq.shtml

basically it says to put in the 10-digit nextel number
@messaging.nextel.com and you can send it with SMTP.  I dunno if this is
what you need but hope it helps..

Eric O'Connell

 I am in the progress of setting up a script where a user can 
 goto a certain website, supply info like a message and their 
 name and instantly page someone on their cell phone by using 
 the PHP based web form. The text would then be sent to the 
 cell phone reciepents screen as it was typed on the web form.
 
 My problem is this.. I got a script at 
 http://www.hotscripts.com/Detailed/9816.html called 
 PHPmyPagers that supports SMS and ICQ messaging, which of 
 course I would use as SMS for what I was working with. Inside 
 the options.inc.php script, it asks for a $pagerservice 
 command which they document as the syntax of the paging 
 service of your service provider is inside the script comments.
 
 So here is my final question.. I have a Nextel cell phone 
 that supports text messaging and all that jazz. Does that 
 support SMS? And if It does, what is the server or IP address 
 I can use to send messages thru their network. If it doesn't 
 require their servers and I can use a current mailserver 
 domain, that would be cool.
 
 If any of you have any suggestions, let me know. It would be 
 great help to me and others who have always wondered how to 
 do this sort of thing :)

--
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]




Re: [PHP-DB] newbie needs to format time field

2001-09-05 Thread Eric J Schwinder

thanks so much, I've gotten a lot from that page of the mySQL
documentation... but I'm still needing little more help.  I am currently
using the following PHP to generate my page (with results displayed in
standard mySQL date and time formats):

   $db = mysql_connect(localhost, username, password);
   $result = mysql_query(SELECT * FROM table order by date,$db);
   $myrow = mysql_fetch_array($result));

   printf(%s,$myrow[date]);
   printf(%s,$myrow[time]);
   printf(%s,$myrow[description]);

Should I change my query to something like this:

  $result = mysql_query(SELECT *,DATE_FORMAT(date,'%m/%d/%y')) FROM
tableorder by date,$db);

I tried using that query, but then I didn't know how to get the formatted
date out of the array field in my PRINTF lines (what goes in the [  ]?)

Should I use two different queries, so that I have $result1 and $result2,
then $myrow1 and $myrow2, like this:

 $result1 = mysql_query(SELECT * FROM table order by date,$db);
 $result2 = mysql_query(SELECT DATE_FORMAT(date,'%m/%d/%y')) FROM table
order by date,$db);
 $myrow1 = mysql_fetch_array($result1));
 $myrow2 = mysql_fetch_array($result2));




Thanks for everyone's time if not for newsgroups, I don't how I'd learn
anything!

Eric Schwinder
eric.AT.bergencomputing.DOT.com




Torgil Zechel [EMAIL PROTECTED] wrote:
Checkout:
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
   
the function DATE_FORMAT(date,format) does what you want...
   

  I have a mySQL database that I am using PHP to interface with.  I have
  fields in the database that are DATE and TIME types.  Can I format these
  values so that the user sees September 15, 2001  or  2:00 PM
  instead of
  2001-09-15 and 14:00:00 when I show the values on the web page?
 




-- 
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]




[PHP-DB] newbie needs to format time field

2001-09-03 Thread Eric J Schwinder

This may be a dumb question but here goes:

I have a mySQL database that I am using PHP to interface with.  I have
fields in the database that are DATE and TIME types.  Can I format these
values so that the user sees September 15, 2001  or  2:00 PM  instead of
2001-09-15 and 14:00:00 when I show the values on the web page?

If so, can anyone suggest a reference which will help me do this?  I didn't
find anything in the mySQL or PHP manuals, but maybe I was looking in the
wrong places!  Thanks in advance from a relatively new PHP user!


Eric J Schwinder
eric.AT.bergencomputing.DOT.com



-- 
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]




[PHP-DB] NON sql database

2001-08-04 Thread Eric Marenyi

I am trying to develop a dynamic website, but I dont have the capability to
use SQL, or Access databases, can I use PHP to interface with a different
type of database?, maybe a text delimited, or something, please help, thanks

--
Eric Marenyi
CEO Virtual British Airways
http://www.virtualbritishairways.com



-- 
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]




[PHP-DB] Can't open dbm files with mod_php4-4.0.5_1

2001-05-22 Thread Eric Jan Pot

Hi,

I upgraded my server to Apache 1.3.19/mod-PHP4-4.0.5_1, but now I can not
open my 'older' dbm database files any more.
When I try to configure --with-dbm , I am not able to compile.

Thanks in advance,

Eric Pot



-- 
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]