Re: PHP and Mysql

2001-07-08 Thread David Robley

On Sun,  8 Jul 2001 19:10, Kevin Smith wrote:
 Hi All,

 Has anyone ever had this problem when using PHP 4.06 and MySQL 3.23.39
 running on Apache 1.3.20 on Windows 2000 Professional SP!?

 br
 bWarning/b:  Supplied argument is not a valid MySQL result resource
 in bd:\program files\apache
 group\apache\www.lemonlaineydesign.com\www\top_frame.php/b on line
 b68/bbr

 And here is the line in my HTML... any ideas what might be wrong?  This
 works on my Unix box with no problems...

 while ($results = mysql_fetch_array($sth)) {


 Thanks,

 Kevin Smith
 Netsmith Limited

Use mysql_error() after your database call to get any error messages that 
mysql returns.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   The guy who writes all those bumper stickers HATES New York.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert queries add TWO records to database

2001-07-05 Thread David Robley

On Thu,  5 Jul 2001 20:22, John (*\\*) wrote:
 I'm not convinced as I have the same problem in Netscape.

 More likely to be a PHP or MySQL configuration problem as the code is
 fine. Or maybe IIS?

 May try it on a different server.

 Regards,

 John Stoops
 Software Engineer

 -Original Message-
 From: David Robley [mailto:[EMAIL PROTECTED]]
 Sent: 05 July 2001 03:48
 To: [EMAIL PROTECTED]
 Subject: Re: Insert queries add TWO records to database


 On Wed,  4 Jul 2001 21:22, you wrote:

 I think I saw on the mysql list you had pinned this problem on IE?

OK - for a further diagnostic you could try using the 
mysql_affected_rows() function and echoing that back to the script 
immediately after the insert. That may give a further clue.

I'll have look through the code you sent me off-list and see if there is 
anything else.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Things working well, no problems. Time to upgrade.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT problem

2001-07-03 Thread David Robley

On Tue,  3 Jul 2001 23:01, Glyndower wrote:
 Hi all,

 I'm new to the whole PHP and MySql stuff and I hopeful that I can get a
 push in the right direction for what I'm sure is a very sinple problem.

 I have succesfully created a databse using telnet and added data to it
 also using telnet.

 I have also succesfully got the data to display on a page using PHP.

 My problem is adding data from the PHP page.

 My insert code is:

 $query = INSERT INTO guests ;

 $query .= (guest_id, guest_name, ;

 $query .= guest_email, guest_time, guest_message) ;

 $query .= values(,'$name','$email',NULL,'$message');

 mysql_pconnect(localhost,blahblah,blahblah)

 or die(Unable to connect to SQL server);

 mysql_select_db(blah) or die(Unable to select database);

 mysql_query($query) or die(Insert Failed!);

Add here

if(mysql_errno) { echo 'Error: ' . mysql_error() . 'BR'; }

and if there is an error returned by mysql it will be displayed.


 When I add data via the form, npthing seems to happen, it does not add
 the data to the databse, nor does it pop any errors.



 Any help would be appreciated...tia

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Now I can chop down that tree, said Tom with a heavy accent.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Insert queries add TWO records to database

2001-07-03 Thread David Robley

On Wed,  4 Jul 2001 01:24, John (*\\*) wrote:
 Operating system: WinNT4
 PHP version:  4.0.6
 PHP Bug Type: MySQL related
 Bug description:  Insert queries add TWO records to database

 All my insert queries seem to add two records to the database instead
 of one.

 I was using MS Access 2000 and did not have the problem. I am now using
 MySQL and all insert queries add 2 recs?!

 Eg.

 $sql = INSERT INTO Campaign
 (CampaignName,CampaignDesc,StartDate,EndDate,CompanyId,CampaignStatus,A
dmini stratorId) VALUES
 ('$name','$desc','$start_date','$end_date',$company_id,0,1);

 $res_insert_campaign=mysql_query($sql,$conn);

 if (!$res_insert_campaign) {
   return false;
 }

 With the
 result:

 CampaignIdCompanyId   AdministratorId CampaignNameCampaignDes 
StartDate
 EndDate   ProposalPDF InvoicePDF  CampaignStatus

 1145  1   Test Alltesting 2001-07-03  2003-07-03  NULL   
 NULL0
 1245  1   Test Alltesting 2001-07-03  2003-07-03  NULL   
 NULL0

 (2 row(s) affected)


Looks like you are using PHP - and it seems like you might be running the 
insert in a function given that you are returning a value?? Can you show 
a little more of your code?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Enter any 11-digit prime number to continue...

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: LIKE

2001-07-02 Thread David Robley

On Tue,  3 Jul 2001 09:44, Eric Fegraus wrote:
 Hi Everyone,

 Does this make sense:
 select * from table_name where column_1 LIKE %word1% OR %word2%;

 yeilds 1 record but...

 select * from table_name where column_1 LIKE %word2% OR %word1%;

 yields 0 records.

 I'm scanning a VARCHAR column trying to return records that contain or
 word1 and word2. Same thing occurs when I replace OR with AND.  The
 search words appear appear in the column as:
  word1 followed by word2.

 Am I using the LIKE incorrectly? Does MySQL have to match the first
 LIKE operator before the second?

 Much thanks,

 Eric

Indeed you are doing it wrong. Try

select * from table_name where column_1 LIKE %word2% OR column_1 LIKE 
%word1%;

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Honk if you love peace and quiet.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Errors on Mysql page

2001-07-02 Thread David Robley

On Tue,  3 Jul 2001 12:57, help wrote:
  I fixed the other errors, however I am still getting
 other errors. This database is tied into PHP. I want
 to be able to have an admin screen so I can make
 changes but it is not working for me. The errors I am
 getting on the Index page are :

 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\all_ads.phtml on line 23

 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\all_ads.phtml on line 24

 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\all_ads.phtml on line 27


 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\affiliate.phtml on line 4
 AFFILIATES

 Warning: rand(): Invalid range: 1..0 in
 C:\sites\docs\affiliate.phtml on line 12

 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\affiliate.phtml on line 16


 Warning: rand(): Invalid range: 1..0 in
 C:\sites\docs\affiliate.phtml on line 12

 Warning: Supplied argument is not a valid MySQL result
 resource in C:\sites\docs\affiliate.phtml on line 16



 Why are these comming up? And how do I make the
 user/pass work so that I and others can login to make
 changes in areas granted.

Without code snippets it's not possible to say what your problem is. 
However, if you judiciously utilise PHP function mysql_error() 
immediately after your calls to the DB, all may be revealed :-)

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I still miss my ex-wife.BUT, My aim is improving!

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: using a variable to search a database

