[PHP-DB] Re: Help needed in searching a sentence in the code

2010-05-27 Thread Tanel Tammik

nagendra prasad nagendra802...@gmail.com wrote in message 
news:aanlktinesp1vyn3do_ubcax9ltlhf5yqduwe24iam...@mail.gmail.com...
 Hi All,

 I have this code where user can search a song or the entire song title. It
 looks like when a user search a single word its searching and giving the
 proper results. However if the user wants to search the entire sentence 
 its
 not giving the proper results. For example let say I have searched for the
 MJ's song Earth Song, its giving me the proper results. However if I am
 searching for the MJ's  Why You Wanna Trip On Me, its not giving me the
 proper results. Below is the code:



 ?php


 //get data
 $button = $_GET['submit'];
 $search = $_GET['search'];

 $s = 0;
 $s = $_GET['s'];
 if (!$s)
 $s = 0;
 $i = 0;

 $e = 30; // Just change to how many results you want per page


 $next = $s + $e;
 $prev = $s - $e;




 if (strlen($search)=2)


  echo brtable align='center'trtdsupdagger;/supfont
 face='sana-serif' size='6'font color='blue'bsupa href='
 http://localhost/searchengine/' style='text-decoration:
 none'MP3dom/a/sup/b/b/fontfont face='sana-serif'
 size='3'suptrade;/sup/tdtdsupform action='search.php'
 method='GET'input type='text' onclick=value='' size='50' name='search'
 value='$search' input type='submit' name='submit'
 value='Search'/form/td/tr/table table bgcolor='#FF'
 width='100%' height='1px'br //tabletable bgcolor='#f0f7f9'
 width='100%' height='10px'trtddiv align='right'bMust be greater
 then 3 chars/b/div/td/tr/tablep/sup;
 else
 {
  echo brtable align='center'trtddagger;font face='sana-serif'
 size='6'font color='blue'ba href='http://localhost/searchengine/'
 style='text-decoration: none'MP3dom/a/b/b/fontfont
 face='sana-serif' size='3'suptrade;/sup/tdtdsubform
 action='search.php' method='GET'input type='text' onclick=value=''
 size='50' name='search' value='$search'input type='submit' name='submit'
 value='Search'/form/td/tr/table/sub;

  //connect to database
  mysql_connect(localhost,root,);
  mysql_select_db(mp3);



   //explode out search term
   $search_exploded = explode( ,$search);

   foreach($search_exploded as $search_each)
   {

//construct query
$x++;
if ($x==1)
 $construct .= name LIKE '%$search_each%';
else
 $construct .=  OR name LIKE '%$search_each%';

   }

  //echo outconstruct
  $constructx = SELECT * FROM data WHERE $construct;

  $construct = SELECT * FROM data WHERE $construct LIMIT $s,$e ;
  $run = mysql_query($constructx);

  $foundnum = mysql_num_rows($run);


  $run_two = mysql_query($construct);

  if ($foundnum==0)
   echo table bgcolor='#F1EDC2' width='100%' height='1px'br
 //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv
 align='right'No results found for
 b$search/b/div/td/tr/tablep;
  else
  {
   echo table bgcolor='#F1EDC2' width='100%' height='1px'br
 //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv
 align='right'Showing 1-30 of b$foundnum/b results found for
 b$search./b/div/td/tr/tablep;







   print 'table bgcolor=#F1EDC2 width=700  height=30 border=0
 align=center ';
   print 'tr';

 print 'td width=100 nowrap=nowrapstrongArtist/strong/td';
 print 'td width=250 nowrap=nowrapstrongSong
 Name/strong/td';
 print 'td width=50 nowrap=nowrapstrongMovie
 Date/strong/td';
 print 'td width=50 nowrap=nowrapstrongSize/strong/td';

   print '/tr';
   while ($runrows = mysql_fetch_assoc($run_two))
   {
//get data
   $type = $runrows['artist'];
   $date = $runrows['date'];
   $name = $runrows['name'];
   $size = $runrows['size'];



 foreach ($runrows as $row)
 {
  if ($i % 2 != 0) # An odd row
$rowColor = #EBECE4;
  else # An even row
$rowColor = #FEF1E9;



 print 'table width=700 height=30 border=0 align=center';

 }


   print '?php do { ?';
 print 'tr bgcolor=' . $rowColor . '';

   print 'td nowrap=nowrap width=100'.'font color=:blue
 size=2'.$type.'/td';
   //print 'td nowrap=nowrap width=250'.'font size=2'.a
 herf='$url'$name.'/td';

   print 'td nowrap=nowrap width=250'.'font color=blue
 size=2'.a href='download.php?url=$url'$name.'/font/td';


   print 'td nowrap=nowrap width=100 align=center'.'font
 size=2'.$date .'/td';
   print 'td nowrap=nowrap width=50'.'font size=2'.$size
 .'/td';
   print 'td nowrap=nowrap width=25'.'font size=2'.$se
 .'/td';
   print 'td nowrap=nowrap width=25'.'font size=2'.$le
 .'/td';
 print '/tr';



 print '/table';
 print '/body';
 print '/html';

   }
 ?


 table width='100%'
 tr
 td
 div align=center
 brbr
 ?php
 if (!$s=0)
 echo a href='search.php?search=$searchs=$prev'Prev/a;

 $i =1;
 for ($x=0;$x$foundnum;$x=$x+$e)
 {


 echo  a href='search.php?search=$searchs=$x'$i/a ;


 $i++;


 }

 if ($s$foundnum-$e)
  echo a href='search.php?search=$searchs=$next'Next/a;

}
 }


 ?
 /div
 /td
 /tr
 /table


 ***

 Also, the above code is giving me the below 

