Before I get in trouble, I have searched extensively for this one, in the
PHP Docs, online etc.
I have a simple page:
<?php
$un="jim";
$pw="jim";
$db="localhost" ;
$link = mysql_connect($ db,$un,$pw) or die("Could not connect: " .
mysql_error());
$sql2 = "SELECT * FROM eib.book ORDER BY bookid";
$op = mysql_query($sq l2) ;
$num= mysql_numrows($ op);
?>
When I run the page I keep getting this error:
Warning: mysql_numrows() : supplied argument is not a valid MySQL result
resource in C:\Program Files\Apache
Group\Apache2\h tdocs\eib\php\i temadd2.php on line 34
I can't work out why?
The code looks fine to me.
Thanks
Jim http://jimpix.co.uk 12 28472
I noticed that Message-ID: <br*********@ti tan.btinternet. com> from
Burton Figg contained the following: $sql2 = "SELECT * FROM eib.book ORDER BY bookid";
What have you tried?
Does this query work in phpMyadmin?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Burton Figg wrote: $sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ;
Try
$op = mysql_query($sq l2) or die(mysql_error () . ' in ' . $sql2);
$num= mysql_numrows($ op);
Shouldn't this be
$num = mysql_num_rows( $op);
## _____________^_ _________
<quote src="http://pt2.php.net/manual/en/function.mysql-num-rows.php">
.. For downward compatibility mysql_numrows() can also be used.
This is deprecated however.
</quote>
When I run the page I keep getting this error:
Warning: mysql_numrows() : supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\h tdocs\eib\php\i temadd2.php on line 34
I can't work out why?
The code looks fine to me.
It looks fine to me too :)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
On Sat, 13 Dec 2003 21:42:29 +0000, Burton Figg wrote: Before I get in trouble, I have searched extensively for this one, in the PHP Docs, online etc.
I have a simple page:
<?php
$un="jim"; $pw="jim"; $db="localhost" ;
$link = mysql_connect($ db,$un,$pw) or die("Could not connect: " . mysql_error());
$sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ; $num= mysql_numrows($ op);
?>
When I run the page I keep getting this error:
Warning: mysql_numrows() : supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\h tdocs\eib\php\i temadd2.php on line 34
I can't work out why?
mysql_select_db ;)
CJ Llewellyn wrote: On Sat, 13 Dec 2003 21:42:29 +0000, Burton Figg wrote: $sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ;
mysql_select_db ;)
No need for that.
select <fields> from database.table ...
You can specify the database in the query string; you can even (luckily)
mix different databases in the same query:
select u.name, x.quantity from db1.tb1 u, db2.tb2 x where u.id=x.id
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
On Sat, 13 Dec 2003 21:42:29 +0000 (UTC), "Burton Figg" <so*****@somewh ere.com>
wrote: Before I get in trouble, I have searched extensively for this one, in the PHP Docs, online etc.
Really? The first few pages on Google web and groups searches come up with the
answer.
$link = mysql_connect($ db,$un,$pw) or die("Could not connect: " . mysql_error()) ;
Here you correctly check for a possible error and stop the script going any
further. $sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ;
Here you haven't bothered...
$num= mysql_numrows($ op);
... resulting in you passing 'false' to mysql_numrows.
When I run the page I keep getting this error:
Warning, actually, you skipped passed the point at which you got an error
(mysql_query) because you didn't check for it
Warning: mysql_numrows() : supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\ htdocs\eib\php\ itemadd2.php on line 34
--
Andy Hassall (an**@andyh.co. uk) icq(5747695) ( http://www.andyh.co.uk)
Space: disk usage analysis tool ( http://www.andyhsoftware.co.uk/space)
On Sat, 13 Dec 2003 22:18:56 +0000, Pedro Graca wrote: CJ Llewellyn wrote: On Sat, 13 Dec 2003 21:42:29 +0000, Burton Figg wrote: $sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ;
mysql_select_db ;)
No need for that.
Call me fussy, but I like to know I've got access to the database before I
try to use it :)
CJ Llewellyn wrote: On Sat, 13 Dec 2003 22:18:56 +0000, Pedro Graca wrote: CJ Llewellyn wrote: mysql_select_db ;)
No need for that.
Call me fussy, but I like to know I've got access to the database before I try to use it :)
fussy!
call me fussy too :)
mysql_select_db () or die();
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
"Burton Figg" a écrit le 13/12/2003 : $sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ; $num= mysql_numrows($ op);
Are you sure a table name containing a dot is OK? I won't risk it
myself. Cause 'eib.book' can be translated by MySQL as field book form
table eib...
What does this select returns directly in phpmyadmin or equivalent ?
--
Have you read the manual? http://www.php.net/manual/en/
Jedi121 <je*********@fr ee.fr.Removethi s> brightened my day with his
incisive wit when in news:mesnews.70 1d7d3c.cb834ecb .367.2689
@free.fr.Remove this he conjectured that: "Burton Figg" a écrit le 13/12/2003 :
$sql2 = "SELECT * FROM eib.book ORDER BY bookid"; $op = mysql_query($sq l2) ; $num= mysql_numrows($ op);
Are you sure a table name containing a dot is OK? I won't risk it myself. Cause 'eib.book' can be translated by MySQL as field book form table eib...
eh? The table name doesn't have a dot in it. He's merely using fully
qualified column names in form "tablename<dot> columnName" isn't he? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: petemaxi |
last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\tockholes\includes\menu.inc.php on line 9
<div class="left">
<div class="menu">
<div class="boxhead" style="text-align:center;"> <strong>Menu</strong> </div>
<br />
<?php
require ('includes/db_conn.inc.php');
$query = "select * from menu order by item_order";
$result = mysql_query($query);
|
by: Ryanlawrence1 |
last post by:
Heya, I get these 2 errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20
You have not entered all the fields
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34
Sorry You failed to enter the correct old password
I was wondering if anyone could help me, I have...
|
by: techjohnny |
last post by:
Error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/jplane/certcent/phpweb/quiz/index.php on line
21
PHP CODE:
|
by: lsmamadele |
last post by:
I am getting the following error messages in my search:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 113
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 127
My code is below. Any help would be much appreciated.
...
|
by: Breana |
last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88
-------------------------------------------
It does this when there is no result "empty table" how can i do a quick fix to say No Results...
row 88:
if ($myrow = mysql_fetch_array($result)) {
do {
if ($rowcolor == 1) {
| |
by: Mubs |
last post by:
Hi,
I 'am trying to connect my sql database with my webpage for users log in. i have got this script so far but i keep getting the following error message which i cannot figure out..
could any1 help..
error:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\checklogin.php on line 18
Wrong Username or Password
code:
|
by: fisherd |
last post by:
When i run this code, i keep getting this message;
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\checklogin.php on line 26
i use this code to check login details. Here is the code for the pages that i used.
main_login.php
<html>
<body>
|
by: kalyanip14 |
last post by:
Hi I am new to Php.I am trying to read My sql database data from table to php.
I am getting this warning
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
and my code is
<?php
|
by: perhapscwk |
last post by:
When I run my site from localhost, no error, but when I move it to
webhosting, it show below error, why?
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/asi50080/public_html/onlineadv/category.php on line 143
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/asi50080/public_html/onlineadv/category.php on line 155
|
by: macdalor |
last post by:
Hi! I'm completely new to all dev and trying to put a website together using MySQLI and PHP; was running fine until I try to gather the DB content with the following script:
<?
$username="xxxxxx";
$password="xxxxxx";
$database="maxalien_davidloran";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |