php-windows Digest 10 May 2007 07:01:31 -0000 Issue 3222
Topics (messages 27859 through 27865):
Re: Problem With Pear::DB
27859 by: Stut
27862 by: Jody Williams
27864 by: Jody Williams
Re: problems with PHP
27860 by: Dan Shirah
Re: Dynamically update mysql field
27861 by: Dan Shirah
27865 by: sam rumaizan
barcode webapp printing
27863 by: Moore, Joshua
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Jody Williams wrote:
I have a situation where I am unable to connect to a Microsoft SQL
2005 Database from Windows Server 2003 (IIS + PHP 5.0.4).
here is the code:
<?php
require_once 'DB.php';
$dsn = "mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station";
$db = DB::connect($dsn);
if (DB::isError($db))
{
die ($db->getMessage().'<br>'.$db->getUserInfo());
}
// no useful info. just trying to return something.
$query = "select [name] as n from sysobjects order by [name]";
$data =& $db->query($query);
while ($row = $data->fetchRow())
{
echo $row[0]."<br>";
}
$db->disconnect();
?>
Here is the error:
[DB Error: connect failed] **
mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station
From my workstation, this can connect just fine (Windows XP, IIS, PHP
5.0.4).
There aren't any firewalls between the machines.
Any suggestions?
Can the server you're running this on resolve eggrs006 to an IP address?
If not, that's your problem. If it can then you need to check the SQL
server user to make sure it can access that database from that machine.
Note that it is very very very unlikely that this problem is anything to
do with PHP or Pear::DB.
-Stut
--- End Message ---
--- Begin Message ---
THat is what I thought. Just to confirm, I created an ODBC connection
for the Windows 2k3 server to the Database using the Server name. I
tried the IP in the PHP file and have the same results.
Is there some kind of restriction that might be in place in Windows 2003?
Jody
On 5/9/07, Stut <[EMAIL PROTECTED]> wrote:
Jody Williams wrote:
> I have a situation where I am unable to connect to a Microsoft SQL
> 2005 Database from Windows Server 2003 (IIS + PHP 5.0.4).
>
> here is the code:
> <?php
> require_once 'DB.php';
> $dsn = "mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station";
> $db = DB::connect($dsn);
> if (DB::isError($db))
> {
> die ($db->getMessage().'<br>'.$db->getUserInfo());
> }
> // no useful info. just trying to return something.
> $query = "select [name] as n from sysobjects order by [name]";
> $data =& $db->query($query);
> while ($row = $data->fetchRow())
> {
> echo $row[0]."<br>";
> }
> $db->disconnect();
> ?>
>
> Here is the error:
>
> [DB Error: connect failed] **
> mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station
>
> From my workstation, this can connect just fine (Windows XP, IIS, PHP
> 5.0.4).
>
> There aren't any firewalls between the machines.
>
> Any suggestions?
Can the server you're running this on resolve eggrs006 to an IP address?
If not, that's your problem. If it can then you need to check the SQL
server user to make sure it can access that database from that machine.
Note that it is very very very unlikely that this problem is anything to
do with PHP or Pear::DB.
-Stut
--- End Message ---
--- Begin Message ---
Any idea why this does work from the same server?
<?php
require_once './includes/adodb/adodb.inc.php';
$dsn = "Provider=MSDASQL;Driver={SQL
Server};SERVER=eggrs006;DATABASE=transfer_station;UID=aspj_transfer;PWD=XXXXXX;";
$db = &ADONewConnection("ado_mssql");
$db->Connect($dsn);
$rs = $db->Execute("select [name] from sysobjects");
foreach($rs as $k=>$row)
{
echo $row[0] . '<br>';
}
$db->disconnect();
?>
This is using ADOdb instead of PEAR::DB.
Jody
On 5/9/07, Stut <[EMAIL PROTECTED]> wrote:
Jody Williams wrote:
> I have a situation where I am unable to connect to a Microsoft SQL
> 2005 Database from Windows Server 2003 (IIS + PHP 5.0.4).
>
> here is the code:
> <?php
> require_once 'DB.php';
> $dsn = "mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station";
> $db = DB::connect($dsn);
> if (DB::isError($db))
> {
> die ($db->getMessage().'<br>'.$db->getUserInfo());
> }
> // no useful info. just trying to return something.
> $query = "select [name] as n from sysobjects order by [name]";
> $data =& $db->query($query);
> while ($row = $data->fetchRow())
> {
> echo $row[0]."<br>";
> }
> $db->disconnect();
> ?>
>
> Here is the error:
>
> [DB Error: connect failed] **
> mssql://aspj_transfer:[EMAIL PROTECTED]/transfer_station
>
> From my workstation, this can connect just fine (Windows XP, IIS, PHP
> 5.0.4).
>
> There aren't any firewalls between the machines.
>
> Any suggestions?
Can the server you're running this on resolve eggrs006 to an IP address?
If not, that's your problem. If it can then you need to check the SQL
server user to make sure it can access that database from that machine.
Note that it is very very very unlikely that this problem is anything to
do with PHP or Pear::DB.
-Stut
--- End Message ---
--- Begin Message ---
How does it "not" work?
On 5/9/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
Hi!
I can only view html-files.. PHP don't seem to work?
Windows 2003 Server, IIS 6... PHP 5.2...
/Gustav
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I think what you're asking is how can you have a form pull data from your
database, populate the form, but then have fields to the side so the user
and update the database based on the user input.
Kind of like a "Change my personal information" page.
I would do it like this:
1. Write your query to pull all your current data from mysql.
2. Assign the output into variables (my_value_1, my_value_2 etc..)
3. Make your form objects have the value you just pulled.
4. Put a submit button at the bottom of the page to save the changes.
5. Upon submit have the page refresh itself to display the new values.
<TR ALIGN="CENTER" HEIGHT="80" >
<TD> data from mysql :<br><b>SAM <br><input type="submit" name="update"
value="update this cell"><br><font color ="red">You can change the
information and submit it to mysql to update the original database.</font>
</TD>
<TD> data from mysql :<input type="text" value="<?php echo $my_value_1;
?>" name="value_1"> </TD>
<TD> data from mysql :<input type="text" value="<?php echo $my_value_2;
?>" name="value_2"> </TD>
<TD> data from mysql :<input type="text" value="<?php echo $my_value_3;
?>" name="value_3"> </TD>
<TD> data from mysql :<input type="text" value="<?php echo $my_value_4;
?>" name="value_4"> </TD>
</TR>
On 5/9/07, Aleksandar Vojnovic <[EMAIL PROTECTED]> wrote:
Sorry I still don't understand. Do you wish to display/reload the data
on some timeout (ala AJAX) or you actually wish to update the data from
this form into the MySQL?
Aleksander
sam rumaizan wrote:
> *Copy and paste my code in your editor and run it then you will
> understand what I need*
>
> *<------------------------------------------------start code
> --------------------------------------->*
> *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
> <HTML>
> <HEAD>
> <TITLE>data</TITLE>*
> *</HEAD>*
> *<BODY>*
> *<H1> <font color ="red">You can change the information in any cell
> and submit it to mysql to update the original database.*
> *Basically when the user views his/her information he/she should have
> the option to change the information.</font>
> </H1>
> <form>
> <TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
> <TR ALIGN="CENTER">
> <TH>NAME</TH>
> <TH>JOB TITLE</TH>
> <TH> COLOR</TH>
> <TH>ADDRESS</TH>
> <TH>PHONE NO</TH>
> </TR>
> <TR ALIGN="CENTER" HEIGHT="80" >
> <TD> data form mysql :<br><b>SAM <br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
> <TD> data form mysql :<br><b>ENGENEER </TD>
> <TD> data form mysql :<br><b>RED </TD>
> <TD> data form mysql :<br><b>OKLAHOMA </TD>
> <TD> data form mysql :<br><b>405-12452 </TD>*
> *</TR>
> <TR ALIGN="CENTER" HEIGHT="80" >
> <TD> data form mysql :<br><b>JOHN </TD>
> <TD> data form mysql :<br><b>DESIGNER <br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
> <TD> data form mysql :<br><b>BLUE </TD>
> <TD> data form mysql :<br><b>COLORADO </TD>
> <TD> data form mysql :<br><b>303-5458 </TD>*
> *</TR>*
> *<TR ALIGN="CENTER" HEIGHT="80" >
> <TD> data form mysql :<br><b>MIKE</TD>
> <TD> data form mysql :<br><b>STUDENT </TD>
> <TD> data form mysql :<br><b>GREEN<br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database. </font> </TD>
> <TD> data form mysql :<br><b>UTAH </TD>
> <TD> data form mysql :<br><b>504-5670 </TD>*
> *</TR>*
> *<TR ALIGN="CENTER" HEIGHT="80" >
> <TD> data form mysql :<br><b>JULI</TD>
> <TD> data form mysql :<br><b>TEACHER</TD>
> <TD> data form mysql :<br><b>PINK<br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
> <TD> data form mysql :<br><b>TEXES </TD>
> <TD> data form mysql :<br><b>405-6364 </TD>*
> *</TR>
> </TABLE>*
> **
> * *
> *
> </form>*
> * *
> *</BODY>
> </HTML>
> *
> *<------------------------------------------------End code
> --------------------------------------->*
> * *
> *
> /Aleksandar Vojnovic <[EMAIL PROTECTED]>/* wrote:
>
> Of course it can be done, but please be more specific about what you
> wish to achieve.
>
> Aleksander
>
> sam rumaizan wrote:
> > Dynamically update mysql field
> >
> > I have a function that will populate the table cells (TD) with
> data (information) from mysql database.
> > What I need to do is to allow the user to update the cell
> information (information was pulled from mysql database) from the
> table cells (TD) then the data get updated in mysql. So when I
> pull the data again I can see the new information.
> > Is there any way to do this using PHP?
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Ahhh...imagining that irresistible "new car" smell?
> > Check outnew cars at Yahoo! Autos.
> >
>
>
>
>
>
>
> ------------------------------------------------------------------------
> Get your own web address.
> <
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
>
> Have a HUGE year through Yahoo! Small Business.
> <
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
update the data from this form into the MySQL?
Aleksandar Vojnovic <[EMAIL PROTECTED]> wrote: Sorry I still don't understand.
Do you wish to display/reload the data
on some timeout (ala AJAX) or you actually wish to update the data from
this form into the MySQL?
Aleksander
sam rumaizan wrote:
> *Copy and paste my code in your editor and run it then you will
> understand what I need*
>
> *<------------------------------------------------start code
> --------------------------------------->*
> *
>
>
> *
> **
> **
> * You can change the information in any cell
> and submit it to mysql to update the original database.*
> *Basically when the user views his/her information he/she should have
> the option to change the information.
>
>
>
>
> NAME
> JOB TITLE
> COLOR
> ADDRESS
> PHONE NO
>
>
> data form mysql :
SAM
[input] > name="update" value="update this cell">
You can
> change the information and submit it to mysql to update the original
> database.
> data form mysql :
ENGENEER
> data form mysql :
RED
> data form mysql :
OKLAHOMA
> data form mysql :
405-12452 *
> *
>
> data form mysql :
JOHN
> data form mysql :
DESIGNER
[input] > name="update" value="update this cell">
You can
> change the information and submit it to mysql to update the original
> database.
> data form mysql :
BLUE
> data form mysql :
COLORADO
> data form mysql :
303-5458 *
> **
> *
> data form mysql :
MIKE
> data form mysql :
STUDENT
> data form mysql :
GREEN
[input] > name="update" value="update this cell">
You can
> change the information and submit it to mysql to update the original
> database.
> data form mysql :
UTAH
> data form mysql :
504-5670 *
> **
> *
> data form mysql :
JULI
> data form mysql :
TEACHER
> data form mysql :
PINK
[input] > name="update" value="update this cell">
You can
> change the information and submit it to mysql to update the original
> database.
> data form mysql :
TEXES
> data form mysql :
405-6364 *
> *
> *
> **
> * *
> *
> *
> * *
> *
>
> *
> *<------------------------------------------------End code
> --------------------------------------->*
> * *
> *
> /Aleksandar Vojnovic /* wrote:
>
> Of course it can be done, but please be more specific about what you
> wish to achieve.
>
> Aleksander
>
> sam rumaizan wrote:
> > Dynamically update mysql field
> >
> > I have a function that will populate the table cells (TD) with
> data (information) from mysql database.
> > What I need to do is to allow the user to update the cell
> information (information was pulled from mysql database) from the
> table cells (TD) then the data get updated in mysql. So when I
> pull the data again I can see the new information.
> > Is there any way to do this using PHP?
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Ahhh...imagining that irresistible "new car" smell?
> > Check outnew cars at Yahoo! Autos.
> >
>
>
>
>
>
>
> ------------------------------------------------------------------------
> Get your own web address.
>
> Have a HUGE year through Yahoo! Small Business.
>
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
--- End Message ---
--- Begin Message ---
Hello,
I am currently trying to print to my Z4MPlus barcode printer via a php web
application. I first just want to test and see if I can get the printer to
print anything using this code:
<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>
When this is run it just returns with a blank screen without printing
anything on my barcode printer. I am running XP pro, Uniform Server with the
shared printer named "ZebraZ4M" The printer is attached LPT1 on my machine.
I don't see anything on my error logs. Am I going at this the right way? I'm
trying to be able to allow anyone to print barcodes on my intranet via this
web application.
-Josh
--- End Message ---