[PHP-DB] Re: help needed.

2010-03-18 Thread Nadim Attari

Hello,

Maybe these can help. Web Server on CD:

http://ampstart.ly-le.info/
http://www.stunnix.com/
http://www.server2go-web.de/
http://www.indigostar.com/microweb.php

PHP EXE Compiler/Embedder : http://www.bambalam.se/bamcompile/

p.s.: Make sure you encode your PHP codes before distributing...


Vinay Kannan wrote:

Hello Guys,

I am developing an application, which would have a front end in Flash, and
the backend would be MySQL, now what I am thinking is to package this as an
exe file, similar to WAMP, which installs everything, So my exe should have
all my files, the MySQL data dump and should auto install PHP, APACHE,
MySQL, can something like this be done, i am sure it can be done, but how do
I do it, any guidelines please?

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

Re: [PHP-DB] Re: help needed.

2010-03-18 Thread Gunawan Wibisono
flash? why not using xml.. is the data will be update?

this good aplication i think

On Thu, Mar 18, 2010 at 4:10 PM, Nadim Attari na...@alienworkers.comwrote:

  Hello,

 Maybe these can help. Web Server on CD:

 http://ampstart.ly-le.info/
 http://www.stunnix.com/
 http://www.server2go-web.de/
 http://www.indigostar.com/microweb.php

 PHP EXE Compiler/Embedder : http://www.bambalam.se/bamcompile/

 p.s.: Make sure you encode your PHP codes before distributing...
 

 Vinay Kannan wrote:

 Hello Guys,

 I am developing an application, which would have a front end in Flash, and
 the backend would be MySQL, now what I am thinking is to package this as an
 exe file, similar to WAMP, which installs everything, So my exe should have
 all my files, the MySQL data dump and should auto install PHP, APACHE,
 MySQL, can something like this be done, i am sure it can be done, but how do
 I do it, any guidelines please?

 Thanks,
 Vinay Kannan.


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




-- 
akan ada dimana mulut terkunci dan suara tak ada lagi..
saat itu gunakanlah HP untuk melakukan SMS!!
- ini aliran bedul.. bukan aliran aneh.
tertawa sebelum tertawa didepan RSJ..


Re: [PHP-DB] Re: help needed.

2010-03-18 Thread Vinay Kannan
Yes, the data would be updated, I am not really good at XML, havnt had a
chance to work with XML, so was trying to avoid it as much as I can, but I
guess if it thats what it takes, then would have to sit down and start
working on it now :)

