[PHP-DB] Problems with MySQL inserts

2001-08-07 Thread Jon Farmer

Hi,

This is a real strange one. I am writing a shell script in PHP which I am
cronning to run every 5 mins. Basically it downloads email via imap. Splits
it up into it relevant sections and adds it to a database. It does multiple
inserts, and update and multiple selects. The problem I have is that some of
the inserts dont work. There is no error returned ny mysql_error() and if
echo the SQL out and run in the MySQL client then it inserts ok. The thing
is that it is not the same query every time either. Sometimes its the first
insert and naother time its the second insert. I have attached the script in
case you want to check it out.. Any ideas anyone?

Thanks

Jon


Jon Farmer
Systems Programmer
Entanet International Ltd www.enta.net
Tel 01952 428969
Mob 07968 524175



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

2001-08-10 Thread Jon Farmer

>I'm trying to make a new directory by doing the following:

>mkdir ("newfolder", 0700);

>but i get the error:

>Warning: MkDir failed (Permission denied) in /home/web/test/upload.php on
>line 159

>Permission is obviously denied but I'm not at the box to change it myself,
>is there a specific entry in the ini file that allows permission for this?

No. It's because the user account that the webserver is running under has no
permissions to create a new directory there. You need to chown or chmod to
correct this.

Regards

Jon


Jon Farmer
Systems Programmer
Entanet International Ltd www.enta.net
Tel 01952 428969
Mob 07968 524175






-- 
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] Re: Show abbreviated article

2001-08-13 Thread Jon Farmer

NO! This will return the first 20 characters from the field not the first 20
words. To do that you need to use a regexp in the SQL or explode the result
in php and use the first 20 elements of the array!

Regards


Jon Farmer
Systems Programmer
Entanet International Ltd www.enta.net
Tel 01952 428969
Mob 07968 524175

-Original Message-
From: Johannes Janson [mailto:[EMAIL PROTECTED]]
Sent: 13 August 2001 12:15
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Show abbreviated article


hi,

[...]
> My question is this: how can I select only those first 20 words in the
> PHP code?

SELECT LEFT(YourBlobFiekd, 20) FROM YourTable;

hope it helps
Johannes



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

2001-08-28 Thread Jon Farmer

The only way i could think of doing this is to loop through $result and
assign the rows you want to keep to a new array.



--
Jon Farmer  տլ
Systems Programmer, Entanet www.enta.net
Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]

-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:41
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] query question


I want to loop round $result fetching rows and if the current row is not
needed then removing it from $result, $result will then get used again but
with the said rows removed.  I am trying to do this to avoid some major code
changes with what I am working with.


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What exactly are you trying to do?  Do you want to delete certain rows
from
> $result?  Or delete ALL rows, in which you'd use:
> mysql_return_result($result);
>
> If you want to delete certain rows, you can't.  You just have to make your
> selection criteria more precise.  Then, fetch row by row to weed out those
> rows you do not want.
>
> rick
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 8:21 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] query question
>
>
> Hi,
>
> If I run a query;-
>
> $result = mysql_query($query);
>
> is there a way of deleting rows from $result after this runs.  Or does
> anyone have any idea of how $result is generally structured when
> mysql_query($query) is run.
>
> thanks
>
>
>
>
> --
> 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 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 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] query question

2001-08-28 Thread Jon Farmer

See

http://www.php.net/manual/en/ref.array.php

You will need a multi-dimensional array if your resultset has more than one
field

Regards

Jon

--
Jon Farmer  տլ
Systems Programmer, Entanet www.enta.net
Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]

-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] query question


yeh this would work, how can I assign the rows to a new array? Is each row
accessed as an element?


"Jon Farmer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The only way i could think of doing this is to loop through $result and
> assign the rows you want to keep to a new array.
>
>
>
> --
> Jon Farmer  տլ
> Systems Programmer, Entanet www.enta.net
> Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
> PGP Key available, send blank email to [EMAIL PROTECTED]
>
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: 28 August 2001 14:41
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] query question
>
>
> I want to loop round $result fetching rows and if the current row is not
> needed then removing it from $result, $result will then get used again but
> with the said rows removed.  I am trying to do this to avoid some major
code
> changes with what I am working with.
>
>
> "Rick Emery" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > What exactly are you trying to do?  Do you want to delete certain rows
> from
> > $result?  Or delete ALL rows, in which you'd use:
> > mysql_return_result($result);
> >
> > If you want to delete certain rows, you can't.  You just have to make
your
> > selection criteria more precise.  Then, fetch row by row to weed out
those
> > rows you do not want.
> >
> > rick
> > -Original Message-
> > From: L Melville [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 28, 2001 8:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] query question
> >
> >
> > Hi,
> >
> > If I run a query;-
> >
> > $result = mysql_query($query);
> >
> > is there a way of deleting rows from $result after this runs.  Or does
> > anyone have any idea of how $result is generally structured when
> > mysql_query($query) is run.
> >
> > thanks
> >
> >
> >
> >
> > --
> > 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 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 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 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] Re: log out

