[PHP-DB] AUTO_INCREMENT problemos

2002-08-27 Thread simon

Hi

Wondering if anybody can help with this:

My table has an INT column named 'member_id' which is set to AUTO_INCREMENT.
It works very well but I have inserted and deleted some test rows during the
development stage and now my incremented numbers have jumped ahead.
The deleted rows (their member_id values) have not been forgotten it seems
and the DB is using them still to evaluate the next number.

Any ideas?

Simon



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




[PHP-DB] Re: convert mysql table to Excell or Access file

2002-08-28 Thread simon

Try the 'free' PC program called MySQL-Front from
http://www.anse.de/mysqlfront/index.php
It has a nice function for exporting to Excel.
simon
"Alex Shi" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can MySQL table be converted to Access or Excell format?
>
> Alex
>
> --
> ---
> TrafficBuilder Network:
> http://www.bestadv.net/index.cfm?ref=7029
>



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




[PHP-DB] form variables not beeing passed to next page

2002-08-30 Thread simon

Upgraded from 4.06 to 4.2.2.

Now suddenly even the simplist of scripts will not pass the form variables
on to next page.

Ex:

if(isset($sumbit))...  etc
//Collect user info from form
//Send to DB
//?> end PHP and 'if'...blah
//Print HTML form with'action' to next page.

Worked fine in 4.06?

Have I missed something?

simon



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




[PHP-DB] Erratic isset()

2002-08-31 Thread simon

Hi

Can anyone shed some light on this problem?

The DB update only happens when I change the if(isset($submit)) to read
if(!isset($submit)).

Yes, I am using PHP 4.0.6 but have also tried with PHP 4.2.2, same problem.
Code snippet:

//HTML  
";