2001-07-02 Thread David Robley

On Tue,  3 Jul 2001 01:53, [EMAIL PROTECTED] wrote:
 I have a database of dealer bulletins. I have a web page that shows the
 results of sorting
 the info in the database in certain ways. I also want to add a field to
 the page to allow the
 user to input a search word(s) and have the results displayed. I can't
 find the answer to this
 in the docs on the mysql site, I tried to search the archive, but it is
 s slow I gave up on
 that. So, here's what I have, a few else/elseif's to handle the
 sorting, plus this line

 elseif ($orderby == 'request'):
 $sql = select bulletin_number,bulletin_subject from bulletin where
 match (body,bulletin_subject) against ('request');

 I want 'request' to be the variable from the form input=text field.
 Does mysql have something similar to perl's $variable=STDIN? Just how
 do I do this type of search?

That looks like PHP scripting (and probably eighteen other languages as 
well)

If PHP, then if INPUT TYPE=text has the name request, it's value will be 
in $request.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A cat will go quack - if you squeeze it hard enough.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: message traffic

2001-06-28 Thread David Robley

On Fri, 29 Jun 2001 01:14, Dave Halliday wrote:
 Quick question - just signed up for this list and I was wondering if it
 would be possible to put a   [MySQL]   tag in the subject line?

 There doesn't seem to be a standard identifier in the messages and
 although I am filtering the entire header looking for instances of 
 mysql  my reader ( Pegasus ) doesn't always catch it.


 Most other lists I subscribe to either have the tag at the beginning
 of the subject line or spoof the address to read the list origin.
 Either way allows for flawless filtering.


 Thanks!
 Dave

