[PHP-DB] Re: Building A Web Site Search Engine Using PHP / mySQL

2004-09-08 Thread Per Lundkvist
Or: http://www.aspseek.org/


Per

Ron Piggott [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I wanted to also ask about how you would build a web site search engine
with
 php and mySQL.

 I had thought of setting up a table with a few columns ---

 one for the URL of the specific page (This could become a link when a
match
 is found for that page)
 second with the page title --- used in displaying the search results
 third with the plain text from the page --- for searching purposes

 and then having one line of the table per web page on the site

 Then setting up a PHP form that would search the text from the page and
make
 some type of matching results page for each entry that found the words the
 user typed in.

 Any other thoughts?  There is no compression this way,. but maybe there
 doesn't need to be.  I don't know how to automate populating a table, but
I
 could use the cut / paste feature.

 Any other thoughts?  I know how to do the above and the PHP commands to
 use --- I wanted to ask before I got started for any tips instead of
 re-starting.

 Ron

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



[PHP-DB] error form check box and database

2004-09-08 Thread Remember14a
Dear friends,

Any guidance to the error , please.
--
---
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
C:\HOME\doctorbush\check.php on line 11

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting 
T_STRING or T_VARIABLE or T_NUM_STRING in C:\HOME\doctorbush\check.php on line 73

--
script code
-
?php

// example code for checkbox.txt
// confirmed working: Friday, March 07, 2003

// Configuration information for connecting to database
// Contains $db_name, $db_user, $db_pass, $db_host
// for connection.

// Enter your database host name here.
$db_host = \localhost\;
// Enter your database password here.
$db_pass = \\;
// Enter your database user name here.
$db_user = \\;
// Enter the name of your database here.
$db_name = \\;

// Connect to database
  $db_conn = @mysql_pconnect($db_host, $db_user, $db_pass);

// Check for database unavailable 
if (!$db_conn)
{
print \ERROR - failed to create connection: \ . 
mysql_error();

}


function make_item_control($value,$title) { 
$content = 'tr class=\tabletext\tdinput type=\checkbox\ 
name=\item[]\ value=\'.$value.'\ /'.$title.'/td';

return $content;
}

if($p_delete_checked) {
// Process items
// We substract one from the count because a for loop executes 
once

// before incrementing.
$n = count($item)-1;
for($i = 0; $i = $n; $i++)
{
$sql = \DELETE FROM note WHERE note_id = $item[$i];\;
$result = mysql_db_query($db_name,$sql);

if (!$result) {
print ' ERROR - Delete note query failed: ' 
.mysql_error();

}

}
} else {
// list items

// database query here

$sql = \SELECT note_id,film_id,LEFT(text,32) AS item_name FROM 
note ORDER BY film_id ASC;\;

$result = mysql_db_query($db_name,$sql);

if (!$result || mysql_num_rows($result)  1) {
print ' ERROR - Select note query failed: ' 
.mysql_error();

}

print 'form action='. $_SERVER['PHP_SELF'] .'';
print 'table';
while($row = mysql_fetch_array($result)) {
print make_item_control($row[note_id],$row[item_name]);
}
print 'tr class=\tabletext\
td
input type=\Submit\ name=p_delete_checked value=\Delete 
Checked\ /

/tr';
print '/table';
print '/form';

}



?


Re: [PHP-DB] error form check box and database

2004-09-08 Thread zareef ahmed
Hi,

 
--- [EMAIL PROTECTED] wrote:

 Dear friends,
 
 Any guidance to the error , please.

--
 ---
 Warning: Unexpected character in input: '\'
 (ASCII=92) state=1 in 
 C:\HOME\doctorbush\check.php on line 11
 
 Parse error: parse error, unexpected
 T_ENCAPSED_AND_WHITESPACE, expecting 
 T_STRING or T_VARIABLE or T_NUM_STRING in
 C:\HOME\doctorbush\check.php on line 73
 

--
 script code

-
 ?php
 
 // example code for checkbox.txt
 // confirmed working: Friday, March 07, 2003
 
 // Configuration information for connecting to
 database
 // Contains $db_name, $db_user, $db_pass, $db_host
 // for connection.
 
 // Enter your database host name here.
 $db_host = \localhost\;
why you need \ in this line. \ is an escaping
charactor for strings , there  is no need of using
this

you should declare any variable just as

$db_host=localhost;

read more about using / charactor

===
zareef ahmed
 
 // Enter your database password here.
 $db_pass = \\;


 // Enter your database user name here.
 $db_user = \\;

 // Enter the name of your database here.
 $db_name = \\;

 
 // Connect to database
   $db_conn = @mysql_pconnect($db_host, $db_user,
 $db_pass);
 
 // Check for database unavailable 
 if (!$db_conn)
 {
 print \ERROR - failed to create connection: \ .

 
 mysql_error();
 
 }
 
 
 function make_item_control($value,$title) { 
 $content = 'tr class=\tabletext\tdinput
 type=\checkbox\ 
 name=\item[]\ value=\'.$value.'\
 /'.$title.'/td';
 
 return $content;
 }
 
 if($p_delete_checked) {
 // Process items
 // We substract one from the count because a for
 loop executes 
 once
 
 // before incrementing.
 $n = count($item)-1;
 for($i = 0; $i = $n; $i++)
 {
 $sql = \DELETE FROM note WHERE note_id =
 $item[$i];\;
 $result = mysql_db_query($db_name,$sql);
 
 if (!$result) {
 print ' ERROR - Delete note query failed: '
 
 .mysql_error();
 
 }
 
 }
 } else {
 // list items
 
 // database query here
 
 $sql = \SELECT note_id,film_id,LEFT(text,32) AS
 item_name FROM 
 note ORDER BY film_id ASC;\;
 
 $result = mysql_db_query($db_name,$sql);
 
 if (!$result || mysql_num_rows($result)  1) {
 print ' ERROR - Select note query failed: '
 
 .mysql_error();
 
 }
 
 print 'form action='. $_SERVER['PHP_SELF'] .'';
 print 'table';
 while($row = mysql_fetch_array($result)) {
 print
 make_item_control($row[note_id],$row[item_name]);
 }
 print 'tr class=\tabletext\
 td
 input type=\Submit\ name=p_delete_checked
 value=\Delete 
 Checked\ /
 
 /tr';
 print '/table';
 print '/form';
 
 }
 
 
 
 ?
 


=
Homepage :: http://www.zasaifi.com



___
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

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



[PHP-DB] error of check box form

2004-09-08 Thread Remember14a
Dear friends,


Any guidance to the error , please.
Resubmitting,
--
---
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
C:\HOME\doctorbush\check.php on line 11

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting 
T_STRING or T_VARIABLE or T_NUM_STRING in C:\HOME\doctorbush\check.php on line 73

--
script code
-
?php

// example code for checkbox.txt
// confirmed working: Friday, March 07, 2003

// Configuration information for connecting to database
// Contains $db_name, $db_user, $db_pass, $db_host
// for connection.

// Enter your database host name here.
$db_host = \localhost\;
// Enter your database password here.
$db_pass = \\;
// Enter your database user name here.
$db_user = \\;
// Enter the name of your database here.
$db_name = \\;

// Connect to database
  $db_conn = @mysql_pconnect($db_host, $db_user, $db_pass);

// Check for database unavailable 
if (!$db_conn)
{
print \ERROR - failed to create connection: \ . 
mysql_error();

}


function make_item_control($value,$title) { 
$content = 'tr class=\tabletext\tdinput type=\checkbox\ 
name=\item[]\ value=\'.$value.'\ /'.$title.'/td';

return $content;
}

if($p_delete_checked) {
// Process items
// We substract one from the count because a for loop executes 
once

// before incrementing.
$n = count($item)-1;
for($i = 0; $i = $n; $i++)
{
$sql = \DELETE FROM note WHERE note_id = $item[$i];\;
$result = mysql_db_query($db_name,$sql);

if (!$result) {
print ' ERROR - Delete note query failed: ' 
.mysql_error();

}

}
} else {
// list items

// database query here

$sql = \SELECT note_id,film_id,LEFT(text,32) AS item_name FROM 
note ORDER BY film_id ASC;\;

$result = mysql_db_query($db_name,$sql);

if (!$result || mysql_num_rows($result)  1) {
print ' ERROR - Select note query failed: ' 
.mysql_error();

}

print 'form action='. $_SERVER['PHP_SELF'] .'';
print 'table';
while($row = mysql_fetch_array($result)) {
print make_item_control($row[note_id],$row[item_name]);
}
print 'tr class=\tabletext\
td
input type=\Submit\ name=p_delete_checked value=\Delete 
Checked\ /

/tr';
print '/table';
print '/form';

}



?


Re: [PHP-DB] error of check box form

2004-09-08 Thread John Holmes
[EMAIL PROTECTED] wrote:
Any guidance to the error , please.
Resubmitting,
--
---
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
C:\HOME\doctorbush\check.php on line 11

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting 
T_STRING or T_VARIABLE or T_NUM_STRING in C:\HOME\doctorbush\check.php on line 73

--
$db_host = \localhost\;
$db_pass = \\;
$db_user = \\;
$db_name = \\;
print \ERROR - failed to create connection: \ . 
$sql = \DELETE FROM note WHERE note_id = $item[$i];\;
$sql = \SELECT note_id,film_id,LEFT(text,32) AS item_name FROM 
note ORDER BY film_id ASC;\;
Remove the \ characters in the lines above.
$db_host = localhost;
etc...
and read this http://us2.php.net/manual/en/language.types.string.php
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Building A Web Site Search Engine Using PHP / mySQL

2004-09-08 Thread Mark Wylie
http://www.phpdig.net/

Uses both PHP and MySQL.

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



Re[2]: [PHP-DB] Re: Building A Web Site Search Engine Using PHP / mySQL

2004-09-08 Thread Mark Wylie
Joseph are you saying Orase uses phpdig?

No. Only that phpdig uses PHP  MySQL.

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



[PHP-DB] Zip Code Fields

2004-09-08 Thread Aaron Todd
Just curious, but what kind of field is everyone using to store a Zip Code. 
I set mine to Medium Integer with a max of 5 digits, but for zip codes that 
begins with 0 the 0 is knocked off.  The only solutiuon I can think of is to 
make the field a text field.  Does anyone have a better solution?

Thanks,

Aaron 

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



RE: [PHP-DB] Zip Code Fields

2004-09-08 Thread Justin Palmer

Are you only accepting US zip codes?

Justin

-Original Message-
From: Aaron Todd [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 08, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Zip Code Fields


Just curious, but what kind of field is everyone using to store a Zip
Code. 
I set mine to Medium Integer with a max of 5 digits, but for zip codes
that 
begins with 0 the 0 is knocked off.  The only solutiuon I can think of
is to 
make the field a text field.  Does anyone have a better solution?

Thanks,

Aaron 

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

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



Re: [PHP-DB] Zip Code Fields

2004-09-08 Thread Chris
With MySQL you could do this:
MEDIUMINT(5) UNSIGNED ZEROFILL
Most databases (I think) would have an equivalent of this if you're 
using something else.

Chris
Aaron Todd wrote:
Just curious, but what kind of field is everyone using to store a Zip Code. 
I set mine to Medium Integer with a max of 5 digits, but for zip codes that 
begins with 0 the 0 is knocked off.  The only solutiuon I can think of is to 
make the field a text field.  Does anyone have a better solution?

Thanks,
Aaron 

 

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


[PHP-DB] Inserting a seperator in long numbers

2004-09-08 Thread Shiloh Madsen
I have several tables with long numbers whose digits are always in some
multiple of 8 eg  or  etc...up to 160 digits long.
The numbers all have a number of digits that is some multiple of 8. What I
need to do is write an sql update query that will insert a - or some other
seperator character every 8 digits in cases where the number of digits is
higher than 8 i.e. -, and so on for bigger numbers. What
query would i use to do this?

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



Re: [PHP-DB] Zip Code Fields

2004-09-08 Thread Micah Stevens

you can store it as an integer, but make sure you use a proper print function 
to display it later that preserves the 5 digits, such as: 


 echo str_pad($zip, 5, 0, STR_PAD_LEFT);


or something like that.. I take it you have no plans to store 10 digit zips? 

-Micah 
 


On Wednesday 08 September 2004 08:36 am, Aaron Todd wrote:
 Just curious, but what kind of field is everyone using to store a Zip Code.
 I set mine to Medium Integer with a max of 5 digits, but for zip codes that
 begins with 0 the 0 is knocked off.  The only solutiuon I can think of is
 to make the field a text field.  Does anyone have a better solution?

 Thanks,

 Aaron

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



RE: [PHP-DB] Zip Code Fields

2004-09-08 Thread Dylan Barber
Doesn't the USPS have some online API for checking Zip Codes?  Not sure but I thought 
I read about it somewhere.

look here

http://www.usps.com/webtools/


-Original Message-
From: Justin Palmer [EMAIL PROTECTED]
Sent: Sep 8, 2004 12:25 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Zip Code Fields


Are you only accepting US zip codes?

Justin

-Original Message-
From: Aaron Todd [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 08, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Zip Code Fields


Just curious, but what kind of field is everyone using to store a Zip
Code. 
I set mine to Medium Integer with a max of 5 digits, but for zip codes
that 
begins with 0 the 0 is knocked off.  The only solutiuon I can think of
is to 
make the field a text field.  Does anyone have a better solution?

Thanks,

Aaron 

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

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



D  B
DDD DD BBB BB
DDD  DD  JJJ   BBB  BB
DDD   DD JJJ   BBB BB 
DDDDDJJJ   B
DDD   DD  JJ JJJ   BBB BB
DDD  DD   JJ JJJ   BBB  BB
DDD DD  ..JJ ..BBB BB
D   ..   ..B

---
Dylan Barber
(CIW Professional, A+ Technician)
Web Designer / Developer / DotNetNuke Portal Creator
---
Clip those URLs! - 
Short links are easier to remember.
http://clipurl.com


D  B
DDD DD BBB BB
DDD  DD  JJJ   BBB  BB
DDD   DD JJJ   BBB BB 
DDDDDJJJ   B
DDD   DD  JJ JJJ   BBB BB
DDD  DD   JJ JJJ   BBB  BB
DDD DD  ..JJ ..BBB BB
D   ..   ..B

---
Dylan Barber
(CIW Professional, A+ Technician)
Web Designer / Developer / DotNetNuke Portal Creator
---
Clip those URLs! - 
Short links are easier to remember.
http://clipurl.com

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



Re: [PHP-DB] Inserting a seperator in long numbers

2004-09-08 Thread John Holmes
From: Shiloh Madsen [EMAIL PROTECTED]
I have several tables with long numbers whose digits are always in some
multiple of 8 eg  or  etc...up to 160 digits long.
The numbers all have a number of digits that is some multiple of 8. What I
need to do is write an sql update query that will insert a - or some other
seperator character every 8 digits in cases where the number of digits is
higher than 8 i.e. -, and so on for bigger numbers. What
query would i use to do this?
Since this is a PHP list...
$formatted_number = preg_replace('/([0-9]{8})/','\1-',$number);
although that leaves a - character on the end to strip off. I'm sure there 
are other ways.

If you want a query to do this, then other than being off topic, it'd help 
if you told us what database you are using. Not everyone uses MySQL...

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


[PHP-DB] Please help

2004-09-08 Thread Stuart Felenstein
I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query

$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);

This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.

Anyone ?

Thank you
Stuart

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



Re: [PHP-DB] Please help

2004-09-08 Thread Peter Ellis
What are the variables $sql and $sql_ext set to?  The query format is
fine.  It's probably in your variables.
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Wed, 2004-09-08 at 12:29 -0700, Stuart Felenstein wrote:
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL 
 
 The code seems to be working fine except in my search
 page where I receive an invalid query
 
 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);
 
 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.
 
 Anyone ?
 
 Thank you
 Stuart

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



Re: [PHP-DB] error of check box form

2004-09-08 Thread Peter Ellis
In addition, please send your messages once and only once.  I have two
copies of the same e-mail, both sent to the list successfully with two
different replies to both messages.  You're more likely to get help if
you post and wait for a reply to your original message.
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Wed, 2004-09-08 at 05:53 -0400, [EMAIL PROTECTED] wrote:
 Dear friends,
 
 
 Any guidance to the error , please.
 Resubmitting,
 --
 ---
 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
 C:\HOME\doctorbush\check.php on line 11
 
 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting 
 T_STRING or T_VARIABLE or T_NUM_STRING in C:\HOME\doctorbush\check.php on line 73
 
 --
 script code
 -
 ?php
 
 // example code for checkbox.txt
 // confirmed working: Friday, March 07, 2003
 
 // Configuration information for connecting to database
 // Contains $db_name, $db_user, $db_pass, $db_host
 // for connection.
 
 // Enter your database host name here.
 $db_host = \localhost\;
 // Enter your database password here.
 $db_pass = \\;
 // Enter your database user name here.
 $db_user = \\;
 // Enter the name of your database here.
 $db_name = \\;
 
 // Connect to database
   $db_conn = @mysql_pconnect($db_host, $db_user, $db_pass);
 
 // Check for database unavailable 
 if (!$db_conn)
 {
 print \ERROR - failed to create connection: \ . 
 mysql_error();
 
 }
 
 
 function make_item_control($value,$title) { 
 $content = 'tr class=\tabletext\tdinput type=\checkbox\ 
 name=\item[]\ value=\'.$value.'\ /'.$title.'/td';
 
 return $content;
 }
 
 if($p_delete_checked) {
 // Process items
 // We substract one from the count because a for loop executes 
 once
 
 // before incrementing.
 $n = count($item)-1;
 for($i = 0; $i = $n; $i++)
 {
 $sql = \DELETE FROM note WHERE note_id = $item[$i];\;
 $result = mysql_db_query($db_name,$sql);
 
 if (!$result) {
 print ' ERROR - Delete note query failed: ' 
 .mysql_error();
 
 }
 
 }
 } else {
 // list items
 
 // database query here
 
 $sql = \SELECT note_id,film_id,LEFT(text,32) AS item_name FROM 
 note ORDER BY film_id ASC;\;
 
 $result = mysql_db_query($db_name,$sql);
 
 if (!$result || mysql_num_rows($result)  1) {
 print ' ERROR - Select note query failed: ' 
 .mysql_error();
 
 }
 
 print 'form action='. $_SERVER['PHP_SELF'] .'';
 print 'table';
 while($row = mysql_fetch_array($result)) {
 print make_item_control($row[note_id],$row[item_name]);
 }
 print 'tr class=\tabletext\
 td
 input type=\Submit\ name=p_delete_checked value=\Delete 
 Checked\ /
 
 /tr';
 print '/table';
 print '/form';
 
 }
 
 
 
 ?

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



RE: [PHP-DB] Please help

2004-09-08 Thread Peter Lovatt
HI

try 

 $result = mysql_query($sql .   . $sql_ext .  limit 0,1)
 or die(Invalid query.mysql_error());

which will give more detail on the error.

HTH

Peter

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 08 September 2004 20:29
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Please help
 
 
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL 
 
 The code seems to be working fine except in my search
 page where I receive an invalid query
 
 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);
 
 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.
 
 Anyone ?
 
 Thank you
 Stuart
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Please help

