Re: [PHP-DB] Warning: Unable to jump to row...

2003-03-31 Thread Ronan Chilvers
Hi Ben

Comments inline 

On 31 Mar,2003 at 13:46 Benjamin Trépanier wrote:


> border="0">
> 
>  
> $i!=$id_news_
> $id= mysql_result($req,$i,"id");
> $titre = mysql_result($req,$i,"titre");
> $date   = mysql_result($req,$i,"date");
> $heure  = mysql_result($req,$i,"heure");
> $heure  = str_replace(":","h",$heure);
> $news   = stripslashes(trim(mysql_result($req,$i,"news")));
> 
> 


You should try using one of mysql_fetch_array() / mysql_fetch_row() to step through 
the recordset.  Something along the lines of

$id$titre\n";  
// \n above to keep the html source reasonably tidy
}

?>



> ?>
> 
> I want that my script show the content of the rows corresponding to my
> Variable called: Id_News_
> 
> So the variable is moving well but when the scirpt is running and go to
> display the row  this code happend:
> 
> Warning: Unable to jump to row number X
> 


Hope this helps.

-- 
Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

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



[PHP-DB] PHP Home 2.2.8

2003-03-31 Thread Steve Dodkins
Hi All
 
 
Has anyone upgraded from PHP Home Edition 2.2.3 (from sourceforge.net) to
version 2.2.8 ? and if so were there any issues?
 
 
 
Steve Dodkins 


  _  

 IMPORTANT NOTICE This email (including any attachments) 
 is meant only for the intended recipient. It may also contain confidential
and privileged information. If you are not the intended recipient, any
reliance on, use, disclosure, distribution or copying of this email or
attachments is strictly prohibited. This email is not intended to be relied
upon by any person without subsequent written confirmation of its contents.
ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or
completeness of this message as it has been transmitted over a public
network.   Furthermore, the content of this e-mail is the personal view of
the sender and does not represent the advice, views or opinion of our
company. Accordingly, our company disclaim all responsibility and accept no
liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555. 

ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ 


 


Re: [PHP-DB] Sharing variable values among PHP files

2003-03-31 Thread Mustafa Ocak
You can store the value in a session variable 

session_start();
if (isset($_HTTP_SESSION_VARS['your_variable_name'])) {
$value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value
}else{
$_HTTP_SESSION_VARS['your_variable_name']=new value;
}

You can use this script to pass values between pages.

HTH
Mustafa


- Original Message - 
From: "Alexa Kirk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 5:35 AM
Subject: [PHP-DB] Sharing variable values among PHP files


> Does anyone know how to take a variable containing POST data from a form
> and use this value in another PHP file? I need to take a username from
> one PHP file and use it in a couple of other PHP files later when adding
> to a database.
>  
> Thank you,
> Alexa Kirk
> 


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



Re: [PHP-DB] Php Thumbnail & Gallery

2003-03-31 Thread Jason Wong
On Tuesday 01 April 2003 11:20, Keith Spiller wrote:

> Can anyone recommend a pure php solution for thumbnail image creation and
> photo gallery script?  Everywhere I look the scripts require either GD,
> NetPBM
> or ImageMagick.  Is it not possible to build an thumbnail app without these
> tools?

In theory it is possible to write a set of image handling functions in pure 
PHP. For example there are pure PHP solutions for PDF creation/handling and 
also at least one for handling zip files.

But AFAIK there isn't a solution yet for image handling. And with the latest 
versions of PHP having a bundled GD library there may not be much incentive 
for people write one.

-- 
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
--
/*
"I'd love to go out with you, but I'm doing door-to-door collecting for static
cling."
*/


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



Re: [PHP-DB] INSERT Question

2003-03-31 Thread Mustafa Ocak
You can't perform update like this.
You should loop through rows you want to update if they have different key
values.

UPDATE tbl_ib_articles SET col_name=new_value WHERE key_column=key_value;

You can change the condition part, which can include non-key columns,

HTH,
Mustafa



- Original Message -
From: "Charles Kline" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 5:56 AM
Subject: Re: [PHP-DB] INSERT Question


Everything looks okay with this when I echo the sql string:

INSERT INTO tbl_ib_articles (issue_brief,article) VALUES
('24','30'),('24','20'),('24','31')

My question was, what do I need to change to make this an UPDATE?

Thanks,
Charles

On Monday, March 31, 2003, at 08:30 PM, [EMAIL PROTECTED] wrote:

> In a message dated 3/31/2003 5:26:36 PM Pacific Standard Time,
> [EMAIL PROTECTED] writes:
>
>
> > then I built the INSERT like so:
> > foreach($article_keys as $articleid)
> > {
> > $insert[] = "('$v_ib_id','$articleid')";
> > }
> > $article_sql = "INSERT INTO tbl_ib_articles (issue_brief,article)
> > VALUES " . implode(',',$insert);
>
>
>
> It's pretty much okay, except you don't have ( ) around the string
> that you create with the implode. You can echo $article_sql to see
> exactly what the SQL looks like and you can then modify your statement
> so you get the right SQL.
>
> Janet


--
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] Re: Database Design Help

2003-03-31 Thread Gustavo Del Castillo Meza
What kind of data do you need to collect at each booking?

"Shaun" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi,
>
> I am creating a database for a web application. The idea for the
application
> is for a company administrator to be able to log into the site and
allocate
> staff to a project.
>
> Staff will be able to log in and update the status of the project they are
> working on and clients will be able to log in and book a member of staff
> to their own projects.
>
> Administrators will be able to add / edit / delete - staff / clients /
> projects.
>
> Here is my database diagram:
>
> http://www.mania.plus.com
>
> My problem is each different project will need to have different data
> collected for it at each booking. How could I handle this in the database
> model? The administrator would like to be able to edit the data collected
> for each project via the site...
>
> Any other comments on my database model would be appreciated as this is my
> weakest area of web development by far!
>
>



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



[PHP-DB] Php Thumbnail & Gallery

2003-03-31 Thread Keith Spiller
Hello,