You seem to be using Pegasus Mail. Set up your filter using a standard 
header match triggered by the text [EMAIL PROTECTED] in the To or Cc 
fields.

The same filter works just fine for me in KMail :-)

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Oxymoron: Somewhat Incompatible.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Query Slowness

2001-06-28 Thread David Robley

On Fri, 29 Jun 2001 13:19, Kris Amy wrote:
 i have a database and a table:-

 mysql describe phone;
 +---+--+--+-+-+---+

 | Field | Type | Null | Key | Default | Extra |

 +---+--+--+-+-+---+

 | name  | blob |  | | |   |
 | add1  | blob |  | | |   |
 | add2  | blob | YES  | | NULL|   |
 | phone | tinyblob |  | MUL | |   |

 +---+--+--+-+-+---+
 4 rows in set (0.03 sec)

 mysql

 The only problem is that it takes anywhere between 10seconds-1 minute
 to search the database. there is ~8.5 million records in it though.

 Anyone know howto speed this up?

 Kind Regards
 Kris Amy

Wouldn't you be better off to use Char or Varchar types for that sort of 
information?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   There is something to be said about me: Wow!!

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How do I stop this script running when the page is loaded?

2001-06-27 Thread David Robley

On Thu, 28 Jun 2001 10:36, Stephen Reynolds wrote:
 I only want this INSERT INTO php sql script to run when the input
 button is pressed. How do I stop the script running when the page is
 loaded?

 +++ Begin HTML Page +++

 ?php
 //create database connection
 include(d:\bin\Apache\include\dbcon.inc);
 ?
 html
 head
 titleTest Script/title
 /head
 body
 form name=update_names method=post action=?php $PHP_SELF ?
 pFirst Namebr
 input type=text name=first_name maxlength=25 size=25/p

 pLast Namebr
 input type=text name=last_name maxlength=25 size=25/p

 pinput type=submit name=Submit value=Save/p
 /form

 ?php
 $sql = INSERT INTO address (first_name, last_name) VALUES
 ('$first_name', '$last_name');
 $result = mysql_query($sql,$dbcon);
 print (Your new record has been entered.);
 ?
 /body
 /html

 +++ End HTML Page +++

 Regards, Steve

You only want the INSERT to run when the INPUT button has been clicked? 
Test to see if the variable $Submit is empty - if not the button has been 
clicked and you can do the insert (after you validate the incoming data, 
of course). You might want to only show the input fields if the action is 
not an insert.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   (C) 1992 Wild Bill's Machine Gun Shop and House of Wax.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Grant/Revoke dialogue doesn't open

2001-06-26 Thread David Robley

skick writes:
 I am havving the same problem. I even tried compiling a version.  If it
 is a window manager problem then how do I fix it. It seems like it
 should work wiith both the kde 2.0 window manager and the enlightenment
 window manager that is part on gnome.
 


 Hi!


 Please try to describe in detail exactly what is happening when you 
 start GRANT dialogue.


 I would like to be able to repeat it. I am using E, but my wife is
 using KDE 2.0.1.
 Regards,

 Sinisa


I came across this discussion from April 2001 on the archives, but 
nothing more recent. I also have encountered the problem, and thought I 
could submit a bit more information.

OS - Linux 2.4.3
XFree  - 4.0.2
KDE- 2.1.1

The problem is not exactly that the grant/revoke dialogue won't open, it 
opens but only shows (in my case) the first 'line' of the dialogue having 
the Grant checkbox and username text box.

I can minimise and restore the window; maximising causes it to widen to 
screen width but the height remains the same. The only resizing that can 
be done is horizontal.

Please query me if any further info is needed.


-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   This is my assessment, said Tom irately.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Grant/Revoke dialogue doesn't open

2001-06-26 Thread David Robley