mysql_select_db("sff") or die("Could not select database");
$doit1 = "INSERT INTO members
VALUES(NULL,'$first_name','$last_name','$addr1',

'$addr2','$postnummer','$postort','$land','$tel','$mob','$email','$memb_date
','$comments')";
 mysql_query($doit1); //put the data in members table

    printf ("Database updated. Enter a new member?");

/* Closing connection */
mysql_close($link);
endif;
?>
//print HTML form etc...

Simon



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




[PHP-DB] variable and MySQL

2005-03-14 Thread simon
Hi, I'm trying to make a script but have a problem ...

How could I do this:

I'd like to use   $get_question_data[xxx_name_en]

where xxx would be a variable variable according to the situation where the 
script is called... how would I do this?

tried :

$get_question_data[$test_name_en]
$get_question_data[{$test}_name_en]
${get_question_data[$test_name_en]}

but nothing works  any help would be appreciated. 

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



[PHP-DB] Problem with writing to database. Possibly a CLOB error...

2001-01-11 Thread simon

Hi,

I get the following error when I try and write to the database on only
some of the items in $res. The majority go in fine. When I enter the
ones causing an error, individually, they go in without a problem.  Is
it because I'm using a loop to enter the data? Can anyone help please?

Thanks in advance,

Simon.


Error:
Warning: OCIStmtExecute: ORA-01704: string literal too long

Code:
while ( list($k, $v) = each($res) )
{
$body = $res[$k][1];
$id = $res[$k][0];
$body = preg_replace( "/'/", "''", $body );
$sql = "update story
set body = '$body'
where id = $id returning body into :body";

$stmt = OCIParse($db->conn, $sql);
$lob = OCINewDescriptor($db->conn, OCI_D_LOB);
OCIBindByName($stmt, ":body" , &$lob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$body = preg_replace( "/''/", "'", $body );
if ( $lob->save ("$body") )
{
    echo "$id written to database\n";
}

OCICommit($db->conn);
OCIFreeStatement($stmt);
OCIFreeDesc($lob);
}

--

Simon Pospisil  Mail:  [EMAIL PROTECTED]
Web EngineerWeb:   http://www.fastsearch.com/
Fast Web Media Ltd. Phone: +44 (0) 161 835 3444
Suite 1202, Sunlight House Quay Street  Fax:   +44 (0) 161 835 3488
Manchester, England M3 3JZ

Try FAST Search: http://www.alltheweb.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Easy MySQL question

2001-01-11 Thread simon

Julie Meloni wrote:

> Paulson, Joseph V. \"Jay\" wrote:
>
> > Hello everyone--
> > I've got a easy question that I can't seem to answer for myself.  I'm
> > running a query in MySQL and want to know how many entries are in a table
> > and then echo that out onto a page.  I thought this would be easy but I
> > don't know why it's not working.  Anyway, here's what I am doing:
> >
> > (open db connection)
> >
> > $query = "SELECT count(*) FROM Movie";
> > $result = mysql_query($sql, $dbLink);
> > $myrow = mysql_result($result);
> > echo $myrow;
> >
>
> $myrow = mysql_result($result,0,"count(*)");
>
> --
> ++
> | Julie Meloni ([EMAIL PROTECTED])  |
> | Tech. Director, i2i Interactive (www.i2ii.com) |
> ||
> |  "PHP Essentials" & "PHP Fast & Easy"  |
> |   http://www.thickbook.com/   |
> ++
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

Shouldn't  this be $query also?

$query = "SELECT count(*) FROM Movie";
$result = mysql_query($sql, $dbLink);
$myrow = mysql_result($result);
echo $myrow;

--

Simon Pospisil  Mail:  [EMAIL PROTECTED]
Web EngineerWeb:   http://www.fastsearch.com/
Fast Web Media Ltd. Phone: +44 (0) 161 835 3444
Suite 1202, Sunlight House Quay Street  Fax:   +44 (0) 161 835 3488
Manchester, England M3 3JZ

Try FAST Search: http://www.alltheweb.com





Re: [PHP-DB] Easy MySQL question

2001-01-11 Thread simon

Julie Meloni wrote:

> simon wrote:
>
> > Julie Meloni wrote:
> >
> >
> >> Paulson, Joseph V. \"Jay\" wrote:
> >>
> >>
> >>> Hello everyone--
> >>> I've got a easy question that I can't seem to answer for myself.  I'm
> >>> running a query in MySQL and want to know how many entries are in a table
> >>> and then echo that out onto a page.  I thought this would be easy but I
> >>> don't know why it's not working.  Anyway, here's what I am doing:
> >>>
> >>> (open db connection)
> >>>
> >>> $query = "SELECT count(*) FROM Movie";
> >>> $result = mysql_query($sql, $dbLink);
> >>> $myrow = mysql_result($result);
> >>> echo $myrow;
> >>>
> >>
> >> $myrow = mysql_result($result,0,"count(*)");
> >>
> >
> >
> > Shouldn't  this be $query also?
> >
> > $query = "SELECT count(*) FROM Movie";
> > $result = mysql_query($sql, $dbLink);
> > $myrow = mysql_result($result);
> > echo $myrow;
> >
>
> Yes; I wasn't paying attention to that, just the use of the
> mysql_result() function.
>
> --
> ++
> | Julie Meloni ([EMAIL PROTECTED])  |
> | Tech. Director, i2i Interactive (www.i2ii.com) |
> ||
> |  "PHP Essentials" & "PHP Fast & Easy"  |
> |   http://www.thickbook.com/   |
> +----+
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

Sorry, I didn't see that I was replying to your reply. I thought you were the
original sender. Perhaps you could help me with my Q above??? I'm pulling my
hair out here!


--

Simon Pospisil  Mail:  [EMAIL PROTECTED]
Web EngineerWeb:   http://www.fastsearch.com/
Fast Web Media Ltd. Phone: +44 (0) 161 835 3444
Suite 1202, Sunlight House Quay Street  Fax:   +44 (0) 161 835 3488
Manchester, England M3 3JZ

Try FAST Search: http://www.alltheweb.com





Re: [PHP-DB] Text Control.

2001-01-12 Thread simon

Ian wrote:

> Dear Sir / Madam,
>
> Problem :-
> Data from HTML  WRAP="virtual"> is likes,
> This is a testing messages:-
> 1. MSG A.
> 2. MSG B.
> 3. MSG C.
>
> So, I insert $test into MYSQL database. After that, I login into MYSQL and
> select the test field, the display is same as above. But, when I used PHP
> coding to select the test field and display it in HTML page, output likes,
> This is a testing messages:- 1. MSG A. 2. MSG B. 3. MSG C.
>
> How to display $test in the requested format?
>
> Thanks in advance.
>
> Best Regards,
> Ian.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

You could try using the nl2br function, thus converting all newline
characters to  tags.

http://uk.php.net/manual/function.nl2br.php

--

Simon Pospisil  Mail:  [EMAIL PROTECTED]
Web EngineerWeb:   http://www.fastsearch.com/
Fast Web Media Ltd. Phone: +44 (0) 161 835 3444
Suite 1202, Sunlight House Quay Street  Fax:   +44 (0) 161 835 3488
Manchester, England M3 3JZ

Try FAST Search: http://www.alltheweb.com





RE: [PHP-DB] Re: Array help needed :-(

2002-10-08 Thread Simon Taylor

You may want to revisit your db design, but if it is like that for  reason
then it is simple enough to associate these items with each other in an
array.
Just put together a query then get the row and split it by the commas then
put it into an array as follows.
$ar = Array('small' => '1.99', 'medium' => '2.99', 'large' => '3,99');
Then you can access these values by the following.

$smvalue = $ar['small']

This example is a simple array, if you had a lot of products you could use a
multi dimensional array like this.

$ar = Array( 'hotdogs' => Array('small' => '1.99', 'medium' => '2.99',
'large' => '3,99'), 
 'burgers' => Array('small' => '2.99', 'medium' => '4.99',
'large' => '6,99'))

Then access them like this

$smallburger = $ar['burger']['small']

Hope this helps.
Simon

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]] 
Sent: 8 October 2002 06:49
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Array help needed :-(


In article <000801c26e10$a2128510$f7fea8c0@chris>, [EMAIL PROTECTED] 
says...
> Hi there everyone,
> 
> I have a problem i'm trying to figure out but i'm not too good with 
> arrays, just know the basics, if anyone could help me out on this it 
> would be wonderful :-)
> 
> I have two sets of data in columns of a MySQL DB, these items are size 
> and price.
> 
> Size is seperate by comma's in the first column, and I have it split 
> into a dropdown box no problem to read (For example):
> 
> small
> medium
> large
> 
> but then I have a price field, which contains 1.99,2.99,3.99 etc . 
> what I need to do is when someone selects an item from the dropdown - 
> say small as an example, it would know how to get 1.99 from the price 
> entry in the DB.  I guess what I need to do is somehow associate each 
> entry in the price field with those in the size, but I have no idea 
> how to do it :-(
> 
> Any help would be really appreciated as this stumps the hell out of 
> me.
> 
> Thanks
> 
> Chris

I think you may have a problem with your database design? Can you explain 
a little more exactly what it is you are trying to do and perhaps someone 
can advise on how your data might best be structured.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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

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




RE: [PHP-DB] Dynamic data from user file

2002-10-09 Thread Simon Taylor

Sean,
Not sure if this helps, but when I developed an in house app for my company
I have to migrate from very messy access db to mysql and I still have to
import once a week from the old db as other people still use it.
I just setup an array with oldtable and newtable then oldfield, newfield
etc. then parse through that array with a loop that inserts the new value
line for line and it works fine for me.
There is possibly a better way of going about it, but this works for me.
Cheers
Simon
 
-Original Message-
From: John Patrick [mailto:[EMAIL PROTECTED]] 
Sent: 9 October 2002 00:15
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dynamic data from user file


Greetings:
I currently am using the fgetcsv function to read in fields from a
user-defined file.  The delimited file is read and displayed just fine.

Firstly, what I'm trying to accomplish:  The MySQL database has a table
with about 30 fields.  The user-defined file may contain only some of these
fields and in no particular order.  I'm trying to achieve a way for the user
to specify what each field is so the insert into MySQL is done correctly.
(An analogy would be a custom import.

The problem I'm having is finding the best way to go about this.  I've
been able to read in the data via fgetcsv and dynamically displaying a drop
down box above each field with all possible choices but am unable to create
a way to link the two for each field successfully.  Been looking for
solutions as well as trial and error to no avail. Any suggestions? -Sean.



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

2002-10-09 Thread Simon Taylor

Does anyone know of a good infrmix list I am in a fix..
Thanks
_
Simon Taylor
AfriTol (Pty) Ltd.
?  [EMAIL PROTECTED]
Å+27 12 361 3303 ext 257
Å+27 72 471 1833
Æ+27 12 365 3810
 

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




RE: [PHP-DB] Javascript

2002-10-11 Thread Simon Taylor

Hi,
In your javascript try 

field1=Number(thisform.field1.value) etc...

Cheers
Simon

-Original Message-
From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]] 
Sent: 11 October 2002 11:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Javascript


My question might have anything to do with PHP but I have the following 
scenario:

Say I have four fields
field1 : 
field2 : 
field3 : 
field4 : 

And a total sum field, which is a total sum of the value of the 
expression, totalsum = field1 + field2 + field3 + field4
Total sum : XXX

You would need to use Javascript to extract the value of field1, field2, 
field3, field4, initiated by the Javascript onChange event.

The HTML codes should look like this:






So the add function snippet that I have:

function add()
{
var thisform=document.forms[0];
var field1=thisform.field1.value;
var field2=thisform.field2.value;
var field3=thisform.field3.value;
var field4=thisform.field4.value;
var totalqty=field1+field2+field3+field4;
thisform.totalsum.value=totalqty;
}

But all I got is a NaN which means Not A Number. I understand that you 
solve this by using the parseInt Javascript function.
But still all i get is a NaN value.

Would appreciate if someone could help me out on this.

Regards


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

2002-10-11 Thread Simon Taylor

The reason for this is these fields are regarded as text and unless you
specify number(variable) it may treat it as text.. When
Field1='0'
Field2='1'
Field3='2'

Field1+Field2+Field3 = '012'

If you use 
Field1=Number('0')
Field2=Number('1')
Field3=Number('2')

Field1+field2+field3 = 3

Cheers
Simon

-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] 
Sent: 11 October 2002 15:48
To: Shahmat Dahlan; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Javascript


