[PHP] Password encyption

2004-07-02 Thread Anzak Wolf
I have been looking at a number of scripts and they all seem to use  
something like a config.php file where there is a var called something like 
$dbpasswd but the password is still clear text.  While I understand that the 
file only sets vars and it can be put outside the document root so that it 
cannot be accessed and you can protect it with permissions and all on the 
server, and you can even put a simple if statement to check that the script 
it was meant for is loading it.  But has anyone done something like 
encypting that password rather than leaving it in plan text.  Call me 
paranoid but I think I would rather play the little bit in overhead to 
decypt the password to give myself a slightly safer feel about my database 
password.

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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


Re: [PHP] Password encyption

2004-07-02 Thread Anzak Wolf
I realize the key needs to be stored somewhere which is part of the problem 
of how to make it a bit more secure.  I just don't feel safe if a password 
in a flat file in clear text.  Ideally the database should support something 
like an ssh style public/private Key auth where the private Key is stored 
internally to the database.  Though I don't know if any databases out there 
actaully do that or if it would be worth the time to set up and learn for 
me.

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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


RE: [PHP] Password encyption

2004-07-02 Thread Anzak Wolf
gt;[snip]
gt;I realize the key needs to be stored somewhere which is part of the
gt;problem of how to make it a bit more secure.  I just don't feel safe if
gt;a password in a flat file in clear text.  Ideally the database should
gt;support something
gt;like an ssh style public/private Key auth where the private Key is
gt;stored internally to the database.  Though I don't know if any databases
gt;out there actaully do that or if it would be worth the time to set up
gt;and learn for
gt;me.
gt;[/snip]
gt;
gt;Have you aactually checked the documentation of your database? It may be
gt;quite simple.
gt;
Yes I have looked though since I'm not 100% sure what I'm looking for it is 
hard to come up with a solid answer.  I'm just looking for a more secure way 
to connect to my database through PHP and was hoping to find some 
suggestions here, not get the run around.

_
Check out the latest news, polls and tools in the MSN 2004 Election Guide! 
http://special.msn.com/msn/election2004.armx

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


RE: [PHP] Password encyption

2004-07-02 Thread Anzak Wolf
gt;So host your own server.  That way nobody but you has access to it.
gt;Then you could store the password wherever you want, unecrypted, and it
gt;wouldn't matter.  If you're running an application that's that security
gt;conscious, you shouldn't be using a shared server anyway.
I do run my own server but I know for a fact that even if I harden the 
server as much as I can there is a chance that someone could gain access to 
that server.  While once they have root on the box they pretty much can do 
as they like, and my app really does not have  a huge security requirement, 
this is a learning processes for me and I'm always looking for a better/more 
secure way to do things.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


[PHP] Alpha Channel Question

2002-07-02 Thread Anzak Wolf

I'm having a small problem understanding Alpha channels.  I thought that the 
Alpha Channel was the level of transparency but the following code does not 
seem to work.

$DI = 50;
$MOD = 127/$DI;
ImageAlphaBlending($im, true);
for ($x=0; $x$DI; $x++) {
$AL = 127-$MOD*$x;
$GLColor=ImageColorResolveAlpha($im,255,255,255,$AL);
ImageFilledArc($im, $WD/2, $HT/2, $DI-$x, $DI-$x, 0, 360, $GLColor, 
4);
}


The idea is to create a simple glare effect by taking a white circle and 
making it more transparent around the edges.  Though this only produces a 
white circle with fuzzy edges.  Can anyone tell me what I'm doing wrong and 
clue me in on this whole Alpha Channel Biz.

-Jim

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: [PHP] Gradients using GD

2002-06-27 Thread Anzak Wolf

  After much pain and suffering I figured out how to do dual color 
Gradients
  using GD in an oval.  While it is not as clean as I'd like it works and 
can
  be tweaked as needed.  In the process I also found some very cool 
Gradient
  effects that could be used as well.  I'm currently working on writing a
  script that will take a parameter to determine which type to use then do
  the correct code of that.  Once I'm down I'll have about 12 different
  effects that people might be interested in.  If you are interested in
  Gradients let me know and I'll email you the code when I'm done with it
  (about a week or two).