2001-09-19 Thread Jon Farmer

> You need to capitalize the 'L' in "Location" (HTTP headers are
> case-sensitive).

Wrong... you can use

header("location: index.php");

just fine... 

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send blank email to [EMAIL PROTECTED]




-- 
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] Creating a file using php

2001-10-23 Thread Jon Farmer

- Original Message - 
> 
> Polite: Well its easier to post and get a reply rather then me going and
> serching fo it.;)


Easier for who?

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send blank email to [EMAIL PROTECTED]




-- 
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] Need help with duplicate entries

2001-10-30 Thread Jon Farmer

Use a  "Select Distinct." query. See www.mysql.com/doc  for more info

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send blank email to [EMAIL PROTECTED]

  - Original Message - 
  From: Chris Payne 
  To: [EMAIL PROTECTED] 
  Sent: Monday, October 15, 2001 9:59 PM
  Subject: [PHP-DB] Need help with duplicate entries


Hi there everyone,

I'm working on a project for a friend who owns a travel agent, he has a MySQL 
database which works very fast, but the problem is that there are alot of duplicate 
entries.  When I am retrieving the results from the DB and getting it ready to display 
on the page, how do I eliminate duplicates via a query?  What I mean is (See below) I 
have backpackeurope.com many times but for different countries, when you search for 
backpacking it brings all the countries up under one another - how do I make it only 
bring 1 entry up of each entry rather than all of them?

Confused?  That's how I feel :-)

Thank you all so much.

Chris Payne

www.backpackeurope.com Backpackers/Hostels in Austria
Backpacking and hostelling tips and links for student and budget travellers 
planning a trip to europe.
[EMAIL PROTECTED] - rating: . Category: Accommodation 
  

  


www.backpackeurope.com Backpackers/Hostels in England
Backpacking and hostelling tips and links for student and budget travellers 
planning a trip to europe.
[EMAIL PROTECTED] - rating: . Category: Accommodation 
   




Re: [PHP-DB] image content in mail().

2001-11-14 Thread Jon Farmer

> Who can I send an HTML e-mail with a image with mail()? Can PHP encode the
> image for


This question has been covered many times on ths list check the archives

http://groups.google.com/groups?q=&hl=en&btnG=Google+Search&meta=group%3Dphp
.general

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send blank email to [EMAIL PROTECTED]



-- 
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] Excel to Mysql

2001-11-20 Thread Jon Farmer

> Is it possible to migrate data into a table in MS Excel to MySQL?

Export to csv from excel and the mysqlimport command is your friend

Regards

Jon


--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



-- 
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] Flushing PHP output

2001-11-23 Thread Jon Farmer

> I want to have a web page access a number of DB's, this will start with
one
> but on a monthly basis increment by one. So within 12 months their will be
> 12 DB's. The web page will access each one in turn starting with the
newest
> DB and search through this for certain text. After a query has ended it
> moves on to the next and so on.


Ok well just call

flush();

to send the current buffer to the browser. Of course it depends on how
quickly each query runs if this has any measurable effect. I use flush quite
successfully on a multiple whois lookup page. On each flush it sends a new
javascript command to update the header telling the user what domain it is
checking at the moment.

Regards

Jon


--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



-- 
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] Flushing PHP output

2001-11-23 Thread Jon Farmer

> in my experience (IE5?) if there is data being "added" to the page, then
the
> browser will display what it can, and keep adding to it until the stream
> breaks or it finishes.

Only if the buffer has been flushed!

> one thing to note is that you wouldn't be able to do
> any tables because they don't display until the code all the way to the
end
> of the table is available.

tables are fine for buffered output. You just need to send a complete table
in each flushed output. In the original posters application he could use a
seperate table for each db call, then flush and they will display fine.

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key






-- 
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] JOBS in mysql

2001-11-07 Thread Jon Farmer

Write a commandline php script to do the job you want and then add the
following to your crontab assuming you are on unix of course

*/10 * * * * /path/to/script

Regards

jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send blank email to [EMAIL PROTECTED]


- Original Message -
From: "Harpreet" <[EMAIL PROTECTED]>
To: "'Mysql List'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 07, 2001 4:15 PM
Subject: [PHP-DB] JOBS in mysql


> I have run JOBs in sql server and was wondering if we have ne thign
similar
> in mysql or use PHP to write a script that would automatically run every
10
> minutes.
>
> Help is apppreciated.
>
> Regards,
>
> Harpreet Kaur
> Software Developer
> Crispin Corporations Inc.
>
>
>
> --
> 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 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] query to check valid emails