I have met this problem before.

The only solution I have found is to assign "0" values to the INPUT tags:


HTH
Ignatius

- Original Message - 
From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 11:34 AM
Subject: [PHP-DB] Javascript


> My question might have anything to do with PHP but I have the 
> following
> scenario:
> 
> Say I have four fields
> field1 : 
> field2 : 
> field3 : 
> field4 : 
> 
> And a total sum field, which is a total sum of the value of the
> expression, totalsum = field1 + field2 + field3 + field4
> Total sum : XXX
> 
> You would need to use Javascript to extract the value of field1, 
> field2,
> field3, field4, initiated by the Javascript onChange event.
> 
> The HTML codes should look like this:
> 
> 
> 
> 
> 
> 
> So the add function snippet that I have:
> 
> function add()
> {
> var thisform=document.forms[0];
> var field1=thisform.field1.value;
> var field2=thisform.field2.value;
> var field3=thisform.field3.value;
> var field4=thisform.field4.value;
> var totalqty=field1+field2+field3+field4;
> thisform.totalsum.value=totalqty;
> }
> 
> But all I got is a NaN which means Not A Number. I understand that you
> solve this by using the parseInt Javascript function.
> But still all i get is a NaN value.
> 
> Would appreciate if someone could help me out on this.
> 
> Regards
> 
> 
> --
> 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] echo printing a cookie

2002-10-15 Thread Simon Taylor

Here ya go..

if ($_cookie["cookiename"]) {
echo"your cookie is".$_COOKIE['cookiename']."";
}

Cheers
Simon

-Original Message-
From: Steve Dodkins [mailto:[EMAIL PROTECTED]] 
Sent: 15 October 2002 15:22
To: Php-Db (E-mail)
Subject: [PHP-DB] echo printing a cookie


Hi I'm trying to print the contents of a cookie (php 4.2.3) the syntax below
is wrong but what should it be?

if ($_cookie["cookiename"]== TRUE) {
echo"your cookie is" $_COOKIE["cookiename"]"";
}



Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and 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




-- 
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] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread Simon Rees
Isn't this due to how your operating system handles the switch from 
daylight saving time to GMT (or local equivilent)? Or is this handled by 
PHP? That could account for different experiences. Of course if your 
locale doesn't switch from DST on this date you won't see the issue 
either...

Using gmdate doesn't cause this anomaly.
Apologies if this is what you're discussing and the issue is when the 
DST switch takes place...

cheers Simon
--
~~~~
 Simon Rees   |

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


Re: [PHP-DB] Reverse (or backward?) Infinity Loop

2004-10-20 Thread Simon Rees
Hi Bruno

It looks like you're trying to do a hierarchical query. What database are 
you using? If you're using Oracle you're in luck, see the docs for the 
START WITH and CONNECT BY clauses of SELECT. I don't think many other 
databases can do this so you would need to write code in your client 
language to interpret the catParentId to catId relationship.

Simon

On Wednesday 20 October 2004 03:47, Bruno B B Magalhães wrote:
> Hi guys,
>
> I have a normal categories table:
>
> catId
> catParentId
> catName
> catStatus
>
> But I want when a user enters on:
>
> http://hostname/site/products/catId1/catId7/catId13/../../contentId.html
>
> A listing should apear like that:
>
> • Category 1
>   • Category 7
>• Category 13
> • Category 2
> • Category 3
> • Category 4
> • Category 5
>
>
> A reverse (or backward) loop! We need to get the last category and then
> follow the ParentId until the 0 ParentId. Have anybody made this before
> (I hope so)?
>
> Many Thanks,
> Bruno B B Magalhaes

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Executing SQL query with ODBC

2004-11-09 Thread Simon Rees
Hi

Most databases don't return the number of rows in the results of a select 
statement to odbc_num_rows. See:

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

Usually the way to determine the number of rows a select returns is to 
either fetch them all and count them or do an additional aggregate query. 
It depends on your requirements.
I presume that this behaviour is because in most cases the database engine 
does not make the number of rows in a result set available to the driver. 
The only way the php interface could calculate the number of rows would be 
to fetch them all which may be inefficient - say if you were only 
interested in the first row out of a possible 100. [anybody else care to 
comment?]

Note, after an insert, update and delete statements odbc_num_rows does 
return the number of rows affected.

cheers Simon

