[PHP-DB] HELP!! - Search

2001-07-24 Thread Matthew Cothier

Whats wrong with this?? Its not working...

Search.php

?php include(search_bool.inc); ?
?php

$connection = mysql_connect($host,$dbusername,$dbpassword) or die 
(Cannot connect to server.);
$db = mysql_select_db($dbname, $connection) or die (Could not select 
database.);
$sqlstring = SELECT * FROM $searchsection WHERE 
.makeboolean(keyword,$search);

$result = mysql_query($sqlstring, $connection) or die (Could not execute 
query.);

if (!$result) {
  echo pCould not get record.;
}

if(mysql_num_rows($result)) {
  $uid = 1;
  while($row = mysql_fetch_row($result))
  {

   print(font face=\Verdana\ size=\1\ba href=\#\ 
onclick=\window.open('./view_ep.php3?news_id=$row[0]','','width=490,height=280');\$row[1]/a/bbrbr$row[2]/font/smallp);

$uid++;
  }

}

?




Search Boolean file I was told to use

## I don't even get these instructions!! *lol*
## usage: makeboolean(fieldname,$searchstring)
## ie: $sqlstring = SELECT * FROM table WHERE 
.makeboolean(field,$search);


class Query {
   var $m_words;
   var $m_logic;

   function Query($logic, $words) {
  $logic =  .$logic. ;
  $this-m_words = $words;
  $this-m_logic = $logic;
   }
};

class phpSQLbool {
   var $m_Querys;
   var $m_start;
   var $m_offset;
   var $m_wordmatch;
   var $m_casematch;

   function QueryGenerator($Querys, $wordmatch=false, $casematch=false) {
  $this-m_Querys = $Querys;
  $this-m_wordmatch = $wordmatch;
  $this-m_casematch = $casematch;
  $this-Restrict(0,0);
   }

   function Restrict($start, $offset) {
  $this-m_start  = $start;
  $this-m_offset = $offset;
   }

   function GetRestrict($start, $offset) {
  $start = $this-m_start;
  $offset = $this-m_offset;
   }

   function GetQueryString($searchfield) {
  // $query_string = SELECT $resultfield FROM $table WHERE ;
  $query_string .= $this-BuildQueryString($table, $searchfield);
  if ($this-m_start || $this-m_offset) {
 $query_string .= LIMIT $this-m_start;
 if($this-m_offset)
 $query_string .= ,$this-m_offset;
  }
  return $query_string;
   }

   function GetCountQueryString($table, $searchfield) {
  $query_string = SELECT count(*) FROM $table WHERE ;
  $query_string .= $this-BuildQueryString($table, $searchfield);
  return $query_string;
   }


   function BuildQueryString($table, $searchfield) {
  $searchfields = explode(,, $searchfield);
  if(!is_array($searchfields))
 $searchfields=array($searchfield);
 while ($searchfield = current($searchfields)) {
if (!$this-m_casematch)
   $searchfield = $searchfield;
$firstquery = true;
reset($this-m_Querys);
while($query = current($this-m_Querys)) {
   if ($firstquery)
  $firstquery=false;
   else if ($query-m_logic == NOT)
  $query_string .=AND ;
   else
  $query_string .=$query-m_logic;
   $query_string .= $this-BuildWhereClause($searchfield, 
$query);
   next($this-m_Querys);
}
if (next($searchfields))
   $query_string .= OR;
  }
  return $query_string;
   }

   function BuildWhereClause($searchfield, $query) {
  while($word = current($query-m_words)) {
 if (!$this-m_casematch)
$word = sql_regcase($word);
 if ($this-m_wordmatch)
$search_type = REGEXP '[[::]].$word.[[::]]';
 else
$search_type = REGEXP '$word';
 if ($query-m_logic == NOT)
$query_string.=$searchfield NOT ;
 else
$query_string.=$searchfield ;
 $query_string.= $search_type;
 if (next($query-m_words))
$query_string.= OR ;
  }
  return $query_string;
   }
};


function makeboolean($field, $keywords) {
   $words = explode( , $keywords);
   for ($i=0; $i  count($words); $i++) {
  $query[] = new Query(AND, array(trim($words[$i])));
   }

   $querygen = new phpSQLbool($query);
   $query =  $querygen-GetQueryString($field);

   return $query;
}
?

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




[PHP-DB] Subtracting times?

2001-06-23 Thread Matthew Cothier

I really need help here. What I am trying to do is the following.

-

$today = date(m.d.y);
$time = date(g:i a);

if($row[3] == $today){

if(($row[4]  $time) and ($time  $row[6])){

print(Now Showing);

} else {

print(Today at $row[4]);

}

} else {

print($row[3] at $row[4]);

}



$row[3] -- Date stored in database i.e 06.23.01
$row[4] -- Start time stored in database i.e 7.00 pm
$row[6] -- End time stored in database i.e 7.30 pm




My problem is that when it looks for the difference in time it works fine 
with say :

start time = 7:00 pm
end time = 8:00 pm