Can anyone recommend a pure php solution for thumbnail image creation and
photo gallery script?  Everywhere I look the scripts require either GD,
NetPBM
or ImageMagick.  Is it not possible to build an thumbnail app without these
tools?

Thank you for any help...

Larentium


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



RE: [PHP-DB] Sharing variable values among PHP files

2003-03-31 Thread Jennifer Goodie
You could set a cookie containing the value on the first page and access it
on the others.

> -Original Message-
> From: Alexa Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 31, 2003 6:35 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP-DB] Sharing variable values among PHP files
>
>
> Does anyone know how to take a variable containing POST data from a form
> and use this value in another PHP file? I need to take a username from
> one PHP file and use it in a couple of other PHP files later when adding
> to a database.
>
> Thank you,
> Alexa Kirk
>


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



Re: [PHP-DB] INSERT Question

2003-03-31 Thread Charles Kline
Everything looks okay with this when I echo the sql string:

INSERT INTO tbl_ib_articles (issue_brief,article) VALUES 
('24','30'),('24','20'),('24','31')

My question was, what do I need to change to make this an UPDATE?

Thanks,
Charles
On Monday, March 31, 2003, at 08:30 PM, [EMAIL PROTECTED] wrote:

In a message dated 3/31/2003 5:26:36 PM Pacific Standard Time, 
[EMAIL PROTECTED] writes:

> then I built the INSERT like so:
> foreach($article_keys as $articleid)
> {
> $insert[] = "('$v_ib_id','$articleid')";
> }
> $article_sql = "INSERT INTO tbl_ib_articles (issue_brief,article)
> VALUES " . implode(',',$insert);


It's pretty much okay, except you don't have ( ) around the string 
that you create with the implode. You can echo $article_sql to see 
exactly what the SQL looks like and you can then modify your statement 
so you get the right SQL.

Janet


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


[PHP-DB] Sharing variable values among PHP files

2003-03-31 Thread Alexa Kirk
Does anyone know how to take a variable containing POST data from a form
and use this value in another PHP file? I need to take a username from
one PHP file and use it in a couple of other PHP files later when adding
to a database.
 
Thank you,
Alexa Kirk


Re: [PHP-DB] INSERT Question

2003-03-31 Thread Charles Kline
How would I modify the code below to handle an UPDATE?

On Sunday, March 30, 2003, at 07:19 PM, Charles Kline wrote:

then I built the INSERT like so:
foreach($article_keys as $articleid)
{
	$insert[] = "('$v_ib_id','$articleid')";
}
$article_sql = "INSERT INTO tbl_ib_articles (issue_brief,article) 
VALUES " . implode(',',$insert);


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


RE: [PHP-DB] mail()

2003-03-31 Thread Jennifer Goodie
This is not so much a database question.  The answer is yes, it can be.  You
can read the documentation to find out how.
 http://www.php.net/manual/en/function.mail.php

A quick example is:
 $val){
$body .= "$key = $val\n";
}
mail ($address, "Form submission", $body);
?>

That is really ugly an inelegant.  I would suggest building off of it by
adding error checking and formatting the mail body.

-Original Message-
From: Mike Delorme [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 3:23 PM
To: MySQL PHP Database Help
Subject: [PHP-DB] mail()


Can this fucktion be use to mail the submited content of a form? If so how?



Thanks for your time,
Mike Delorme


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



[PHP-DB] Solved! Re: initialize assoc arrays

2003-03-31 Thread Charles Kline
Hey. I just figured it out! So simple too :)

$myarray = array();
foreach ($sth_opt as $thekey => $thevalue){
$myarray[$thevalue] = true;
}
On Monday, March 31, 2003, at 06:05 PM, Charles Kline wrote:

hi all, i am changing the title are reposting - i have a clearer idea 
now of what i am trying to do...

what is the syntax to initialize an associative array with values 
returned in a query where the key in the array is coming from the 
query and the value is static value of true?

i want to create an array that 'could' look like this:

$myarray = array('31'=>true,'21'=>true);

where 31 and 21 are the values returned from query

thanks,
charles
--
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] mail()

2003-03-31 Thread Mike Delorme
Can this fucktion be use to mail the submited content of a form? If so how?



Thanks for your time,
Mike Delorme

RE: [PHP-DB] PHP mail() question?

2003-03-31 Thread Jennifer Goodie
mail() will not run queries, you need to look at the php manual for the set
of functions for the database type you plan on using and execute the
database stuff in your script and pass the formatted results in the
appropriate argument of the mail function.

ie
$con = mysql_connect($host, $user,$pw);
$query = "SELECT Email from EmailDatabse.TableToUse Where criteria =
'clause'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
$bcc .= $row[Email].",";
}
$bcc = substr($bcc 0, -1); //getting rid of last comma

$headers .= "bcc: $bcc\r\n";

This is just a quick example, you'll need to add error checking and make
sure the argument order is correct on the functions, I don't have time to,
but I thought I'd at least put an effort into sending you on your way to
getting a functioning script.



-Original Message-
From: JeRRy [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 3:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP mail() question?


Hi,

I am trying to get PHP mail() to do the following:

1) Grab email addresses from a database and put in the
BCC of the email. (hidding their email address)

2) Grab first names from a database and put in the
body of the email.

Below is a script I am using, does not do any queries
to any database because I am not sure how to do it in
the function.  I have tried but have failed so thought
I'd ask here.  Can anyone help?  Here is the code I am
using...

\r\n";
$headers .= "To: ".$contactname."
<".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname."
<$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";

mail($contactemail, $subject, $message, $headers);

?>

Maybe I need a different function? If so could someone
show me a example of how it can be achieved please?

Thanks!

Jerry

P.S. I am using mysql database.

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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP mail() question?

2003-03-31 Thread JeRRy
Hi,

I am trying to get PHP mail() to do the following:

1) Grab email addresses from a database and put in the
BCC of the email. (hidding their email address)

2) Grab first names from a database and put in the
body of the email.

Below is a script I am using, does not do any queries
to any database because I am not sure how to do it in
the function.  I have tried but have failed so thought
I'd ask here.  Can anyone help?  Here is the code I am
using...  

