php-windows Digest 5 May 2001 15:25:35 -0000 Issue 581

Topics (messages 7304 through 7312):

Apache + PHP4 can't connect ODBC
        7304 by: Art

Re: R: [PHP-WIN] PHP4 and MS Access
        7305 by: John Lim

help:How can I upload the whole directory to the web
        7306 by: yanshuldg
        7307 by: Phil Driscoll
        7309 by: Matt Williams

Re: trouble with MySQL 'LIKE' command
        7308 by: PHPWIN
        7310 by: PHPWIN
        7311 by: PHPWIN

PWS uses wrong PHP version
        7312 by: Wenz Christian

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]


----------------------------------------------------------------------


I have Win NT4.0/SP3 with OmniHttpd as my Web Server for S/W dev. project.
It's about Web-Base MS Access Database with ODBC and it's run properly.
Recently I decided to use Apache instead. So I remove Omni and install
Apache instead, and then PHP. After that I move my program to Apache folder
and run.
I found it's can't connect to odbc from "odbc_connect", the error is about
this

Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified, SQL state IM002 in SQLConnect in
c:\program files\apache group\apache\htdocs\test\odbc.php on line 6

So I decide to install Omni and shutdown Apache Service. It's work!!! ODBC
is all right.
But when I had shutdown Omni and start Apache service, It's doesn't. Why????

Help meeee!!! As soon as possible, Thanks.






If you are familiar with ADO, you can try ADODB at
http://php.weblogs.com/adodb

-john

"Ermanno Iannacci" <[EMAIL PROTECTED]> wrote in message
003401c0d3a7$26925fa0$51fda8c0@ciccio">news:003401c0d3a7$26925fa0$51fda8c0@ciccio...
> Use ODBC functions.
> http://www.php.net/manual/en/ref.odbc.php
>
>
> ----- Original Message -----
> From: Net Citizen <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 03, 2001 10:02 AM
> Subject: [PHP-WIN] PHP4 and MS Access
>
>
> > Hello:
> >
> > I'm a newbie to PHP.
> >
> > I'm running PHP4 on IIS5 on a Win2K machine. I'd like to query an MS
> Access
> > table ("SELECT * FROM Member") from the PHP script. The ODBC DSN is
> already
> > set up properly.
> >
> > Which PHP functions should I use to do the job?
> >
> > Do you know of a tutorial site for this kind of data queries, or queries
> > from MS SQL Server?
> >
> > Thanks for your tips.
> >
> >
> >
> >
> >
> > --
> > PHP Windows 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 Windows 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]
>









-----------------------------------------
免费汉堡包,轻松学英语
http://www.etang.com/texthanburg/index.htm
她关心你的温暖
http://ad2.263.net/cgi-bin/advert/push/redirect.cgi?aid=2725
Etang数字专卖店
http://www.etang.com/adclient/cncard/index.htm
女强人批判书
http://topic.etang.com/




>Subject: [PHP-WIN] help:How can I upload the whole directory to the web
You can't - it would be a security nightmare!
-- 
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org







> Subject: [PHP-WIN] help:How can I upload the whole directory to the web

FTP

M@





, could be html coding problem
or your data contains incomplete html like <table><tr><td>...but no closing
tags,
try

function genData($ID){
$sql=" select * from table where ID like   '%".$ID."%' ";
$sql_result=mysql_result($sql) or die($sql');

$r ="<table>";

whille($result=mysql_fetch_array($sql_result)){
  $r.=" <tr> ";
    for($ii=0;$ii<count($result);$ii++){

    $r.= " <td> ".htmlSpecialChars(stripslashes($result[$ii]))." </td> ";

    }
 $r.="</tr> ";

    }
$r.="</table>";
return $r;
}

echo genData($ID);




----- Original Message -----
From: "r.gelstharp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 05, 2001 2:28 AM
Subject: Re: [PHP-WIN] trouble with MySQL 'LIKE' command


> Done like you recommended with the select....like '%".$var."%' but it
still
> gives me empty rows of data.
>
> Everytime I try and search for something it returns with 7 rows of data,
all
> of which are blank. I'm using the basic mysql_num_rows to get the number
of
> rows of data it retrieves, and I'm using a WHILE($data =
> mysql_fetch_array($sql_result)) to output the rows of data.
>
> If it's not the SQL statement, what could be doing this? I ask in case
> you've heard this problem mentioned by some thick newbie like meself
before.
>
>
>
> --
> PHP Windows 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]
>
>




