[PHP-DB] Re: Not sure what I am doing wrong here?

2002-07-23 Thread Jas

No kidding huh?  Thanks a ton.

David Robley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In article [EMAIL PROTECTED], [EMAIL PROTECTED]
 says...
  Ok, now I am not sure why I cannot get this output into a variable so I
can
  place it into a database table field.  Any help would be greatly
  appreciated.
  ?php
 
  /* Check client info and register */
  if (getenv(HTTP_X_FORWARDED_FOR)){
   $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
  } else {
   $ipaddy = getenv(REMOTE_ADDR);
   $host = gethostbyaddr($REMOTE_ADDR); }
 
  /* Start looking up users IP vs. WHOIS database for logging */
  $nipaddy = ;
  function message($msg){
  echo $msg;
  flush();
  }
  function arin($ipaddy){
  $server = whois.arin.net;
  if (!$ipaddy = gethostbyname($ipaddy))
$msg .= Can't IP Whois without an IP address.;
  else{
if (! $sock = fsockopen($server, 43, $num, $error, 20)){
  unset($sock);
  $msg .= Timed-out connecting to $server (port 43);
  }
else{
  fputs($sock, $ipaddy\n);
  while (!feof($sock))
$buffer .= fgets($sock, 10240);
  fclose($sock);
  }
 if (eregi(RIPE.NET, $buffer))
   $nextServer = whois.ripe.net;
 else if (eregi(whois.apnic.net, $buffer))
   $nextServer = whois.apnic.net;
 else if (eregi(nic.ad.jp, $buffer)){
   $nextServer = whois.nic.ad.jp;
   #/e suppresses Japanese character output from JPNIC
   $extra = /e;
   }
 else if (eregi(whois.registro.br, $buffer))
   $nextServer = whois.registro.br;
 if($nextServer){
   $buffer = ;
   message(Deferred to specific whois server:
$nextServer...brbr);
   if(! $sock = fsockopen($nextServer, 43, $num, $error, 10)){
 unset($sock);
 $msg .= Timed-out connecting to $nextServer (port 43);

 Hmm, seems your message is too long for my newsreader to include the lot.
 However, it seems that you may not be returning a value from the function
 arin(), so whan you do

 /* Place results into a var */
 $whois = arin($ipaddy); // Right now if this is here it will show in two
 areas of the screen

 natuarally nothing is placed in $whois.

 Cheers
 --
 David Robley
 Temporary Kiwi!

 Quod subigo farinam




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




[PHP-DB] obdc_pconnect problems

2002-07-23 Thread Escuder Nicolas

Hello,

i use php as not a cgi it is include in my apache
my odbc is a custom odbc driver


so i try to use odbc_pconnect, the first time it connect to the db i saw the 
connection tcp by netstat
and the next time (on the next page) i reuse pconnect with the same db user pass and 
sql cursor but it open 
a new connection, i see two connection with netstat ... and more connection if i go 
another page ...

i don't understand why ...

see you

nicolas.



[PHP-DB] obdc_pconnect problems

2002-07-23 Thread Escuder Nicolas


Hello,

i use php as not a cgi it is include in my apache
my odbc is a custom odbc driver


so i try to use odbc_pconnect, the first time it connect to the db i saw the 
connection tcp by netstat
and the next time (on the next page) i reuse pconnect with the same db user pass and 
sql cursor but it open 
a new connection, i see two connection with netstat ... and more connection if i go 
another page ...

i don't understand why ...

see you

nicolas.



[PHP-DB] Storing Variable Function Info

2002-07-23 Thread Raquel Rice

I've run out of ideas.  I want to store a variable name and a
function call in a text column of a MySQL database and have them
interpreted at runtime, but I can't figure out how to do it.  

Examples:
This is the $nbrtimes you've asked.
and
$answer is the square root of sqrt($nbr).

I've tried to figure out eval() but don't seem to be able to make
it work either.  Any ideas?

-- 
Raquel

They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety.
  --Benjamin Franklin


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




Re: [PHP-DB] odbc and primary key

2002-07-23 Thread salamander

Jaz,

http://www.php.net/manual/en/function.odbc-primarykeys.php

Best regards,
Andrew Hill

On Wednesday, July 17, 2002, at 08:16 AM, j.a.z. wrote:

 How can i get the information if a field on a database (in my case
 Access2000) is primary key via a php-odbc-function?
 or does i have to use sql for that?
 thanx j.a.z.



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

2002-07-23 Thread Pentothal

I guess this is the wrong place to ask for a new PHP
feature, but ... I don't know where else to ask!

I just want to signal to C skilled (and willing) people
here that there is a new interesting RDBMS server called
picoSQL (www.picosoft.it).

Besides beeing really small it's really full-featured and
fast. It's available for Linux and NT, it has a windows
ODBC driver (and JDBC driver, too), and ODBC 2.5 compliant
C/C++ API. It supports transactions, row level locking,
BLOBS, sub-queries and more...

Well: it needs a PHP module!

P.S.

Last but not least: it distributed under GPL !





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




[PHP-DB] What is a mysql link ressource

2002-07-23 Thread Mathieu Dumoulin

Ok guys i got this problem here:

I got a class i made that creates a link ressource for a mysql database.
Stores it inside of itself with different login and password and other
params. Other functions are also available for usage.

When i start this class it connects fine, i can also use it no problem.
BUT...At one point i start referencing this object to other objects so they
can use one and only one connection.

If one of these alternate objects using the connection does an error, i can
NO PROBLEM get the mysql_error() using the link ressource from inside the
alternate object. If i try to get the error from outside that object in my
top level script lets say, i use the one and only mysql_connection object
and it still fails. it's like it doesn't see the error. (I think it's
because the object is being copied, but i looked at my script several times
and i never see any copy.) My only guess is that a mysql_link resssource is
also an object and gets copied or lost somewhere in the middle.

Can anybody tell me what i could do???

(PS i didn't post all the source and the real login info...tehre is too much
to paste and also, it's too improtant to reveal anything)

SOURCE:
class mysql_connection{
 //Variables
 var $mysql_link;
 var $mysql_username;
 var $mysql_password;
 var $mysql_database;

 //Constructor(Establishes the connection)
 function mysql_connection($hostname, $username, $password, $database){
  //Connection to database
  $this-mysql_link = mysql_connect($hostname, $username, $password);
  if(!$this-mysql_link){
   //Display an error message
   exit(Error connecting to mysql server, contact web administrator or try
again later!);
  }
  //Select the database
  if(!mysql_select_db($database, $this-mysql_link)){
   //Display an error message
   exit(Error selecting database on mysql server, contact web administrator
or try again later!);
  }
 }
}

class arenas{

 //System objects
 var $mysql_server;
 var $item;

 //Variables/Arrays
 var $indexes = array();
 var $curindex = 0;

 //Constructor
 function arenas($mysql_server){
  //Store the server
  $this-mysql_server = $mysql_server;
  //Build the index
  $this-refresh();
 }
}

$mysql_server = new mysql_connection(localhost, username, password,
database);

//Get the arenas and the current item
$arenas = new arenas($mysql_server);

//At this point i would do a sql query from inside my arenas class that
would raise an error
//If i echo the error from inside the class using
//echo mysql_error($this-mysql_server-mysql_link);
//it works

//if i echo from the script itself like here it doesn't work
echo mysql_error($mysql_server-mysql_link);

//The first one will show something, the second will never show the error,
any clue why?



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




[PHP-DB] Re: Storing Variable Function Info

2002-07-23 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 I've run out of ideas.  I want to store a variable name and a
 function call in a text column of a MySQL database and have them
 interpreted at runtime, but I can't figure out how to do it.  
 
 Examples:
 This is the $nbrtimes you've asked.
 and
 $answer is the square root of sqrt($nbr).
 
 I've tried to figure out eval() but don't seem to be able to make
 it work either.  Any ideas?
 
 
Perhaps if you can show what you have tried and the problem you have had, 
someone may be able to help you further.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP-DB] Global variables, $_GET problem

2002-07-23 Thread Ruth Zhai

Hello php friends,
We just upgraded our PHP to version 4.2.1.  I realized that $var is no
longer available from www.url.com/myphp.php?var=3 .  As instructed in the
document, we have tried two things:
1. I tried to use $_GET('var'), however, I got Fatal error: Call to
undefined function: array() in /home/httpd/...  message.  I have no clue
what this means, and what I have done wrong.
2. Set register_globals = on in the configuration file.  This did not make
any difference.

I don's know what to do now.  Your help is highly appreciated.

Ruth



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




RE: [PHP-DB] Global variables, $_GET problem

2002-07-23 Thread Beau Lebens

Ruth,

your reference to $_GET('var') is close, but as you have seen - no cigar :)
using the () after GET makes it refer to a function, but it is actually an
array which is automatically created, so you need to use

$_GET['var'] (note the square brackets

as for point 2 (register_globals) did you restart the apache service after
changing it? because registering globals should make $var available again
(but won't help with problem 1 :)

HTH

Beau

// -Original Message-
// From: Ruth Zhai [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 24 July 2002 11:39 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] Global variables, $_GET problem
// 
// 
// Hello php friends,
// We just upgraded our PHP to version 4.2.1.  I realized that 
// $var is no
// longer available from www.url.com/myphp.php?var=3 .  As 
// instructed in the
// document, we have tried two things:
// 1. I tried to use $_GET('var'), however, I got Fatal error: Call to
// undefined function: array() in /home/httpd/...  message.  I 
// have no clue
// what this means, and what I have done wrong.
// 2. Set register_globals = on in the configuration file.  
// This did not make
// any difference.
// 
// I don's know what to do now.  Your help is highly appreciated.
// 
// Ruth
// 
// 
// 
// -- 
// 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] Global variables, $_GET problem

2002-07-23 Thread Jason Wong

On Wednesday 24 July 2002 11:38, Ruth Zhai wrote:

 We just upgraded our PHP to version 4.2.1.  I realized that $var is no
 longer available from www.url.com/myphp.php?var=3 .  As instructed in the
 document, we have tried two things:

Good, someone who reads the docs :)

 1. I tried to use $_GET('var'), however, I got Fatal error: Call to
 undefined function: array() in /home/httpd/...  message.  I have no clue
 what this means, and what I have done wrong.

It should be $GET['var'].

 2. Set register_globals = on in the configuration file.  This did not make
 any difference.

Did you restart the webserver? 
Did you make sure you're editing the correct php.ini? Check using phpinfo().

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Serocki's Stricture:
Marriage is always a bachelor's last option.
*/


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