2001-11-28 Thread Jon Farmer

No this will not do what the original poster requested

it will be something like the following

select * from table where email regexp
"^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$";

Regards

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key




select * from tbl where email like "%$email%"; This will find the string
stored in the variable
'$email' in the column 'email'

Adjust having the '%' at the end, the beginning or both (as above) as they
will find the string
'$email' at end or at the beginning of the string stored in the column
'email' respectively.

Russ

On Sat, 24 Nov 2001 13:06:50 -0500 Noah Spitzer-Williams
<[EMAIL PROTECTED]> wrote:

> what's the LIKE query to see if an email address is valid?
>
> For example, in PHP it's something like
> if
>
(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$
> email,$check)) {
> echo "valid";
> }
>
>
> i want to sort through rows in a db and look for invalid email addresses
>
> so like, select * from tbl where email like "???"
>
> Thanks!
>
> - Noah
>
>
> --
> TradeMyTraffic! Banner Exchange
> http://www.trademytraffic.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]
>

#---#

  "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge

  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam

  www.theruss.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 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] JOIN Very SLOW...

2001-11-28 Thread Jon Farmer

I would suggest changing COUNT(*) to COUNT(properties.PropertyID)

Regards

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



- Original Message - 
From: "Martin E. Koss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 28, 2001 10:09 AM
Subject: [PHP-DB] JOIN Very SLOW...


The following does work but it extremely slow.

$phselect = "select COUNT(*) AS phTotal from properties LEFT JOIN
propertydetails ON properties.PropertyID=propertydetails.PropertyID where
((propertydetails.Image1Desc='') AND
(properties.PropertyType='$PropertyType'))";

$phresult = mysql_query ($phselect,$conID);
while ($phrow = mysql_fetch_array($phresult)) {
$phTotal = $phrow["phTotal"];
PRINT "$phTotal\n";
} // end WHILE

Is there an obvious problem here and can anyone help?

Martin E. Koss
M: 07946-706459
E: [EMAIL PROTECTED]


-- 
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 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] MySQL table recovery.

2001-12-06 Thread Jon Farmer

> Is there a way to "rollback" a 'delete from table;' command in MySQL
> 3.23.36-1? Yes I did it... I pressed  instead of .
> Did I lost my table content? I have no backup of this especific database.
> 
> PS: I didn't close the connection with the database yet.
> 
> Thank for any help, even if it's "forget it, no way..."

If this was a transaction then you can rollback if not then forget it

Regards

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key

- Original Message - 


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

2001-12-08 Thread Jon Farmer

> I have a database that stores the location of image files - the images are
> all of different sizes. How can I get the screen size in order to scale
the
> images according to the users screen. I can use GetImageSize() to
determine
> the image size but cannot find a means of determining the screen size.


You cant do this with PHP. You need to use a client side script (javascript)
to determine the screen res and then pass that pack to PHP either through
the query string or a form post.

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



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

2001-12-09 Thread Jon Farmer

> I slved it with a javascript function - now I can't get the page refresh
to
> work properly - I have implimented the ability to rotate the images but
> although the image i rotated it's contents aren't. I have used all maner
of
> header()'s to try and solve it but it only works when I physically hit the
> refresh button on the browser.

OK well can you show us the code? As you dont give much to go on. BTW you
are posting to the wrong list you should use the PHP-General list as this
list is for database issues.

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key




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

2001-12-18 Thread Jon Farmer

Ok you need to use PHP to decide what they have selected and construct a sql
statement based on that.

for instance

if ($location != "" && $discipline != "") :
//construct variable with sql statement
elseif ($location == "" && $discipline != ""):
//construct variable with sql statement
elseif ($location !="" && $discipline == "");
//construct variable with sql statement
else :
// nothing selected
endif;


hth

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 12:49 PM
Subject: [PHP-DB] Database query


> Hi group,
>
> I am still getting to grips with PHP and MySQL and have a question that
hopefully someone can easily answer:
>
> I have a search page which consists of two drop down menus, the user has 3
ways of finding information.
>
> The first is by selecting a location and a discipline which would look in
the database and return any entries with the data in the two seperate
fields.
>
> The second is where they can select the location only, and this will
return all entries with that location
>
> The third is where they can select the discipline only, and again this
will return all entries with that discipline.
>
> The problem I have is when the user selects the location and a discipline
which should return no results as it is not an exact match it is returning
results as it contains part of the information.
>
> My sql query is as follows: $sql = "SELECT * FROM vacancy WHERE
('$related_discipline' = related_discipline and '$location' = location) or
('$related_discipline' = related_discipline) or ('$location' = location)
ORDER BY ID LIMIT $limitvalue1, $limit";
>
> Could someone tell me what I need to change?
>
> Again help is always appreciated.
>
>
> --
> 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 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] Database query

