[PHP-DB] RE: [PHP-WIN] Which ORM tool for Windows with Microsoft SQL Server 7/2000/2005.

2009-04-19 Thread Andi Gutmans
Btw, in Zend Framework while we based our adapter interface on PDO we allow for 
adapters which are not based on PDO (via quackable interfaces).
DB2, Oracle and MySQLi are supported in that way as well as of course many PDO 
drivers.
You can easily take one of those native DB adapters and make them work with the 
sql server for PHP driver.
Andi

> -Original Message-
> From: David Sceppa [mailto:david.sce...@microsoft.com]
> Sent: Sunday, April 19, 2009 5:18 PM
> To: Richard Quadling
> Cc: php-db@lists.php.net; php-wind...@lists.php.net; php-windows-
> intern...@lists.php.net
> Subject: RE: [PHP-WIN] Which ORM tool for Windows with Microsoft SQL
> Server 7/2000/2005.
> 
> Richard,
> 
> As pointed out on other branches of the thread, PDO_ODBC is currently
> your best option for accessing SQL Server via PDO and technologies that
> rely on PDO.  We are investigating producing a PDO driver for SQL
> Server Driver going forward.
> 
> David Sceppa
> Program Manager - Microsoft SQL Server Driver for PHP
> 
> -Original Message-
> From: Richard Quadling [mailto:rquadl...@googlemail.com]
> Sent: Tuesday, April 14, 2009 7:38 AM
> To: php-db@lists.php.net; php-wind...@lists.php.net; php-windows-
> intern...@lists.php.net
> Subject: [PHP-WIN] Which ORM tool for Windows with Microsoft SQL Server
> 7/2000/2005.
> 
> Hi.
> 
> I'm trying to find an ORM tool to allow me to talk to Microsoft SQL
> servers (V7, 2000 and 2005) for Windows.
> 
> For those that use ORM, what do you use?
> 
> I've looked at Doctrine (requires php_pdo_mssql which isn't part of
> the VC9 win32 builds; for the VC6 builds, it requires ntwdblib.dll
> which is oh so dead).
> 
> I'm looking into Propel next. This now seems to be using PDO and
> PDO_MSSQL, so it seems I've got the same problems.
> 
> Ideally, using the nice shiny Microsoft SQL Server 2005 Driver for PHP
> from Microsoft (http://www.codeplex.com/SQL2K5PHP) would be nice. But
> this isn't PDO.
> 
> Is there anyone capable of getting the Microsoft driver PDO aware?
> 
> Any help/suggestions would be appreciated.
> 
> Regards,
> 
> Richard Quadling.
> 
> --
> -
> Richard Quadling
> Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread mrfroasty

Thanks
Great tip there...

Gr
mrfroasty


Chris wrote:

mrfroasty wrote:

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address')";


P:S
id incremented automatically by MYSQL now


Maybe - but it's by accident. You're trying to insert the word NULL 
into an int field (it's being treated as a word because of the single 
quotes around it).


Don't specify the id field at all:

$query2 = "insert into contacts(phone, name, address) values ('" . 
mysql_real_escape_string($_POST['phone']) . "', '" . 
mysql_real_escape_string($_POST['name']) . "', '" . 
mysql_real_escape_string($_POST['address']) . "')";


You should always use the field names (as above) because if your table 
gets reordered, your inserts will now break - if you put "name" before 
phone, the data is now going into the wrong fields.





--
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


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



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread Chris

mrfroasty wrote:

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address')";


P:S
id incremented automatically by MYSQL now


Maybe - but it's by accident. You're trying to insert the word NULL into 
an int field (it's being treated as a word because of the single quotes 
around it).


Don't specify the id field at all:

$query2 = "insert into contacts(phone, name, address) values ('" . 
mysql_real_escape_string($_POST['phone']) . "', '" . 
mysql_real_escape_string($_POST['name']) . "', '" . 
mysql_real_escape_string($_POST['address']) . "')";


You should always use the field names (as above) because if your table 
gets reordered, your inserts will now break - if you put "name" before 
phone, the data is now going into the wrong fields.


--
Postgresql & php tutorials
http://www.designmagick.com/


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



[PHP-DB] RE: [PHP-WIN] Which ORM tool for Windows with Microsoft SQL Server 7/2000/2005.

2009-04-19 Thread David Sceppa
Richard,

As pointed out on other branches of the thread, PDO_ODBC is currently your best 
option for accessing SQL Server via PDO and technologies that rely on PDO.  We 
are investigating producing a PDO driver for SQL Server Driver going forward.

David Sceppa
Program Manager - Microsoft SQL Server Driver for PHP

-Original Message-
From: Richard Quadling [mailto:rquadl...@googlemail.com] 
Sent: Tuesday, April 14, 2009 7:38 AM
To: php-db@lists.php.net; php-wind...@lists.php.net; 
php-windows-intern...@lists.php.net
Subject: [PHP-WIN] Which ORM tool for Windows with Microsoft SQL Server 
7/2000/2005.

Hi.

I'm trying to find an ORM tool to allow me to talk to Microsoft SQL
servers (V7, 2000 and 2005) for Windows.

For those that use ORM, what do you use?

I've looked at Doctrine (requires php_pdo_mssql which isn't part of
the VC9 win32 builds; for the VC6 builds, it requires ntwdblib.dll
which is oh so dead).

I'm looking into Propel next. This now seems to be using PDO and
PDO_MSSQL, so it seems I've got the same problems.