Maybe you can wrap it up in a class and contribute it to

http://www.phpclasses.org

Was already planning to do that.  Maybe once I put it up there someone can 
help me get the whole thing to run faster because right now it is very math 
heavy and takes a good 10 Seconds to run.

-Jim

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: [PHP] Gradients in PHP GD

2002-06-26 Thread Anzak Wolf

I wrote a Color gradient in GD it is actually very simple.  Though you need 
GD 2.x and mine is designed to go from left to right changing the color to 
the center line then changing it back to the edge.  If your interested let 
me know and I'll send you a code snippet.  Though I would like to see 
someone who can show me how to do a gradient oval, I can do it in my image 
editing software so there must be a formula to do it I just need to know 
what it is.

-Jim

Exactly! Of course the change can be only across a part of an image.

Ville

  What do you mean by gradients?  Is it something like a gradual change 
across
  an image, say from black to white?
  Hugh
  - Original Message -
  From: Ville Mattila [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, June 25, 2002 10:38 AM
  Subject: [PHP] Gradients in PHP  GD
 
 
   Hello,
  
   Does anybody have an idea where could I find a code library or code
  snippet
   to create gradients to images with PHP and GD?
  
   Thank you,
   Ville Mattila
   Ikaalinen, Finland
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 





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


_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] Gradients using GD

2002-06-26 Thread Anzak Wolf

After much pain and suffering I figured out how to do dual color Gradients 
using GD in an oval.  While it is not as clean as I'd like it works and can 
be tweaked as needed.  In the process I also found some very cool Gradient 
effects that could be used as well.  I'm currently working on writing a 
script that will take a parameter to determine which type to use then do the 
correct code of that.  Once I'm down I'll have about 12 different effects 
that people might be interested in.  If you are interested in Gradients let 
me know and I'll email you the code when I'm done with it (about a week or 
two).

-Jim

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] POST/GET var problem

2002-06-12 Thread Anzak Wolf

take the following html code

form method=post
input type=image name=myimg src=something.gif
/form

Now when that is created by a php script the value that is passed back is 
the following.

myimg.x=Click loc Xmyimg.y=Click loc y

I could leave the name attribute off and I get an x/y value set that I can 
use for some math functions I have.  The problem is that I have more than 
one image that could be clicked on and depending on which you click on 
determines what math to do.

$HTTP_POST_VARS['myimg.x'] seems to be an object as I can't do the following
$x=$HTTP_POST_VARS['myimg.x'];

Anyone know how I can get this value into a variable I can use?

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




[PHP] Passing Values to an image script

2002-06-05 Thread Anzak Wolf

I'm stuck on an odd problem with sending values between scripts.  Take the 
following example.

$h=20;
$w=80;
print img src=\image.php?h=$hw=$w\;

Now this is a much watered down version of what I'm doing, but the idea is 
the same.  I don't want to put the values I'm passing to the image in the 
html code to be passed with a get.  I'd like to be able to maybe pass then 
in a POST format though I'm not sure how I can do that or if I can.  The 
other idea I had was to start a session and register $h and $w then when I 
start the images script I can connect to the session and get the values form 
there though I would have to use Arrays so that I could keep data on many 
diff. images.  I could pass the array index to the image script which would 
index all the array elements needed.  The only down side I can see to that 
is that I would have to serialize the array vars in order to maintain them 
between sessions (index.php and image.php) and I would have a higher over 
head on my session code which may impact preformance greatly.  Anyone have 
any ideas about this as in good idea bad idea, or other suggestions on how 
to pass this data without letting the user see it.

-Jim

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




Re: [PHP] Passing Values to an image script

2002-06-05 Thread Anzak Wolf

On Thu, 6 Jun 2002, Anzak Wolf wrote:
  $h=20;
  $w=80;
  print img src=\image.php?h=$hw=$w\;
 
  Now this is a much watered down version of what I'm doing, but the idea 
is
  the same.  I don't want to put the values I'm passing to the image in 
the
  html code to be passed with a get.  I'd like to be able to maybe pass 
then
  in a POST format though I'm not sure how I can do that or if I can.  The
  other idea I had was to start a session and register $h and $w then when 