On Tue, 26 Jun 2001 16:21, [EMAIL PROTECTED] wrote:
 Your message cannot be posted because it appears to be either spam or
 simply off topic to our filter. To bypass the filter you must include
 one of the following words in your message:

 database,sql,query,table

 If you just reply to this message, and include the entire text of it in
 the reply, your reply will go through. However, you should
 first review the text of the message to make sure it has something to
 do with MySQL. You have written the following:

 skick writes:
  I am havving the same problem. I even tried compiling a version.  If
  it is a window manager problem then how do I fix it. It seems like
  it should work wiith both the kde 2.0 window manager and the
  enlightenment window manager that is part on gnome.
 
  Hi!
 
  Please try to describe in detail exactly what is happening when you
  start GRANT dialogue.
 
  I would like to be able to repeat it. I am using E, but my wife is
  using KDE 2.0.1.
  Regards,
 
  Sinisa

 I came across this discussion from April 2001 on the archives, but
 nothing more recent. I also have encountered the problem, and thought I
 could submit a bit more information.

 OS - Linux 2.4.3
 XFree  - 4.0.2
 KDE- 2.1.1

 The problem is not exactly that the grant/revoke dialogue won't open,
 it opens but only shows (in my case) the first 'line' of the dialogue
 having the Grant checkbox and username text box.

 I can minimise and restore the window; maximising causes it to widen to
 screen width but the height remains the same. The only resizing that
 can be done is horizontal.

 Please let me know if any further info is needed.

Forgot - mysqlgui 1.7.5 (according to the download, but help shows 1.7.4) 
and the problem also exists in the table hierarchy window

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   The Definition of an Upgrade: Take old bugs out, put new ones in.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Grant/Revoke dialogue doesn't open

2001-06-26 Thread David Robley

On Tue, 26 Jun 2001 22:29, Sinisa Milivojevic wrote:
 David Robley writes:
  I came across this discussion from April 2001 on the archives, but
  nothing more recent. I also have encountered the problem, and thought
  I could submit a bit more information.
 
  OS - Linux 2.4.3
  XFree  - 4.0.2
  KDE- 2.1.1
 
  The problem is not exactly that the grant/revoke dialogue won't open,
  it opens but only shows (in my case) the first 'line' of the dialogue
  having the Grant checkbox and username text box.
 
  I can minimise and restore the window; maximising causes it to widen
  to screen width but the height remains the same. The only resizing
  that can be done is horizontal.
 
  Please query me if any further info is needed.
 
 
  --
  David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
  CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

 Many FLTK applications, including mysqlgui have problems under KDE
 2.x.x.

 Try changing settings in KDE Window Manager or temproarily use other
 window manager with KDE.

Thank you. I will have a play with settings (changing window manager 
isn't an option at the moment) and report any positive results for the 
benefit of others with similar problem.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Figures won't lie, but liars will figure.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: databases disappear...

2001-06-26 Thread David Robley

On Wed, 27 Jun 2001 12:34, Marco Bleeker wrote:
 For the first time developing a PHP-MySQL system, I am experiencing
 strange things. Perhaps it is the off-line mode (Localhost) I am
 running Apache in, or my Wintel 98SE Pentium3. So I create and populate
 3 small tables in a database with a standard little PHP script. Then I
 start working on my other PHP scripts and testing them out. Of course
 there are mistakes, like forgotten semicolons or a left bracket where
 it should be a right one (parse errors), and I correct them, untill I
 get a nice output on my screen. But suddenly - Offset 0 is not valid
 for this result set. This is a mysql_data_seek() error, but that is
 probably a coincidence. The point is: MySQL suddenly thinks that the
 database is empty, as if it was destroyed.

You are making a wrong assumption here. In fact, the result set returned 
by the query (not the database itself) has a problem - quite likely you 
are trying to cycle through an empty result set. Perhaps you need to trap 
the case where your query returns no results?  Or perhaps you may be able 
to structure your PHP code better.

In any case, the problem is not with Mysql - perhaps if you were to 
enquire on the PHP list with a code sample?


-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I was arrested for selling illegal sized paper.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php