Ideally, using the nice shiny Microsoft SQL Server 2005 Driver for PHP
from Microsoft (http://www.codeplex.com/SQL2K5PHP) would be nice. But
this isn't PDO.

Is there anyone capable of getting the Microsoft driver PDO aware?

Any help/suggestions would be appreciated.

Regards,

Richard Quadling.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

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




Re: [PHP-DB] Please help a newbie: Fixed

2009-04-19 Thread Rij
Ok, figured it out.
I was using an int for the field but the value was too large for it. I
used bigint instead and life is suddenly so much better. Well it helps
that its bright and sunny here too :)

On Sun, Apr 19, 2009 at 10:37 AM, mrfroasty  wrote:
> Try using var_export() or var_dump() to debug to see why that 1st time is
> having different values than what you want :-)
> The idea from the sample code I have provided is not to use phone as id...
>
> P:S
> A wild guess would phone is some sort of string.
>
> GR
> mrfroasty
>
>
>
> Rij wrote:
>>
>> Ok. But that still doesn't tell me why I am getting the behavior from
>> my code. Where is the garbage value coming from? And why only the
>> first time I do an INSERT?
>>
>> To Daniel Carrera, thanks for your tip. I sure will look up your
>> suggestion.
>>
>> On Sun, Apr 19, 2009 at 2:32 AM, mrfroasty  wrote:
>>
>>>
>>> Hello,
>>>
>>> May be try something like this:
>>>
>>> $query1=
>>> CREATE TABLE contacts(
>>> id int(16) NOT NULL auto_increment,
>>> phone varchar(15)  NOT NULL,
>>> name varchar(15) NOT NULL,
>>> address varchar(15) NOT NULL,
>>> PRIMARY KEY (id)
>>> );
>>>
>>> $query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name',
>>> '$address')";
>>>
>>> P:S
>>> id incremented automatically by MYSQL now
>>>
>>> GR
>>> mrfroasty
>>>
>>>
>>>
>>>
>>
>>
>
>
> --
> Extra details:
> OSS:Gentoo Linux-2.6.25-r8
> profile:x86
> Hardware:msi geforce 8600GT asus p5k-se
> location:/home/muhsin
> language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
> Typo:40WPM
> url:http://mambo-tech.net
> url:http://blog.mambo-tech.net
>
>

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



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread Daniel Carrera

Rij wrote:

I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = "INSERT INTO contacts VALUES ('$phone', '$name', '$address')";
if (mysql_query($query, $con)) echo "Values inserted";
else die('Unable to create table : '.mysql_error());


This is unsafe code. I suggest you lookup "prepared statements" and the 
PDO library (which is part of PHP).


Daniel.

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



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread mrfroasty

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address')";


P:S
id incremented automatically by MYSQL now

GR
mrfroasty



Rij wrote:

Hello,

I am new to the world of PHP and MySQL. My objective is to create a
table, insert values in it and read it back.

Here's the partial code to create a table from a PHP file:

if (!$table_exists) {
$query="CREATE TABLE contacts (id int(20) NOT NULL, name
varchar(15) NOT NULL, address varchar(15),PRIMARY KEY(id)
if (mysql_query($query, $con)) echo "Table contacts created";
else die('Unable to create table : '.mysql_error());
}


I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = "INSERT INTO contacts VALUES ('$phone', '$name', '$address')";
if (mysql_query($query, $con)) echo "Values inserted";
else die('Unable to create table : '.mysql_error());


Now the problem that I am facing is that when I make my first insert,
the id field shows a garbage value and not the number that I entered.
Subsequent entries into the table show up just fine. It's only the
first one.

What am I doing wrong?

Thanks, Rij

  



--
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


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



[PHP-DB] Re: Which ORM tool for Windows with Microsoft SQL Server 7/2000/2005.

2009-04-19 Thread Manuel Lemos
Hello,

on 04/14/2009 11:38 AM Richard Quadling said the following:
> I'm trying to find an ORM tool to allow me to talk to Microsoft SQL
> servers (V7, 2000 and 2005) for Windows.
> 
> For those that use ORM, what do you use?
> 
> I've looked at Doctrine (requires php_pdo_mssql which isn't part of
> the VC9 win32 builds; for the VC6 builds, it requires ntwdblib.dll
> which is oh so dead).
> 
> I'm looking into Propel next. This now seems to be using PDO and
> PDO_MSSQL, so it seems I've got the same problems.
> 
> Ideally, using the nice shiny Microsoft SQL Server 2005 Driver for PHP
> from Microsoft (http://www.codeplex.com/SQL2K5PHP) would be nice. But
> this isn't PDO.
> 
> Is there anyone capable of getting the Microsoft driver PDO aware?

You may want to take a look at Metastorage. It supports MS-SQL via the
regular mssql extension, but it would not be hard to develop a driver
for using PDO MS-SQL driver.

http://www.metastorage.net/


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP-DB] Please help a newbie

2009-04-19 Thread Rij
Hello,

I am new to the world of PHP and MySQL. My objective is to create a
table, insert values in it and read it back.

Here's the partial code to create a table from a PHP file:

if (!$table_exists) {
$query="CREATE TABLE contacts (id int(20) NOT NULL, name
varchar(15) NOT NULL, address varchar(15),PRIMARY KEY(id)
if (mysql_query($query, $con)) echo "Table contacts created";
else die('Unable to create table : '.mysql_error());
}


I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = "INSERT INTO contacts VALUES ('$phone', '$name', '$address')";
if (mysql_query($query, $con)) echo "Values inserted";
else die('Unable to create table : '.mysql_error());


Now the problem that I am facing is that when I make my first insert,
the id field shows a garbage value and not the number that I entered.
Subsequent entries into the table show up just fine. It's only the
first one.

What am I doing wrong?

Thanks, Rij

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