I
  start the images script I can connect to the session and get the values 
form
  there though I would have to use Arrays so that I could keep data on 
many
  diff. images.  I could pass the array index to the image script which 
would
  index all the array elements needed.  The only down side I can see to 
that
  is that I would have to serialize the array vars in order to maintain 
them
  between sessions (index.php and image.php) and I would have a higher 
over
  head on my session code which may impact preformance greatly.  Anyone 
have
  any ideas about this as in good idea bad idea, or other suggestions on 
how
  to pass this data without letting the user see it.

You don't want them to see it for which reason?

1) It's highly confidential; or
2) It looks ugly; or
3) You don't want casual users messing with it...?

If 3, just base64 encode the serialized array of data and most people will
leave it alone (it'll just look like a string of random letters and
numbers)

Posting isn't that useful unless the image is going to show up on its own
in the web browser window.

Sessions are okay, but once people start using the back button you are
going to have some weird side effects.

miguel


It's not confidental, but I don't want users figuring out my backend image 
code from it.  While I'm not sure what they could do with it other than make 
images the way they want and display then for themselves I don't see any 
danger in it.  I just don't like messy long URL lines.  I'm already going to 
be giving the users a way to customize the site so they don't need to me 
messing with varibles passed to the image script.  As for your comment about 
the back button I have come up with a section of code for my site that stops 
user for doing much with the back or reload button.  I keep track of a link 
counter in a session var and then if they hit back or reload the link 
counter that gets sent in the post data is not equal to counter++ and so I 
redirect them to an error page that explains that the site does not allow 
the use of the back button or reload buttons.

-Jim

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




[PHP] GD 2.x formulas

2002-06-03 Thread Anzak Wolf

Does anyone know of a good site for GD 2.x formulas using Alpha channels?  
Currently I'm trying to make a color gradiant, but in an oval rather than a 
line.  I have a tools that can do this on an image, but my goal is to allow 
the color to be dynamic so I need to build it on the fly.

-Jim

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




[PHP] Global vars

2002-06-02 Thread Anzak Wolf

I have a question about global vars.  Why is it that I have to declare a var 
global if I'm using it across included files.  For example the only why I 
can get this var to work is by making it global.

main.php
?php
include loader.inc;
include builder.inc;
include render.inc;
?

loader.inc
?php
global $obj;
$obj = new Whiz_bang();
?

builder.inc
?php
global $obj;
$obj-build_whizzer();
?

render.inc
?php
render-html();
?

considering that if you took the could and just inserted the code form the 
included files into the main you would not need to make the var global why 
is that I need to when I cross files.  I don't think I have  read a good 
reasoning for this anywhere.  My goal is simple to use as few global vars as 
possible which is why I ask.

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] Images with GD

2002-05-17 Thread Anzak Wolf

I'm working on getting some image creation scripts done and I have one 
requirement that I'm not sure how to handle.  I have a base image that I can 
create with no problem.  The problem comes in that I want to set some text 
in the exact center of the image.  Is there some sort of formula I can use 
for finding the x,y point to start from based on a string and which font and 
angle I use in to create it so that I can get the text correctly centered?

-Jim

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




Re: [PHP] Re: mailing list using mail()

2002-04-10 Thread Anzak Wolf

Is there anyway you could break this up into managable chunks maybe.  I'm 
currently doing something similar in that I'm writing a PHP based list 
server app that uses a heirarchical grouping system, but mine is broken done 
into smaller chunks based on group and user permissions.  What if you did a 
1 second sleep between each user send?  While it would take a very long time 
to parse through the list of users the mail server would still be able to 
respond quickly and not have PHP timeout.








From: Yasuo Ohgaki [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: mailing list using mail()
Date: Wed, 10 Apr 2002 20:46:57 +0900
MIME-Version: 1.0
Received: from [216.92.131.4] by hotmail.com (3.2) with ESMTP id 
MHotMailBE7D714200A640043720D85C830472400; Wed, 10 Apr 2002 04:47:15 -0700
Received: (qmail 99799 invoked by uid 1010); 10 Apr 2002 11:47:04 -
Received: (qmail 99780 invoked by uid 1007); 10 Apr 2002 11:47:00 -
From php-general-return-92371-anzak Wed, 10 Apr 2002 04:47:23 -0700
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9+) 
Gecko/20020328
X-Accept-Language: ja, en-us, en
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED]
X-Posted-By: 210.154.73.126