<?
//search.php
mysql_connect($host,$user,$pw);
mysql_select_db($db);


 echo genSearch($table,$ID,$search,$host,$user,$pw,$db);
if(isset($search)){
echo genData($table,$ID,$search);
 }

/*********** fucntions ********/
function genSearch($table,$ID,$search,$host,$user,$pw,$db){
      $r="<table bgcolor='#D0D0D0'>";
      $r.="<tr><td><form action='search.php'></td></tr>";
      $r.="<tr><td>Host:</td><td><input type=text name=host
value=$host></td></tr>";
      $r.="<tr><td>User</td><td><input type=text name=user
value=$user></td></tr>";
      $r.="<tr><td>Password</td><td><input type=password name=pw
value=$pw></td></tr>";
      $r.="<tr><td>Database</td><td><input type=text name=db
value=$db></td></tr>";
      $r.="<tr><td>Table:</td><td><input type=text name=table
value=$table></td></tr>";
      $r.="<tr><td>Field</td><td><input type=text name=ID
value=$ID></td></tr>";
      $r.="<tr><td>Search</td><td><input type=text name=search
value=$search></td></tr>";

      $r.="<tr><td></td></tr><tr><td><input
type=submit></form></td></tr></table>";
      return $r;
    }

function genData($table,$ID,$search){
$sql=" select * from $table where lower($ID) like
'%".strtolower($search)."%' ";
$sql_result=mysql_query($sql) or die($sql);

$r ="<br><table><tr><td bgcolor='#D0D0D0'>Table: $table Field: $ID
</td></tr>";
 $c=0;
while($result=mysql_fetch_array($sql_result)){
 $c++;
  $r.="<tr> ";
    for($ii=0;$ii<count($result);$ii++){
     $color=($ii%2==0)?'#D0DCE0':'#DDDDDD';
    $r.= " <td bgcolor=$color>
".htmlSpecialChars(stripslashes($result[$ii]))." </td> ";

    }
 $r.="</tr> ";

    }
$r.="</table><b>$sql</b>";
return " Matches: ".$c.$r;
}



?>

----- Original Message -----
From: "r.gelstharp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 05, 2001 2:28 AM
Subject: Re: [PHP-WIN] trouble with MySQL 'LIKE' command


> Done like you recommended with the select....like '%".$var."%' but it
still
> gives me empty rows of data.
>
> Everytime I try and search for something it returns with 7 rows of data,
all
> of which are blank. I'm using the basic mysql_num_rows to get the number
of
> rows of data it retrieves, and I'm using a WHILE($data =
> mysql_fetch_array($sql_result)) to output the rows of data.
>
> If it's not the SQL statement, what could be doing this? I ask in case
> you've heard this problem mentioned by some thick newbie like meself
before.
>
>
>
> --
> PHP Windows 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]
>
>




Man you got me in the scripting mood...
I think this is pretty useful to have on a site

<?
//searchDB.php
mysql_connect($host,$user,$pw);


 echo genSearch($table,$ID,$search,$host,$user,$pw,$db);
if(isset($search)){
echo genData($db,$table,$ID,$search);
 }

