Re: [PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-27 Thread edwardspl
Rob Adams wrote:

> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > Rob Adams wrote:
> >
> > > <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > > $str = " INSERT INTO staff (name,job,subject)
> > >  1   2   3
> > > > VALUES('$name','$job','$date','$subject',)";
> > >   1   2 - 3
> >
> > $date=date('Y-m-d H:i:s');
> >
> > Any idea for me to fix this kind of problem ?
>
> I guess I wasn't explicit enough.  I would start by chaning your insert
> statement to:
>
> insert into staff (name, job, date_field, subject) values ... (etc.)
>
>   -- Rob

Hello Rob,

Just enable global function of php.ini, then it is ok now !

Thank for your reply !

Edward.

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



Re: [PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-27 Thread Rob Adams

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Rob Adams wrote:
>
> > <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > > $str = " INSERT INTO staff (name,job,subject)
> >  1   2   3
> > > VALUES('$name','$job','$date','$subject',)";
> >   1   2 - 3
>
> $date=date('Y-m-d H:i:s');
>
> Any idea for me to fix this kind of problem ?

I guess I wasn't explicit enough.  I would start by chaning your insert
statement to:

insert into staff (name, job, date_field, subject) values ... (etc.)

  -- Rob

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



Re: [PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-26 Thread edwardspl
Rob Adams wrote:

> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > $str = " INSERT INTO staff (name,job,subject)
>  1   2   3
> > VALUES('$name','$job','$date','$subject',)";
>   1   2 - 3
>
>   -- Rob

$date=date('Y-m-d H:i:s');

Any idea for me to fix this kind of problem ?

Thank a lots.

Edward.

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



[PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-26 Thread Rob Adams
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> $str = " INSERT INTO staff (name,job,subject)
 1   2   3
> VALUES('$name','$job','$date','$subject',)";
  1   2 - 3

  -- Rob

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



[PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-26 Thread Chris Thomas
Do you have register_globals on?
If not ayou have to get the POST information manually.
ie..  $job = $_POST['job']

Also are you sure that you are connecting to the database successfully?

add:
or die('could not connect')

to the end of your mssql_pconnect and mssql_select_db statements.

So your save.php should something like this.

Search data




Chris

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Dear All,
>
> There is a sample that can't to insert any data ( via variable ) in
> MS-SQL :
>
> insert.php:
> 
> 
> 
> Job
> Subject
> 
> 
> 
> 
>
> save.php:
> Search data
> 
> 
>  $date=date('Y-m-d H:i:s');
> $link = mssql_pconnect("sql","sa","1234");
> mssql_select_db("phpbook",$link);
> $str = " INSERT INTO staff (name,job,subject)
> VALUES('$name','$job','$date','$subject',)";
> mssql_query($str,$link);
> ?>
>
> After insert data by using save.php, I found no any data from the
> Database system ( MS-SQL ), but I sure the Database System is no problem
> !
>
> So, how can I fix this kind of problem ( Sorry, I'm not familar with php
> ) ?
> Many thank for your help !
>
> Edward.

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