[PHP-DB] Re: troubles with select * from... to a ms-sql-server
hi, thanx for replying! i installed the new php version 4.2 - but this time as isapi-module. and since this i have no troubles! ( i used not the php.ini.recommend! ) bye - hermann Oliver Cronk [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have you tried removing the [] brackets? And what is ReferencesComplete - a standard table, a view or a stored procedure? Ollie -Original Message- From: Hermann Otteneder [mailto:[EMAIL PROTECTED]] Sent: 17 April 2002 16:30 To: [EMAIL PROTECTED] Subject: troubles with select * from... to a ms-sql-server hi, i try to get some data from our ms-sql-server the following statement: $SQL = SELECT * FROM [ReferencesComplete]; causes an error of the php.exe! i tried many various of this statement but nothing helped. ether it came no error and the [$result = mssql_query($SQL,$IDconnection);] variable was false or the php.exe crashed! with mysql it workes ok but with the ms-sql-server not! please give me help - this so what simple - but does not work - i lost so much time... hermann -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search Script
The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Search Script
Sorry about that, I just pasted and took out the =, but I see another thing that could be a problem: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch%' ORDER BY iname; The single quote was in the wrong place, it should have been after '% $shopsearch%, not after iname. HTH Maureen Maureen [EMAIL PROTECTED] said: The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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 -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search Script
Jennifer, In the manual it's probably under the SELECT heading. (I've not checked, but that's a godd spot to start looking for the bits that can amke up the WHERE clause.) Try removing the single quotes - you have one before %shopsear and another following iname, as iname' Sorry this is a bit vague, but if you need the single quotes arounf shopsearch you may have to build up the SQL statement bit by bit. Remember to echo $query so that you will know if it look right. Cheers - Miles At 07:15 AM 4/25/2002 -0700, Jennifer Downey wrote: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Search Script
And Maureen is right! We just so *used* to seeing equal signs in SELECT statements. Smacking fist on head Miles Thompson At 02:23 PM 4/25/2002 +, Maureen wrote: The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search Script
Thanks Maureen, I don't get the errors I was getting so that shows me you are great. Now my next problem is if an item is found how do I echo or print that to the screen. I have this as a starting point but I don't know where to go after this. if($search) { $query = SELECT uid, id, image, iname, quantity, user, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while(list($iname)=mysql_fetch_row($ret)) $user = $row['user']; if($iname == $searchword) echo $user; }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } I can't get any data to show up. Could you shed some light on this. I don't want you to wirte it just let me know if I am on the righ track. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search Script
From what I can see, you are not defining the array $row in here. You would need to define something like: $row=mysql_fetch_array($ret); before calling it. I finally found where the information on LIKE is in the manual (I can understand your frustration, it took me a while). It is under Pattern Matching if you search the manual. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Thanks Maureen, I don't get the errors I was getting so that shows me you are great. Now my next problem is if an item is found how do I echo or print that to the screen. I have this as a starting point but I don't know where to go after this. if($search) { $query = SELECT uid, id, image, iname, quantity, user, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while(list($iname)=mysql_fetch_row($ret)) $user = $row['user']; if($iname == $searchword) echo $user; }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } I can't get any data to show up. Could you shed some light on this. I don't want you to wirte it just let me know if I am on the righ track. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Search Script
Hello!! Your right!! don't use = on the like part...I don't know what I was thinking!!! Anyway here is the code right from my search page... include(./navbar2.php); $nav = new navbar; $nav-numrowsperpage = 30; $sql = SELECT Print_Name, Art_Job_Number, Size, Item_Number FROM Table1 WHERE Print_Name LIKE '%$Print_Name%' ORDER BY $or $place; $result = $nav-execute($sql, $db, mysql); $rows = mysql_num_rows($result); for ($y = 0; $y $rows; $y++){ $data = mysql_fetch_object($result); That should do it!! Dan On Thursday, April 25, 2002, at 09:23 AM, [EMAIL PROTECTED] wrote: The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Variables
HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count sizeof($artist); $count++) { echo i$artist[$count]/ibr; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED]
RE: [PHP-DB] Variables
I think what you don't know is this: $varName = c1; $$varName = 3; that just set $c1 to equal 3. Does that help? -Original Message- From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 9:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count sizeof($artist); $count++) { echo i$artist[$count]/ibr; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables
In an attempt to be less vague I think you want to change your line: $c . $count+1 = $artist[$count]; to be: $varName = $c.($count+1); $$varName = $artist[$count]; Got it now? --- I think what you don't know is this: $varName = c1; $$varName = 3; that just set $c1 to equal 3. Does that help? -Original Message- From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 9:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count sizeof($artist); $count++) { echo i$artist[$count]/ibr; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED] -- 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
[PHP-DB] Re: Search Script
Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mssql/Sybase errors
Hello. I have recently installed the freetds package and reconfigured PHP to connect to MSSQL. I am running a simple join query on two tables and I get the following error. bWarning/b: Sybase error: 'REQ' is not a recognized OPTIMIZER LOCK HINTS option. (severity 15) in myFile.php on line b29/bbr REQ is one of the tables in the database. here is the query, which works fine in MS Query Analyzer. Anyone run up against this problem? mssql_query(select REQ.DESCR, BUSINESS_AREA.DESCR, REQ_NUM from REQ INNER JOIN BUSINESS_AREA. ON (REQ.BUSINESS_AREA = BUSINESS_AREA.BUSINESS_AREA) WHERE REQ.BUSINESS_AREA = '$area'); I can run basic select queries, but came into this when i started using JOIN. Many thanks, Jeff my set up is PHP4.1.2/Apache/Unix/Freetds 0.53 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
The if/else/echo should all be within the while loop. The way it is now, it should only show the last record returned, because that is the last value within the while loop. The way you have it, the rest would be done after it had looped through all of the records and it would return whatever the last values were for the $row array. According to the following link from the MySQL Manual at http://www.mysql.com/doc/S/t/String_comparison_functions.html, string comparisons using LIKE should be case insensitive as stated below: The following two statements illustrate that string comparisons are case insensitive unless one of the operands is a binary string: mysql SELECT 'abc' LIKE 'ABC'; - 1 mysql SELECT 'abc' LIKE BINARY 'ABC'; - 0 I am not sure why it is showing case sensitivity, unless as it states, one of the operands is a binary string. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Re: Search Script
I am quite positive that they are not Binary what I am finding is that it has to be exactly as it is in the table. I have one item called StarrRacing Guide if I put in starr or Starr it will return nothing I have to spell it exactly like it is in the db StarrRacing Guide. here is a dump of the table maybe I have done something wrong there: uid int(10) NOT NULL default '0', id int(5) NOT NULL default '0', iname varchar(50) NOT NULL default '', image varchar(100) NOT NULL default '', quantity int(10) unsigned NOT NULL default '1', type varchar(20) NOT NULL default '', price int(6) NOT NULL default '0', user varchar(50) NOT NULL default '', I did move the while curly brace down to include the echo and that part is working great returning all records found. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The if/else/echo should all be within the while loop. The way it is now, it should only show the last record returned, because that is the last value within the while loop. The way you have it, the rest would be done after it had looped through all of the records and it would return whatever the last values were for the $row array. According to the following link from the MySQL Manual at http://www.mysql.com/doc/S/t/String_comparison_functions.html, string comparisons using LIKE should be case insensitive as stated below: The following two statements illustrate that string comparisons are case insensitive unless one of the operands is a binary string: mysql SELECT 'abc' LIKE 'ABC'; - 1 mysql SELECT 'abc' LIKE BINARY 'ABC'; - 0 I am not sure why it is showing case sensitivity, unless as it states, one of the operands is a binary string. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
[PHP-DB] Re: Search Script
Hello, Jennifer Downey wrote: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Maybe you would like to see these classes that seem to do what you are looking for: http://www.phpclasses.org/search%20query Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
Jennifer, Check if there is a set exact setting for MySQL. Using LIKE should find everything beginning with Starr. You may also have to convert search term and target values to one of lower or upper case in the SELECT statement. Miles At 10:55 AM 4/25/2002 -0700, Jennifer Downey wrote: I am quite positive that they are not Binary what I am finding is that it has to be exactly as it is in the table. I have one item called StarrRacing Guide if I put in starr or Starr it will return nothing I have to spell it exactly like it is in the db StarrRacing Guide. here is a dump of the table maybe I have done something wrong there: uid int(10) NOT NULL default '0', id int(5) NOT NULL default '0', iname varchar(50) NOT NULL default '', image varchar(100) NOT NULL default '', quantity int(10) unsigned NOT NULL default '1', type varchar(20) NOT NULL default '', price int(6) NOT NULL default '0', user varchar(50) NOT NULL default '', I did move the while curly brace down to include the echo and that part is working great returning all records found. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The if/else/echo should all be within the while loop. The way it is now, it should only show the last record returned, because that is the last value within the while loop. The way you have it, the rest would be done after it had looped through all of the records and it would return whatever the last values were for the $row array. According to the following link from the MySQL Manual at http://www.mysql.com/doc/S/t/String_comparison_functions.html, string comparisons using LIKE should be case insensitive as stated below: The following two statements illustrate that string comparisons are case insensitive unless one of the operands is a binary string: mysql SELECT 'abc' LIKE 'ABC'; - 1 mysql SELECT 'abc' LIKE BINARY 'ABC'; - 0 I am not sure why it is showing case sensitivity, unless as it states, one of the operands is a binary string. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 -
RE: [PHP-DB] Re: Search Script
Jennifer I suggest you check out MySQLs full text indexing capabilities. If you create a fulltext index on the text fields you want to search you can use the MATCH function. This will perform a fuzzy matching search that returns results in order of relevance. For details see http://www.mysql.com/doc/F/u/Fulltext_Search.html -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Search Script
Ok I am looking at the code an I'm thinking it has to be in the code because I tried it on my box at home and it did the same thing. So while looking hard at the code I came up with this: if($searchword == $iname) this is the problem if $searchword == $iname then it will echo everything I want it to. What I needed to do is have it where it isn't == to anything in otherwords a null value. So if $searchword = $iname then it will work as it is suppose to. Thanks everyone for your time, effort and help. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
Here is some more information I found in the manual about case sensitivity in searches. The whole page is at http://www.mysql.com/doc/C/a/Case_sensitivity.html Here is the text that shows what might be the problem: In older MySQL versions LIKE comparisons where done on the uppercase value of each character (E == e but E é). In newer MySQL versions LIKE works just like the other comparison operators. What version of MySQL are you running? If you do not know, check to see if you can do a search for something in upper case that is in the database in lower case. If this works, then it looks like the situation above. I think previously, you were searching using all lower case for a word that was in the database with an upper case letter in it. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Ok I am looking at the code an I'm thinking it has to be in the code because I tried it on my box at home and it did the same thing. So while looking hard at the code I came up with this: if($searchword == $iname) this is the problem if $searchword == $iname then it will echo everything I want it to. What I needed to do is have it where it isn't == to anything in otherwords a null value. So if $searchword = $iname then it will work as it is suppose to. Thanks everyone for your time, effort and help. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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
[PHP-DB] Couldn't Unsubscribe
Yes it seems off-topic but I only joined to this mail-list. So I don't have any other place to ask. I sent mail to unsubscribe me from the list but nothing happened. I'm still recieving mails from the list. What's wrong? See Dave Matthews Band live or win a signed guitar http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mssql/Sybase errors
hehehe, you recoded PHP to reconnect to MSSQL, but you forgot to redo your connection stuff. Sybase error: means that you're connecting to Sybase and not MSSQL. *wink* 'Luck -Szii - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 10:18 AM Subject: [PHP-DB] Mssql/Sybase errors Hello. I have recently installed the freetds package and reconfigured PHP to connect to MSSQL. I am running a simple join query on two tables and I get the following error. bWarning/b: Sybase error: 'REQ' is not a recognized OPTIMIZER LOCK HINTS option. (severity 15) in myFile.php on line b29/bbr REQ is one of the tables in the database. here is the query, which works fine in MS Query Analyzer. Anyone run up against this problem? mssql_query(select REQ.DESCR, BUSINESS_AREA.DESCR, REQ_NUM from REQ INNER JOIN BUSINESS_AREA. ON (REQ.BUSINESS_AREA = BUSINESS_AREA.BUSINESS_AREA) WHERE REQ.BUSINESS_AREA = '$area'); I can run basic select queries, but came into this when i started using JOIN. Many thanks, Jeff my set up is PHP4.1.2/Apache/Unix/Freetds 0.53 -- 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
[PHP-DB] Append into another table
Hi, how can I append from one table to another with same structure some selected records Thanks, Rosen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FORM not inserting data
Help. Help Please, Please tell me what I am doing wrong here...I have a form to input data but it is not posting ithere is the code. It seems to work no errors but a query show no new additions to the table. $sql = INSERT INTO employees (first,last,address,date_of_birth,sex,age,telephone, parent_guardian_name,parent_guardian_workplace,work_telephone,emergency_information_contact, list_physical_conditions_if_any,all_schools_previously_attended,examinations_passed,older_brothers,younger_brothers,older_sisters,younger_sisters, names_sisters_or_brothers_attending_school) VALUES ('$first','$last','$address','$date_of_birth',$sex','$age','$telephone','$parent_guardian_name','$parent_guardian_workplace', '$work_telephone','$emergency_information_contact','$list_physical_conditions_if_any','$all_schools_previously_attended','$examinations_passed','$older_brothers','$younger_brothers','$older_sisters','$younger_sisters','$names_sisters_or_brothers_attending_school'); $result = mysql_query($sql); echo Thank you! Information entered.\n; } else{ // display form ? Neil
[PHP-DB] Re: FORM not inserting data
As many people have told me and I have just now got it through my thick head try either echoing the query or use $result = mysql_query($sql) or die(mysql_error()); You will find out what is being passed (or not passed) through your variables or find out what error you are getting. HTH Jennifer Neil [EMAIL PROTECTED] wrote in message 002501c1ecc2$8b1e16a0$1bc5fea9@neilmar">news:002501c1ecc2$8b1e16a0$1bc5fea9@neilmar... Help. Help Please, Please tell me what I am doing wrong here...I have a form to input data but it is not posting ithere is the code. It seems to work no errors but a query show no new additions to the table. $sql = INSERT INTO employees (first,last,address,date_of_birth,sex,age,telephone, parent_guardian_name,parent_guardian_workplace,work_telephone,emergency_info rmation_contact, list_physical_conditions_if_any,all_schools_previously_attended,examinations _passed,older_brothers,younger_brothers,older_sisters,younger_sisters, names_sisters_or_brothers_attending_school) VALUES ('$first','$last','$address','$date_of_birth',$sex','$age','$telephone','$pa rent_guardian_name','$parent_guardian_workplace', '$work_telephone','$emergency_information_contact','$list_physical_condition s_if_any','$all_schools_previously_attended','$examinations_passed','$older_ brothers','$younger_brothers','$older_sisters','$younger_sisters','$names_si sters_or_brothers_attending_school'); $result = mysql_query($sql); echo Thank you! Information entered.\n; } else{ // display form ? Neil --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
Thanks Maureen, The == was the problem. I can search with upper and lower case and only partial words. Hosting is using 3.23.45 mysql so I don't believe that was the case. Thanks again! Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here is some more information I found in the manual about case sensitivity in searches. The whole page is at http://www.mysql.com/doc/C/a/Case_sensitivity.html Here is the text that shows what might be the problem: In older MySQL versions LIKE comparisons where done on the uppercase value of each character (E == e but E é). In newer MySQL versions LIKE works just like the other comparison operators. What version of MySQL are you running? If you do not know, check to see if you can do a search for something in upper case that is in the database in lower case. If this works, then it looks like the situation above. I think previously, you were searching using all lower case for a word that was in the database with an upper case letter in it. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Ok I am looking at the code an I'm thinking it has to be in the code because I tried it on my box at home and it did the same thing. So while looking hard at the code I came up with this: if($searchword == $iname) this is the problem if $searchword == $iname then it will echo everything I want it to. What I needed to do is have it where it isn't == to anything in otherwords a null value. So if $searchword = $iname then it will work as it is suppose to. Thanks everyone for your time, effort and help. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php