On Thu, Mar 18, 2010 at 8:11 AM, Gunawan Wibisono landavi...@gmail.comwrote:

 flash? why not using xml.. is the data will be update?

 this good aplication i think

 On Thu, Mar 18, 2010 at 4:10 PM, Nadim Attari na...@alienworkers.com
 wrote:

   Hello,
 
  Maybe these can help. Web Server on CD:
 
  http://ampstart.ly-le.info/
  http://www.stunnix.com/
  http://www.server2go-web.de/
  http://www.indigostar.com/microweb.php
 
  PHP EXE Compiler/Embedder : http://www.bambalam.se/bamcompile/
 
  p.s.: Make sure you encode your PHP codes before distributing...
  
 
  Vinay Kannan wrote:
 
  Hello Guys,
 
  I am developing an application, which would have a front end in Flash,
 and
  the backend would be MySQL, now what I am thinking is to package this as
 an
  exe file, similar to WAMP, which installs everything, So my exe should
 have
  all my files, the MySQL data dump and should auto install PHP, APACHE,
  MySQL, can something like this be done, i am sure it can be done, but how
 do
  I do it, any guidelines please?
 
  Thanks,
  Vinay Kannan.
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



 --
 akan ada dimana mulut terkunci dan suara tak ada lagi..
 saat itu gunakanlah HP untuk melakukan SMS!!
 - ini aliran bedul.. bukan aliran aneh.
 tertawa sebelum tertawa didepan RSJ..



[PHP-DB] Re: Help Needed with malfunctioning query

2006-02-26 Thread El Bekko

Chris Payne wrote:

Hi there everyone,
 
This line of code USED TO WORK but now it gives me a Coudln't Execute Query

error:
 
$query2 = SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'

IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage;

I tried it with a basic $query2 = SELECT * FROM dictionary; to make sure
it wasn't something else that was broke and this is the problem above, it
used to work great and now it's on a live site after working great for 6
months and it suddenly doesn't work and I haven't touched anything !!!  the
server hasn't been updated so it's not that as it also does the same on my
local dev machine here, the only thing that happened was my co-worker did a
global find and replace with dreamweaver but that's all and I can't
personally see anything wrong with the above though I could be looking too
hard.
 
Any help would REALLY be appreciated as this is on a very popular website

and needs fixing ASAP so I don't lose my head !!!
 
Chris




I tested your SQL on
http://developer.mimer.com/validator/parser200x/index.tml#parser
and got this:



Result:
SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
^   ^
syntax error: ,
  correction: JOIN identifier ON identifier ) ,
syntax error: )
  correction: =

IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
   ^--^---  ^   ^--
syntax error: BOOLEAN
  correction: (
syntax error: FROM
  correction: ) FROM
syntax error: MATCH
  correction: identifier
syntax error: ) AGAINST
  correction: = AGAINST

('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage
 ^--   ^  ^
syntax error: BOOLEAN
  correction: (
syntax error: LIMIT $ offset ,
  correction: ,
syntax error: $ item_perpage
  correction: item_perpage


^
syntax error: end
expected: ( ) * + , - - . / ::  =  =  = [ || AND AS AT BETWEEN
  COLLATE DAY HOUR IN IS LIKE MATCH MEMBER MINUTE MONTH 
MULTISET

  NOT OR OVERLAPS SECOND SIMILAR SUBMULTISET YEAR
  correction: ) ) end



Hope it helps :)

-- Bekko

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



[PHP-DB] Re: Help needed

2002-12-10 Thread Hugh Bothwell

Spiderwebb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I dont know if this is possible in PHP (Newbie) im working on a project
 where each product has 3 diffierent prices depending on the amount sold so
 say for example 1- 100 price A 101-299 price B and above 300 Price C.
What
 I need to be able to do is increment an mysql database field each time an
 item is sold then look at that field to decide which price variable to
write
 to the price field of the database. Could someone point me in the right
 direction where I could solve this or to someone who could

First, how are you storing the price points?
I would consider a separate pricing table linked
to the item table like so:

table ItemForSale
  id integer auto_increment
  name varchar(30)
  descr varchar(200)

table PricePoint
  id integer auto_increment
  item integer
  ordersize integer
  priceper float

then for a given item and number of items ordered, you
can retrieve the applicable price-per by

SELECT priceper FROM PricePoint
 WHERE item=$itemID AND ordersize=$number
 ORDER BY ordersize DESC
 LIMIT 1

Each item can have an arbitrary number of
price points at any number-of-items.  Note
that this assumes the priceper always decreases
with increasing ordersize for a given item.