\r\n"; 
$headers .= "To: ".$contactname."
<".$contactemail.">\r\n"; 
$headers .= "Reply-To: ".$myname."
<$myreplyemail>\r\n"; 
$headers .= "X-Priority: 1\r\n"; 
$headers .= "X-MSMail-Priority: High\r\n"; 
$headers .= "X-Mailer: Just My Server"; 

mail($contactemail, $subject, $message, $headers); 

?>

Maybe I need a different function? If so could someone
show me a example of how it can be achieved please? 

Thanks!

Jerry

P.S. I am using mysql database.

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] initialize assoc arrays

2003-03-31 Thread Charles Kline
hi all, i am changing the title are reposting - i have a clearer idea 
now of what i am trying to do...

what is the syntax to initialize an associative array with values 
returned in a query where the key in the array is coming from the query 
and the value is static value of true?

i want to create an array that 'could' look like this:

$myarray = array('31'=>true,'21'=>true);

where 31 and 21 are the values returned from query

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


Re: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
Hmm... that is not quite it. Here is a better example:

Here is how I would define default values for a checkbox in 
HTML_QuickForm;

$defaultValues['ichkABC']   = array('A'=>true,'B'=>true);
$form->setDefaults($defaultValues);
The checkboxes are defined later like this:

$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 
'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 
'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 
'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 
'D');
$form->addGroup($checkbox, 'ichkABC', 'ABCD:', array(' ', ''));

So what I am trying to do is built that array that gets passed to: 
$defaultValues['ichkABC']   =

If I can create a variable that contains the array that is fine too. 
the values 'A' or 'B' as in the above example will be the values in 
quotes as I get them from my table query.

thanks
charles


On Monday, March 31, 2003, at 04:52 PM, Jennifer Goodie wrote:

$mystring;
foreach ($sth_opt as $thekey => $thevalue){
$mystring .= "'".$thevalue."'=>true, ";
}
$defaultValues['ib_article']   = array($mystring);
Try this ...

foreach ($sth_opt as $thekey => $thevalue){
$defaultValues['ib_article'][$thevalue] = 'true';
}
I'm not sure if the indices line up exactly with what you had in mind, 
but
I'm confident you can play with it to get what you want.

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:49 PM
To: Jennifer Goodie
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] using a variable as values in an array
Here is more details. Thanks for the reply.

I am using HTML_QuickForm (pear) to create my forms. In order to set
the default state of some of the elements (checkboxes in this case) I
need to pass an array as the value to QuickForm.
This array needs to be in the format of this:

array('30'=>true, '29'=>true) where the 30 and 29 are the values that
are coming back from my query. This could return up to 50 records.
This is what I was trying, but it isn't woring:

$mystring;
foreach ($sth_opt as $thekey => $thevalue){
$mystring .= "'".$thevalue."'=>true, ";
}
On Monday, March 31, 2003, at 04:32 PM, Jennifer Goodie wrote:

Instead of building a string in your loop do the assignment in the 
loop
I have no idea what is being pulled from where, so I can't really give
a
good example

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] using a variable as values in an array
I am trying to build an array from the results of a query on a mySQL
table.
I am using a loop to create this string in a variable $mystring:

'30'=>true, '20'=>true

I then need to use it like this:

$defaultValues['ib_article']   = array($mystring);

It isn't working. I am sure there is a better method, can anyone point
me in the right direction?
thanks
charles
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


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


RE: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
>$mystring;
>foreach ($sth_opt as $thekey => $thevalue){
>   $mystring .= "'".$thevalue."'=>true, ";
>}
>$defaultValues['ib_article']   = array($mystring);

Try this ...

foreach ($sth_opt as $thekey => $thevalue){
$defaultValues['ib_article'][$thevalue] = 'true';
}

I'm not sure if the indices line up exactly with what you had in mind, but
I'm confident you can play with it to get what you want.


-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:49 PM
To: Jennifer Goodie
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] using a variable as values in an array


Here is more details. Thanks for the reply.

I am using HTML_QuickForm (pear) to create my forms. In order to set
the default state of some of the elements (checkboxes in this case) I
need to pass an array as the value to QuickForm.

This array needs to be in the format of this:

array('30'=>true, '29'=>true) where the 30 and 29 are the values that
are coming back from my query. This could return up to 50 records.

This is what I was trying, but it isn't woring:

$mystring;
foreach ($sth_opt as $thekey => $thevalue){
$mystring .= "'".$thevalue."'=>true, ";
}


On Monday, March 31, 2003, at 04:32 PM, Jennifer Goodie wrote:

> Instead of building a string in your loop do the assignment in the loop
> I have no idea what is being pulled from where, so I can't really give
> a
> good example
>
> -Original Message-
> From: Charles Kline [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 31, 2003 1:25 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] using a variable as values in an array
>
>
> I am trying to build an array from the results of a query on a mySQL
> table.
>
> I am using a loop to create this string in a variable $mystring:
>
> '30'=>true, '20'=>true
>
> I then need to use it like this:
>
> $defaultValues['ib_article']   = array($mystring);
>
> It isn't working. I am sure there is a better method, can anyone point
> me in the right direction?
>
> thanks
> charles
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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


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



Re: [PHP-DB] print table truncated

2003-03-31 Thread rob . koch
Dan,

It is more of a HTML-related question:

Need to change the table width in percentage (%) rather than just numbers.

HTH,
-rob





"Dan Liu" <[EMAIL PROTECTED]>
03/31/2003 01:17 PM

 
To: <<[EMAIL PROTECTED]>
cc: 
Subject:[PHP-DB] print table truncated


Hi,
I havea question about printing.When the table in HTML page is too big and 
I print the page,part of the table got truncated.Is there a way to print 
the web page without truncation? 
Thanks in advance.

Dan


-- 
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] using a variable as values in an array

2003-03-31 Thread Charles Kline
Here is more details. Thanks for the reply.