2001-12-18 Thread Jon Farmer

Sorry the second elseif statement should have ended with : not ;
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key


- Original Message -
From: "Jon Farmer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 1:12 PM
Subject: Re: [PHP-DB] Database query


> Ok you need to use PHP to decide what they have selected and construct a
sql
> statement based on that.
>
> for instance
>
> if ($location != "" && $discipline != "") :
> //construct variable with sql statement
> elseif ($location == "" && $discipline != ""):
> //construct variable with sql statement
> elseif ($location !="" && $discipline == "");
> //construct variable with sql statement
> else :
> // nothing selected
> endif;
>
>
> hth
>
> Jon
> --
> Jon Farmer
> Systems Programmer, Entanet www.enta.net
> Tel 01952 428969 Mob 07763 620378
> PGP Key available, send email with subject: Send PGP Key
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, December 18, 2001 12:49 PM
> Subject: [PHP-DB] Database query
>
>
> > Hi group,
> >
> > I am still getting to grips with PHP and MySQL and have a question that
> hopefully someone can easily answer:
> >
> > I have a search page which consists of two drop down menus, the user has
3
> ways of finding information.
> >
> > The first is by selecting a location and a discipline which would look
in
> the database and return any entries with the data in the two seperate
> fields.
> >
> > The second is where they can select the location only, and this will
> return all entries with that location
> >
> > The third is where they can select the discipline only, and again this
> will return all entries with that discipline.
> >
> > The problem I have is when the user selects the location and a
discipline
> which should return no results as it is not an exact match it is returning
> results as it contains part of the information.
> >
> > My sql query is as follows: $sql = "SELECT * FROM vacancy WHERE
> ('$related_discipline' = related_discipline and '$location' = location) or
> ('$related_discipline' = related_discipline) or ('$location' = location)
> ORDER BY ID LIMIT $limitvalue1, $limit";
> >
> > Could someone tell me what I need to change?
> >
> > Again help is always appreciated.
> >
> >
> > --
> > 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 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 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] Run php page automatically

2001-12-21 Thread Jon Farmer

> it's better to do something like
> 
> 0,10,20,30,40,50 * * * * /usr/bin/php -q
> /home/you/yourscript.php > /dev/null

or even

*/10 * * * * /home/you/yourscript.php > /dev/null


with the first line of you php script being

#!/path/to/php -q





-- 
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] Problem with mail function

2002-01-15 Thread Jon Farmer

Hi Faye

> Maybe I shouldn't be trying to send that many emails at a time. I am on
> apache using mysql and php...
> -- 

put the line 

set_time_limit(0);

at the top of your PHP script

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



-- 
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] Re: [PHP] Connecting from PHP to MySQL on another Server

2002-01-17 Thread Jon Farmer

> 1. What is the difference between working with PHP and MySQL on a local
> server and working with PHP and MySQL when MySQL is on a remote server

None in terms of functionality.

> 2. What is the protocol used to connect to MySQL on a local server and
> what is the protocol used to connect to a remote MySQL server?

On the local machine a client (PHP is a client) can connect through unix
sockets or TCP (3306). On a remote machine its TCP only. Unix sockets access
is faster than TCP.

> 3. Is there a difference in performance between connecting from PHP to
> MySQL on a remote server or PHP to MSSQL Server?

See above answer. Also you have any TCP/IP overhead to add on.

Regards

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



-- 
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] 1 query or 2 queries

2002-01-18 Thread Jon Farmer

Yes,

Do a join on the two tables and only pull the book data from the first
record.


--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key


- Original Message -
From: "George Pitcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 1:37 PM
Subject: [PHP-DB] 1 query or 2 queries


> I  have a page that displays a book and some of its chapters (not all
> chapters are recorded) and I want to do a layout like this:
>
> ISN:   012345678X
> Book Title:  A Christmas Carol
> Book Author:  Dickens, C.
> Publisher:Victorian Press
> Year:  1934
>
> Dickens, C Chapter One:title 1-33  Last sold for 5p per page
> Digitised
> Dickens, C Chapter Two:title34-43 Last sold for 5p per page
> Digitised
> Dickens, C Chapter Three:title  44-63 Not Cleared
> Not Digitised
> Dickens, C Chapter Six :title 92-114   Last sold for 5p per page
> Digitised
>
> Now, I know I could do 2 queries, 1 against the book table and the other
> against the chapter table. Would it be possible and if so more efficient
to
> combine them into a single query and still be able to display in this way?
>
> MTIA
>
> George in Edinburgh (data is fictional in more ways than one)
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.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 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]