On Tuesday 09 November 2004 08:09, Petrus Ali Saputra wrote:
> Here is my code:
> $conn = odbc_connect("Ta Fara","","");
> $query = "SELECT * FROM Config";
> $result = odbc_exec($conn, $query);
> echo odbc_num_rows($result);
>
> This code never give me a 0 result even there is some data. How can I
> solve it? Thank you.
> --
> Petrus Ali Saputra
> ==
> Addr. : Karang Empat Besar 76
>  Surabaya 60133
>  East Java, Indonesia
> Phone : 62-31-381-7866
>  62-31-6010-2653
>  62-81-23000-254
> --
> A professional web hosting for your business and corporate
> URL   : http://attractive.as/hostmania
> --
> Mau kredit mobil baru/bekas dengan bunga rendah?
> URL   : http://fantastic.as/kreditmobil

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Do You Need addslashes() When Using Bind Variables

2004-11-10 Thread Simon Rees
Hi Francis

No. Thats one of the great things about bind variables.

cheers Simon

On Wednesday 10 November 2004 05:45, Francis Chang wrote:
> Hi,
>
> I'm using the Oracle database though I think this question is generic to
> all databases.
>
> If you're using bind variables and preparing the SQL statements ahead of
> time, do you still need to call addslashes() before binding the strings
> to the bind variables?
>
> Thanks in advance.
>
> Francis

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Problem with an insert query

2004-11-13 Thread Simon Rees
You also appear to have a quote in the value that contains the word
members'
You will need to escape this or use bind vars.

Simon

On Saturday 13 November 2004 06:29, GH wrote:
> In my mySQL database I have the following tables:
> +-+
>
> | Tables_in_AHRC  |
>
> +-+
>
> | Attendance  |
> | Participants|
> | ProgressNotes   |
> | Sessions|
> | Staff   |
> | StaffAttendance |
>
> +-+
>
> I am trying to insert data in the ProgressNotes Table using the
> following query but it does not work. Can someone please assist? Thank
> You.
>
> INSERT INTO ProgressNotes
> (
> DateOfReport,
> NumPartReg,
> NumPartPresent,
> NumStaffPresent,
> NumVolPresent,
> TodaysActivities,
> DescribeSession,
> Interactions,
> Comments,
> Plans,
> Signed
>  )
> VALUES (
> '1',
> Select Count(*) From Attendance WHERE Session = 1,
> Select Count(*) From Attendance WHERE Session = 1 AND Present =
> 'Yes', Select Count(*) From StaffAttendance WHERE Session = 1 AND Present
> = 'Yes',
> '0',
> 'Attempt to start program',
> 'Due to the lack of completed paperwork between  and SITE, we
> were unable to complete the program as schedule. We informed the
> consumers of the situation.',
>  'Understandably, the consumers were upset. The Dean (SR) was
> kind enough to try and help explain to our members that there was a
> communications problem that caused the paperwork not to be completely
> in place before we started the program. LL and I got the members'
> phone numbers so that we can advise them if we are canceled next week.
>
> One consumer, DSL, was being uncooperative with us through out the
> time we were in session. She was pouting and having an attitude with
> all who were there including: the parents of another consumer, Dean SR
> and  staff. I attempted to calm Ms. L down and stated that I was
> informed by MR that there might be a problem at 6:45PM on Friday.
> After the close of business hours on Friday. Ms. L stated on many
> occasions that M should of told her that we were not having class
> today. She called a couple of persons including a counselor at ZZZ, to
> which I was able to speak and explain the situation. I attempted to
> explain the entire situation and that we did not definitely know that
> they were not going to let us in to the room  until today. The
> counselor seemed to be understanding. I told her that we are expecting
> to run the program next week and that we would contact Ms. L if we are
> told that we can not.',
> 'Everyone (Consumers, Parents and Staff) wishes to have the
> program by next week please help us get up and running.',
> 'Attempt to start up the program next session.',
> 'GMH, PgmLdr'
> );
>
> mysql> describe ProgressNotes;
> +--+--+--+-+-+---+
>
> | Field| Type | Null | Key | Default | Extra |
>
> +--+--+--+-+-+---+
>
> | DateOfReport | int(2)   |  | PRI | 0   |   |
> | NumPartReg   | int(2)   |  | | 0   |   |
> | NumPartPresent   | int(2)   |  | | 0   |   |
> | NumStaffPresent  | int(1)   |  | | 0   |   |
> | NumVolPresent| int(2)   |  | | 0   |   |
> | TodaysActivities | varchar(255) |  | MUL | |   |
> | DescribeSession  | text |  | | |   |
> | Interactions | text |  | | |   |
> | Comments | text |  | | |   |
> | Plans| text |  | | |   |
> | Signed   | text |  | | |   |
>
> +--+--+--+-+-+---+
> 11 rows in set (0.00 sec)
>
> [QUOTE PHPMYADMIN RESULTS]
>
> Database AHRC  - Table Participants  running on localhost
>
> Error
>
> There seems to be an error in your SQL query. The MySQL server error
> output below, if there is any, may also help you in diagnosing the
> problem
>
> ERROR: Unclosed quote @ 2040
> STR: '
> SQL: INSERT INTO ProgressNotes
> (
> DateOfReport,
> NumPartReg,
> NumPartPresent,
> NumStaffPresent,
> NumVolPresent,
> TodaysActivities,
> DescribeSession,
>  

Re: [PHP-DB] Problem with an insert query

2004-11-15 Thread Simon Rees
On Saturday 13 November 2004 20:25, GH wrote:
> Explain Bind Vars please... Thanks

It is a technique for preparing an SQL statement with placeholders which can 
then be substituted with values when the statement is executed. It will be 
unavailable to you unless you are using MySQL 4.1.3 or above and are using 
the mysqli library. See:

http://www.php.net/manual/en/function.mysqli-prepare.php

Note, this is a common technique in database programming but one which MySQL 
is only just starting to adopt...

Simon

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Simon Rees
On Tuesday 18 January 2005 19:18, Jochem Maas wrote:
> I was always under the impression that single quotes (assuming you are
> delineating you args with single quotes) should (officially) be escaped
> with another single quote - although backslash also works:

I think it depends on the database that you are using. Oracle and MS-SQL 
both require quotes to be escaped with another quote, MySQL uses 
backslashes.
I seem to recall that two quotes is the standard...

Of course it is even better to use bind vars and then you don't need to 
escape the quotes (or worry about sql injection attacks)...

cheers Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] IIS, PHP, and session data