I am using HTML_QuickForm (pear) to create my forms. In order to set 
the default state of some of the elements (checkboxes in this case) I 
need to pass an array as the value to QuickForm.

This array needs to be in the format of this:

array('30'=>true, '29'=>true) where the 30 and 29 are the values that 
are coming back from my query. This could return up to 50 records.

This is what I was trying, but it isn't woring:

$mystring;
foreach ($sth_opt as $thekey => $thevalue){
$mystring .= "'".$thevalue."'=>true, ";
}
On Monday, March 31, 2003, at 04:32 PM, Jennifer Goodie wrote:

Instead of building a string in your loop do the assignment in the loop
I have no idea what is being pulled from where, so I can't really give 
a
good example

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] using a variable as values in an array
I am trying to build an array from the results of a query on a mySQL
table.
I am using a loop to create this string in a variable $mystring:

'30'=>true, '20'=>true

I then need to use it like this:

$defaultValues['ib_article']   = array($mystring);

It isn't working. I am sure there is a better method, can anyone point
me in the right direction?
thanks
charles
--
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] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
Instead of building a string in your loop do the assignment in the loop
I have no idea what is being pulled from where, so I can't really give a
good example

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] using a variable as values in an array


I am trying to build an array from the results of a query on a mySQL
table.

I am using a loop to create this string in a variable $mystring:

'30'=>true, '20'=>true

I then need to use it like this:

$defaultValues['ib_article']   = array($mystring);

It isn't working. I am sure there is a better method, can anyone point
me in the right direction?

thanks
charles


--
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] using a variable as values in an array

2003-03-31 Thread Charles Kline
I am trying to build an array from the results of a query on a mySQL 
table.

I am using a loop to create this string in a variable $mystring:

'30'=>true, '20'=>true

I then need to use it like this:

$defaultValues['ib_article']   = array($mystring);

It isn't working. I am sure there is a better method, can anyone point 
me in the right direction?

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


[PHP-DB] print table truncated

2003-03-31 Thread Dan Liu
Hi,
I havea question about printing.When the table in HTML page is too big and I print the 
page,part of the table got truncated.Is there a way to print the web page without 
truncation? 
Thanks in advance.

Dan


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



Re: [PHP-DB] Connect Microsoft SQL database with php on unix

2003-03-31 Thread Greg Cirino
>Maybe mssql_connect()??
>
>www.php.net/mssql_connect


The documentation indicates using sybase_connect (etc...) unless you
are on a windows machine.

But that doesn't work either as the sybase.so file seems to be
non-existant (on my machine anyway)

Regards
Greg Cirino


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would like to know the best way to connect to SQL database(which
located
> on Microsoft SQL Server) from PHP(Located on Unix Server).

Maybe mssql_connect()??

www.php.net/mssql_connect

---John W. Holmes...

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] Database Design Help

2003-03-31 Thread shaun
Hi,

I am creating a database for a web application. The idea for the application
is for a company administrator to be able to log into the site and allocate
staff to a project.

Staff will be able to log in and update the status of the project they are
working on and clients will be able to log in and book a member of staff
to their own projects.

Administrators will be able to add / edit / delete - staff / clients /
projects.

Here is my database diagram:

http://www.mania.plus.com

My problem is each different project will need to have different data
collected for it at each booking. How could I handle this in the database
model? The administrator would like to be able to edit the data collected
for each project via the site...

Any other comments on my database model would be appreciated as this is my
weakest area of web development by far!



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



RE: [PHP-DB] MSSQL/PHP problem

2003-03-31 Thread Poon, Kelvin (Infomart)
Yeah it worked, thank you very much.  I just have one more question.

How much space does the data takes up if I set it to text.  Because in
VarChar (which I had before) will change it's size depending how long the
chars is, will changing it to text cause the data to take up a large amount
of space even though the actual text is small?

Second question, I notice when I switch it to text, the length becomes "16"
and I can not change it.  So how much text can the column contain then?  Or
what is the limit or maximum number of words/letters I can fit into this
column?

Thanks a lot

Kelvin

-Original Message-
From: Roedel, Mark [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 2:27 PM
To: Poon, Kelvin (Infomart); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MSSQL/PHP problem


> -Original Message-
> From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 31, 2003 9:13 AM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] MSSQL/PHP problem
> 
> 
> [snip]
>
> WHen I retrieve this data from php to display on my webpage I 
> get this:
> 
> Globe and Mail data are retrieved and processed for CustomSearch. 
> On the R30, the crontab entry: 
> 0 4 * * 1-6 /usr1/applic/ntgm/ntgm_get.pl 
> will run the Perl script at 4 a.m. everyday to retrieve the 
> data from Globe
> and Mail. It will look for the fi
>
> [snip] 
> 
> P.S. I have set the limit of the mssql table to have 8000 
> character, so it should exceed the limit, but I just don't know
> why it takes only 6 lines of the total 11 lines of what I had in
> the mssql table.

That looks suspiciously close to 255 characters, which I believe is the
maximum size of a char() or varchar() column.  If this column is either
of those types, you might consider changing it to 'text'.

---
Mark Roedel   | "The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little."
Longview, Texas  USA  |-- Owen Porterfield

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



RE: [PHP-DB] MSSQL/PHP problem

2003-03-31 Thread Roedel, Mark
> -Original Message-
> From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 31, 2003 9:13 AM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] MSSQL/PHP problem
> 
> 
> [snip]
>
> WHen I retrieve this data from php to display on my webpage I 
> get this:
> 
> Globe and Mail data are retrieved and processed for CustomSearch. 
> On the R30, the crontab entry: 
> 0 4 * * 1-6 /usr1/applic/ntgm/ntgm_get.pl 
> will run the Perl script at 4 a.m. everyday to retrieve the 
> data from Globe
> and Mail. It will look for the fi
>
> [snip] 
> 
> P.S. I have set the limit of the mssql table to have 8000 
> character, so it should exceed the limit, but I just don't know
> why it takes only 6 lines of the total 11 lines of what I had in
> the mssql table.