/*********** fucntions ********/
function genSearch($table,$ID,$search,$host,$user,$pw,$db){
      $dbs=mysql_list_dbs();
      $num_db=mysql_num_rows($dbs);
      $ddb="<select name=db>";
    for($d=0;$d<$num_db;$d++){
      $ddb.="<option
".selected($db,mysql_db_name($dbs,$d)).">".mysql_db_name($dbs,$d)."</option>
";
     }
    $ddb.="</select>";



    @mysql_select_db($db);
     $tbs=@mysql_list_tables($db);
     $num_tb=@mysql_num_rows($tbs);
     $tb="<select name=table>";
    for($d=0;$d<$num_tb;$d++){
      $tb.="<option
".selected($table,@mysql_tablename($tbs,$d)).">".@mysql_tablename($tbs,$d)."
</option>";
     }
    $tb.="</select>";



     $fl=@mysql_list_fields($db,$table);
     $num_fd=@mysql_num_fields($fl);
     $fd="<select name=ID>";
    for($d=0;$d<$num_fd;$d++){
      $fd.="<option
".selected($ID,@mysql_field_name($fl,$d)).">".@mysql_field_name($fl,$d)."</o
ption>";
     }
    $fd.="</select>";



      $r="<table bgcolor='#D0D0D0'>";
      $r.="<tr><td><form method=post action='searchDB.php'></td></tr>";
      $r.="<tr><td>Host</td><td><input type=text name=host
value=$host></td></tr>";
      $r.="<tr><td>User</td><td><input type=text name=user
value=$user></td></tr>";
      $r.="<tr><td>Password</td><td><input type=password name=pw
value=$pw></td></tr>";
      $r.="<tr><td>Database</td><td> $ddb </td></tr>";
      $r.="<tr><td>Table</td><td> $tb </td></tr>";
      $r.="<tr><td>Field</td><td> $fd </td></tr>";
      $r.="<tr><td>Search</td><td><input type=text name=search
value=$search></td></tr>";

      $r.="<tr><td></td></tr><tr><td><input
type=submit></form></td></tr></table>";
      return $r;
    }

function selected($a,$b){
   return ($a==$b)?"selected":"";
 }

function genData($db,$table,$ID,$search){



   $fields =@mysql_list_fields($db,$table);//could have $link as 3rd
argument
   $num=@mysql_num_fields($fields);

 $r ="<br><table><tr>";

   for($f=0;$f<$num;$f++){
    $r.="<td bgcolor='#D0DCE0'>".@mysql_field_name($fields,$f)."</td>";
   }
    $r.="</tr>";



 $sql=" select * from $table where lower($ID) like
'%".strtolower($search)."%' ";
 $sql_result=@mysql_query($sql);

 $c=0;
while($result=@mysql_fetch_array($sql_result)){
 $c++;
  $r.="<tr> ";
    for($ii=0;$ii<count($result);$ii++){
     $color=($c%2==0)?'#D0DCE0':'#DDDDDD';
    $r.= " <td bgcolor=$color>
".htmlSpecialChars(stripslashes($result[$ii]))." </td> ";

    }
 $r.="</tr> ";

    }
$r.="</table>";
return "<br><b>$sql</b><br><br> Matches: ".$c."<br>".$r;
}



?>

> ----- Original Message -----
> From: "r.gelstharp" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, May 05, 2001 2:28 AM
> Subject: Re: [PHP-WIN] trouble with MySQL 'LIKE' command
>
>
> > Done like you recommended with the select....like '%".$var."%' but it
> still
> > gives me empty rows of data.
> >
> > Everytime I try and search for something it returns with 7 rows of data,
> all
> > of which are blank. I'm using the basic mysql_num_rows to get the number
> of
> > rows of data it retrieves, and I'm using a WHILE($data =
> > mysql_fetch_array($sql_result)) to output the rows of data.
> >
> > If it's not the SQL statement, what could be doing this? I ask in case
> > you've heard this problem mentioned by some thick newbie like meself
> before.
> >
> >
> >
> > --
> > PHP Windows 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 Windows 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]
>
>




Hi, 

this is not a problem with the Win32 version of PHP, but maybe someone here
can shed some light ... 
I have different versions of PHP on one of my machines (Win98SE, PWS4), and
whenever a new release comes out, I install the new version in a new
directory and change the appropriate entries in php.ini (mainly
extension_dir) and the registry
(HKLM/Software/Services/W3SVC/Parameters/ScriptMap), and copy php4ts.dll
into \windows\system.

Lately, I experienced that PWS always seems to use php4.0.4 (located in
c:\php\php4.0.4) when a php page is requested from the server. Using a text
search I found out that there seems to be a c:\php\php4.0.4-entry in
system.dat, that was not shown in regedit. So I used a registry optimizing
tool, and now this string is no longer found in system.dat. However,
whenever I call a .php page, still 4.0.4 is used. I finally deleted the .php
entry in ScriptMap, rebootet - and what do you gess, .php scripts do still
get executed.

Does anyone have any idea? The workaround - copying the latest distributions
in c:\php\php4.0.4 - does work, but I am still very interested why my PWS
still executes .php scripts. Where else could I look?

Best regards 
Christian 


Reply via email to