2004-09-08 Thread Stuart Felenstein
Not sure what the varialbe are set too.  Going through
the code and rebuilding the query.
Post on hold to further notice :).

Stuart
--- Peter Ellis [EMAIL PROTECTED] wrote:

 What are the variables $sql and $sql_ext set to? 
 The query format is
 fine.  It's probably in your variables.
 -- 
 Peter Ellis - [EMAIL PROTECTED]
 Web Design and Development Consultant
 naturalaxis | http://www.naturalaxis.com/
 
 On Wed, 2004-09-08 at 12:29 -0700, Stuart Felenstein
 wrote:
  I'm using a product called dbqwiksite pro.  PHP
  generator for PHP - MySQL 
  
  The code seems to be working fine except in my
 search
  page where I receive an invalid query
  
  $result = mysql_query($sql .   . $sql_ext . 
 limit
  0,1)
  or die(Invalid query);
  
  This is the place I where the code is taking the
 die
  path.
  I'm guessing something belongs between the
 quotation
  marks , just not sure.
  
  Anyone ?
  
  Thank you
  Stuart
 
 
 

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



Re: [PHP-DB] Please help

2004-09-08 Thread Micah Stevens

Change the code to this:

$result = mysql_query($sql .   . $sql_ext .  limit 0,1)  or 
die(mysql_error().br.$sql. .$sql_ext .  limit 0,1br);