Second, I don't understand why you reset
the cumulative price-point every time you
process an order; for selling, surely the price-
point only applies to a single order rather
than cumulatively, and for purchasing or
reporting, I would expect to calculate it
dynamically at the time the report is generated.
Have I missed something?



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




[PHP-DB] Re: HELP NEEDED!

2002-07-13 Thread Mark McCulligh

Your _Name1 in your SELECT doesn't have a $ in front of it.

$_query = select userName from users where userName = '$_Name1' ;
or
$_query = select userName from users where userName = '.$_Name1.' ;

Also after you query your database you have to get the results from your
select.
$_result after $_result = mysql_query($_query) or   die(mysql_error());
will only hold false or true depending on the success of the query.

Use mysql_result or mysql_fetch_array to get your results.

Example:
$userName = mysql_reqult($result,0);

Nik Alleyne [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there
 I am having a problem querrying to my database.
 I wish to check to see if a username is listed in the database so that I
can
 authenticate that individual. However, when I try to echo my $_result i'm
 always getting 0 can someone please help. I think it should be either 1 or
 0.

 These are my scripts.

 This is my login pagepage
 ?php
 echo FORM name=_Form1 method=post action=test.php;
echo TABLE border=1 width=300 height=300;
   echo tr;
echo td valign=top;
 echo INPUT type=text value='' name=_Name1br;
 echo INPUT type=text value='' name=_Name2br;
 echo INPUT type=submit value='Submit' name=_submitButton;
 echo INPUT type=Reset value='Reset' name=_ResetButtonbr;
echo /td valign=top;
  echo /tr;
echo /TABLE;
  echo /FORM
 ?

 This is my script processor
 ?php
 file://Script processor
 mysql_connect(localhost, nik, playas) or
  die(Could not connect to the server);

  mysql_select_db(chronicleOnline) or
   die(Could not connect to the database);

  $_query =  select userName from users where userName='_Name1' ;

  $_result = mysql_query($_query) or
   die(mysql_error());

  if ( $_result = 0 )
   {
 echo $_result;
   }
  else
   {
echo $_result;
   }
 ?

 P.S. I have no problem putting the data into the database, just this
query.

 Thx
 Nik





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




Re: [PHP-DB] Re: HELP NEEDED!

2002-07-13 Thread Adam Alkins

 Use mysql_result or mysql_fetch_array to get your results.
 
 Example:
 $userName = mysql_reqult($result,0);

Just use mysql_num_rows($result) and count the amount of rows selected.

if(mysql_num_rows($result) == '0')
{
do_user_doesnt_exist_stuff();
}
else
{
do_user_exists_stuff();
}

--
Adam Alkins
http://www.rasadam.com
--


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




[PHP-DB] Re: HELP NEEDED

2002-07-13 Thread Adam Royle

First of all, you are not using the variable when you are passing it to 
the sql string. Second, you are doing a pointless var check, and 
thirdly, your condition statement is flawed.

1. SQL should be (if you have register globals turned on, otherwise you 
must use $_GET['_Name1'] ):
  $_query =  select userName from users where userName='$_Name1' ;

2. mysql_query returns a result identifier - not the actual results. You 
should use mysql_num_rows() to find out if any rows were returned (or 
use the other mySQL functions to retrieve the actual data):
$numRows = mysql_num_rows($_result);

3. Print the value of $numRows, without doing a check:
echo $numRows;

4. In your IF statement, the equal comparison operator should be '==' 
(otherwise you are assigning the value to the variable). What you also 
could choose to do, is to leave out the comparison like so:

  if ( $_result ) // 0 = false, 1 = true;
   {
 echo Name was found in the database;
   }
  else
   {
echo Name was NOT found in the database;
   }

Hope that helps..

Adam


 Hi there
 I am having a problem querrying to my database.
 I wish to check to see if a username is listed in the database so that 
 I can
 authenticate that individual. However, when I try to echo my $_result 
 i'm
 always getting 0 can someone please help. I think it should be either 1 
 or
 0.

 These are my scripts.

 This is my login pagepage
 ?php
 echo FORM name=_Form1 method=post action=test.php;
echo TABLE border=1 width=300 height=300;
   echo tr;
echo td valign=top;
 echo INPUT type=text value='' name=_Name1br;
 echo INPUT type=text value='' name=_Name2br;
 echo INPUT type=submit value='Submit' name=_submitButton;
 echo INPUT type=Reset value='Reset' name=_ResetButtonbr;
echo /td valign=top;
  echo /tr;
echo /TABLE;
  echo /FORM
 ?

 This is my script processor
 ?php
 file://Script processor
 mysql_connect(localhost, nik, playas) or
  die(Could not connect to the server);

  mysql_select_db(chronicleOnline) or
   die(Could not connect to the database);

  $_query =  select userName from users where userName='_Name1' ;

  $_result = mysql_query($_query) or
   die(mysql_error());

  if ( $_result = 0 )
   {
 echo $_result;
   }
  else
   {
echo $_result;
   }
 ?

 P.S. I have no problem putting the data into the database, just this 
 query.

 Thx
 Nik



[PHP-DB] Re: Help needed - need to access a value from DB into all pages

2002-02-21 Thread Joe Van Meer

Hi there :) One of the most common methods of achieving this is by using
session variables. First the user logins in through a form with a username
and a password, you check these  against the database to make sure they are
who they say they are, once that is established you could create a session
variable called $USERID   (or something a little less intutive:) once
retrieving the $USERID, and do a check within every page to see what $USERID
they are and perform the appropriate actions.

