[PHP-DB] New Member

2003-06-07 Thread David Blomstrom
Hi, this is my first post on this list. I've never used PHP, but I'm 
interested in exploring it, along with MySQL and Apache server software.

Very briefly, my main focus is on designing webpages. I've been unemployed 
for several months and have been using my extra time to learn new computer 
skills, primarily Dreamweaver and Cascading Style Sheets.

I'm working with Windows XP, but I'd like to get away from Windows 
eventually. I got Linux installed on my computer a couple months ago, but I 
haven't found time to learn it yet. Then I apparently forgot part of my 
password, so I'm locked out! So I'm going to stick with the Windows 
platform for now.

I started downloading MySQL just today, when one of your members 
recommended I join this list. He also recommended Apache, so I checked it 
out and discovered that you can download pre-configured packages of PHP, 
MySQL and Apache at 
http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/

So here are my first questions:

1. Which package should I download - the first one (Firepages phpdev)?

2. Since this is all new to me, I don't want to do anything that will 
somehow screw up my other software. I don't really understand servers and 
would like to ask if installing Apache will give me two servers, or will it 
replace IIS? I just want to make sure I can continue previewing my webpages 
and was concerned that I might somehow screw things up if I install Apache 
wrong. Eventually, it would probably be nice to have Apache software up and 
running on a Linux platform and use IIS on the Microsoft platform when 
necessary.

Finally, here's an example of my immediate goal, which I understand would 
involve MySQL and PHP: http://www.geobop.com/marini/2.htm I want to create 
really nice, interactive tables featuring information on the world's 
nations and animals. I posted the questions on this page to a Dreamweaver 
group, but they indicate where I'm headed.

Thanks!



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


[PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
hi,
i put a script together to scan a directory and its subdirectories for 
all mp3 files. the tag informations and path then should be put into a 
mysql database.
i included a script called mphp3.php from http://res.crea-bmb.de/mphp3/ 
which returns the needed tag info from one file.
the script to recursively scan a dir i got from groups.google.

using the mphp3.php with one file is simple (demo from website):
?
include(mphp3.php);
$info = New mphp3(2); 
$info-load(test.mp3); 
echo $info-title. is a nice song. it's encoded with.$info-
bitrate.kbps.;
?

my code to include the db:
?
  include(mphp3.php);

  mysql_connect(192.168.100.12,user,password) or die (no connect 
to db);
  mysql_select_db(music) or die (db does not exist);

  function scan_dir($dir)
{
$info = New mphp3(2);

$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi(^\.{1,2}$,$file))
{
continue;
}

if(is_dir($dir.$file))
{
scan_dir($dir.$file./);
}
else
{
$info-load(/.$dir.$file);

$query =insert into mp3 (
  file,
  path,
  artist,
  title,
  album)
values (
 '$info2-filename',
 '$dir',
 '$info2-v2_artist',
 '$info2-v2_title',
 '$info2-v2_album');;

mysql_query($query);
}
}
@closedir($handle);
}
scan_dir(mp3/);
?

but all it does is to put the path ($dir) into the database. everything 
else is ignored. an error does not occur. since the simple demo works 
fine i think its a problem with the validity of variables.
i'm new to php, so could anybody give me a hint on what mightbe wrong 
with my code please?

thanx a lot

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Allowee
Hi,

Where do you get $info2 from?
I only see $info in this function.

.: Allowee

 function scan_dir($dir)
 {
 $info = New mphp3(2);

 $handle = @opendir($dir);
 while ($file = @readdir ($handle))
 {
 if (eregi(^\.{1,2}$,$file))
 {
 continue;
 }

 if(is_dir($dir.$file))
 {
 scan_dir($dir.$file./);
 }
 else
 {
 $info-load(/.$dir.$file);

 $query =insert into mp3 (
   file,
   path,
   artist,
   title,
   album)
 values (
  '$info2-filename',
  '$dir',
  '$info2-v2_artist',
  '$info2-v2_title',
  '$info2-v2_album');;

 mysql_query($query);
 }
 }
 @closedir($handle);
 }
 scan_dir(mp3/);
 ?

 but all it does is to put the path ($dir) into the database. everything
 else is ignored. an error does not occur. since the simple demo works
 fine i think its a problem with the validity of variables.
 i'm new to php, so could anybody give me a hint on what mightbe wrong
 with my code please?

 thanx a lot


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



[PHP-DB] ?? php and mysql database question ??

2003-06-07 Thread JeRRy
Hello,

I have a question, not sure if what I am looking for
is available at all or a smaller program of the full
sized program I am looking for but thought I'd ask to
see if anyone knows of a program or a program they may
of created.

On my personal Computer I run a Windows OS and on my
server (located elsewhere) I run a linux OS.  Now on
my server I have PHP 4.0 installed as well as mysql
database installed.  But I am not always available
online to update the website/databse and wondered if
there is a way to do updates/tests my my personal
computer.  Test them offline and put them live when I
am happy with it.

The thing is on my personal computer I run a Windows
OS and was wondering if there is a program I can
install to have mysql database or a similar program to
mysql database to run my scripts offline?

I already have installed a PHP program that I can
run/test PHP scripts and thought I'd ask here if
anyone knew of a mysql one.  (I thought since a PHP
program is available on Windows OS maybe a mysql one
was too?)

If anyone can help me that would be great.  If not, it
was worth a shot!

If anyone has another idea of doing things offline let
me know, I am all ears.  (e.g. a similar database
program to mysql I can download for Windows OS .. I
don't mean MS ACCESS etc, needs to be linux like so I
can test my scripts offline and make MINOR  edits to
get it to work with mysql.  But would prefer a mysql
program if available.)

I need the program so I can test my PHP pages and do
database changes to work with my PHP pages.  As I do
on my live website.  (e.g. retrieve data from a
database, and send data to a database. etc...)

I'm not aware of a program for mysql on Windows OS but
thought to ask here and see if any of you people do or
know any in development.

Thanks for your time in advance.

Kind Regards,
Jerry



http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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



Re: [PHP-DB] ?? php and mysql database question ??

2003-06-07 Thread Allowee
 I already have installed a PHP program that I can
 run/test PHP scripts and thought I'd ask here if
 anyone knew of a mysql one.  (I thought since a PHP
 program is available on Windows OS maybe a mysql one
 was too?)

There is...

http://www.mysql.com/ for more info

.: Allowee


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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
hi allowee,

sorry, this was not meant to be. $info2 is supposed to be $info. my 
fault. but that is not the actual problem.

 Hi,
 
 Where do you get $info2 from?
 I only see $info in this function.
 
 .: Allowee
 
  function scan_dir($dir)
  {
  $info = New mphp3(2);
 
  $handle = @opendir($dir);
  while ($file = @readdir ($handle))
  {
  if (eregi(^\.{1,2}$,$file))
  {
  continue;
  }
 
  if(is_dir($dir.$file))
  {
  scan_dir($dir.$file./);
  }
  else
  {
  $info-load(/.$dir.$file);
 
  $query =insert into mp3 (
file,
path,
artist,
title,
album)
  values (
   '$info2-filename',
   '$dir',
   '$info2-v2_artist',
   '$info2-v2_title',
   '$info2-v2_album');;
 
  mysql_query($query);
  }
  }
  @closedir($handle);
  }
  scan_dir(mp3/);
  ?
 
  but all it does is to put the path ($dir) into the database. everything
  else is ignored. an error does not occur. since the simple demo works

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Allowee
hmmm,
maybe this code..

$info-load(/.$dir.$file);

if $dir = mp3s and $file = test.mp3
then it will load '/mp3s/test.mp3'

you got that directory?
I've seen the class and you are hiding the fopen error message, which could be 
the problem.

.: Allowee

On Saturday 07 June 2003 11:11, Ole Hornauer wrote:
 hi allowee,

 sorry, this was not meant to be. $info2 is supposed to be $info. my
 fault. but that is not the actual problem.

  Hi,
 
  Where do you get $info2 from?
  I only see $info in this function.
 
  .: Allowee
 
   function scan_dir($dir)
   {
   $info = New mphp3(2);
  
   $handle = @opendir($dir);
   while ($file = @readdir ($handle))
   {
   if (eregi(^\.{1,2}$,$file))
   {
   continue;
   }
  
   if(is_dir($dir.$file))
   {
   scan_dir($dir.$file./);
   }
   else
   {
   $info-load(/.$dir.$file);
  
   $query =insert into mp3 (
 file,
 path,
 artist,
 title,
 album)
   values (
'$info2-filename',
'$dir',
'$info2-v2_artist',
'$info2-v2_title',
'$info2-v2_album');;
  
   mysql_query($query);
   }
   }
   @closedir($handle);
   }
   scan_dir(mp3/);
   ?
  
   but all it does is to put the path ($dir) into the database. everything
   else is ignored. an error does not occur. since the simple demo works


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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ruprecht Helms
Hi,

 Where do you get $info2 from?
 I only see $info in this function.

