php-windows Digest 8 Jan 2002 09:23:08 -0000 Issue 942
Topics (messages 11339 through 11340):
Re: PHP/SQL search engine help (newbie)
11339 by: Carlos Andre Marques Moreira
Subject: Cookie Problems with IIS 4 and not with IIS 5.1
11340 by: Kevin
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 ---
Hi,
AFAIK PHP don't access MS Access directly so you should access your database
via ODBC.
Here are some ODBC Functions:
int odbc_connect(string dsn, string user, string password, int
[cursor_type]) -> Connect to ODBC, cursor_type is optional
int odbc_exec(int conn_id, string query_string) -> Executes the SQL Query
String
int odbc_fetch_row(int result_id, int [row_number]) -> Retrieve a row from
your query, row_number is optional, if not provided will retrieve next row.
string odbc_result(int result_id, mixed field) -> Retrieve a column, mixed
field could be column name or number
void odbc_close(int conn_id) -> Close the connection to ODBC
Ex1.:
$conn_id = odbc_connect("access","","");
$result = odbc_exec($conn_id, "select * from students");
$result_row = odbc_fetch_row($result);
$student_name = odbc_result($result_row, "name");
Ex2.:
ODBC configuration
dsn name = "access", no user or password set.
Access table
Table name = "thelp"
Columns -> ID, Title, Help
$word is the query string you'll look for into your database
This you'll search the database for $word and then output the help title as
a link to the help description
<?php
$conn_id = odbc_connect("access","","");
$result = odbc_exec($conn_id, "select id, title from thelp where title like
'*$word*' or help like '*$word*'");
while ($result_row = odbc_fetch_row($result)){
?>
<a href="help.php?id=<?php echo odbc_result($result_row, "id");?>"><?php
echo odbc_result($result_row, "2");?></a>
<br>
<?php
}
?>
For more information see ODBC Functions in the Manual.
Carlos André Marques Moreira
Bolsista CNPq / RHAE
SENAI / CETAE
[EMAIL PROTECTED]
2001 Ano Internacional do Voluntário
-----Original Message-----
From: Keith Hughes [mailto:[EMAIL PROTECTED]]
Sent: segunda-feira, 7 de janeiro de 2002 13:22
To: [EMAIL PROTECTED]
Subject: PHP/SQL search engine help (newbie)
Hi,
Completely new at this, so don't be too harsh.
I'm trying to create a help file system for a programme (much like the help
files that you get with macromedia flash).
All the help files will be in HTML format and will be in an access database.
I need to search through the database with a search engine, and I assumed
that the best way to do this would be to use a combination of SQL and PHP.
Unfortunately I'm very very new to both. I have a basic grasp of SQL but
hardly any for PHP.
Could anybody give me any tips on how to get started or a link to any good
tutorials?
Thanks for any help
Keith
--- End Message ---
--- Begin Message ---
I have the same code on 2 systems, NT4 Server with IIS 4 and XP IIS 5.1 the
cookies work ok on IIS 5.1 and not IIS 4.
It's the same PHP.INI file on both systems and the same version of PHP.
Does and know how to fix it?
Kevin
CONFIG.PHP
<?php
$Domain = www.mydomain.com;
$URLPath = "/test/";
?>
INDEX.PHP
<?php
error_reporting(1);
require("config.php");
$Referer = getenv("HTTP_REFERER");
setcookie ("First", "First",time()+60, "$URLPath", "$Domain",0);
setcookie ("Referer", "$Referer" ,time()+60, "$URLPath", "$Domain",0);
?>
--- End Message ---