Michael Virnstein wrote:
Should I just use one message and append the BCC: line of the one 
message?


this could probably be the best way.

Right, but some MTA cannot handle too large header(s).

Why don't you use list server in first place?
For example, ezmlm support database backends if you
are using qmail. PHP has ezmlm_hash function for it.

--
Yasuo Ohgaki




Petre Agenbag [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Hi,
the combination of PHP and mysql and the ease of use of the mail()
function obviously leads me to believe that it *should* be a singe to
use php to send customised messages to all my users , of whom I have
details in a mysql table by simply running a select * from table and
then using a while loop to run through every row and sending an e_mail
to $user_in_table.

The obvious problem here is that ( in my case 17 000 users) this can
easily kill the mail server and could also cause the script to timeout
or ( if increasing the timeout) kill the server outright.
So, what are my options?
Should I be attempting this ( if not, how can I keep others that are
hosting on my machines from trying this with their own tables)
Should I just use one message and append the BCC: line of the one 
message?

Thanks







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



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




[PHP] Function stored in a database

2002-04-09 Thread Anzak Wolf

I have a question about storing functions.  I have some security mode stuff 
I'm working on and what I'm thinking is that as part of the security mode 
table I would store a function that could be called if the security mode is 
called.

Something like this.
Select s.function from s Security g group where g.Group_name = something

I know I have the syntax wrong but this is just pseudo code.

Now in my php I would have something like this.

$func = get_row($result)

$func();

Would that work.

-Jim








_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




Re: [PHP] Assigning unique form names...

2002-04-08 Thread Anzak Wolf

I'm not sure if I can help you much here, but something I might suggest is 
going to a single page approach.  I have a class on www.phpclasses.org that 
you can download called Command Class.  Basicly the idea is that you have a 
single index.php file which loads your headers and footer information then 
based on a command and sub-command pair is does a database look up to find 
the file you wish to load as your content.  This way your form should always 
look like this.

form method=post
form data
/form

The only thing you would need to do is either as part of your form have a 
hidden field with the command and sub-command pair or you could have a 
script run after you create the $command object then set the command and 
subcommand based on the data you have then all you would need to do is when 
you are ready to display the page do a $command-load_command();  It works 
well for me though it is still early code and there might be some bugs and 
possible security issues I haven't worked out yet.

-Jim








_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




[PHP] List server

2002-04-02 Thread Anzak Wolf

Since no one seems to have heard of a php driven list server could someone 
get me started on writting my own by telling me who I would read from stdin.

-Jim








_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




Re: [PHP] List server

2002-04-02 Thread Anzak Wolf

On Tuesday 02 April 2002 22:10, Anzak Wolf wrote:
  Since no one seems to have heard of a php driven list server could 
someone
  get me started on writting my own by telling me who I would read from
  stdin.

fopen(php://stdin, r);


How does that relate to readline()?

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




[PHP] List server

2002-04-01 Thread Anzak Wolf

I thought I remember reading somewhere about a list server written in PHP.  
Does anyone know of something like this and is it any good?

-Jim








_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




[PHP] MySQL arrays

2002-03-26 Thread Anzak Wolf

I'm trying to do something a little different in my database class I have a 
method to do the query and store it in an array.

function query ($s = ) {
$q = mysql_query($s,$this-database_connect_id);
if (!$q) {
$tools-error(array(Query Resulted in NULL value));
return 0;
}
$len = sizeof($this-query);
$len++;
$this-query = array($len=$q);
mysql_free_result($q);
return $len;
}

function num_rows($q_id) {
// Set temp array to the selected query
$tq = $this-query[$q_id];
$rows = mysql_num_rows($tq);
return $rows;
}

When I do a var_dump of the two key vars I get the following

var_dump($this-query);
array(1) {
  [1]=
  resource(2) of type (mysql result)
}
var_dump($tq);
resource(2) of type (Unknown)

Here is the error that happens when I do the mysql_num_rows

br
bWarning/b:  2 is not a valid MySQL result resource in 
b/var/www/includes/database_class.php/b on line b77/bbr

any ideas as to what I can do to fix this so that I can store query for 
later use?

-Jim





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




RE: [PHP] MySQL arrays

2002-03-26 Thread Anzak Wolf


Sorry my mistake the array is $this-query_id the function is $query I still 
get the same results though.







From: Rick Emery [EMAIL PROTECTED]
To: 'Anzak Wolf' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] MySQL arrays
Date: Tue, 26 Mar 2002 09:23:11 -0600
MIME-Version: 1.0
Received: from [216.92.131.4] by hotmail.com (3.2) with ESMTP id 
MHotMailBE69DDDA00B840042A0FD85C8304065D0; Tue, 26 Mar 2002 07:25:15 -0800
Received: (qmail 25557 invoked by uid 1010); 26 Mar 2002 15:24:18 -
Received: (qmail 25534 invoked from network); 26 Mar 2002 15:24:16 -
From php-general-return-90196-anzak Tue, 26 Mar 2002 07:26:42 -0800
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Message-ID: 
[EMAIL PROTECTED]
X-Mailer: Internet Mail Service (5.5.2653.19)

how can you take a size of a function: $len = sizeof($this-query);
and WTF (query is a function, not an array):  $tq = $this-query[$q_id];

-Original Message-
From: Anzak Wolf [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 9:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL arrays


I'm trying to do something a little different in my database class I have a
method to do the query and store it in an array.

function query ($s = ) {
 $q = mysql_query($s,$this-database_connect_id);
 if (!$q) {
 $tools-error(array(Query Resulted in NULL value));
 return 0;
 }
 $len = sizeof($this-query);
 $len++;
 $this-query = array($len=$q);
 mysql_free_result($q);
 return $len;
}

function num_rows($q_id) {
 // Set temp array to the selected query
 $tq = $this-query[$q_id];
 $rows = mysql_num_rows($tq);
 return $rows;
}

When I do a var_dump of the two key vars I get the following

var_dump($this-query);
array(1) {
   [1]=
   resource(2) of type (mysql result)
}
var_dump($tq);
resource(2) of type (Unknown)

Here is the error that happens when I do the mysql_num_rows

br
bWarning/b:  2 is not a valid MySQL result resource in
b/var/www/includes/database_class.php/b on line b77/bbr

any ideas as to what I can do to fix this so that I can store query for
later use?

-Jim





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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

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



_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: [PHP] MySQL arrays

2002-03-26 Thread Anzak Wolf

CHANGE:
  $len = sizeof($this-query_id);
  $len++;
  $this-query_id = array($len=$q);
  mysql_free_result($q);
  return $len;

TO:
  $this-query_id[] = $q;
  return sizeof($this-query_id);

second:
$q is a resource, that is, a pointer variable.  When you execute
mysql_free_result($q), you free-up the memory that it pointed to.
Therefore, when you attempt to recall its value, it is pointing to memory
that you no longer own.  Hence, it is not a valid resource.  Therefore, do
not free the resource.  When the script completes, the memory will
automatically be de-allocated.  Also, when you use the phrase $q, you 
are
creating a pointer to a pointer; is that what you want?

I thought that $q created a new instance ie a copy of the data rather than 
a pointer.

That worked though I have do a $q_id-- in my num_rows method because sizeof 
returns 1 but the way the value is being assigned it is being put in the 0 
location.  Though that is not a problem.  Would it be better to parse out 
the data into arrays that I can access later then destroy the query?

for example
$q = mysql_query(select * from User);
$this-query_id[] = mysql_num_rows($q);
mysql_free_result($q);
$len = sizeof($this-query_id) - 1;
return $len;

This way when I have a large number of queries stored I don't have the over 
head of all the pointers to the query objects or would doing this create 
more overhead?

I'm trying to save on repeated calls to the database since it is possible 
that the database may change between with the first query is done and the 
last query is done and if they are the same query then the page would need 
the results to be the same.

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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