Re: [PHP-DB] recursion in php and mysql

2007-03-01 Thread bedul
>>$row = mysql_fetch_array($result, $connection);
this is the problem
you should type
$row = mysql_fetch_array($result, MYSQL_NUM);

there not such things as $connection on the mysql_fetch_array
in mysql_query.. u use that connection.. but not in fetch array


array mysql_fetch_array ( resource result [, int result_type] )


- Original Message -
From: "Ron Croonenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, March 02, 2007 12:36 PM
Subject: Re: [PHP-DB] recursion in php and mysql


Hi Micah,

thanks I have a bunch of things working now.

mysql_fetch_array() is complaining.

I use it like this:

function recursive() {
global $connection;

$result = mysql_query("SELECT * FROM $table WHERE bthb4='$bthb4'",
$connection);
$row = mysql_fetch_array($result);
}

the error I got was:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in recursion.php on line 93

I tried: $row = mysql_fetch_array($result, $connection);

But I have the impression that $result  now isn't correct anymore ?

the mysql_fetch_array() is the only function (so far) that complains ?

thanks for your earlier very quick response,

Ron


>>> Micah Stevens <[EMAIL PROTECTED]> 03/02/07 12:04 AM >>>
Yep, just put the connect function outside your recursive loop. You can
then access the connection that is returned by the connect function by
making it global, or passing it by reference by the recursive function.

In other words:

$connection = mysql_connect();
mysql_select_db($database, $connection);

recursive_function($value);

function recursive_function($value)
{
global $connection;

$data = mysql_query($sql, $connection);

recursive_function($data);

}

... or something.. you get the picture.

-Micah



On 03/01/2007 08:52 PM, Ron Croonenberg wrote:
> Hello all,
>
> I wrote an app in php and it uses recursion.
>
> Problem I have is that when I connect to a database using
> mysql_connect($dbhost, $username, $password); and select a table with
> mysql_select_db($database) I cannot access the table anymore from some
> function.
>
> Now I can connect and select a database in that php function  but that
> means that process happens A LOT and connecting and selecting everytime
> probably slows down the app quite a bit
>
> Is there a way to connect to a database and select a table "globally"
> so that I have access to it in ever php function I write ?
>
> thanks,
>
> Ron
>
>

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



Re: [PHP-DB] recursion in php and mysql

2007-03-01 Thread Ron Croonenberg
Hi Micah,

thanks I have a bunch of things working now.

mysql_fetch_array() is complaining.

I use it like this:

function recursive() {
global $connection;

$result = mysql_query("SELECT * FROM $table WHERE bthb4='$bthb4'", $connection);
$row = mysql_fetch_array($result);
}

the error I got was:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result 
resource in recursion.php on line 93

I tried: $row = mysql_fetch_array($result, $connection);

But I have the impression that $result  now isn't correct anymore ?

the mysql_fetch_array() is the only function (so far) that complains ?

thanks for your earlier very quick response,

Ron


>>> Micah Stevens <[EMAIL PROTECTED]> 03/02/07 12:04 AM >>>
Yep, just put the connect function outside your recursive loop. You can 
then access the connection that is returned by the connect function by 
making it global, or passing it by reference by the recursive function.

In other words:

$connection = mysql_connect();
mysql_select_db($database, $connection);

recursive_function($value);

function recursive_function($value)
{
global $connection;

$data = mysql_query($sql, $connection);

recursive_function($data);

}

... or something.. you get the picture.

-Micah



On 03/01/2007 08:52 PM, Ron Croonenberg wrote:
> Hello all,
>
> I wrote an app in php and it uses recursion.
>
> Problem I have is that when I connect to a database using
> mysql_connect($dbhost, $username, $password); and select a table with
> mysql_select_db($database) I cannot access the table anymore from some
> function.
>
> Now I can connect and select a database in that php function  but that
> means that process happens A LOT and connecting and selecting everytime
> probably slows down the app quite a bit
>
> Is there a way to connect to a database and select a table "globally"
> so that I have access to it in ever php function I write ?
>
> thanks,
>
> Ron
>
>   

-- 
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] recursion in php and mysql

2007-03-01 Thread bedul
hmm.. i think there something going on on this func
mysql_select_db($database)
read more below
==

- Original Message - 
From: "Ron Croonenberg" <[EMAIL PROTECTED]>
To: 
Sent: Friday, March 02, 2007 11:52 AM
Subject: [PHP-DB] recursion in php and mysql


> Hello all,
> 
> I wrote an app in php and it uses recursion.
> 
> Problem I have is that when I connect to a database using
> mysql_connect($dbhost, $username, $password); and select a table with
> mysql_select_db($database) I cannot access the table anymore from some
> function.

try this
mysql_select_db($database) or die(mysql_error());
=

> Now I can connect and select a database in that php function  but that
> means that process happens A LOT and connecting and selecting everytime
> probably slows down the app quite a bit
> 
> Is there a way to connect to a database and select a table "globally"
> so that I have access to it in ever php function I write ?
> 
> thanks,
> 
> Ron

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



Re: [PHP-DB] recursion in php and mysql

2007-03-01 Thread Micah Stevens
Yep, just put the connect function outside your recursive loop. You can 
then access the connection that is returned by the connect function by 
making it global, or passing it by reference by the recursive function.


In other words:

$connection = mysql_connect();
mysql_select_db($database, $connection);

recursive_function($value);

