Code runs smoothly now, thanks. It's always great to pick up diverse coding
tips through the conversations here.
2011/5/30 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-
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
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 wrote:
Hi all,
I've run into a little barrier, and I'
On 30 May 2011 22:31, Nazish 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 value al
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 value already exists in the database, the page will echo
This much is working:
The output is
1
1
which is correct.
One small step at a time, hopefully forward.
Richard.
--- Begin Message ---
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 ha
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 n
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 number of rows. It
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 foun
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
somethi
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 followi
Dear Sir or Madame,
I found the following error,
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /home/xxx/public_html/sitename/dynamicfile.php on line 61
What is the reason?
I want anyone who knows to answer to reply me.
Thank you in advance for sharing your pr
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
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 in
y to return any rows.
Hope this helps.
Rich
> -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 change
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 ="SEL
> $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.ne
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 r
x27;user_id');
--Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310
-Original Message-
From: Craig Hoffman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 12:50 PM
To: [EMAIL PROTECTED]
Subject: Spam:[PHP-DB] mysql_nu
Perhaps someone could look at this function and help me trouble shoot
it? This function notifies the user of their new passwd.
I keep getting an error message on this page (see below). What's
strange is the script seems to be working because i am getting an
email with my new password.
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 a
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 insert statement for every instance, when the 17 turns
into zero the
--
From: 1LT John W. Holmes [SMTP:[EMAIL PROTECTED]]
<mailto:[SMTP:[EMAIL PROTECTED]]>
Sent: Thursday, September 19, 2002 2:56 PM
To: LSC Exhibits Department; [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Subject:
> I'm getting a strange error message from calling this function
>
> It spits out
> 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
>
> This query runs fine in console I j
I'm getting a strange error message from calling this function
It spits out
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
This query runs fine in console I just can't get my
Hello All,
I am struggling to understand why my query throws an error the code as below
$link = mysql_connect ( "db.localhost.org", $user , $pass );
if ( ! $link )
die ( "Couldn't Connect to Mysql Server" );
print "Sucessfully connect to server ";
$query = "select * from users "
."wh
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 20
t;
Sent: Tuesday, January 08, 2002 6: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 quer
> -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 ju
> > -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";
>
ROTECTED]]
Sent: 08 January 2002 14: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 i
> -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";
> $r
I think i narrowed down the problem and know what is wrong, and just
solved the problem:). The problem wasn't with mysql or php it was because of
my poor i should say object-oriented skill. I will tell why I had this
problem so that it might be a good reference for someone else who are likely
to
=dn
- Original 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 m
urhan
-Original 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:
&q
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 m
[mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 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:
>
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.
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. without where clause)
mysql_num_rows returns the right number, but when i put in a query with
where clause, although there are rows returned, PHP is giving:
"Warni
39 matches
Mail list logo