Check out sessions at :
http://www.php.net/manual-lookup.php?pattern=sessions

Cheers, Joe :)





Wg4- Cook [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I am struggling with a concept and can't seem to find a way to do it so
 hoping you all can help.

 We want to use PHP with MySql Db.
 For security reasons on the DB, it is to be accessed only through this
front
 end i.e. via the internal web
 Each user will have a number of levels of access to various parts of the
 system, so the obvious design is one where there is only 1 real login to
the
 MySQL db (i.e. the system will auto log everyone in as this without them
 knowing it), and then the user is validated against a table in my DB which
 holds the access rights. I can get through the login OK, and get my table
to
 return USERID for this person. Now I need that USERID available to ALL
 other pages so I can use it to determine what parts of screens to show,
and
 what to allow them to do.

 My question is how do I make this variable available to all pages??  Do I
 have to include it with the variables passed to each page or is there a
 simpler way of doing it.  Can I put the variable in an include file and
 include it in every page - will that work?.

 Surely someone must have had a similar situation before and can tell me
how
 they solved it.

 Many thanks

 Janet






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




[PHP-DB] RE: HELP NEEDED! SELECT of Text Fields in MS SQL Server 7.0 Limitation

2001-12-26 Thread Niko Spyridonos

Yeap. That's what it was. In the PHP.INI file the directive mssql.textlimit
and mssql.textsize were set to 4096 bytes. I just set them to maximum of
2147483647 and it works like a charm.

Thanks for the tip.


Niko Spyridonos
Director of E-Business Services

Chamerlik/CompuLogic
http://www.designtech1.com/

T: (847) 679-5030 ext. 201
F: (847) 933-9413
C: (847) 980-7799

-
Chamerlik/CompuLogic is standing
strong against terrorism!

 -Original Message-
From:   Ian [mailto:[EMAIL PROTECTED]] 
Sent:   Saturday, December 15, 2001 5:29 PM
To: Niko Spyridonos
Subject:Re: HELP NEEDED! SELECT of Text Fields in MS SQL Server 7.0
Limitation

set your bufffer in the php.ini
- Original Message -
From: Niko Spyridonos [EMAIL PROTECTED]
Newsgroups: php.db
To: [EMAIL PROTECTED]
Sent: Saturday, December 15, 2001 10:47 AM
Subject: HELP NEEDED! SELECT of Text Fields in MS SQL Server 7.0 Limitation


 When trying to extract the contents of a text field in MS SQL Server 7.0
 with PHP 4.0, I can only get up to about 8,000 characters of text out of
 them.

 Has anyone achieved to pull more data using PHP and if yes how?

 Thanks in advance.



 Niko Spyridonos
 Director of E-Business Services

 Chamerlik/CompuLogic
 http://www.designtech1.com/

 T: (847) 679-5030 ext. 201
 F: (847) 933-9413
 C: (847) 980-7799

 -
 Chamerlik/CompuLogic is standing
 strong against terrorism!


-- 
PHP Database 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]