And you'll get the error from mysql and a copy of the actual query. Without 
that, it's pretty tough to help. 

-Micah 

On Wednesday 08 September 2004 12:29 pm, Stuart Felenstein wrote:
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL

 The code seems to be working fine except in my search
 page where I receive an invalid query

 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);

 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.

 Anyone ?

 Thank you
 Stuart

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



RE: [PHP-DB] Please help

2004-09-08 Thread Gary Every
What exactly is in the $sql and $sql_ext??

Try to put it into a variable so you can print out what you're sending
to the DB

Such as:
$query = $sql .   . $sql_ext .  limit 0,1;
Echo $query . BR;

If your $sql and $sql_ext combine to make a valid sql query, the   is
just putting a space inside the query, and it is valid

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 08, 2004 2:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help


I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query

$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);

This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.

Anyone ?

Thank you
Stuart

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

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



Re: [PHP-DB] Please help

2004-09-08 Thread Steve Davies
What's contained in $sql and $sql_ext ???
Stuart Felenstein wrote:
I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query
$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);
This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.
Anyone ?
Thank you
Stuart
 

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


RE: [PHP-DB] Search page

2004-09-08 Thread Gary Every




K, first off I'm brand new to PHP and databases.  So I
hope my question isn't stupid or unfitting to the
list.  