That looks suspiciously close to 255 characters, which I believe is the
maximum size of a char() or varchar() column.  If this column is either
of those types, you might consider changing it to 'text'.

---
Mark Roedel   | "The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little."
Longview, Texas  USA  |-- Owen Porterfield

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



[PHP-DB] Problem with Firebird date

2003-03-31 Thread André Cupini
Hello people,
First, sorry my english. I´m brazilian.
I´m have a problem when work with date in a Firebird "date" field. By
default, Firebird set up the date format as month/day/year. I need date in
day/month/year format. In a Linux, i just add to the php.ini the following
line:
ibase.dateformat = "%d/%m/%Y"
But in a machine with Window+Apache+PHP+Firebird, it´s don´t work.

Anybody help-me?
Thanks.


André Cupini - Programador

[EMAIL PROTECTED]

NeoBiz - fábrica de internet
http://www.neobiz.com.br


[PHP-DB] Warning: Unable to jump to row...

2003-03-31 Thread Benjamin Trépanier
Hi, 

I'm trying to using a  news script and improve somes with a query.


$req = MYSQL_QUERY("SELECT * FROM $TBL_NEWS");
$res = MYSQL_NUM_ROWS($req);

?>







I want that my script show the content of the rows corresponding to my
Variable called: Id_News_

So the variable is moving well but when the scirpt is running and go to
display the row  this code happend:

Warning: Unable to jump to row number X

Or

Currently he is always showing row #5...

I put my id_news_  in a echo and the variable is ok.. I really dont
understand

Thanks for your help!

BEn




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



Re: [PHP-DB] getting serial in PHP

2003-03-31 Thread Rick Morris


On Mon, 31 Mar 2003, Roger 'Rocky' Vetterberg wrote:

> [Snip]
>
>
> >>About the second suggestion, just pulling the data back out; I could
> >>do that, but the only thing that is unique in the string is the
> >>timestamp. Theoretically, on a busy site even that could be identical
> >>in two rows. (Since timestamp is in one millionth of a second, its not
> >>very likely but could happen)
> >>So if I do a search on the data I just inserted, I could get two or
> >>more hits, and there would be no way for me to tell which one is the
> >>one Im after.
> >>
> >>Im new to both php and sql, but I keep thinking things like this must
> >>be done every day on thousands of sites. I just cant figure out how to
> >>do it, any suggestions?
> >
> >
> > What I do, when I need to reference an ID from a sequence after I do the
> > INSERT, is I get the next number in the sequence /before/ inserting the data
> > into the table, like so:
> >
> > $res = pg_query($conn, "select nextval('my_seq');");
> > $row = pg_fetch_array($res);
> > $id = $row['nextval'];
> > $res = pg_query($conn, "insert into my_table values ($id, 'value',
> > 'value');");
> > //Error checking here...
> > echo "Your submission was accepted with ID $id";
> >
> > Since you are just getting the next value of the sequence, your data is safe
> > from having non-unique id numbers, as long as you always call nextval() in
> > order to get your id number. Any subsequent calls to nextval() will return
> > the next number, regardless of whether you use the $id returned by the first
> > query.
> >
> > Hope that helps.
> >
> > 
> > Nathaniel Price http://www.thornvalley.com
> > "Who is General Failure and why is he reading my hard drive?"
>
>
> For future reference, here is the code snippet that finally
> worked for me:
> --
> $res = pg_query($connection, "select
> nextval('public.logs_log_id_seq'::text);");
>
> $row = pg_fetch_array($res);
> $log_id = $row['nextval'];
>
> $query = "insert into logs values
> ($log_id,$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]');";
> $result = pg_query($connection, $query) or die("Error in query:
> $query. " .pg_last_error($connection));
> --
>
> The data is stored, and the counter value is saved in $log_id and
> available for use.
>
> Thanks to all those that helped!
>
> --
> R

Let me suggest a shorthand for the above. Since the query only
returns one result, there is no need to fetch an array. Just use
pg_fetch_result to get the value. In fact, you can even nest the
calls, like so:

$log_id = pg_fetch_result(pg_query($connection, "select
nextval('public.logs_log_id_seq'::text);"), 0, 0)
or die(pg_result_error());

This saves a little bit of memory too, since you aren't making two extra
assignments to get your $log_id.

Next, just turn this into a nice little PHP function, so you can do
$log_id = getNextVal('sequencename');


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



Re: [PHP-DB] getting serial in PHP

2003-03-31 Thread Roger 'Rocky' Vetterberg
[Snip]


About the second suggestion, just pulling the data back out; I could
do that, but the only thing that is unique in the string is the
timestamp. Theoretically, on a busy site even that could be identical
in two rows. (Since timestamp is in one millionth of a second, its not
very likely but could happen)
So if I do a search on the data I just inserted, I could get two or
more hits, and there would be no way for me to tell which one is the
one Im after.
Im new to both php and sql, but I keep thinking things like this must
be done every day on thousands of sites. I just cant figure out how to
do it, any suggestions?


What I do, when I need to reference an ID from a sequence after I do the
INSERT, is I get the next number in the sequence /before/ inserting the data
into the table, like so:
$res = pg_query($conn, "select nextval('my_seq');");
$row = pg_fetch_array($res);
$id = $row['nextval'];
$res = pg_query($conn, "insert into my_table values ($id, 'value',
'value');");
//Error checking here...
echo "Your submission was accepted with ID $id";
Since you are just getting the next value of the sequence, your data is safe
from having non-unique id numbers, as long as you always call nextval() in
order to get your id number. Any subsequent calls to nextval() will return
the next number, regardless of whether you use the $id returned by the first
query.
Hope that helps.


Nathaniel Price http://www.thornvalley.com
"Who is General Failure and why is he reading my hard drive?"


For future reference, here is the code snippet that finally 
worked for me:
--
$res = pg_query($connection, "select 
nextval('public.logs_log_id_seq'::text);");

$row = pg_fetch_array($res);
$log_id = $row['nextval'];
$query = "insert into logs values 
($log_id,$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]');";
$result = pg_query($connection, $query) or die("Error in query: 
$query. " .pg_last_error($connection));
--

The data is stored, and the counter value is saved in $log_id and 
available for use.

Thanks to all those that helped!

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


Re: [PHP-DB] getting serial in PHP

2003-03-31 Thread Roger 'Rocky' Vetterberg


Nathaniel Price wrote:
- Original Message -
From: "Roger 'Rocky' Vetterberg" <[EMAIL PROTECTED]>
To: "kevin myers" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 4:52 AM
Subject: Re: [PHP-DB] getting serial in PHP
*snip*

What I do, when I need to reference an ID from a sequence after I do the
INSERT, is I get the next number in the sequence /before/ inserting the data
into the table, like so:
$res = pg_query($conn, "select nextval('my_seq');");
$row = pg_fetch_array($res);
$id = $row['nextval'];
$res = pg_query($conn, "insert into my_table values ($id, 'value',
'value');");
//Error checking here...
echo "Your submission was accepted with ID $id";
Since you are just getting the next value of the sequence, your data is safe
from having non-unique id numbers, as long as you always call nextval() in
order to get your id number. Any subsequent calls to nextval() will return
the next number, regardless of whether you use the $id returned by the first
query.
Hope that helps.


Nathaniel Price http://www.thornvalley.com
"Who is General Failure and why is he reading my hard drive?"
So even if I just do a select on nextval, it increases in value?
I was under the impression that a select would just return the 
current value, and that I would have to do a insert to actually 
increase it?

I will certainly test this, it sounds like this could be the 
solution Im looking for.

Thanks!

--
R


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


Re: [PHP-DB] help, please

2003-03-31 Thread Hendri
Make sure that u had installed Oracle Client on your Machine and Recompile your php 
with --with-oracle=$ORACLE_HOME then
check wether your Apache included -lpthread

-Original Message-
From: Marcial Comerón Mariño <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Date: Mon, 31 Mar 2003 07:57:38 -0600
Subject: [PHP-DB] help, please


Hi all
I'm new with php.
I need connect with my db in oracle7.3.3, and doing it:


But not work.

thank's and regards








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



RE: [PHP-DB] PHP / Apache -- output truncated after pg_connect() call

2003-03-31 Thread Dave Brunberg
For any who may be interested:  

I fixed the problem, noted below, myself.  Evidently the Slackware
PHP/Apache binary is somewhat broken. It worked after I rebuilt PHP with
"configure --with-axps  --with-pgsql"
Apache did not require a rebuild.

dwb

> -Original Message-
> From: Dave Brunberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 28, 2003 1:30 PM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] PHP / Apache -- output truncated after pg_connect()
> call
> 
> 
> I'm having a problem with a php script when connecting to a postgresql
> database.  The problem is this:  When Apache runs the php script, the
> output is missing everything after my first call to 
> pg_connect().  i.e., I
> can "echo", "print" whatever I like, but everything is cut 
> off after that
> call--it doesn't show up in the output when run by Apache  However. 
> if I pass the script through php manually, I get the expected 
> output.  
> For instance, here's the code:
> 
> 
> 
> PHP Test
> 
> 
>  
> import_request_variables('p', 'p_');
> 
> 
> $conn_string = "dbname=PilotProjects user=web-user password=secret";
>   print "";
>   echo "Point 1"; 
>   echo "";
>   print "fubar";
>$database = pg_connect ($conn_string)
>   or die ("No connection to the database. Error: " . 
> pg_last_error());
>echo "Point1.5\n";
>echo "";
>echo pg_dbname($database); 
>echo "";
>echo get_resource_type($database);
>   echo "Point 2\n";
> 
> 
>   $result=pg_query ($database, "SELECT \"ProjectName\" FROM
> \"ProjectsTable\"");
> 
>   $resultprintme = pg_fetch_row($result,0)
>   or die ("Help! no query result. Error: " 
> .pg_last_error() . "\n");
> 
>   echo $resultprintme[0] . "\n";
>   /* foreach ($resultprintme as $ProjectName) {
>   print ("$ProjectName\n");   
>}*/
>pg_close ($database);
> ?>
> 
> 
> 
> 
> When Apache runs the script through php, here's the output:
> 
> 
> 
> PHP Test
> 
> 
> fubar
> 
> 
> However, when I run the code through php from the command 
> line, the output
> is this:
> 
> [EMAIL PROTECTED]:~/htdocs/tests/php$ php ./selectStudy1.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.0
> 
> 
> 
> 
> PHP Test
> 
> 
> Point 1fubarPoint1.5
> PilotProjectspgsql linkPoint 2
> Brown County
> 
> 
> 
> 
> Which is what I expected.
> 
> Can anyone help me with this?  Is this a problem with Apache? 
> With php? With
> something 
> else?
> 
> Any help will be greatly appreciated!
> 
> dwb
> 
> ===
> 
> My configuration:
> 
> Slackware Linux w / 2.4.18 kernel
> 
> Apache:
> 
> [EMAIL PROTECTED]:/etc/apache# httpd -V
> Server version: Apache/1.3.26 (Unix)
> Server built:   Jun 19 2002 05:51:45
> Server's Module Magic Number: 19990320:13
> Server compiled with
>  -D EAPI
>  -D HAVE_MMAP
>  -D HAVE_SHMGET
>  -D USE_SHMGET_SCOREBOARD
>  -D USE_MMAP_FILES
>  -D HAVE_FCNTL_SERIALIZED_ACCEPT
>  -D HAVE_SYSVSEM_SERIALIZED_ACCEPT
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>  -D HTTPD_ROOT="/usr"
>  -D SUEXEC_BIN="/usr/sbin/suexec"
>  -D DEFAULT_PIDLOG="/var/run/httpd.pid"
>  -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard"
>  -D DEFAULT_LOCKFILE="/var/run/httpd.lock"
>  -D DEFAULT_ERRORLOG="/var/log/apache/error_log"
>  -D TYPES_CONFIG_FILE="/etc/apache/mime.types"
>  -D SERVER_CONFIG_FILE="/etc/apache/httpd.conf"
>  -D ACCESS_CONFIG_FILE="/etc/apache/access.conf"
>  -D RESOURCE_CONFIG_FILE="/etc/apache/srm.conf"
> 
> php:
> [EMAIL PROTECTED]:/etc/apache# php -v
> PHP 4.3.0 (cgi), Copyright (c) 1997-2002 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
> 
> 
> David W. Brunberg
> Engineering Supervisor - Field Process
> The F.B. Leopold Company, Inc.
> 227 South Division Street
> Zelienople PA 16063
> (724) 452-6300
> 
> 
> -- 
> 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] phpMsAdmin ?

2003-03-31 Thread Peter Beckman
Are there any scripts out there, in PHP or ASP, that give similar support
in Microsoft SQL Server (MSSQL) that phpMyAdmin gives for MySQL databases?
I have a client who is requiring me to code in ASP using MSSQL server, and
I'd like to have a web-based (preferably in PHP) admin tool for the server.

Peter
---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



Re: [PHP-DB] getting serial in PHP

2003-03-31 Thread Nathaniel Price

- Original Message -
From: "Roger 'Rocky' Vetterberg" <[EMAIL PROTECTED]>
To: "kevin myers" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 4:52 AM
Subject: Re: [PHP-DB] getting serial in PHP
[snip]

> >> From: "Roger 'Rocky' Vetterberg" <[EMAIL PROTECTED]>
> >> To: [EMAIL PROTECTED]
> >> Subject: [PHP-DB] getting serial in PHP
> >> Date: Fri, 28 Mar 2003 13:46:36 +0100
> >>
> >> Hi list.
> >>
> >> I have no real education in PHP or postgre, so forgive me if I dont
> >> use the correct language or expressions.
> >> I have a small problem that is probably easily solved if you just know
> >> how to do it.
> >>
> >> I have a PHP interface over a postgreSQL database, where I can search,
> >> add, delete or modify records.
> >> Now, when adding a new record, a query could look something like this:
> >> $query = "insert into logs values
> >>
(nextval('public.logs_log_id_seq'::text),$id,'$logtext','now','$_SERVER[PHP_
AUTH_USER]');";
> >>
> >>
> >> The first value, the "nextval" thingie (if someone could give me the
> >> correct term for such a feature I would appriciate it) gives the added
> >> row a unique serial number. How do I figure out the serial my newly
> >> added row was assigned?
> >> What I want to do is something like
> >> 'echo "Your submission was accepted and assigned log ID $log_id"; '
> >> directly below the $query line. How do I get the correct value into
> >> $log_id?
> >>
> >> Hopefully, someone understands my confused rantings and can give me
> >> directions to some documentation or maybe even the name of a variable
> >> I can use. :)
> >>
> >> TIA
> >>
> >> --
> >> R
>
[Snip]

> About the second suggestion, just pulling the data back out; I could
> do that, but the only thing that is unique in the string is the
> timestamp. Theoretically, on a busy site even that could be identical
> in two rows. (Since timestamp is in one millionth of a second, its not
> very likely but could happen)
> So if I do a search on the data I just inserted, I could get two or
> more hits, and there would be no way for me to tell which one is the
> one Im after.
>
> Im new to both php and sql, but I keep thinking things like this must
> be done every day on thousands of sites. I just cant figure out how to
> do it, any suggestions?

What I do, when I need to reference an ID from a sequence after I do the
INSERT, is I get the next number in the sequence /before/ inserting the data
into the table, like so:

$res = pg_query($conn, "select nextval('my_seq');");
$row = pg_fetch_array($res);
$id = $row['nextval'];
$res = pg_query($conn, "insert into my_table values ($id, 'value',
'value');");
//Error checking here...
echo "Your submission was accepted with ID $id";

Since you are just getting the next value of the sequence, your data is safe
from having non-unique id numbers, as long as you always call nextval() in
order to get your id number. Any subsequent calls to nextval() will return
the next number, regardless of whether you use the $id returned by the first
query.

Hope that helps.


Nathaniel Price http://www.thornvalley.com
"Who is General Failure and why is he reading my hard drive?"


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



[PHP-DB] MSSQL/PHP problem

2003-03-31 Thread Poon, Kelvin (Infomart)
Hi, 

I have this problem retrieving data from a mssql table with PHP.

I have this in my mssql table column:

Globe and Mail data are retrieved and processed for CustomSearch.

On the R30, the crontab entry:
0 4 * * 1-6  /usr1/applic/ntgm/ntgm_get.pl
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail.  It will look for the file, retry if not found, until 6 a.m.

Most common problem is caused by the data file not available after 6 a.m.
for retrieval.  The system will send an error message to the support team to
alert the problem.

To retry downloading manually, simply sign on to the R30 and run the script
/usr1/applic/ntgm/ntgm_get.pl.

The data file can be found in the done directory and two log files in the
log directory.

WHen I retrieve this data from php to display on my webpage I get this:

Globe and Mail data are retrieved and processed for CustomSearch. 
On the R30, the crontab entry: 
0 4 * * 1-6 /usr1/applic/ntgm/ntgm_get.pl 
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail. It will look for the fi

The code I have in my php to display this text is:

$query = "SELECT * FROM knowledgeBase WHERE Title = '$title'";
$result = mssql_query($query);
$line = mssql_fetch_row($result);
echo "$line[2]";

$line[2] because this data is in the second column of the mssql table of the
row '$title'

P.S. I have set the limit of the mssql table to have 8000 character, so it
should exceed the limit, but I just don't know why it takes only 6 lines of
the total 11 lines of what I had in the mssql table.

Please advise! THANKS!

Kelvin





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



[PHP-DB] Re: [PHP] date() and mktime() functions: weeknumbers and months.

2003-03-31 Thread Marek Kilimajer
Check out mysql manual, section 6.3.4 - Date and Time Functions, example

$condition='';
if($GET['week']) $condition .= "WEEK(date)='$_GET[week]' AND ";
if($GET['year']) $condition .= "YEAR(date)='$_GET[week]' AND ";
and so on
then use the condition:
$sql = "SELECT * FROM news WHERE $condition 1";



Davy Obdam wrote:

Hi people,

I would like to select news from my database bases on week/year and
month/year.
How can i do this.. I would like to pass two arguments in the query
string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
Can anybody help me.. Thanks in advance. I have been looking at the
date() and mktime() functions, but is there anyway to determine the date
from a weeknumber? I have been using this:
$yr="2003"; 
$mnth="03"; 
$dy="31"; 
echo "base date: ".$yr."-".$mnth."-".$dy.""; 
echo "last sunday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."
/>"; 
echo "next saturday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."
r />";

$sql = "SELECT * FROM news WHERE date>='$last_sunday' AND
date<='$next_saturday').
But i would find it better to use a weeknumber instead

Best regards,

Davy Obdam - Networking4all
Webapplication developer
E-mail: [EMAIL PROTECTED]
Web: http://www.networking4all.com 

Kijk ook eens op: http://www.verzamelgids.nl 



 



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


[PHP-DB] RE: MySql Help needed

2003-03-31 Thread Adam Douglas
Are you sure you give access to this user from the machine to the database
server? Check IP address permissions and if the user has access to the
specific table and/or database in MySQL. Also check to make sure the
database server is setup to allow you access from your machine.. check the
MySQL and System log files they usually help to determine what went wrong.

> -Original Message-
> From: Sparky Kopetzky [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 29, 2003 9:12 PM
> To: [EMAIL PROTECTED]
> Subject: MySql Help needed
> 
> 
> Greetings!
> 
> I am building an application in PHP and am creating a global 
> $connect_id for MySql. I have MySql on a separate machine and 
> am using the connect like this:
> 
> $server = "development.myservermachine.net";
> $username = "myname";
> $password = "mypassword";
> $connect_id = mysql_connect($server, $username, $password);
> 
> All I get is 'Access denied for user '[EMAIL PROTECTED]' (Using 
> password:YES)
> 
> Now, I know I'm in the DNS server for my system, and the 
> username and password are correct as I checked the User table.
> 
> Any thoughts, ideas, etc. toward fixing this problem??
> 
> I'd appreciate any help provided.
> 
> Robin Kopetzky
> Black Mesa Computer/Internet Services
> 
> 
> 

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



[PHP-DB] date() and mktime() functions: weeknumbers and months.

2003-03-31 Thread Davy Obdam
Hi people,

I would like to select news from my database bases on week/year and
month/year.
How can i do this.. I would like to pass two arguments in the query
string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
Can anybody help me.. Thanks in advance. I have been looking at the
date() and mktime() functions, but is there anyway to determine the date
from a weeknumber? I have been using this:

$yr="2003"; 
$mnth="03"; 
$dy="31"; 
echo "base date: ".$yr."-".$mnth."-".$dy.""; 
echo "last sunday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr)).""; 
echo "next saturday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."";

$sql = "SELECT * FROM news WHERE date>='$last_sunday' AND
date<='$next_saturday').

But i would find it better to use a weeknumber instead

Best regards,

Davy Obdam - Networking4all
Webapplication developer
E-mail: [EMAIL PROTECTED]
Web: http://www.networking4all.com 

Kijk ook eens op: http://www.verzamelgids.nl 



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



[PHP-DB] help, please

2003-03-31 Thread Marcial Comerón Mariño

Hi all
I'm new with php.
I need connect with my db in oracle7.3.3, and doing it:


But not work.

thank's and regards






Re: [PHP-DB] getting serial in PHP

2003-03-31 Thread Roger 'Rocky' Vetterberg
kevin myers wrote:
well right after you insert it you can pull it right back out again, or 
i think you can do :
$query = "insert into logs values
((nextval('public.logs_log_id_seq'::text) as 
$log_id),$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]');";
and then use it that way, or maybe you can do this:
$log_id = nextval('public.logs_log_id_seq'::text);
and then insert it that way

From: "Roger 'Rocky' Vetterberg" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] getting serial in PHP
Date: Fri, 28 Mar 2003 13:46:36 +0100
Hi list.