2005-01-25 Thread Simon Rees
On Tuesday 25 January 2005 20:20, Perry, Matthew (Fire Marshal's Office) 
wrote:
> I am having trouble with my session data on Microsoft IIS.
>
> Here is a little background of the problem:
>
> 1)   I am not personally in control of our web server.  Our IT
> department manages it.  

oh dear! ;-) 

> They have IIS running on their sever and use MS 
> SQL Server, but they have allowed me to use PHP instead of ASP.
>
> 2)   I have Apache running on a local web server in our office (not
> the IT department).  It accesses the SQL Server database remotely.  I

I can't comment on the use of register_globals or session_register as I 
always use the $_SESSION array but I do use PHP on IIS...
Something that you might like to check is that the directory specified by:

session.save_path

in the IIS server's php.ini is a directory writable by the user that IIS 
masquerades. The default value for this is:

c:\php\sessiondata

which if your sysadmin installed php as Administrator will not be writable 
by the IIS user (normally IUSR_).

Either get the sysadmin to specify (& create) another dir that is writable 
by IIS or change the permissions on c:\php\sessiondata

Assuming you're running Apache on a Linux (and probably other un*x) 
distribution you will find that the session.save_path variable is set 
to /tmp which is usually world writable.

I think if you posted the exact error message it would tell me if this was 
happening to you or not...

hth, Simon

-- 
~~
Simon Rees Â| [EMAIL PROTECTED] Â|
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] JOIN problem

2005-02-07 Thread Simon Rees
On Monday 07 February 2005 18:22, Zouari Fourat wrote:
> Hello
> I have 2 tables with two columns in each one (cloned tables) like this :
>
> ID int(6)
> UserName varchar(25)
>
> and i would like to select usernames from table1 that doesnt appear in
> table2 so i did this :

Depending on which database you're using you may be able to do this:

SELECT a.username
FROM table1 a
WHERE a.username NOT IN ( SELECT b.username FROM table2 b )

cheers Simon
-- 
~~~~~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-28 Thread Simon Rees
On Sunday 27 February 2005 20:53, Micah Stevens wrote:
> I think about as safe as you can get is by putting the connection data
> out of the served directory, somewhere that's not directly accessable,
> and concentrate on system integrity. (security wise) 

A refinement of this technique is available on Unix boxes to which you have 
root access. 
Create a simple program that can read data about passwords etc. from a file.
Create a file that can be read by the program you've written with the 
'secrets' you want to keep secure in it. Make this file owned and readable 
only by root.
Set the program owned by root, executable by everyone and suid.

This will allow any user that can execute programs on the machine to obtain 
the password. Attackers who have just 'escaped' the web server root, say by 
taking advantage of a coding flaw, will not be able to read the password 
file. You can use groups to give finer grained access by making the program 
executable by a specific group only. However if an attacker has managed to 
obtain an account on your box they could probably just use a rootkit.

In practice I use a simple c program (for speed) to read the password file 
and a system call in my php script to call the c program. A PHP program 
could be used for reading the password file but will need to be executed by 
a shebang rather than as a parameter to php.

I can post further details if anyone is interested.

cheers Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-28 Thread Simon Rees
On Monday 28 February 2005 10:52, Jason Wong wrote:
>
> If you don't need the flexibility of the custom program and would rather
> make use of existing infrastructure:
>
> http://marc.theaimsgroup.com/?l=php-general&m=110137778213700&w=2
You said in that post: "Set default MySQL user and password in your virtual 
host container. Then connect to MySQL without specifying user and 
password."

Presumably the file which contains the virtual host directive is readable by 
the process the webserver is running as - if not how does this work? 
Therefore the technique you describe is no more secure than that described 
earlier of putting the passwords in a file outside the webserver root. 
The technique I described keeps you passwords secret even if an attacker has 
read access to files they shouldn't. A similar strategy is used for the 
shadow password file on Unix boxes.

cheers Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Re: password in md5 to connect to mysql instead of clear password

2005-02-28 Thread Simon Rees
On Monday 28 February 2005 13:52, Gael Lams wrote:
> Simon, I read your post regarding the use of a C
> program and I would be interested in having some more
> details as we started thinking about implementing
> something similar.

Unfortunately I've misplaced the program I'd used in the past to do this. It 
was written by a colleague at a workplace we've now both left. As an 
exercise I've tried to re-implement it myself. The source code is inline at 
the end of this message. Note I'm still learning C so it may be worth 
getting someone more experienced to check it over before setting it suid 
and using it in a secure environment! - it does appear to work however. It 
may be worth considering one of the many C libs already written for 
accessing config information as well...

> Our idea is to 'obfuscate' the password in some way
> and then process the value to get back to the plain
> text password.

I don't know that this would be much help - if someone can read the file the 
passwords are in it is likely they can read and copy the executable that 
reads that file. Running the executable themselves they will be able to 
figure out the obfuscation used... Still any obstacle is an obstacle!

> In order to perform the connection to Oracle, the php

I liked Jason's suggestion of setting the password in an apache config file 
that was only readable by root which has the same benefits as my suggestion 
but much simpler. I didn't realise you could do that. 
AFAICT the feature to set a default password, user etc doesn't seem to be 
available for Oracle connections. Although I'm going to investigate that 
further as I'm working with oracle at the moment.

cheers Simon

---
keyinfo.c:

/*
 * keyinfo.c:
 *
 * Retrieve information from a config file.
 *
 * Reads a text file. Splits each line on the first whitespace. If the token
 * before the whitespace matches the program's argument everything after the
 * whitespace up until the end of line is returned. Processing of further 
lines
 * stops on the first match.
 * Lines starting # are ignored.
 *
 * $Id: keyinfo.c,v 1.3 2005/02/28 18:30:12 sr Exp $
 */

#include 
#include 
#include 

/* hard coded location of the file which contains secret information */

#define SECRETS_FILE "/etc/keyinfo.conf"

/* maximum length of lines in the secrets file */

#define MAX_LINE_LENGTH 80