Welcome! Only those that don't ask are unfitting


I am creating a search and results page of, right
now 3 fields with more to add. 
Perhaps not necessary to my question, I have created a
working SQL statement which involved one main
transactional table and a number of joins to static
tables where the id codes inserted into the main table
are referenced.  All is fine.  
I thought I could use AND / OR statements, but both
don't allow for any number of fields unusued or force
a return if the first condition is met.  I have a
variable in the SQL statment , like LocationCity =
'resset1', LocationState = 'resset2', etc.

Just sure how to get the code to see if it was passed
a value or not.  Also to treat each field
independently, so if the user leaves the first 2
unchanged , and only enters the 3rd it will search for
that particular condition.  

Try this, which is assuming that you are sending variables through POST
// Start the query off right
$query = Select * FROM table_name WHERE (;

Foreach($_POST as $key-$value) {
if($value != '') {
// Add the query part
$query_frag .=  $key = '$value' AND ;
}
}

// Now you have something that looks like
// $query_frag =  first_var = 'Value1' AND second_var = 'Value2' AND
third_var = 'Value3' AND 

// Get rid of that last AND, plus close out your parentheses
$query_frag_trimmed = rtrim($query_frag,AND ) . ')';

// Now $query_frag_trimmed =  first_var = 'Value1' AND second_var =
'Value2' AND third_var = 'Value3'
// If you want to limit your query, tack on a limit clause on the end
$offset = 0;
$rows = 50;
$query_frag_trimmed .=  LIMIT $offset,$rows;

// Now put it all together
$completed_query = $query . $query_frag_trimmed;

// You've got:
// $completed_query = Select * FROM table_name WHERE ( first_var =
'Value1' AND second_var = 'Value2' AND third_var = 'Value3') LIMIT
0,50;

