ordering search results

2009-07-17 Thread PJ
Can't find anything on the web that deals with my problem(s). I have to display thousands of book listings by title, sub_title with 10 books per page. The php/mysql code works fine - except: ASC or DESC does not change one iota. I have checked by commandline and find that it is not working at all

Re: ordering search results

2009-07-17 Thread PJ
Here's the query: SELECT * FROM book ORDER BY $sort $dir LIMIT $offset, $records_per_page; $sort == 'title, sub_title'; $dir==ASC (or DESC); $offset== (any multiple of 10); $records_per_page== 10; I could let the user change these, but I decided it is simpler to keep it at 10 books/page. Only the

ignore accents in order by

2009-06-11 Thread PJ
Is there a way to order lists while ignoring the accents? So far, I have found nothing simple; and I need to keep the accents for output. The language is French (and québécois) :-) TIA -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme.

Re: ignore accents in order by

2009-06-11 Thread PJ
order by text2 desc; +--+---+ | text | text2 | +--+---+ | �   |    1 | | a   |    0 | +--+---+ What Collation are you using? can you send us the table schema? thx! Isart On Thu, Jun 11, 2009 at 4:48 PM, PJ af.gour...@videotron.ca

Re: Can a MyISAM DB hold /everything/?

2009-05-28 Thread PJ
Scott Haneda wrote: Unless you have very good reason to store binary data like an image in your database, do not. It may work well for a time, but always be prepared that your system will grow. If it grows a good deal relative to your hardware, and users, and connections etc, you will always

dumb crash

2009-05-26 Thread PJ
Hydro Quebec just f***ed my server just as I was booting up three machines; XP is ok, FreeBSD 7.1 is the one with mysql problem, FreeBSD 4.10 - don't know, but boots ok. Result: can't access database. One table seems to abort mysqld. PhpMyAdmin connects to all databases except one. mysql CHECK

Re: cannot alter table - solved

2009-05-22 Thread PJ
Michael Dykman wrote: On Fri, May 22, 2009 at 12:26 AM, PJ af.gour...@videotron.ca wrote: Michael Dykman wrote: On Thu, May 21, 2009 at 11:06 PM, PJ af.gour...@videotron.ca wrote: I have a seemingly impossible situation. I cannot insert values into the tables and I cannot

cannot alter table - rather urgent

2009-05-21 Thread PJ
I have a seemingly impossible situation. I cannot insert values into the tables and I cannot alter or delete the primary key (which should not exist) or delete the foreign keys nor remove the constraint. G search doesn't help. CREATE TABLE `book_categories` ( `bookID` smallint(6) unsigned NOT

Re: cannot alter table - solved

2009-05-21 Thread PJ
Michael Dykman wrote: On Thu, May 21, 2009 at 11:06 PM, PJ af.gour...@videotron.ca wrote: I have a seemingly impossible situation. I cannot insert values into the tables and I cannot alter or delete the primary key (which should not exist) or delete the foreign keys nor remove

Re: Password Reset Not Working

2009-05-14 Thread PJ
Carlos Proal wrote: The machine mysql.unixslut.com is not the same than localhost, right ??, If you only need root access from localhost you can delete the first row (delete from user where user='root' and host='mysql.unixslut.com';) Carlos On 5/14/2009 5:55 PM, Carlos Williams wrote:

Re: [PHP] How to deal with identical fields in db

2009-05-05 Thread PJ
Tom Worster wrote: On 5/5/09 4:42 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: On Tue, May 5, 2009 at 1:34 PM, PJ af.gour...@videotron.ca wrote: I'm coming up with a bit of a quandry: how to enter and retrieve an identical book title with different authors. It is rather

Re: A good US Hosting Site?

2009-04-20 Thread PJ
I've been using www.host45.com for some years. linux and they've always been reliable. :-) -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com

how to join tables on multiple conditions for same column

2009-04-05 Thread PJ
I am trying to select names from a list which depends on another table for their ranking. I want to retrieve all names that start with a Capital letter in last_name and ranking of 1 and any other names that have a ranking of 2 but are both related to a third table. tables: book(id,...etc.),

how do I select multiple conditions from 1 table column?