int main ( int argc, char *argv[] )
{

FILE *in_fileh;
char buffer[MAX_LINE_LENGTH + 1];
char *sought_key;
char *key, *value;

char delimiter_chars[] = " \t";

/* check a single parameter was passed */

if ( argc != 2 ) {

fprintf( stderr, "Required single command argument not 
supplied\n" );

exit( 8 );
}
else {

sought_key = argv[1];
}

/* open keyinfo.conf file */

in_fileh = fopen( SECRETS_FILE, "r" );

if ( in_fileh == NULL ) {

fprintf( stderr, "Error: Unable to open file %s\n", 
SECRETS_FILE );

exit( 8 );
}

/* read lines in file looking for key match */

while ( fgets( buffer, sizeof( buffer ), in_fileh ) ) {

/* skip lines that start with # */

if ( buffer[0] == '#' ) {

continue;
}

key = strtok( buffer, delimiter_chars );
value = strtok( NULL, delimiter_chars );

if ( strcmp( key, sought_key ) == 0 ) {

/* remove trailing \n from value and print to stdout */

value[ strlen( value ) - 1 ] = '\0';

printf( "%s", value );

break;
}
}

fclose( in_fileh );

exit( 0 );

}

---
/etc/keyinfo.conf:

# database 1 password
db1_pass 6dioqlFq
# database 2
db2_passxx55usp

---
-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Why not ?

2005-03-24 Thread Simon Rees
On Thursday 24 March 2005 17:26, JeRRy wrote:
>
> I was getting an error earlier stating round1 does not
> exist, however it does.  round1 table does not exist.
> So does not say round1.game1 does not exist.

Does a table named round1 exist in your database?
If so and you are using mysql > 4.0.4 you will need to mention all tables 
referenced in the WHERE clause in the UPDATE clause. e.g.

UPDATE tipping, round1
SET tipping.score = 3
WHERE round1.game1 = 'H'
AND tipping.username = 'jerry'

(assuming the score column you want to update is in the tipping table...)

You almost certainly want to join the two tables as well but without knowing 
your database it is impossible for me to say how.
If you are using an older mysql version what you want to do is probably 
impossible in one statement.

Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] comprehensive sql tutorial

2005-03-28 Thread Simon Rees
On Monday 28 March 2005 13:00, Yemi Obembe wrote:
> Does anyone please know where i can get a comprehensive SQL tutorial as
> in one that contains stuffs on engines, data structures, table types,
> etc& NOT JUST the basic query commands  DELETE, INSERT...> & their syntax(es).

Hi Yemi

It sounds like the information you're after tends to be fairly specific for 
the database you're using. Of the databases I've used both Oracle and 
MySql's documentation was very helpful about setting up databases although 
they do assume some knowledge of general database concepts.

See (for MySQL)
http://dev.mysql.com/doc/
or (for Oracle - requires OTN membership which is free)
http://oraclesvca2.oracle.com/docs/cd/B14117_01/index.htm

cheers Simon

-- 
~~~~~~
Simon Rees Â| [EMAIL PROTECTED] Â|
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] GD Question

2005-04-05 Thread Simon Rees
On Tuesday 05 April 2005 19:19, Craig Hoffman wrote:
> The script works fine when I test it on a stand alone page. I'm just
> not sure how to include with the "rest" of the site.

You can't do it all from the same script (AFAIK). This is because of the way 
http/browsers work - each image is requested as a separate file. Put your 
image code in a separate script and request it in the src attribute of your 
html image tags. e.g.



Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] PHP Sessions

2005-04-14 Thread Simon Rees
On Thursday 14 April 2005 10:23, Ian McGhee wrote:
> I have been looking into PHP sessions and I have noticed you can
> actually use a database for storing the sessions instead of flat files I
> will be using MS SQL for the database can any one give be a clue as to
> how I would go about this or point me in the direction of a good
> tutorial?

Have a look at the user comments on this page of the docs:

http://www.php.net/manual/en/function.session-set-save-handler.php

There are examples for MySQL and Postgres which should give you an idea of 
where to start.

cheers Simon

-- 
~~
Simon Rees Â| [EMAIL PROTECTED] Â|
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] Re: SQL or array ?

2005-04-24 Thread Simon Rees
On Sunday 24 April 2005 12:25, Paul Reilly wrote:
> How would I go about benchmarking the different options?
> What tools are there to do this?

a) time the script - quick, dirty and inaccurate but may provide an 
indicative result.

b) use a profiler, which can be more interesting as it will show the CPU 
time taken by various parts of the script.

I've used Xdebug for profiling and found it useful. Have a look at

http://www.php.net/debugger

for this and other options (I assume the other debuggers have profiling 
support).

Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] printf() in a variable, or alternative to printf()

2005-05-27 Thread Simon Rees
On Friday 27 May 2005 04:49, mayo wrote:
> I need to be able to format data.
>
> Printf() is perfect because I need a certain amount of characters (30
> for address).
>
> However I need this formatted data to be inside a file that's fwrite()
> and then FTPed to a distributor who will parse it and input into their
> database.

Use sprintf
see:
http://uk2.php.net/manual/en/function.sprintf.php

Si

-- 
~~~~~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] transactions

2005-11-08 Thread Simon Rees
On Tuesday 08 November 2005 09:37, Koen Wagemans wrote:
> MySQL isn't a transactional DB it doesn't know rollback and commit.

MySQL does support transactions so long as you use a reasonably recent version 
and InnoDB tables.

However as Bastien suggested a transaction can't persist beyond the execution 
of a script. 

cheers Simon

-- 
~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



[PHP-DB] Tricky one - include($identifer);

2001-02-07 Thread Simon Helson

Hey guys - I've been mulling this one over for a few days now - and still
haven't come up with anything intelligent to sort it...

I'm building a site where you can edit the content on the fly - basically
allowing you to write code and add pages without touching a telnet or ftp
session etc etc etc...

So I end up with chunks of text stored in my database - which I then pull
out and (currently) do the following with:


echo $content;

This works real nice when the text is plain HTML - makes setting up a site
nice-n-easy.. however, I want certain people to be able to put php code in
their snippets using  as you would when editing a normal php
file.

This is where my $echo falls over - none of the php code is executed (as
you would expect). What I really want to be able to do is:

include($content);

I haven't been able to find any ways to do this though - eval() looks for
just php code and include() and require() look for filenames. I really
don't want to store my snippets as files - but I guess I may have to if I
can't find a way to pull em out of a database and include() em.

Any help would be much appreciated

Cheers

Simon 

-- 
THE WORST HOMING PIGEON

This historic bird was released in Pembrokeshire in June 1953 and was
expected to reach its base that evening.  It was returned by post, dead,
in a cardboard box eleven years later from Brazil.
-- Stephen Pile, "The Book of Heroic Failures"


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] PHP4.0.5 and PHP 4.0.6