function recursive_function($value)
{
global $connection;

$data = mysql_query($sql, $connection);

recursive_function($data);

}

... or something.. you get the picture.

-Micah



On 03/01/2007 08:52 PM, Ron Croonenberg wrote:

Hello all,

I wrote an app in php and it uses recursion.

Problem I have is that when I connect to a database using
mysql_connect($dbhost, $username, $password); and select a table with
mysql_select_db($database) I cannot access the table anymore from some
function.

Now I can connect and select a database in that php function  but that
means that process happens A LOT and connecting and selecting everytime
probably slows down the app quite a bit

Is there a way to connect to a database and select a table "globally"
so that I have access to it in ever php function I write ?

thanks,

Ron

  


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



[PHP-DB] recursion in php and mysql

2007-03-01 Thread Ron Croonenberg
Hello all,

I wrote an app in php and it uses recursion.

Problem I have is that when I connect to a database using
mysql_connect($dbhost, $username, $password); and select a table with
mysql_select_db($database) I cannot access the table anymore from some
function.

Now I can connect and select a database in that php function  but that
means that process happens A LOT and connecting and selecting everytime
probably slows down the app quite a bit

Is there a way to connect to a database and select a table "globally"
so that I have access to it in ever php function I write ?

thanks,

Ron

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



[PHP-DB] Re: [PHP-WIN] RE: [PHP-DB] auto upload

2007-03-01 Thread Austin Gruenweller >-]O
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I too think this would be the best way to do that.

Unless you secured your page well you could open yourself up to
something you might not like.

Bastien Koert wrote:
> What about just writing a batch script that opens the ftp services and
> sends the file?
> 
> Bastien
> 
> 
>> From: "bedul" <[EMAIL PROTECTED]>
>> To: ,
>> Subject: [PHP-DB] auto upload
>> Date: Thu, 1 Mar 2007 12:03:48 +0700
>>
>> this might a strange code i request, plz forgive my rudeness.
>>
>> everyday i was update a doc where i always put on d:\report\today.xls
>> where
>> i use a simple upload document prog (inside only box for upload only? and
>> submit). the file i upload will save on file folder (inside the upload
>> folder)
>>
>> today i want to skip that procedure.. i want to build this web where i
>> open
>> the site (http://server-e/upload/index.php) then click the
>> button/submit..
>> this button will triger action where i will upload the
>> d:\report\today.xls
>> file "without using browse/file input".
>>
>> can u help me?? i do know about the unsafe that metodh.. thx for your
>> attention.
>>
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 
> _
> Your Space. Your Friends. Your Stories. Share your world with Windows
> Live Spaces. http://spaces.live.com/?mkt=en-ca
> 

- --
 _ _ _
|_|@|_| Good order is the foundation of all things.
|_|_|@| http://php.uat.edu/~ausgruen/
|@|@|@| Public key available on pgp.mit.edu
 ¯ ¯ ¯
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFF5xyGWqsILSLH8toRAra/AJ4/pVNkmhQYMhjJ9DQ3QVz3HXh1/QCfbaBC
Wfr4nWsdm9LeaNGVYOsYCPk=
=D8Dh
-END PGP SIGNATURE-

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



RE: [PHP-DB] auto upload

2007-03-01 Thread Bastien Koert
What about just writing a batch script that opens the ftp services and sends 
the file?


Bastien



From: "bedul" <[EMAIL PROTECTED]>
To: ,
Subject: [PHP-DB] auto upload
Date: Thu, 1 Mar 2007 12:03:48 +0700

this might a strange code i request, plz forgive my rudeness.

everyday i was update a doc where i always put on d:\report\today.xls where
i use a simple upload document prog (inside only box for upload only? and
submit). the file i upload will save on file folder (inside the upload
folder)

today i want to skip that procedure.. i want to build this web where i open
the site (http://server-e/upload/index.php) then click the button/submit..
this button will triger action where i will upload the d:\report\today.xls
file "without using browse/file input".

can u help me?? i do know about the unsafe that metodh.. thx for your
attention.

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



_
Your Space. Your Friends. Your Stories. Share your world with Windows Live 
Spaces. http://spaces.live.com/?mkt=en-ca


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



[PHP-DB] Re: Creating a Table to line query results in php?

2007-03-01 Thread datsclark
You could also just use CSS.  Make each column in a div and line them up 
that way.  Might not be as simple as a table right off-the-bat, but if you 
have to make any changes later, its often easier.

A quick google search shows tons of tutorials on tables in css. 
http://css.nu/articles/table-in-css.html


"Scott" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi everyone!
>
> How can I create a table...or even something similar...to line information 
> up?
>
> The information is coming from an mysql database and there are 5
> columns of data.
>
> Of course I am using php to call the data out of the database.
>
> A simple example:
>
> while ($data = mysql_fetch_array($res))
> {
> $idfield = $data['IDFIELD'];
> $name = $data['Name'];
> $effect = $data['Effect'];
> $category = $data['Category'];
> $origin = $data['Origin'];
> $image = $data['Image'];
>
> echo ", $name, $effect, $category, $origin";
> }
>
> The echo is the stuff I want to line up under the headings of the
> columns when they are displayed.
>
> So there are 5 headers and under the 5 headers is the resulting
> display of info and I want it lined up, centered, under the headers.
>
> Does that all make sense?
>
> Thanks for all of your time!
>
> S 

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