2009-04-01 Thread PJ
I am trying to select all books whose authors last names begin with I, J or K. I have 3 tables: book, author and book_author. The following query works with one condition but not with three. SELECT * FROM book WHERE id IN (SELECT bookID FROM book_author WHERE authID IN (SELECT

Re: how do I select multiple conditions from 1 table column?

2009-04-01 Thread PJ
David Giragosian wrote: On Wed, Apr 1, 2009 at 1:27 PM, PJ af.gour...@videotron.ca mailto:af.gour...@videotron.ca wrote: I am trying to select all books whose authors last names begin with I, J or K. I have 3 tables: book, author and book_author. The following query

Re: avoiding use of Nulls

2009-03-13 Thread PJ
mich...@j3ksolutions.com wrote: On Fri, 13 Mar 2009, mich...@j3ksolutions.com wrote: Explanation(5): The more you understand how the database is to be used, and the more complexity and thought you put into your database design, the less complex it will be to retrieve reliable

Re: [PHP] RE: non-auto increment question

2009-03-11 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 11:27 -0500, PJ wrote: Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site

how to sanitize mysql_connect?

2009-03-04 Thread PJ
I hope this is the right list as it concerns mysql and php ??? I just realized that an open connection is necessary to usemysql_real_escape_string...So how do you sanitize an include page used to open a connection This is the page // db1.php // SQL login parameters for local environment

whoa!

2009-02-27 Thread PJ
What is this supposed to mean from the manual: The use of |mysql_num_rows()| http://dev.mysql.com/doc/refman/5.0/en/mysql-num-rows.html depends on whether you use |mysql_store_result()| http://dev.mysql.com/doc/refman/5.0/en/mysql-store-result.html or |mysql_use_result()|

is there another way

2009-02-27 Thread PJ
Is there another way to determine what the query found? The input is a string whatever. I'm looking for a return of a string or null or nuber of rows or something that will permit to to channel the execution of the file. The snippet below is good for (there is a match) and (there is no match) but

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration

catch the error

2009-02-26 Thread PJ
What is wrond with this file? same identical insert works from console but not from this file :-( html head titleUntitled/title /head body ? //include (lib/db1.php);// Connect to database mysql_connect('biggie', 'user', 'password', 'test'); $sql1 = INSERT INTO example (name, age) VALUES

Re: catch the error

2009-02-26 Thread PJ
? :-) Hi PJ, Could it be that you have //include (lib/db1.php); commented out? Try uncommenting that line and see what happens. The error message will always print because the query is never executing properly if you have the db connections file commented out. On Thu, Feb 26, 2009 at 12:28

Re: [PHP] catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 12:28 -0500, PJ wrote: What is wrond with this file? same identical insert works from console but not from this file :-( html head titleUntitled/title /head body ? //include (lib/db1.php); // Connect to database mysql_connect('biggie

Re: catch the error

2009-02-26 Thread PJ
,$db); if (!$result1) { echo(PError performing 1st query: . mysql_error() . /P); exit(); } ? On Thu, Feb 26, 2009 at 11:46 AM, PJ af.gour...@videotron.ca mailto:af.gour...@videotron.ca wrote: It is commented out because I am using mysql_connect I don't think it would

Re: catch the error

2009-02-26 Thread PJ
Ricardo Dias Marques wrote: Hi PJ, On Thu, Feb 26, 2009 at 17:28, PJ af.gour...@videotron.ca wrote: What is wrond with this file? same identical insert works from console but not from this file :-( [snip] ? //include (lib/db1.php);// Connect to database mysql_connect('biggie

Re: catch the error

2009-02-26 Thread PJ
'); $result1 = mysql_query($sql1,$db); if (!$result1) { echo(PError performing 1st query: . mysql_error() . /P); exit(); } ? That should fix the problem. On Thu, Feb 26, 2009 at 12:46 PM, PJ af.gour...@videotron.ca wrote: It is commented out because I am using mysql_connect I

Re: catch the error

2009-02-26 Thread PJ
Jerry Schwartz wrote: -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 12:28 PM To: php-gene...@lists.php.net; MySql Subject: catch the error What is wrond with this file? same identical insert works from console but not from

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is trying to help you and that's cool, but EVERYONE on this list may not be so nice

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
('Arnie Shwartz', '75'); $result1 = mysql_query($sql1,$db); if (!$result1) { echo(PError performing 3st query: . mysql_error() . /P); } echo $sql1; echo br /; echo $db_select; exit(); ? This works fine either as is or using the include... :-) 9el wrote: But the question is PJ, have you got

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:44 -0500, Jerry Schwartz wrote: Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query =

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:56 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here

Re: [PHP] Re: catch the error

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 14:15 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:56 -0500, PJ wrote: Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ

non-auto increment question

2009-02-25 Thread PJ
I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book;

Re: [PHP] RE: non-auto increment question

2009-02-25 Thread PJ
the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-gene...@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest

Re: how to deal with multiple authors for one book

2009-02-24 Thread PJ
Reinhardt Christiansen wrote: From: PJ af.gour...@videotron.ca To: MySql mysql@lists.mysql.com Subject: how to deal with multiple authors for one book Date: Mon, 16 Feb 2009 17:20:54 -0500 In my db there are a number of books with several authors; so, I am wondering how to set up a table

insert question

2009-02-24 Thread PJ
Is there a way to insert several rows into a table with one statement? I have this: $sql2 = INSERT INTO authors (first_name, last_name, ordinal) VALUES ('$first_nameIN', '$last_nameIN', '1'); $result2 = mysql_query($sql2, $db); I want to avoid doing another insert

multiple choice dropdown box puzzle

2009-02-23 Thread PJ
I think this is a tough one... and way above my head: PLEASE READ ALL OF THE ABOVE TO UNDERSTAND WHAT I AM TRYING TO DO. Having a bit of a rough time figuring out how to formulate php-mysql to insert data into fields using a multiple dropdown box in a form. to post I am using the following:

Re: multiple choice dropdown box puzzle

2009-02-23 Thread PJ
); That example does not sanitize the data before inserting. Brent On Mon, Feb 23, 2009 at 10:25 AM, PJ af.gour...@videotron.ca wrote: I think this is a tough one... and way above my head: PLEASE READ ALL OF THE ABOVE TO UNDERSTAND WHAT I AM TRYING TO DO. Having a bit of a rough time figuring out how

Re: multiple choice dropdown box puzzle

2009-02-23 Thread PJ
Brent Baisley wrote: It's actually a very simple solution, and you should do it all in a single INSERT. Putting INSERTs in a loop will kill your performance when you try to scale. $sql4 = 'INSERT INTO test (example) VALUES (' . implode('),(', $_POST[categoriesIN]) . ')'; $result4 =

Re: left joins concat

2009-02-22 Thread PJ
tables!! After you connect(join) the two tables you could want to see only certain rows, ok now you use the WHERE. Forget about CONCAT/CONCAT_WS this is a string function, and is not related to JOINS. Please, let me know if this was useful to you. Claudio Nanni 2009/2/22 PJ af.gour

Re: left joins concat

2009-02-22 Thread PJ
tables you could want to see only certain rows, ok now you use the WHERE. Forget about CONCAT/CONCAT_WS this is a string function, and is not related to JOINS. Please, let me know if this was useful to you. Claudio Nanni 2009/2/22 PJ af.gour...@videotron.ca mailto:af.gour

Re: left joins concat

2009-02-22 Thread PJ
* Consulting * Administration http://www.olindata.com On Sun, Feb 22, 2009 at 4:15 PM, PJ af.gour...@videotron.ca wrote: Gentlemen, and all those who care, THE PROBLEM SEEMS TO BE SOLVED (for now, NEXT is HOW TO QUERY(SELECT) MULTIPLE AUTHORS AND DISPLAY THAT and then HOW TO DEAL

HOW TO QUERY(SELECT) and display MULTIPLE AUTHORS

2009-02-22 Thread PJ
SELECT b.title, b.sub_title, b.descr, b.comment, b.bk_cover, b.copyright, b.ISBN, c.publisher, CONCAT_WS(' ', first_name, last_name) AS Author FROM book AS b LEFT JOIN book_author AS ab ON b.id = ab.bookID LEFT JOIN author AS a ON ab.authID=a.id LEFT JOIN book_publisher AS abc ON b.id =

book categories

2009-02-22 Thread PJ
Here's a tough one... In my library I have some 62 categories where a number of books can be in several categories. Now, to relate the categories table(AS c) to the book table (AS a), I assume that I need an intermediate table book_category (AS d) linking d.bookID to the b.bookID and d.categoryID

Re: book categories

2009-02-22 Thread PJ
author thingie. Phil Jourdan AGAIN: CONCAT is just a string function, it is not a sql operator, and it is not giving anything that you don't already know, dont focus on CONCAT, forget it for now. Let me know Claudio Nanni 2009/2/22 PJ af.gour...@videotron.ca Here's a tough one

left joins concat

2009-02-21 Thread PJ
I have been searching and searching for a clear and logical explanation of JOINs and have found nothing that can be reasonably understood. Perhaps I am dense or from another planet, but nothing seems to fall into place. I need to display all the books (with their respective authors and publishers)

Re: how to check for null in string

2009-02-17 Thread PJ
variable, however, most often NULL becomes indistinguishable from an emtpy string. On Tue, Feb 17, 2009 at 2:47 AM, PJ af.gour...@videotron.ca wrote: I know this is not working, but how can I check for NULL; or how can I configure my field sub_title so I can check if $booksub_title contains

how to deal with multiple authors for one book

2009-02-16 Thread PJ
In my db there are a number of books with several authors; so, I am wondering how to set up a table on books and authors to be able to insert (via php-mysql pages) data and retrieve and display these books with several authors I suspect that to insert data for a multiple author book I will have to

Re: how to deal with multiple authors for one book

2009-02-16 Thread PJ
Michael Dykman wrote: On Mon, Feb 16, 2009 at 5:20 PM, PJ af.gour...@videotron.ca wrote: In my db there are a number of books with several authors; so, I am wondering how to set up a table on books and authors to be able to insert (via php-mysql pages) data and retrieve and display

how to check for null in string

2009-02-16 Thread PJ
I know this is not working, but how can I check for NULL; or how can I configure my field sub_title so I can check if $booksub_title contains anything or is empty. This problem as been breaking my back...don't know what to put in as a default to be able to check against string input (VARCHAR) or

query and insert data on multiple tables

2009-02-13 Thread PJ
I am trying to create a php-mysql page to POST new records to several tables from one php page and I have to retrieve records from several (like 4 to 8) tables in one query. Being quite new to php mysql, I am wondering what is the best way to go about this. My tables consist of * Structure

Re: db setup - correction

2009-02-10 Thread PJ
Peter Brawley wrote: PJ, As I understand it, I have one table books it lists all the info for the book other than the author(s) or the categories ; for these I need an authors table and a category table... I'll continue with the authors as categories will surely be the same thing. BTW, I

Re: db setup - correction

2009-02-10 Thread PJ
Peter Brawley wrote: PJ But what about foreign keys? Don't I need that to find the relationships between the books, the authors and the categories? After all, isn't this a relational db? If so, I can't use the default engine (MyISAM) which does not support FK. So, if I have to use foreign

Re: db setup - correction

2009-02-10 Thread PJ
ddevaudre...@intellicare.com wrote: PJ af.gour...@videotron.ca wrote on 02/10/2009 12:44:04 PM: -- - -- Table `books` -- - CREATE TABLE IF NOT EXISTS `books` ( `id` SMALLINT(4

db setup

2009-02-09 Thread PJ
being a newbie to mysql, I'm a little confused about how to deal with the following: I am creating a database of books and have come down to this - table for books (books) including fields for id (primary key, auto-incr.) title author (could be 2 or more) category (could be several - eg. youth,

Re: db setup - correction

2009-02-09 Thread PJ
where rel_books authors has 3 entries for a book with 3 authors just using the book id and the author is's Olaf On 2/9/09 10:25 AM, PJ af.gour...@videotron.ca wrote: being a newbie to mysql, I'm a little confused about how to deal with the following: I am creating a database of books

Re: db setup - correction

2009-02-09 Thread PJ
Peter Brawley wrote: PJ Why do I need a third table? The clue is author (could be 2 or more) in your books column list. It is incorrect to store two author names or IDs in one column. The relationship is 1:many. So you need a bridge table: books(id PK, etc...) authors(id PK, etc

Re: how to design book db

2009-01-06 Thread PJ
different ISBN numbers but not to worry, they are diffeerent but they are unique and would not conflict with the US numbers. BTW, it might be worth while for PJ to look at how Amazon stores its data. I don't think you can find an easier to use database for searching on books. It looks like

Re: how to design book db

2009-01-05 Thread PJ
with IE. Some of the links and jscripts don't work on FireFox. TIA, PJ You can of course simplify things by putting the alternate ISBN number in the description of the book and put a full text index on it. Same with alternate authors etc.. It would be a catch all for items that you don't have

how to design book db

2008-12-29 Thread PJ
on FireFox. TIA, PJ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

installation nightmare

2008-12-22 Thread PJ
I feel like one big fat stupid sheep problem SOLVED... It turns out that the root of all the problems was my own little forgetful brain... I had forgotten that I had changed the permissions on the apache22/data files to 766 which prevented the execution of all the php scripts which

Re: installation nightmare

2008-12-20 Thread PJ
IT Technician On Fri, 2008-12-19 at 15:47 -0500, PJ wrote: Do what I can, there seems to be no way to install mysql 5.1.30 on FreeBSD 7.0 I even removed all files in reference to mysql5.0, 5.1, 6.0.8 from the Ports collection, cvsup'd the Ports, deinstalled php5, php5-mysql, phpMyAdmin

installation nightmare

2008-12-19 Thread PJ
Do what I can, there seems to be no way to install mysql 5.1.30 on FreeBSD 7.0 I even removed all files in reference to mysql5.0, 5.1, 6.0.8 from the Ports collection, cvsup'd the Ports, deinstalled php5, php5-mysql, phpMyAdmin, Webmin and followed the documentation as closely as possible (a

Re: installation nightmare

2008-12-19 Thread PJ
://www.mysql.com/certification/candidates.php?exam=3 (CMDEV) MySQL Certified Associate http://www.mysql.com/certification/candidates.php?exam=6 (CMA) Comptia A+ Certified Professional IT Technician On Fri, 2008-12-19 at 15:47 -0500, PJ wrote: Do what I can, there seems to be no way

installation nightmare

2008-12-18 Thread PJ
Or should I say 4-day-mare... I have been trying to set up mysql for the last 4 days with weird success. I first installed mysql 6.0.8alpha not knowing I needed 5.0 compatibility for my ISP Website host. I go everything working pretty well... mysql6, php5, phpMyAdmin, all on FreeBSD 7.0 with