I have no real education in PHP or postgre, so forgive me if I dont 
use the correct language or expressions.
I have a small problem that is probably easily solved if you just know 
how to do it.

I have a PHP interface over a postgreSQL database, where I can search, 
add, delete or modify records.
Now, when adding a new record, a query could look something like this:
$query = "insert into logs values 
(nextval('public.logs_log_id_seq'::text),$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]');"; 

The first value, the "nextval" thingie (if someone could give me the 
correct term for such a feature I would appriciate it) gives the added 
row a unique serial number. How do I figure out the serial my newly 
added row was assigned?
What I want to do is something like
'echo "Your submission was accepted and assigned log ID $log_id"; '
directly below the $query line. How do I get the correct value into 
$log_id?

Hopefully, someone understands my confused rantings and can give me 
directions to some documentation or maybe even the name of a variable 
I can use. :)

TIA

--
R
I just cant figure this out.
Another user directed me to 
http://www.php.net/manual/en/function.pg-last-oid.php, which gave me a 
few pointers.
If I understand it correctly, something like this should work:

if (empty($id)) {
	die("No id specified, can not continue");
	}
else {
	$query = "insert into logs values 
(nextval('public.logs_log_id_seq'::text),$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]')";
	}
	if($result = pg_exec($connection, $query)) {
		echo "oid : " .pg_last_oid($result);
	}

However, it doesnt work. The data is added with a correct serial, but 
it still prints just "oid: "

About the second suggestion, just pulling the data back out; I could 
do that, but the only thing that is unique in the string is the 
timestamp. Theoretically, on a busy site even that could be identical 
in two rows. (Since timestamp is in one millionth of a second, its not 
very likely but could happen)
So if I do a search on the data I just inserted, I could get two or 
more hits, and there would be no way for me to tell which one is the 
one Im after.

Im new to both php and sql, but I keep thinking things like this must 
be done every day on thousands of sites. I just cant figure out how to 
do it, any suggestions?

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