473,394 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Multiple WHERE statements and numrows()

Can anyone help me out here...

I can't quite seem to get this right. I have a table of which I need
to extract data based on two fields: entry_id and vis. The below
results in error. When I remove the second condition from the WHERE
statement, it counts the entry id as "comnumrows".

Is my SELECT statement wrong???

$comvis = "N";
$comquery = mysql_query("SELECT * FROM comments WHERE (entry_id =
$id AND vis = $comvis)");
$comquery_data = mysql_fetch_row($comquery );
$comnumrows = $comquery_data[0];
print $comnumrows . " comments";

Feb 27 '07 #1
3 1934
On 26 Feb 2007 21:31:38 -0800, in comp.lang.php "Abersparky"
<ab********@gmail.com>
<11*********************@k78g2000cwa.googlegroups. comwrote:
>| Can anyone help me out here...
|
| I can't quite seem to get this right. I have a table of which I need
| to extract data based on two fields: entry_id and vis. The below
| results in error. When I remove the second condition from the WHERE
| statement, it counts the entry id as "comnumrows".
|
| Is my SELECT statement wrong???
|
| $comvis = "N";
| $comquery = mysql_query("SELECT * FROM comments WHERE (entry_id =
| $id AND vis = $comvis)");
vis = '$comvis')");
because the variable is a string/char
>| $comquery_data = mysql_fetch_row($comquery );
| $comnumrows = $comquery_data[0];
| print $comnumrows . " comments";
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 27 '07 #2
Jeff North wrote:
jn******@yourpantsyahoo.com.au : Remove your pants to reply
Trousers down; would you prefer the photos in PNG or JPEG?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 27 '07 #3
On Tue, 27 Feb 2007 09:58:47 +0000, in comp.lang.php Toby A Inkster
<us**********@tobyinkster.co.uk>
<nv************@ophelia.g5n.co.ukwrote:
>| Jeff North wrote:
|
| jn******@yourpantsyahoo.com.au : Remove your pants to reply
|
| Trousers down; would you prefer the photos in PNG or JPEG?
Production quality video will suffice :-P

Oh BTW, I saw someone else with this type of sig and I asked if I
could 'borrow it'.

Now getting back to the topic at hand.....
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Fritz | last post by:
Hello, i'm using pear (for the first time). the function "numRows" (Win XP SP2 , IIS, MS ACCESS) gives me always the value "-1" (= the ErrrorObject) - although the sqlResult contains data. I...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
2
by: Annie D via AccessMonster.com | last post by:
Hi, Is it possible to use multiple statements in SQL?? (I’ve never used it before) : I have one query that i'm working with, The statements I want to use are as below, they all work...
24
by: sureshjayaram | last post by:
In some functions where i need to return multiple error codes at multiple places, I use multiple return statements. Say for ex. if (Found == 1) { if (val == -1) return error1; } else { if...
1
by: apusateri | last post by:
Good morning (afternoon, evening, whatever), I realize this is PHP as well as MySQL, but I had to make a judgement call on where to post the question, hope that's okay... Is there any way to...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
2
by: Milan Krejci | last post by:
function odstran($jmeno) { $this->res=&$this->mdb2->query("DELETE FROM auth WHERE username='".$jmeno."' LIMIT 1"); if (PEAR::isError($this->res)) die($this->res->getMessage());...
4
by: Kim | last post by:
I keep getting "function not defined" when trying to get a result count on my queries ("numRows()") and dont see a bug report on PHP.net on this matter. And yes, my queries DO have results. Any...
0
by: shivapadma | last post by:
i want to know how multiple tables are added to the MS word document using vb.net i wrote following code to insert one table in MS word document using vb.net 1.opened MS word document 2.inserted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.