Re: [PHP-DB] mysql_num_rows == 0

2011-05-30 Thread Peter Lind
On 30 May 2011 22:31, Nazish naz...@jhu.edu wrote: Hi all, I've run into a little barrier, and I'm wondering whether you have any insights. I'm entering values into a MySQL database. Before running the mysql_query, I'm checking if the value already exists (using mysql_num_rows == 0).  If the

Re: [PHP-DB] mysql_num_rows == 0

2011-05-30 Thread Karl DeSaulniers
try this instead.. if(mysql_num_rows($check) 0) { //true } else { //false } and yes, Peter's right... please dont make everything die(). Karl On May 30, 2011, at 3:43 PM, Peter Lind wrote: On 30 May 2011 22:31, Nazish naz...@jhu.edu wrote: Hi all, I've run into a little

Re: [PHP-DB] mysql_num_rows == 0

2011-05-30 Thread Nazish
That did the trick: I was over-enthusiastic in my usage of die(mysql_error). I initially used mysql_error to troubleshoot another problem (which has now re-emerged), but that's a different question which is puzzling me. The error message ($alert = Username already exists!;) displays on the page

Re: [PHP-DB] mysql_num_rows == 0

2011-05-30 Thread Nazish
Code runs smoothly now, thanks. It's always great to pick up diverse coding tips through the conversations here. 2011/5/30 Nazish naz...@jhu.edu That did the trick: I was over-enthusiastic in my usage of die(mysql_error). I initially used mysql_error to troubleshoot another problem (which

Re: [PHP-DB] mysql_num_rows, resource id #

2008-03-27 Thread Evert Lammerts
Richard Dunne wrote: In my code below, I am trying to verify that the query is selecting data from both rows of my answers table. I have run the query on my MySQL CLI and getting answers from both rows, but running this script I get $rows = 0. I can't figure out why its not returning 2 for the

Fwd: Re: [PHP-DB] mysql_num_rows, resource id #

2008-03-27 Thread Richard Dunne
This much is working: ?PHP ini_set('error_reporting',E_All); DEFINE (host,localhost); DEFINE (user,root); DEFINE (password,password); DEFINE (database,questions); $connection=mysql_connect(host,user,password) or die ('Could not connect' . mysql_error() );

Re: [PHP-DB] mysql_num_rows

2005-03-08 Thread Calvin Lough
That means that you dont have any rows to work with. It could mean that you are not connected to the database, or the query you performed did not return any rows. Calvin On Tue, 8 Mar 2005 16:11:10 +0300, Tsegaye Woldegebriel [EMAIL PROTECTED] wrote: Dear Sir or Madame, I found the following

Re: [PHP-DB] mysql_num_rows

2005-03-08 Thread J. Connolly
Use the mysql_error() function which may give you more answers. In addition you can use something like $num = mysql_num_rows($test); echo $num; If it returns 0 you have no entries, if nothing happens then you have problem with your query or connection. If you get a number then there is

Re: [PHP-DB] mysql_num_rows

2005-03-08 Thread Martin Norland
Calvin Lough wrote: That means that you dont have any rows to work with. It could mean that you are not connected to the database, or the query you performed did not return any rows. Calvin On Tue, 8 Mar 2005 16:11:10 +0300, Tsegaye Woldegebriel [EMAIL PROTECTED] wrote: Dear Sir or Madame, I found

RE: [PHP-DB] mysql_num_rows

2004-03-03 Thread Swan, Nicole
From a quick glance, I noticed that you have commented out the code that does the actual query against the MySQL database. This is the line: // $result = mysql_query($query, $db); Without this statement, there is no query to the database. It should be: $result = mysql_query($query);

Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Micah Stevens
because you're supplying it with a string not the result of the query.. uncomment your line that says: $result = mysql_query($query, $db); and change the num rows line to: else if (mysql_num_rows($result)==1) Your line that gets the column results will fail for the same reason, give it the

Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Daniel Clark
$query =SELECT username FROM users WHERE username=('$username'); // $result = mysql_query($query, $db); Above line should be uncommented. if (!$query) And the if checking the number of rows returned from the $result set. -- PHP Database Mailing List (http://www.php.net/) To

Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Craig Hoffman
ok, I uncommented the line and changed a few things around. However I am still getting errors. I really do appreciate everyone's help. Thanks CH Here is the 'new' code: function notify_password($username, $password) // notify the user that their password has been changed { $query

RE: [PHP-DB] mysql_num_rows

2004-03-03 Thread Hutchins, Richard
-Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 3:34 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_num_rows ok, I uncommented the line and changed a few things around. However I am still getting errors. I really do

Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Micah Stevens
the $db variable isn't referencing a proper connection. As you did not create the db connection in this function, I'm assuming it's a scope problem. Make sure that $db is global, and then add a global statement to the first line in the function for this variable. the $db you're referencing

Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Craig Hoffman
I got it working! Thanks everyone! __ Craig Hoffman - eClimb Media v: (847) 644 - 8914 f: (847) 866 - 1946 e: [EMAIL PROTECTED] w: www.eclimb.net _ On Mar 3, 2004, at 2:46 PM, Micah Stevens wrote: the $db variable isn't referencing a

Re: [PHP-DB] mysql_num_rows()

2002-11-19 Thread Jason Wong
On Wednesday 20 November 2002 09:11, Tyler Whitesides wrote: Hi, I have been having some trouble with this, I mysql_num_rows() to find out how many rows there are and do an insert statement in the for loop for every row returned. So, if mysql_num_rows returns 17 then the for loops does an

Re: [PHP-DB] mysql_num_rows

2002-09-19 Thread 1LT John W. Holmes
I'm getting a strange error message from calling this function It spits out Unknown column 'Resource' in 'field List' This is my query: SELECT dept.name, count(maintenance.deptid)/$total AS percentage FROM maintenance JOIN dept WHERE maintenance.deptid=dept.deptid GROUP BY dept.name

RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]
-Original Message- From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] Sent: 06 January 2002 20:10 I am pretty sure that the query is correct. here is the actual query: $query=select distinct(nodeid), nodename from books where bookid=$bookid;

RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread matt stewart
:07 To: 'Gurhan Ozen'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] mysql_num_rows -Original Message- From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] Sent: 06 January 2002 20:10 I am pretty sure that the query is correct. here is the actual query: $query=select distinct(nodeid

RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]
-Original Message- From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] Sent: 06 January 2002 20:10 I am pretty sure that the query is correct. here is the actual query: $query=select distinct(nodeid), nodename from books where bookid=$bookid;

RE: [PHP-DB] mysql_num_rows

2002-01-08 Thread Ford, Mike [LSS]
-Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: 08 January 2002 14:10 don't know if this makes a difference, but i've always used WHERE bookid = '$bookid'; - single quote round the $bookid variable - not sure if that's the problem, or if it's just good

Re: [PHP-DB] mysql_num_rows

2002-01-08 Thread Neil Thomson
:07 AM Subject: RE: [PHP-DB] mysql_num_rows -Original Message- From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] Sent: 06 January 2002 20:10 I am pretty sure that the query is correct. here is the actual query: $query=select distinct(nodeid), nodename from books where bookid

Re: [PHP-DB] mysql_num_rows

2002-01-08 Thread bill
Drop the $result from the mysql_num_rows() so it reads: $num_results=mysql_num_rows(); Depending upon the PHP version, that might do the trick for you. kind regards, bill Mike Ford wrote: -Original Message- From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] Sent: 06 January 2002

Re: [PHP-DB] mysql_num_rows

2002-01-06 Thread Richard S. Crawford
It would help if we could see the actual query. It sounds like the problem is a syntax error in the query itself. At 11:52 AM 1/6/2002, Gurhan Ozen wrote: Hi everyone, I have a problem with mysql connectivety which is making me nuts. If the query is select blah, blah from table (i.e.

RE: [PHP-DB] mysql_num_rows

2002-01-06 Thread Gurhan Ozen
, 2002 3:01 PM To: Gurhan Ozen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_num_rows It would help if we could see the actual query. It sounds like the problem is a syntax error in the query itself. At 11:52 AM 1/6/2002, Gurhan Ozen wrote: Hi everyone, I have a problem with mysql

RE: [PHP-DB] mysql_num_rows

2002-01-06 Thread Richard S. Crawford
Hm, if the result you want is the number of distinct nodeid values, why not use a query like this: select count(distinct(nodeid)) as nodecount from books where bookid = $bookid; Then the number of nodeid's is stored in nodecount. You might also want to look into the GROUP BY clause. That

RE: [PHP-DB] mysql_num_rows

2002-01-06 Thread Gurhan Ozen
Message- From: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 06, 2002 3:34 PM To: Gurhan Ozen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] mysql_num_rows Hm, if the result you want is the number of distinct nodeid values, why not use a query like this: select count(distinct

Re: [PHP-DB] mysql_num_rows

2002-01-06 Thread DL Neil
Message - From: Gurhan Ozen [EMAIL PROTECTED] To: Richard S. Crawford [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: 06 January 2002 20:42 Subject: RE: [PHP-DB] mysql_num_rows hmm that's an idea... I stil don't get why mysql_num_rows wouldn't work with WHERE clause but i will try to do a workaround