I guess that the $info-values are formfieldvalues.
$info-[db-field] is normaly used within a whileloop for
outputing a select-statement.

In the case of formfieldvalues you can use $formfieldname.

 .: Allowee

  function scan_dir($dir)
...
  $query =insert into mp3 (
file,
path,
artist,
title,
album)
  values (
   '$info2-filename',
   '$dir',
   '$info2-v2_artist',
   '$info2-v2_title',
   '$info2-v2_album');;
 
  mysql_query($query);
...

Regards,
Ruprecht

--
Ruprecht Helms IT-Service und Softwareentwicklung

Tel./Fax  +49[0]7621 16 99 16
email:  [EMAIL PROTECTED]
Homep.http://www.rheyn.de

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Allowee
On Saturday 07 June 2003 11:20, Allowee wrote:
 hmmm,
 maybe this code..

 $info-load(/.$dir.$file);

 if $dir = mp3s and $file = test.mp3
 then it will load '/mp3s/test.mp3'

 you got that directory?
 I've seen the class and you are hiding the fopen error message, which could
 be the problem.

 .: Allowee


hmmm.
that won't work..

you can try
$info-load(./.$dir./.$file);

or simple..
$info-load($dir./.$file);

.: Allowee

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
well, you are right. the dir '/mp3' does not exist. 'mp3' is a subdir 
from my htdocs dir. so i think the right path should be 
'mp3/someartist/somesong', right?
i fixed that, but the original problem is still the same :(

 hmmm,
 maybe this code..
 
 $info-load(/.$dir.$file);
 
 if $dir = mp3s and $file = test.mp3
 then it will load '/mp3s/test.mp3'
 
 you got that directory?
 I've seen the class and you are hiding the fopen error message, which could be 
 the problem.
 
 .: Allowee
 
 On Saturday 07 June 2003 11:11, Ole Hornauer wrote:
  hi allowee,
 
  sorry, this was not meant to be. $info2 is supposed to be $info. my
  fault. but that is not the actual problem.
 
   Hi,
  
   Where do you get $info2 from?
   I only see $info in this function.
  
   .: Allowee
  
function scan_dir($dir)
{
$info = New mphp3(2);
   
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi(^\.{1,2}$,$file))
{
continue;
}
   
if(is_dir($dir.$file))
{
scan_dir($dir.$file./);
}
else
{
$info-load(/.$dir.$file);
   
$query =insert into mp3 (
  file,
  path,

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
moin,

sorry, my php-knowledge is not the best.
what do you mean with formfieldvalues?
i think $info-value is used to get the id3-tag info from the class, 
right? this worked for me in a more simple way without the recursive 
scan:

?
  include(mphp3.php);
  $info = New mphp3(2);

  mysql_connect(192.168.100.12,user,password);
  mysql_select_db(music);

  $info-load(test.mp3);

  $abfrage =insert into mp3 (
  file,
  artist,
  title,
  album)
   values (
 '$info-filename',
 '$info-v2_artist',
 '$info-v2_title',
 '$info-v2_album');;
  mysql_query($abfrage);
?

 Hi,
 
  Where do you get $info2 from?
  I only see $info in this function.
 
 I guess that the $info-values are formfieldvalues.
 $info-[db-field] is normaly used within a whileloop for
 outputing a select-statement.
 
 In the case of formfieldvalues you can use $formfieldname.
 
  .: Allowee
 
   function scan_dir($dir)
 ...
   $query =insert into mp3 (
 file,
 path,
 artist,
 title,
 album)
   values (
'$info2-filename',
'$dir',
'$info2-v2_artist',
'$info2-v2_title',
'$info2-v2_album');;
  
   mysql_query($query);
 ...
 
 Regards,
 Ruprecht
 
 --
 Ruprecht Helms IT-Service und Softwareentwicklung
 
 Tel./Fax  +49[0]7621 16 99 16
 email:  [EMAIL PROTECTED]
 Homep.http://www.rheyn.de
 

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



[PHP-DB] Re: ?? php and mysql database question ??

2003-06-07 Thread Ole Hornauer
hi,

u can install vmware (not freeware) on your windows machine and then 
install linux as a virtual machine. it behaves just like a real machine. 
works fine for me!

 Hello,
 
 I have a question, not sure if what I am looking for
 is available at all or a smaller program of the full
 sized program I am looking for but thought I'd ask to
 see if anyone knows of a program or a program they may
 of created.
 
 On my personal Computer I run a Windows OS and on my
 server (located elsewhere) I run a linux OS.  Now on
 my server I have PHP 4.0 installed as well as mysql
 database installed.  But I am not always available
 online to update the website/databse and wondered if
 there is a way to do updates/tests my my personal
 computer.  Test them offline and put them live when I
 am happy with it.
 
 The thing is on my personal computer I run a Windows
 OS and was wondering if there is a program I can
 install to have mysql database or a similar program to
 mysql database to run my scripts offline?
 
 I already have installed a PHP program that I can
 run/test PHP scripts and thought I'd ask here if
 anyone knew of a mysql one.  (I thought since a PHP
 program is available on Windows OS maybe a mysql one
 was too?)
 
 If anyone can help me that would be great.  If not, it
 was worth a shot!
 
 If anyone has another idea of doing things offline let
 me know, I am all ears.  (e.g. a similar database
 program to mysql I can download for Windows OS .. I
 don't mean MS ACCESS etc, needs to be linux like so I
 can test my scripts offline and make MINOR  edits to
 get it to work with mysql.  But would prefer a mysql
 program if available.)
 
 I need the program so I can test my PHP pages and do
 database changes to work with my PHP pages.  As I do
 on my live website.  (e.g. retrieve data from a
 database, and send data to a database. etc...)
 
 I'm not aware of a program for mysql on Windows OS but
 thought to ask here and see if any of you people do or
 know any in development.
 
 Thanks for your time in advance.
 

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



[PHP-DB] What must a (Windows) User do to query Oracle9i with oci8 functions

2003-06-07 Thread Jakob Mund
hi
i already found this in this newsgroup:

 Hi Robert

 Yes oci8 functions work fine with Oracle9i.

that's great :-)

but someone said something about Recompiling to use oci8 extension with
Oracle9i.
So now my question:
 What tasks are requiered to query Oracle9i DB with the oci8-extension ?



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



[PHP-DB] Problems with OCIFetchStatement()'s $skip and $return?

2003-06-07 Thread Sapporo
Hi,

I'm using OCIFetchStatement()'s undocumented parameter $return 
(http://de.php.net/manual/de/function.ocifetchstatement.php) to limit 
the number of rows fetched from a result set. Unfortunately, I 
sometimes get far less rows than expected.

Before I further investigate the issue, can anyone confirm problems 
with using OCIFetchStatement()'s $skip and $return parameters?

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


[PHP-DB] incrementing values

2003-06-07 Thread Merlin
Hi there,

is there a function in mysql to increment a value inside a field? I am
always doing this with php, just thought this might be really usefull?!

Thanx,

Merlin



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



Re: [PHP-DB] incrementing values

2003-06-07 Thread Becoming Digital
AUTO_INCREMENT
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Merlin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 03 June, 2003 17:56
Subject: [PHP-DB] incrementing values


Hi there,

is there a function in mysql to increment a value inside a field? I am
always doing this with php, just thought this might be really usefull?!

Thanx,

Merlin



-- 
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] problem with insert query

2003-06-07 Thread Ahmed Abdelaliem
hi
i am wrote a script to read e-malis from a file and insert it into the 
tables of database
i get error when i write it
here is the code
can anyone tell me what is wrong?

?
$mails=file(mails.txt);
$number_of_mails = count($mails);
for ($i=0; $i$number_of_mails; $i++){

@ $db = mysql_connect(localhost);
mysql_select_db(me2resh00);
$query = insert into recipients (recipient_name, recipient_email) values 
('friend', '.$mails[$i].');
$result = mysql_query($query);
if ($result)
	echo mysql_affected_rows(). affected.;

  }
?
here is the error that i get

Parse error: parse error in enter.php on line 9

and line 9 is

$query = insert into recipients (recipient_name, recipient_email) values 
('friend', '.$mails[$i].');

_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Re: [PHP-DB] Displaying groups from SELECT

2003-06-07 Thread m-kale
What I did to somewhat solve the problem of over calling mysql was to
initiate the query outside the loop (SELECT prod_name query), put the
results into an array and then use the array inside the while($cats) loop.

For example,

$sql=SELECT prod_name, cat_id FROM products;
$result=mysql_query($sql, $conn);

Be sure to get the cat_id too!  The go through the results and create an
associative array.  I don't have my php book in front of me so I can't
write out the code verbatim.  Plus it's Saturday morning.. the alcohol
hasn't left my brain from last night...  :)

Then, inside your while ( $cats = mysql_fetch_array( $result ) ) loop,
you call your array and compare each line with some equality test on
cat_id.  That should do the trick.

metin

PS. there's probably an mysql query that could do what you want.. just
can't think of it right now.


On Fri, 06 Jun 2003 23:55:46 -0400 Becoming Digital wrote:

 Thanks, Gürhan, but I think I needed to explain things better.  As is 
 generally
 a good idea, the categories are referenced in the product table by
 ID, not name.
 Additionally, this is something along the lines of what I already
 had.  I was
 trying to use only one query and make PHP do the remaining work.
 
 Here's the code I'm currently using, which I should have posted in
 the first
 place.
 
 ?
 $query = SELECT * FROM categories;
 $result = mysql_query( $query );
 $rows = mysql_num_rows( $result );
 
 print ul\n;
 
 while ( $cats = mysql_fetch_array( $result ) )
 {
 print li .$cats[cat_name] ./li;
 
 $queryB = SELECT prod_name FROM products
 WHERE prod_cat= .$cats[cat_id];
 $resultB = mysql_query( $queryB );
 print ul;
 
 while ( $items = mysql_fetch_array( $resultB ) )
 {
 print li .$items[prod_name] ./li;
 }
 
  print /ul;
 }
 
 print /ul;
 ?
 
 The more I think about it, the more it seems like I'll just have to
 use two
 queries.  I just didn't want to do so bcs the second query will run
 at least
 four times and it seemed inefficient.
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: Gürhan Özen [EMAIL PROTECTED]
 To: Becoming Digital [EMAIL PROTECTED]
 Cc: PHP-DB [EMAIL PROTECTED]
 Sent: Friday, 06 June, 2003 23:07
 Subject: Re: [PHP-DB] Displaying groups from SELECT
 
 
 On Fri, 2003-06-06 at 21:49, Becoming Digital wrote:
  I'm wearing the stupid hat today, so please pardon this.  I know I
 must be
  overlooking something.
 
  I have a small catalogue with two tables (categories, products)
 from which I'm
  trying to display items.  I'm trying to print the contents as below 
 without
  using two queries, but I'm having a difficult time with it.
 
  cat1
  prod1
  prod2
  cat2
  prod1
  prod2
  etc.
 
  I think this came up fairly recently, but I cannot for the life of
 me figure
 out
  what search terms would answer this question.  As you can see from
 the message
  subject, I don't even know how to refer to my problem.  Thanks a
 lot for all
  your help.
 
  Edward Dudlik
  Becoming Digital
  www.becomingdigital.com
 
 
   Hi Ed,
  The magic word is DISTINCT :)
 
  $query=SELECT DISTINCT(category) AS cat_name FROM table_name;
  $result=mysql_query($query);
  print ul;
  while ($row=mysql_fetch_array($result)) {
 print li.($row[cat_name]).;
 $query1=SELECT productname FROM tablename WHERE
 category=.($row[cat_name]).;
 $result1=mysql_query($query1);
 while ($row1=mysql_fetch_array($result1)) {
print li.($row1[productname]).;
 }
 print /ul;
 }
 
 print /ul;
 
 
 I hope this helps..
 
 
 
 
 
 -- 
 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] SQL Server connection error.

2003-06-07 Thread Russell Roberts-Spears
Hi,

I am new to PHP DB code and am currently struggling with the connection to 
SQL Server 2000. I am using ODBC and have created a System DSN with 
integrated NT security specifiying which DB etc. I have written the 
following code and posted it in the htdocs folder for Apache. (We are all 
running on Win2000 platforms, Web server is set apart from the DB server, 
but linked via LAN.

PHP code:

HEAD
 TITLEADODB Test in PHP/TITLE
/HEAD
BODY
 ?php
// simple conection

$cnx = odbc_connect('web', '', '');
//query
$SQL_Exec_String =  select * from TblClients;
//ejecucion query
$cur= odbc_exec( $cnx, $SQL_Exec_String );
echo  table border=1trthDni/ththNombre/th.
   thcodigo/ththciudad/th/tr\n;
  while( odbc_fetch_row( $cur ) ) {
 $Title= odbc_result( $cur, 1 );
 $Fname= odbc_result( $cur, 2 );
 $Surname= odbc_result( $cur, 3 );
 $Address1= odbc_result( $cur, 4 );
  echo trtd$Title/tdtd$Fname/td.
   td$Surname/tdtd$Address1/td/tr\n;
  }
  echo  /table;
?
/BODY
/HTML


I then get back the following error:



Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login 
failed for user 'PROTE\LATTITUDWEBSERV$'., SQL state 28000 in SQLConnect in 
C:\Apache\Apache2\htdocs\DBtest.php on line 9

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in 
C:\Apache\Apache2\htdocs\DBtest.php on line 10
DATA FROM SQL SERVER WITH PHP4 Cand_ID Password

Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result 
resource in C:\Apache\Apache2\htdocs\DBtest.php on line 14



Am at a loss as to why the error. Have created another DSN in same system 
which links in using VB to the same SQL Server using the same NT integrated 
security and it is fine, so I am a little perplexed.

Any help or pointers would be gratefully received

Best regards



Russell

_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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


Re: [PHP-DB] problem with insert query

2003-06-07 Thread Becoming Digital
Try this.  I made some minor syntax changes and added some error reporting.
While it may not fix things, it might help you figure out what's wrong.

?
$mails=file(mails.txt);
$number_of_mails = count($mails);

for ($i=0; $i$number_of_mails; $i++)
{
$link = @ mysql_connect(localhost)
or die( mysql_error() );
$db = mysql_select_db(me2resh00, $link);
$query = insert into recipients (recipient_name, recipient_email) values
(\friend\, \.$mails[$i].\);
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows(). affected.;
}
?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ahmed Abdelaliem [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 07 June, 2003 08:15
Subject: [PHP-DB] problem with insert query


hi
i am wrote a script to read e-malis from a file and insert it into the
tables of database
i get error when i write it
here is the code
can anyone tell me what is wrong?

?
$mails=file(mails.txt);
$number_of_mails = count($mails);

for ($i=0; $i$number_of_mails; $i++){

 @ $db = mysql_connect(localhost);
mysql_select_db(me2resh00);
$query = insert into recipients (recipient_name, recipient_email) values
('friend', '.$mails[$i].');
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows(). affected.;

   }
 ?


here is the error that i get

Parse error: parse error in enter.php on line 9


and line 9 is

$query = insert into recipients (recipient_name, recipient_email) values
('friend', '.$mails[$i].');

_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
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] Possible to store arrays in mySQL without explode()/implode()

2003-06-07 Thread Jakob Mund
is it possible to store an array in mySQL without using implode() /
explode(), like this:

$stuff['blob'] = string;
$stuff['hm'] = G-string;

mysql_query(INSERT INTO table VALUES ($stuff));

and if, who must the mysql table be defined ?

thx
Jakob 'iNstinct' Mund



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



[PHP-DB] Glitching install script.

2003-06-07 Thread Fulco of Scarborough
I'm still new to php and my syntax is not great. 

 

I am getting this notice: 

Notice: Undefined variable: begin in /home/wwwfulc/public_html/install.php
on line 21

 

When I hit subit it just prints  Completed. and doesn't update the
database at all. 

 

Can anyone help me find my glitch in this? 

 

You can see it in action here http://www.fulco.net/install.php

 

You can see the whole file (minus html tags at beginning and end) here
http://www.fulco.net/installphp.txt

Here's the code (minus the SQL Dump). 

PHP:

  _  

 

html

head

titleXenology Database Install Script/title

meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

/head

 

body bgcolor=#FF text=#00

?php

error_reporting(E_ALL);

require(xenosetup.php);

 

$con = mysql_connect($host, $user, $pass) or die (I cannot connect to the
database because: . mysql_error());

mysql_select_db($db, $con) or die(I cannot select the correct database
because:  . mysql_error());

 

if ($begin){

$sql = 'CREATE TABLE xeno(SQL DUMP HERE);

echo Completed.;

} else {

printf(a href=\%s?begin=1\Begin/abr, $PHP_SELF);

}

?

/body

/html

 

  _  



Your help is appreciated!

 

Yours in Service,

Jason Britton

Scar's http://st.fulco.net/  Legion

[EMAIL PROTECTED]

 

Vincit imitationem veritas.

 



Re: [PHP-DB] Possible to store arrays in mySQL withoutexplode()/implode()

2003-06-07 Thread Becoming Digital
Not that I'm aware of, but why don't you give it a shot.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Jakob Mund [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 07 June, 2003 09:04
Subject: [PHP-DB] Possible to store arrays in mySQL without explode()/implode()


is it possible to store an array in mySQL without using implode() /
explode(), like this:

$stuff['blob'] = string;
$stuff['hm'] = G-string;

mysql_query(INSERT INTO table VALUES ($stuff));

and if, who must the mysql table be defined ?

thx
Jakob 'iNstinct' Mund



-- 
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] problem with insert query

2003-06-07 Thread Jeff Shapiro

It seems to me that this code will not provide useful information:

if ($result)
echo mysql_affected_rows(). affected.;

If the insert was successful, it will always say 1 affected. Since 
you are only inserting one row at a time. 

On Sat, 07 Jun 2003 08:49:15 -0400, Becoming Digital wrote:
 Try this.  I made some minor syntax changes and added some error reporting.
 While it may not fix things, it might help you figure out what's wrong.
 
 ?
 $mails=file(mails.txt);
 $number_of_mails = count($mails);
 
 for ($i=0; $i$number_of_mails; $i++)
 {
 $link = @ mysql_connect(localhost)
 or die( mysql_error() );
 $db = mysql_select_db(me2resh00, $link);
 $query = insert into recipients (recipient_name, 
 recipient_email) values
 (\friend\, \.$mails[$i].\);
 $result = mysql_query($query);
 if ($result)
 echo mysql_affected_rows(). affected.;
 }
 ?
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: Ahmed Abdelaliem [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, 07 June, 2003 08:15
 Subject: [PHP-DB] problem with insert query
 
 
 hi
 i am wrote a script to read e-malis from a file and insert it into the
 tables of database
 i get error when i write it
 here is the code
 can anyone tell me what is wrong?
 
 ?
 $mails=file(mails.txt);
 $number_of_mails = count($mails);
 
 for ($i=0; $i$number_of_mails; $i++){
 
  @ $db = mysql_connect(localhost);
 mysql_select_db(me2resh00);
 $query = insert into recipients (recipient_name, recipient_email) values
 ('friend', '.$mails[$i].');
 $result = mysql_query($query);
 if ($result)
 echo mysql_affected_rows(). affected.;
 
}
  ?
 
 
 here is the error that i get
 
 Parse error: parse error in enter.php on line 9
 
 
 and line 9 is
 
 $query = insert into recipients (recipient_name, recipient_email) values
 ('friend', '.$mails[$i].');
---
Listserv only address.
Jeff Shapiro

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



RE: [PHP-DB] incrementing values

2003-06-07 Thread John W. Holmes
 is there a function in mysql to increment a value inside a field? I am
 always doing this with php, just thought this might be really
usefull?!

UPDATE table SET column = column + 1 WHERE ...

Like that?

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP-DB] Possible to store arrays in mySQL without explode()/implode()

2003-06-07 Thread Jason Wong
On Saturday 07 June 2003 21:04, Jakob Mund wrote:
 is it possible to store an array in mySQL without using implode() /
 explode(), like this:

 $stuff['blob'] = string;
 $stuff['hm'] = G-string;

 mysql_query(INSERT INTO table VALUES ($stuff));

serialize()

 and if, who must the mysql table be defined ?

Any *TEXT field large enough to hold it.

-- 
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
--
/*
It is better to have loved and lost -- much better.
*/


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



[PHP-DB] Loading database information from a text file

2003-06-07 Thread JeRRy
Hi,

I have a text file with all my database information
from creating databases to setting up tables.  I have
looked throught the mysql docs on how to load these on
from a text file via the mysql prompt.  But all I can
find is:

load data infile filename.txt into table whatever

But this is not what I am looking for. :(  As the
tables are already defined in the text file and the
appropiate database name to enter them into.

Is there a way to load these into the database
directly instead of doing each table seperately from
the mysql prompt? (not web admin)

Thanks in advance.

Kind Regards,
Jerry


http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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



Re: [PHP-DB] Displaying groups from SELECT

2003-06-07 Thread Kieu D. N. Trang
hey, you can join the two queries and make only one...

?
function get_inventory()
{
$query = SELECT c.cat_id, p.product_name FROM categories as c LEFT JOIN
products as p on (c.cat_id = p.cat_id);
$result = mysql_query( $query );
if ( mysql_num_rows($query)  0 )   
{
while ( $row = mysql_fetch_array($query, MYSQL_ASSOC) )
{
$res_array[] = array('cat_id' = $row['cat_id'],
'product_name' = $row['product_name']
);
}
if (is_array($res_array)
{
return $res_array;
}
else
{
return 0;
}
}
else
{
return 0;
}
}

//MAIN 

if (!$inventory = get_inventory()); 
{   
echo 'There is no result for your search.';
}
else
{
$counter = count($inventory);
for ($i=0; $i$counter; $i++)   
{
print ul\n;
$current_inventory = $inventory[$i['cat_id']];
$peek_inventory = $inventory[$i+1['cat_id']];
if ($current_inventory != $peek_inventory)  
{
print li . $current_inventory ./li; 
print /ul\n;
print ul;
print li . $inventory[$i['product_name']] . /li;
print /ul\n;
}
else
{
print li . $inventory[$i['product_name']] . /li;
}
print /ul;
}
}
?

i think this work...didn't and couldn't test it...   hope it's not too
late
KD

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



RE: [PHP-DB] Loading database information from a text file

2003-06-07 Thread John W. Holmes
 I have a text file with all my database information
 from creating databases to setting up tables.  I have
 looked throught the mysql docs on how to load these on
 from a text file via the mysql prompt.  But all I can
 find is:
 
 load data infile filename.txt into table whatever
 
 But this is not what I am looking for. :(  As the
 tables are already defined in the text file and the
 appropiate database name to enter them into.
 
 Is there a way to load these into the database
 directly instead of doing each table seperately from
 the mysql prompt? (not web admin)

Is this a mysqldump file? The file has all of the SQL statements that
you need to run? If so, just send it to mysql...

Mysql -uuser -ppassword database_name  filename.txt

You can call that through exec() if you want. The file must be proper
SQL, though. 

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP-DB] Re: ?? php and mysql database question ??

2003-06-07 Thread JeRRy
snip
hi,

u can install vmware (not freeware) on your windows
machine and then 
install linux as a virtual machine. it behaves just
like a real 
machine. 
works fine for me!
/snip

Yup I am aware of this but would be much better under
Windows itself, saves mucking around than if it is
possible.  Which it is.  :)  

I downloaded yesturday a Windows version of mysql that
runs via DOS.  Works a wonderful.  Does exactly what I
want being offline.  Now I have can do all my PHP and
mysql work offline as I have all the tools now for it.
 including the PHP server side to display php offline
correctly.

Thanks people for all your help in pointing me in the
right direction.  Mostly appreicated and I hope I can
help some of you in return sometime soon.

Now off to do my offline work. :)

Kind Regards,
Jerry

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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



[PHP-DB] Re: ?? php and mysql database question ??

2003-06-07 Thread JeRRy
snip
hi,

u can install vmware (not freeware) on your windows
machine and then 
install linux as a virtual machine. it behaves just
like a real 
machine. 
works fine for me!
/snip

Yup I am aware of this but would be much better under
Windows itself, saves mucking around than if it is
possible.  Which it is.  :)  

I downloaded yesturday a Windows version of mysql that
runs via DOS.  Works a wonderful.  Does exactly what I
want being offline.  Now I have can do all my PHP and
mysql work offline as I have all the tools now for it.
 including the PHP server side to display php offline
correctly.

Thanks people for all your help in pointing me in the
right direction.  Mostly appreicated and I hope I can
help some of you in return sometime soon.

Now off to do my offline work. :)

Kind Regards,
Jerry

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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