But as soon as I go into:

start time = 7:00 pm
end time = 7.35 pm

it mucks up!


Please help!! What do I need to do?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Moving database info?

2001-04-14 Thread Matthew Cothier

Does anyone know how I can move tables from one database to another using 
phpmyadmin?

Please help, thanks!

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] A question - ($file_exists)

2001-03-27 Thread Matthew Cothier

I am setting up an episode guide for one of my favourite shows and with this 
I need to include three screenshots:

episodeID_a.jpg
episodeID_b.jpg
episodeID_c.jpg

In some cases though the files will not exist and therefore I need too check 
if they exist and if they don't then it will display a blank image...

Whats wrong with this code?

-

?php

$img1 = "episodeID_a.jpg";
$img2 = "episodeID_b.jpg";
$img3 = "episodeID_c.jpg";

for ($x=1; $x = 3; $x++) {

if (!$file_exists(.//$img$x)) {

//Change the variable $img? and give it the value of a temporary, blank 
image

$img$x="blank.jpg";

}

print("$img$xbr");

}

?



I would be grateful for any help with this, thanks in advance,

Matt
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




Re: [PHP-DB] A question - ($file_exists)

2001-03-27 Thread Matthew Cothier

Why isn't this working?




?php

$img[] = "$episodeID_a.jpg";
$img[] = "$episodeID_b.jpg";
$img[] = "$episodeID_c.jpg";

for ($x=0; $xcount($img); $x++) {

if(!file_exists($img[$x])) {

print("td align=centerimg src=\"blank.gif\" width=160 height=120 
border=\"1\"/td");

} else {

print("td align=centerimg src=\"$img[$x]\" width=160 height=120 
border=\"1\"/td");

}//end if

}//end for loop
?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Bad Gateway Errors

2001-03-11 Thread Matthew Cothier

Is there anyway of reducing bad gateway errors on my mysql messageboard, 
members are starting to get really irritated by it?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Drop down box

2001-03-01 Thread Matthew Cothier

How do I get my select form to select a value for $num_view and refesh the 
page?

SELECT * FROM table_name ORDER BY n_id DESC LIMIT $num_view

I now need a dropdown box that has set values for 5,10,15 and 20 so that the 
user can select a number of news articles to view and it will refresh the 
page and show that many?

How can I do this without a button needing to be pressed?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




RE: [PHP-DB] Drop down box

2001-03-01 Thread Matthew Cothier




From: Ben Cairns [EMAIL PROTECTED]
To: php-db [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Drop down box
Date: Thu, 1 Mar 2001 14:06:21 +

Hope this helps

-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."



Hope what helps? *lol*
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Selecting number of news items on frontpage

2001-02-28 Thread Matthew Cothier

I have a homepage which has a news headline system. Bascially via form the 
admin of the site can submit news which appears on the front page, the only 
problem is the news just keeps coming and I have a front page with too many 
headlines on.

How can I make it so that say 7 articles appear on the front page and the 
rest can be accessed through some sort of archive?

Perhaps a link underneath these articles to the archive?

And the actual archive a page with the headlines listed that they can click 
on and view the story, the headlines listed in date order.

How would I do this?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Resolution detect and redirect

2001-02-27 Thread Matthew Cothier

I am lookign for a piece of code that will detect the resolution of the user 
and return a page dependant on that i.e - The table will be adjusted to suit 
that.

Is there a script where I can detect what the resolution is, and also 
redirect to a page depending on what resolution they are using?

Thanks in advance for any help!
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




RE: [PHP-DB] Resolution detect and redirect

2001-02-27 Thread Matthew Cothier

Why not just create a table that will resize to any resolution?

Because I am using different sized images for the different resolutions as 
well as other page thingys.

And I need the script for other things too.

So can anyone help?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] cookies, email and passwords

2001-02-25 Thread Matthew Cothier

Sorry for putting three topics in one but they all go together so I thought 
I would.

I am setting up a user login/members area!

* Firstly how do I generate a random password?

* Then how do I email it to the user?

* And now I need to know how to set a cookie with their username and 
password so that when they log in they don't have to keep entering their 
username and password for the hour that the cookie is active?

* How do I also call the cookie into each page?

If anyone can help with any of these I would be really grateful!


_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] cookies, email and passwords

2001-02-25 Thread Matthew Cothier

Thanks!

Is there anyone who can actually give me little bits of code that I need 
cause I am in a rush with this
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] Data input

2001-02-21 Thread Matthew Cothier

I have set up a database so that users can submit news to my website. The 
only problem is they input their news article into the database through a 
form but it comes out as a continuous string of text.

(a) shows what it looks like now, and (b) shows how its supposed to look. 
How can they input the data into the database as they typ eit in without 
them having to add html .br. tags?

(a) this is line one this is line two this is line three

(b) this is line one

this is line two

this is line three
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP-DB] nl2br()

2001-02-21 Thread Matthew Cothier

Where exactly do I need to insert this?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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