// And send that to mysql




Also I should mention, that when the Search form comes
up, all the drop down menus say Please Select, that
label actually has a value, which I assume is common. 
Regardless on submit that value is going.   

I was looking at the following code but the !='' tells
me that it's looking for an empty string.  So if my
dead Please Select value is sent , do I need to put
the value in there, i.e. !='XXX' ?

?php
if (isset($HTTP_GET_VARS['states'])  $HTTP_GET_VARS['states']!=''){
  if (!isset($isNotFirst) OR $isNotFirst==false){
   $isNotfirst = true;
   $KT_search = '1=1 AND ';
  }else{
   $KT_search .=' AND ';
  }
  $KT_search .='LocationState = \''.$HTTP_GET_VARS['states'].'\' '; } ?

Well I hope I don't get flamed since I'm obviously
clueless and seeking some advice when perhaps I should
be finding it on my own. 

Thank you ,
Stuart

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

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



Re: [PHP-DB] IBM DB2

2004-09-08 Thread Dan Scott
Robert Twitty wrote:
On Thu, 19 Aug 2004, Gerard Samuel wrote:

Robert Twitty wrote:
Hi
Is anyone using PHP to connect to an IBM DB2 database?  The reason why I
am asking is becaouse I want to see if the odbtp extension can be used to
successfully prepare and execute DB2 stored procedures.  So far, ODBTP
performs quite well with IBM DB2 in regards to regular queries.
I've never used stored procedures before, but if you have example code
on hand, I can give it a shot...
Unfortunately, I do not have access to an IDM DB2 database, so I don't
have any examples of my own.  However, after Googling, I have discovered
that creating DB2 stored procedures is a bit more complex than that of
other databases, like SQL Server and Oracle. It appears that DB2 stored
procedures are implemented as external shared libraries, i.e., DLLs. The
examples that I found were written in C. So, testing ODBTP with DB2
stored procedures may be beyond the call of duty.
-- bob
Actually, DB2 has supported SQL procedures (following the SQL standard 
syntax for Persistent SQL Modules or PSM) since Version 7, but until 
Version 8.1 FixPak 7 (aka Version 8.2) you had to have a C compiler 
lurking under the covers -- which occasionally wound up in a 
configuration problem. There are lots of simple SQL procedure samples 
shipped in the sqllib/samples/sqlproc/ directory, or you can view them 
online at 
http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0007623.htm

With Version 8.1 FixPak 7 / Version 8.2 the requirement for a C compiler 
is lifted and you can simply issue a CREATE PROCEDURE statement to, 
well, create an SQL procedure. So testing should become a whole lot simpler.

You can get a free-for-development version of DB2 Personal Developer's 
Edition from 
http://www14.software.ibm.com/webapp/download/search.jsp?rs=db2pde if 
you want to test it out. Registration is required, but there's no 
license fee involved as long as you're not using the database in a 
production environment.

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


[PHP-DB] Data sorting

2004-09-08 Thread Vipin Chandran
hi,

I have two tables
say customer_tbl and record_tbl

the customer table stores all details abt the customer like name , id
, address, email etc and the record table stores the daily records of
the customer like id, marks_scored, total marks, date etc ..

in the reports.php page i display the reports based on date selected
.. this takes data from both the tables and displays name, email,
marks_scored and total marks .. now i need to sort the data by
clicking the title of each column.. for ex. when clicking the 'name'
title , the report should be displayed by sorting the data based on
the name .. how do i handle this .. which is the best method to handle
the above

Thanks and Regards,
Vipin Chandran

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