2001-07-19 Thread Simon Lange

...ive checked both versions, but they all have the same "error" inside.

Lets start in the beginning.
For several months my webserver has used mysql 3.23.38 AND php4.0.1 on 
Apache 1.3.12.
I had never ANY problems so the motto was: Never touch a runnning system 
(oh murphy you are so damn right!).

Well, i have several sites (about 40) running on this server. Never a 
performance issue appeared so i was glad.
Within these 40 servers i have several forums and 
contentmanagementsystems and some stats-systems. lets take as an example:
www.usrangers.net/stats/hlstats.php (hlstats 1.01)
alliance.usrangers.net (phpnuke5)
alliance.usrangers.net/forum (vBulletin2)
these three should be a good example to the php prob i have.


One day i had to install an addon to hlstats (the first link). but 
hlstats needs at least 4.0.4 (php) so i had to update from 4.0.1 to a 
more recent version. i choosed 4.0.5 because it was the most recent rpm 
i could find.

so i did install 4.0.5 and my problems began.

from now on i get a lot of times 2014:command out of sync when php did 
try to connect to the mysqldatabase. also i did realise that the did 
remove the command connection_timeout() (btw: bad attitude! never remove 
commands replace them by dummies! you never know how many system you 
will affect when you remove a command!), but that was fixed pretty fast.

first  i thought only hlstats is affected by this "bug" but then i 
realised that the other sites were too. hlstats is only more often the 
"caseofemergency" because it does use more often the database (it uses 
pretty complex and large queries). but phpnuke and vbulleting had 
problems as well!

So please help me i dont know what to do next. i think i have tried 
everything, but hey - you may have an idea!

Here is the webservers coniguration:
dual celeron 500mhz
512mb ram
29160 u-lvd controller
130gb u-lvd harddisks (5 harddisks)
intel network adapter (reference model)
redhat 6.2 with most recent patches and updates
kernel 2.2.18
uptime: 10:33am  up 45 days,  8:14,  4 users,  load average: 0.07, 0.09, 
0.11

as i said before the system is 100% stable and the ONLY factor i did 
change WAS php4 from 4.0.1 to 4.0.5 (i did check 4.0.6 as well but there 
was no significant change!)

sincerly

Simon


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] insert date problem

2001-08-31 Thread simon . pospisil

I get the following error when I try the statement below. Through
elimination I know it is the dates that are causing the problem. I  have
set the date format to this: alter session set NLS_DATE_FORMAT =
'-MM-DD';

$sql_season: insert into season (id, code, start_date, end_date) values
(16, 'all',  '2001-04-06', '2001-09-20')

Warning: OCIStmtExecute: ORA-01861: literal does not match format string
in ... on line 44

Can anyone help?


Cheers

Simon.



[PHP-DB] Setting nls_date_format in initSID.ora

2001-08-31 Thread simon . pospisil

Hello, I've tried changing the nls_date_format variable from:
nls_date_format = DD-MON-
to
nls_date_format = -MM-DD

Then I restart the database but it will only use the old format, the new
format has not been recognised. I'm editing the initSID.ora file where
SID is the sid of the database in question. Is that right? However, if
 I alter the format within a session then it works fine.

Any ideas?

Cheers

Simon.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Oracle8i connecting to database problem

2001-09-10 Thread simon . pospisil

Hi,

I've configured php as follows,


'./configure' '--with-mysql' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-config-file-path=/megsoc3/' '--enable-trans-sid' '--with-sablot'
'--with-zlib' '--with-oracle' '--with-oci8' '--enable-sigchild'
'--enable-track-vars' '--enable-sockets'

and it makes and installs fine.

Then I start httpd ok but it won't create a connection to the database.
Is this because I'm using apxs? Do I have to do it statically. Can't see
anything about it being a problem but I can't think of anything else.
Any ideas?

(I can create a connection to the database using sqlplus and the
variables I've set in php for the password and name etc. so I'm pretty
sure my client and server installations are ok).


Thanks,

Simon.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] special chars

2001-11-28 Thread Simon Brunner

Hi,

I'm just getting started with php/mysql and I have a big question: how do I
handle the special chars? when I import an excel sheet into my db, all
special chars are displayed wrongly. If a change them to html entities befor
the import, it works, but it's ugly to have all the & and whatnot in the
db. Is there some way i can administrate thise special chars?

also, the function htmlentities() does not work properly - it ignors ö, ä,
etc. 

Does anyone know a manual for that?

Thanks!!!

Simon


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] DB update problem...

2003-09-13 Thread Simon Stiefel
On 13 Sep 2003 at 17:26, James Hatridge wrote:

> HI gang!

Hi!

> I am trying to do a mysql update. I wrote a small bash file that works fine at 
> the command line. But I would like to have it ran by PHP whenever I start the 
> DB. What I am trying to do is have PHP check if a new update file is there 
> (AUD.txt) if it is run the "euro-update.program". But I'm getting either 
> nothing or errors. see below
> 
> ###
> 
> Here is the piece of code that is making this error:
> 
>  
>   $db = mysql_connect("XXX", "YY", "Z");
>   mysql_select_db("WartHog",$db);
> 
>  if (file_exists("/var/lib/mysql/WartHog/AUD.txt")){
> 
> exec(`/var/lib/mysql/WartHog/euro-update.program`)  

Here's the problem.
Your euro-update.program is already executed through the inverted 
commas.
And then the exec-function tries to execute the return value from 
your program. And so you get the exec-warning, cause it doesn't know 
what to execute.


>   or die ('didnt work #1') ;
> }
> else
> {
> echo('File not there');
> }
> 
> ?>
> #
> 
> Running the code as is I get this error:
> 
> Warning: exec() [function.exec]: Cannot execute a blank command in 
> /home/hatridge/public_html/Database/currency.php on line 22
> 
> #
> 
> When I use " " or ' ' around the program name  I get only "didn't work #1". 

Then you perhaps don't have the right to execute it.
Note that the apache-user must have the execution right on that file.


> Any ideas?

Yes, see above. ;)

> 
> Thanks!
> 
> JIM

HTH,

Simon

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



[PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Simon J Welsh
On 30/12/2010, at 1:12 PM, Ethan Rosenberg wrote:

> Dear List -
> 
> Thank you for all your help in the past.
> 
> Here is another one
> 
> I would like to have a regex  which would validate that a telephone number is 
> in the format xxx-xxx-.
> 
> Thanks.
> 
> Ethan
> 
> MySQL 5.1  PHP 5  Linux [Debian (sid)] 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

\d{3}-\d{3}-\d{4}

Also, have a look at the phoneNumber method in the relevant Validate PEAR 
package: http://pear.php.net/packages.php?catpid=50&catname=Validate

---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e


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



[PHP-DB] RE: problems with require...

2001-02-14 Thread Simon R Jones

> I have only started to program in php over the past month or so.
> but I'm some problems with this bit of code below.
>
> Problem area
>  require('$includefile.inc');

hi Dave,
the 
  require($includefile);

bit should work fine. but before that try replacing this line
  $includefile = $row["includefile"];
with:
  $includefile = $row["includefile"].".inc";  

PHP is prob getting confused what the "." means in your require statement.

best wishes,
simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
  30 Hopkins Close   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1FD   |   www.studio24.net 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] running PHP from the cron

2001-02-19 Thread Simon R Jones

hi there,
I have PHP installed as an Apache module and I can't have it as CGI.. now
I'm looking into ways to run PHP scripts off the cron, and I saw that PHPAds
does a fetch command to parse the script on a regular basis.

I'm just wondering if anyone else out there has had to do this, and what is
the best method? Otherwise I'll have to fall back on Perl to do my cron
stuff ;-)

have fun
simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
  30 Hopkins Close   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1FD   |   www.studio24.net




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] running PHP from the cron

2001-02-19 Thread Simon R Jones

> > I have PHP installed as an Apache module and I can't have it as
> CGI.. now
> > I'm looking into ways to run PHP scripts off the cron, and I saw
>
> Rebuilt php again and don't specify the apache configuration option. This
> will build php as a CGI program which you can then use in cron.
>
> Does anyone else do this? I'd love it if the default php build still built
> the CGI when building the apache plugin.

thanks for the reply Dave,
my point is that I do not have access to certain root stuff on Apache (it's
a virtual server) so I am forced to only use PHP as a module, which to be
honest I prefer to do since as far as I'm aware that makes it faster and
it's only for some cron job stuff where the CGI option becomes more useful
(to me at least).

So I'm wondering if anyone has any experience of using fetch to parse PHP
scripts off the cron. An example (from PHPAds) is below..
  59 23 * * * fetch -o -
http://www.profi.it/phpAds/mail.php3>>/var/log/messages

I'm wondering if there are any pros/cons to this approach, and whether there
are any better ways of running PHP off the cron bar resorting to CGI.

best wishes,
simon


 ---
 Studio 24 Ltd   |   tel. 01223 501 892
  30 Hopkins Close   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1FD   |   www.studio24.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] running PHP from the cron

2001-02-19 Thread Simon R Jones

> I run my PHP crons like this:
>
> 0 6 * * * /usr/local/bin/lynx -source "http://www.domain.com/file.php"
>
> This is not the most secure of course, as the file is below the root
> and could be hit by any user.  But works for my particular case ...
>
> Anyone know of a method to make this more secure ... password
> protecting the directory it's in?  chnaging the permissions of the
> file???

if that's how you do it what about putting a .htaccess file in the web
directory with the PHP script in it restricting access to only your
webserver, that way the script would run from the cron, but no-one else
could access the script.

si

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
  30 Hopkins Close   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1FD   |   www.studio24.net




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] get_browser()

2001-03-27 Thread Simon R Jones

hi all
how does everyone feel about the get_browser function?? Is the general
impression it's overkill, and also flawed since it depends on the
browser.ini file being up to date, or it is widely used?

I'm about to need to use browser detection & I'm wondering if a simple
get_env("HTTP_USER_AGENT") will be far simpler

thanx in advance..
si

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
 PO Box 88   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1XH   |   www.studio24.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Can't connect to local MySQL server through socket '/tmp/mysql.sock'

2001-04-26 Thread Simon R Jones

> > I have this error
> > Can't connect to local MySQL server through socket '/tmp/mysql.sock'
> >  (111)

sounds like MySQL is not running on your server.. ensure it's installed
properly and has actually started, i think typing
  mysqladmin -p version

at the command line will tell you if it's running.

you might find some useful info here:
http://www.mysql.com/doc/S/t/Starting_server.html

good luck,
simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
 PO Box 88   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1XH   |   www.studio24.net



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] RE: nobody header

2001-04-30 Thread Simon R Jones

> the script below gives me a from header = "Nobody"; and the
> $from which is supposed to be the header has been included in the
> body of the email. How can i make the $from to be placed in the header?

hi Jennifer,
you have to specify the From email address in the following way:
   $from = "From: [EMAIL PROTECTED]";

the last parameter passed to PHP is not by default the from address, but any
additional paremeters, so you've gotta tell PHP it's the from address (in
the way above). Look here for more info:
http://www.php.net/manual/en/function.mail.php

the "nobody" user will be the webserver, and since your original script did
not specify a sender then this is what the server usually defaults to.

best wishes,
Simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
 PO Box 88   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1XH   |   www.studio24.net



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] RE: MySQL: CRITICAL problem

2001-05-11 Thread Simon R Jones

> The connection has already been established, and some data read from
> database without problem. The connection was not closed, rather
> left alive.
> Now...
> Why this happens when I try to execute additional query? Help, anyone!

the connection variable is not global, so the function your MySQL statement
is in cannot access it. to access a variable outside of a function write

  global $connection;

or something similar (whatever the name of your MySQL connection handle) as
the first line of your function :-)

simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
 PO Box 88   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1XH   |   www.studio24.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] security in PHP under Apache

2001-05-23 Thread Simon R Jones

hi there
does anyone know how to make PHP run as a different user than the default
one ("nobody" i believe). I have many users with websites and would like
them to be able to run PHP under their usernames so as to ensure security.
Though I'm not sure this is possible unless I install PHP as a CGI binary
and use something like suExec (I currently have it as an Apache module, and
would like to leave it that way).

best wishes,
simon

 ---
 Studio 24 Ltd   |   tel. 01223 501 892
 PO Box 88   |   fax. 0870 063 1216
 Cambridge   |   mob. 07974 074 547
   CB4 1XH   |   www.studio24.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]