Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
They don't do anything, but my point was, he said that what he pulled
from the DB needed to be put into an array, and I was pointing out, it
already was.

On Wed, 2002-11-27 at 12:23, Mark wrote:
> But what do all those $row['fieldname'} rows do? Call me ignorant
> (you wouldn't be the first), but a statement that simply has a
> variable name doesn't DO anything. Should these have echos in front
> of them?
> 
> --- Adam Voigt <[EMAIL PROTECTED]> wrote:
> > Umm, he is putting them into an array, I quote:
> > 
> > while ($row = mysql_fetch_array($result)) {
> > > > $row['Books.Title'];
> > > > $row['Books.Author'];
> > > > $row['Books.ISBN'];
> > > > $row['BookList.dbase'];
> > > > $row['BookList.dbase_user'];
> > > > $row['BoxSet.BoxSet'];
> > > > $row['Category.Category'];
> > > > $row['Category.Sub_category'];
> > > > $row['Publisher.Publisher'];
> > > > $row['AuthUsers.email'];
> > > > 
> > > > }
> > 
> > See the while condition?
> > 
> > On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
> > > You need to put your $result into an array. you can use:
> > > 
> > > $result_array = mysql_fetch_array($result);
> > > 
> > > then, if you know the field names in the array, print them like
> > so:
> > > 
> > > echo $result_array["field1"];
> > > echo $result_array["field2"];
> > > 
> > > or if you dont know their names you can refer to their position
> > numbers
> > > starting from 0 e.g.
> > > 
> > > echo $result_array[0];
> > > echo $result_array[1];
> > > 
> > > using the position numbers you could put together a quick script
> > to
> > > crawl through the array and print all the fields with a few lines
> > of
> > > code.
> > > 
> > > On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
> > > > Hello.
> > > > 
> > > > I am using MySQL as a database for a departmental library.  I
> > have written
> > > > a quick search script, but keep getting "resource id #2" as a
> > result to my
> > > > search.  I have read the online documentation for the
> > > > mysql_fetch_array() function and must say, I don't see that I'm
> > missing
> > > > anything.  However, I've only started programming, much less
> > working with
> > > > PHP, so perhaps someone can help me out.  Here's my code:
> > > > 
> > > >  > > > 
> > > > $quickSearch = "mcse";
> > > > 
> > > > $table1 = "Books";
> > > > $table2 = "BookList";
> > > > $table3 = "BoxSet";
> > > > $table4 = "Category";
> > > > $table5 = "Publisher";
> > > > $table6 = "AuthUsers";
> > > > $table7 = "CD";
> > > > 
> > > > $connection = mysql_connect("localhost", "root") or
> > die("Couldn't connect
> > > > to the library database.");
> > > > 
> > > > $db_select = mysql_select_db("library", $connection) or
> > die("Couldn't
> > > > select the library database.");
> > > > 
> > > > $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON
> > Books.BookListID =
> > > > BookList.BookListID
> > > > LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> > > > LEFT JOIN $table4 ON Books.CategoryID =
> > Category.CategoryID
> > > > LEFT JOIN $table5 ON Books.PublisherID =
> > Publisher.PublisherID
> > > > LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> > > > LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> > > > WHERE Books.Title LIKE \"%'$quickSearch'%\"
> > > > OR Books.Author LIKE \"%'$quickSearch'%\"
> > > > OR Books.ISBN LIKE \"%'$quickSearch'%\"
> > > > OR BookList.dbase LIKE \"%'$quickSearch'%\"
> > > > OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> > > > OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> > > > OR Category.Category LIKE \"%'$quickSearch'%\"
> > > > OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> > > > OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";
> > > > 
> > > > $result = mysql_query($search, $connection) or die("Couldn't
> > search the
> > > > library.");
> > > > 
> > > > while ($row = mysql_fetch_array($result)) {
> > > > $row['Books.Title'];
> > > > $row['Books.Author'];
> > > > $row['Books.ISBN'];
> > > > $row['BookList.dbase'];
> > > > $row['BookList.dbase_user'];
> > > > $row['BoxSet.BoxSet'];
> > > > $row['Category.Category'];
> > > > $row['Category.Sub_category'];
> > > > $row['Publisher.Publisher'];
> > > > $row['AuthUsers.email'];
> > > > 
> > > > }
> > > > 
> > > > 
> > > > ?>
> > > > 
> > > > I then have some HTML to display the result of the search.  I
> > don't
> > > > receive any error messages - I just see an empty table from the
> > HTML
> > > > code I wrote.  I added an echo of the $result to find the
> > "resouce id
> > > > #2".
> > > > 
> > > > Thanks for any help you can provide.
> > > > 
> > > > --joel
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > _
> > > > The new MSN 8: advanced junk

Re: [PHP-DB] Resource id #2

2002-11-27 Thread Mark
But what do all those $row['fieldname'} rows do? Call me ignorant
(you wouldn't be the first), but a statement that simply has a
variable name doesn't DO anything. Should these have echos in front
of them?

--- Adam Voigt <[EMAIL PROTECTED]> wrote:
> Umm, he is putting them into an array, I quote:
> 
> while ($row = mysql_fetch_array($result)) {
> > > $row['Books.Title'];
> > > $row['Books.Author'];
> > > $row['Books.ISBN'];
> > > $row['BookList.dbase'];
> > > $row['BookList.dbase_user'];
> > > $row['BoxSet.BoxSet'];
> > > $row['Category.Category'];
> > > $row['Category.Sub_category'];
> > > $row['Publisher.Publisher'];
> > > $row['AuthUsers.email'];
> > > 
> > > }
> 
> See the while condition?
> 
> On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
> > You need to put your $result into an array. you can use:
> > 
> > $result_array = mysql_fetch_array($result);
> > 
> > then, if you know the field names in the array, print them like
> so:
> > 
> > echo $result_array["field1"];
> > echo $result_array["field2"];
> > 
> > or if you dont know their names you can refer to their position
> numbers
> > starting from 0 e.g.
> > 
> > echo $result_array[0];
> > echo $result_array[1];
> > 
> > using the position numbers you could put together a quick script
> to
> > crawl through the array and print all the fields with a few lines
> of
> > code.
> > 
> > On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
> > > Hello.
> > > 
> > > I am using MySQL as a database for a departmental library.  I
> have written
> > > a quick search script, but keep getting "resource id #2" as a
> result to my
> > > search.  I have read the online documentation for the
> > > mysql_fetch_array() function and must say, I don't see that I'm
> missing
> > > anything.  However, I've only started programming, much less
> working with
> > > PHP, so perhaps someone can help me out.  Here's my code:
> > > 
> > >  > > 
> > > $quickSearch = "mcse";
> > > 
> > > $table1 = "Books";
> > > $table2 = "BookList";
> > > $table3 = "BoxSet";
> > > $table4 = "Category";
> > > $table5 = "Publisher";
> > > $table6 = "AuthUsers";
> > > $table7 = "CD";
> > > 
> > > $connection = mysql_connect("localhost", "root") or
> die("Couldn't connect
> > > to the library database.");
> > > 
> > > $db_select = mysql_select_db("library", $connection) or
> die("Couldn't
> > > select the library database.");
> > > 
> > > $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON
> Books.BookListID =
> > > BookList.BookListID
> > > LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> > > LEFT JOIN $table4 ON Books.CategoryID =
> Category.CategoryID
> > > LEFT JOIN $table5 ON Books.PublisherID =
> Publisher.PublisherID
> > > LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> > > LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> > > WHERE Books.Title LIKE \"%'$quickSearch'%\"
> > > OR Books.Author LIKE \"%'$quickSearch'%\"
> > > OR Books.ISBN LIKE \"%'$quickSearch'%\"
> > > OR BookList.dbase LIKE \"%'$quickSearch'%\"
> > > OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> > > OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> > > OR Category.Category LIKE \"%'$quickSearch'%\"
> > > OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> > > OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";
> > > 
> > > $result = mysql_query($search, $connection) or die("Couldn't
> search the
> > > library.");
> > > 
> > > while ($row = mysql_fetch_array($result)) {
> > > $row['Books.Title'];
> > > $row['Books.Author'];
> > > $row['Books.ISBN'];
> > > $row['BookList.dbase'];
> > > $row['BookList.dbase_user'];
> > > $row['BoxSet.BoxSet'];
> > > $row['Category.Category'];
> > > $row['Category.Sub_category'];
> > > $row['Publisher.Publisher'];
> > > $row['AuthUsers.email'];
> > > 
> > > }
> > > 
> > > 
> > > ?>
> > > 
> > > I then have some HTML to display the result of the search.  I
> don't
> > > receive any error messages - I just see an empty table from the
> HTML
> > > code I wrote.  I added an echo of the $result to find the
> "resouce id
> > > #2".
> > > 
> > > Thanks for any help you can provide.
> > > 
> > > --joel
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> _
> > > The new MSN 8: advanced junk mail protection and 2 months FREE*
> 
> > > http://join.msn.com/?page=features/junkmail
> > > 
> > > 
> > > -- 
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > 
> > 
> -- 
> Adam Voigt ([EMAIL PROTECTED])
> The Cryptocomm Group
> My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
> 

> ATTACHMENT part 2 application/pgp-signature name=signature.asc



=
Mark Weinstock
[EMAIL PROTECTED]
***

Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
Umm, he is putting them into an array, I quote:

while ($row = mysql_fetch_array($result)) {
> > $row['Books.Title'];
> > $row['Books.Author'];
> > $row['Books.ISBN'];
> > $row['BookList.dbase'];
> > $row['BookList.dbase_user'];
> > $row['BoxSet.BoxSet'];
> > $row['Category.Category'];
> > $row['Category.Sub_category'];
> > $row['Publisher.Publisher'];
> > $row['AuthUsers.email'];
> > 
> > }

See the while condition?

On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
> You need to put your $result into an array. you can use:
> 
> $result_array = mysql_fetch_array($result);
> 
> then, if you know the field names in the array, print them like so:
> 
> echo $result_array["field1"];
> echo $result_array["field2"];
> 
> or if you dont know their names you can refer to their position numbers
> starting from 0 e.g.
> 
> echo $result_array[0];
> echo $result_array[1];
> 
> using the position numbers you could put together a quick script to
> crawl through the array and print all the fields with a few lines of
> code.
> 
> On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
> > Hello.
> > 
> > I am using MySQL as a database for a departmental library.  I have written
> > a quick search script, but keep getting "resource id #2" as a result to my
> > search.  I have read the online documentation for the
> > mysql_fetch_array() function and must say, I don't see that I'm missing
> > anything.  However, I've only started programming, much less working with
> > PHP, so perhaps someone can help me out.  Here's my code:
> > 
> >  > 
> > $quickSearch = "mcse";
> > 
> > $table1 = "Books";
> > $table2 = "BookList";
> > $table3 = "BoxSet";
> > $table4 = "Category";
> > $table5 = "Publisher";
> > $table6 = "AuthUsers";
> > $table7 = "CD";
> > 
> > $connection = mysql_connect("localhost", "root") or die("Couldn't connect
> > to the library database.");
> > 
> > $db_select = mysql_select_db("library", $connection) or die("Couldn't
> > select the library database.");
> > 
> > $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
> > BookList.BookListID
> > LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> > LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
> > LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
> > LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> > LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> > WHERE Books.Title LIKE \"%'$quickSearch'%\"
> > OR Books.Author LIKE \"%'$quickSearch'%\"
> > OR Books.ISBN LIKE \"%'$quickSearch'%\"
> > OR BookList.dbase LIKE \"%'$quickSearch'%\"
> > OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> > OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> > OR Category.Category LIKE \"%'$quickSearch'%\"
> > OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> > OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";
> > 
> > $result = mysql_query($search, $connection) or die("Couldn't search the
> > library.");
> > 
> > while ($row = mysql_fetch_array($result)) {
> > $row['Books.Title'];
> > $row['Books.Author'];
> > $row['Books.ISBN'];
> > $row['BookList.dbase'];
> > $row['BookList.dbase_user'];
> > $row['BoxSet.BoxSet'];
> > $row['Category.Category'];
> > $row['Category.Sub_category'];
> > $row['Publisher.Publisher'];
> > $row['AuthUsers.email'];
> > 
> > }
> > 
> > 
> > ?>
> > 
> > I then have some HTML to display the result of the search.  I don't
> > receive any error messages - I just see an empty table from the HTML
> > code I wrote.  I added an echo of the $result to find the "resouce id
> > #2".
> > 
> > Thanks for any help you can provide.
> > 
> > --joel
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _
> > The new MSN 8: advanced junk mail protection and 2 months FREE* 
> > http://join.msn.com/?page=features/junkmail
> > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-27 Thread Chris Barnes
You need to put your $result into an array. you can use:

$result_array = mysql_fetch_array($result);

then, if you know the field names in the array, print them like so:

echo $result_array["field1"];
echo $result_array["field2"];

or if you dont know their names you can refer to their position numbers
starting from 0 e.g.

echo $result_array[0];
echo $result_array[1];

using the position numbers you could put together a quick script to
crawl through the array and print all the fields with a few lines of
code.

On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
> Hello.
> 
> I am using MySQL as a database for a departmental library.  I have written
> a quick search script, but keep getting "resource id #2" as a result to my
> search.  I have read the online documentation for the
> mysql_fetch_array() function and must say, I don't see that I'm missing
> anything.  However, I've only started programming, much less working with
> PHP, so perhaps someone can help me out.  Here's my code:
> 
>  
> $quickSearch = "mcse";
> 
> $table1 = "Books";
> $table2 = "BookList";
> $table3 = "BoxSet";
> $table4 = "Category";
> $table5 = "Publisher";
> $table6 = "AuthUsers";
> $table7 = "CD";
> 
> $connection = mysql_connect("localhost", "root") or die("Couldn't connect
> to the library database.");
> 
> $db_select = mysql_select_db("library", $connection) or die("Couldn't
> select the library database.");
> 
> $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
> BookList.BookListID
> LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
> LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
> LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> WHERE Books.Title LIKE \"%'$quickSearch'%\"
> OR Books.Author LIKE \"%'$quickSearch'%\"
> OR Books.ISBN LIKE \"%'$quickSearch'%\"
> OR BookList.dbase LIKE \"%'$quickSearch'%\"
> OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> OR Category.Category LIKE \"%'$quickSearch'%\"
> OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";
> 
> $result = mysql_query($search, $connection) or die("Couldn't search the
> library.");
> 
> while ($row = mysql_fetch_array($result)) {
> $row['Books.Title'];
> $row['Books.Author'];
> $row['Books.ISBN'];
> $row['BookList.dbase'];
> $row['BookList.dbase_user'];
> $row['BoxSet.BoxSet'];
> $row['Category.Category'];
> $row['Category.Sub_category'];
> $row['Publisher.Publisher'];
> $row['AuthUsers.email'];
> 
> }
> 
> 
> ?>
> 
> I then have some HTML to display the result of the search.  I don't
> receive any error messages - I just see an empty table from the HTML
> code I wrote.  I added an echo of the $result to find the "resouce id
> #2".
> 
> Thanks for any help you can provide.
> 
> --joel
> 
> 
> 
> 
> 
> 
> 
> _
> The new MSN 8: advanced junk mail protection and 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 




signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-26 Thread Jason Wong
On Wednesday 27 November 2002 02:09, The Cossins Fam wrote:
> Hello.
>
> I am using MySQL as a database for a departmental library.  I have written
> a quick search script, but keep getting "resource id #2" as a result to my
> search.  I have read the online documentation for the
> mysql_fetch_array() function and must say, I don't see that I'm missing
> anything.  However, I've only started programming, much less working with
> PHP, so perhaps someone can help me out.  Here's my code:
>
> 
> $quickSearch = "mcse";
>
> $table1 = "Books";
> $table2 = "BookList";
> $table3 = "BoxSet";
> $table4 = "Category";
> $table5 = "Publisher";
> $table6 = "AuthUsers";
> $table7 = "CD";
>
> $connection = mysql_connect("localhost", "root") or die("Couldn't connect
> to the library database.");
>
> $db_select = mysql_select_db("library", $connection) or die("Couldn't
> select the library database.");
>
> $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
> BookList.BookListID
> LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
> LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
> LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> WHERE Books.Title LIKE \"%'$quickSearch'%\"
> OR Books.Author LIKE \"%'$quickSearch'%\"
> OR Books.ISBN LIKE \"%'$quickSearch'%\"
> OR BookList.dbase LIKE \"%'$quickSearch'%\"
> OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> OR Category.Category LIKE \"%'$quickSearch'%\"
> OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";

It's always a good idea to print out your query so you can visually check 
whether it looks OK. So:

  print $search;

> $result = mysql_query($search, $connection) or die("Couldn't search the
> library.");

It's also a good idea to see what really went wrong by using mysql_error(). 
IE:

  if (($result = mysql_query($search, $connection) === FALSE)) {
print mysql_error();
die("Couldn't search the library.");
  }


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
[Crash programs] fail because they are based on the theory that, with nine
women pregnant, you can get a baby a month.
-- Wernher von Braun
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Resource id #2

2002-11-26 Thread Jason Vincent

Try this...

either...

while ($row = mysql_fetch_array($result)) {
  $title = $row['Books.Title'];
  $author = $row['Books.Author'];
...

print $title;
}

or...

while ($row = mysql_fetch_array($result)) {
  print $row['Title'];
...
}



-Original Message-
From: The Cossins Fam [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, November 26, 2002 1:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resource id #2


Hello.

I am using MySQL as a database for a departmental library.  I have written a
quick search script, but keep getting "resource id #2" as a result to my
search.  I have read the online documentation for the
mysql_fetch_array() function and must say, I don't see that I'm missing
anything.  However, I've only started programming, much less working with
PHP, so perhaps someone can help me out.  Here's my code:



I then have some HTML to display the result of the search.  I don't receive
any error messages - I just see an empty table from the HTML code I wrote.
I added an echo of the $result to find the "resouce id #2".

Thanks for any help you can provide.

--joel







_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource id #2

2002-11-26 Thread Adam Voigt
Add: print_r($row)

In your while loop, that will show you everything that is being returned
with both it's numeric and text based position.

On Tue, 2002-11-26 at 13:09, The Cossins Fam wrote:
> Hello.
> 
> I am using MySQL as a database for a departmental library.  I have written
> a quick search script, but keep getting "resource id #2" as a result to my
> search.  I have read the online documentation for the
> mysql_fetch_array() function and must say, I don't see that I'm missing
> anything.  However, I've only started programming, much less working with
> PHP, so perhaps someone can help me out.  Here's my code:
> 
>  
> $quickSearch = "mcse";
> 
> $table1 = "Books";
> $table2 = "BookList";
> $table3 = "BoxSet";
> $table4 = "Category";
> $table5 = "Publisher";
> $table6 = "AuthUsers";
> $table7 = "CD";
> 
> $connection = mysql_connect("localhost", "root") or die("Couldn't connect
> to the library database.");
> 
> $db_select = mysql_select_db("library", $connection) or die("Couldn't
> select the library database.");
> 
> $search = "SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
> BookList.BookListID
> LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
> LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
> LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
> LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
> LEFT JOIN $table7 ON Books.CD = CD.CD_ID
> WHERE Books.Title LIKE \"%'$quickSearch'%\"
> OR Books.Author LIKE \"%'$quickSearch'%\"
> OR Books.ISBN LIKE \"%'$quickSearch'%\"
> OR BookList.dbase LIKE \"%'$quickSearch'%\"
> OR BookList.dbase_user LIKE \"%'$quickSearch'%\"
> OR BoxSet.BoxSet LIKE \"%'$quickSearch'%\"
> OR Category.Category LIKE \"%'$quickSearch'%\"
> OR Category.Sub_category LIKE \"%'$quickSearch'%\"
> OR Publisher.Publisher LIKE \"%'$quickSearch'%\"";
> 
> $result = mysql_query($search, $connection) or die("Couldn't search the
> library.");
> 
> while ($row = mysql_fetch_array($result)) {
> $row['Books.Title'];
> $row['Books.Author'];
> $row['Books.ISBN'];
> $row['BookList.dbase'];
> $row['BookList.dbase_user'];
> $row['BoxSet.BoxSet'];
> $row['Category.Category'];
> $row['Category.Sub_category'];
> $row['Publisher.Publisher'];
> $row['AuthUsers.email'];
> 
> }
> 
> 
> ?>
> 
> I then have some HTML to display the result of the search.  I don't
> receive any error messages - I just see an empty table from the HTML
> code I wrote.  I added an echo of the $result to find the "resouce id
> #2".
> 
> Thanks for any help you can provide.
> 
> --joel
> 
> 
> 
> 
> 
> 
> 
> _
> The new MSN 8: advanced junk mail protection and 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] resource id#2 - ????

2002-06-12 Thread Jas

Thanks a ton, I was really looking right past that variable.
Jas

"Paul Dubois" <[EMAIL PROTECTED]> wrote in message
news:p05111763b92d3addd3b4@[192.168.0.33]...
> At 11:42 -0600 6/12/02, Jas wrote:
> >Not sure how to over come this,  the result of a database query keeps
giving
> >me this:
> > >/* Get Ip address, where they came from, and stamp the time */
> >if (getenv(HTTP_X_FORWARDED_FOR)){
> > $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
> >} else {
> > $ipaddy = getenv(REMOTE_ADDR); }
> >
> >$referrer = $HTTP_REFERER;
> >$date_stamp = date("Y-m-d H:i:s");
> >
> >/* Start session, and check registered variables */
> >session_start();
> >if (isset($HTTP_SESSION_VARS['ipaddy']) ||
> >isset($HTTP_SESSION_VARS['referrer']) ||
> >isset($HTTP_SESSION_VARS['date_stamp'])) {
> >  $main = "Video clips stored in Database";
> >
> >/* Insert client info to database table */
> >  require('/path/to/connection/class/con.inc');
> >   $table_sessions = "dev_sessions";
> >   $sql_insert = "INSERT INTO $table_sessions
> >(ipaddy,referrer,date_stamp) VALUES
('$ipaddy','$referrer','$date_stamp')";
> >   $result = @mysql_query($sql_insert,$dbh) or die("Couldn't execute
> >insert to database!");
> >
> >/* Pull video info from database table into an array */
> >   $table_content = "dev_videos";
> >   $sql_content = @mysql_query("SELECT * FROM $table_content",$dbh);
> >  while ($row = @mysql_fetch_array($record)) {
>
> $record isn't defined anywhere.  Do you mean $sql_content?
>
> > $id = $row['id'];
> > $file_name = $row['file_name'];
> > $file_size = $row['file_size'];
> > $file_properties = $row['file_properties'];
> > $file_codec = $row['file_codec'];
> > $file_author = $row['file_author'];
> >  $result = @mysql_query($sql_content,$dbh) or die("Couldn't execute
> >query on database!");
> >
> >/* loop through records and print results of array into table */
> >   $current .=
>
>"$id$file_name$file_size$file_properties
<
> >/td>$file_codec$file_author"; }
> >   } else {
> >   /* Start a new session and register variables */
> >   session_start();
> >   session_register('ipaddy');
> >   session_register('referrer');
> >   session_register('date_stamp'); }
> >?>
> >Just to make sure everything is working correctly I have echoed every
> >statement to the screen so I may see what's going on like so:
> >
> >
> > // my results should be here but instead I get
> >Resource ID #2 printed wtf?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >Any help would be great!
> >Jas
> >
> >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] resource id#2 - ????

2002-06-12 Thread Leotta, Natalie (NCI/IMS)

I totally didn't even see that section of code.  I am sorry I wrote back
like you were an idiot!  I think we know who the real idiot is today... :-)

Sorry again!

-Natalie

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 1:53 PM
To: Jas; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] resource id#2 - 


At 11:42 -0600 6/12/02, Jas wrote:
>Not sure how to over come this,  the result of a database query keeps 
>giving me this: /* Get Ip address, where they came from, and stamp the time */
>if (getenv(HTTP_X_FORWARDED_FOR)){
> $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
>} else {
> $ipaddy = getenv(REMOTE_ADDR); }
>
>$referrer = $HTTP_REFERER;
>$date_stamp = date("Y-m-d H:i:s");
>
>/* Start session, and check registered variables */ session_start();
>if (isset($HTTP_SESSION_VARS['ipaddy']) ||
>isset($HTTP_SESSION_VARS['referrer']) ||
>isset($HTTP_SESSION_VARS['date_stamp'])) {
>  $main = "Video clips stored in Database";
>
>/* Insert client info to database table */
>  require('/path/to/connection/class/con.inc');
>   $table_sessions = "dev_sessions";
>   $sql_insert = "INSERT INTO $table_sessions
>(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp')";
>   $result = @mysql_query($sql_insert,$dbh) or die("Couldn't 
>execute insert to database!");
>
>/* Pull video info from database table into an array */
>   $table_content = "dev_videos";
>   $sql_content = @mysql_query("SELECT * FROM $table_content",$dbh);
>  while ($row = @mysql_fetch_array($record)) {

$record isn't defined anywhere.  Do you mean $sql_content?

> $id = $row['id'];
> $file_name = $row['file_name'];
> $file_size = $row['file_size'];
> $file_properties = $row['file_properties'];
> $file_codec = $row['file_codec'];
> $file_author = $row['file_author'];
>  $result = @mysql_query($sql_content,$dbh) or die("Couldn't 
>execute query on database!");
>
>/* loop through records and print results of array into table */
>   $current .= 
>"$id$file_name$file_size$file_proper
>ties<
>/td>$file_codec$file_author"; }
>   } else {
>   /* Start a new session and register variables */
>   session_start();
>   session_register('ipaddy');
>   session_register('referrer');
>   session_register('date_stamp'); }
>?>
>Just to make sure everything is working correctly I have echoed every
>statement to the screen so I may see what's going on like so:
>
>
> // my results should be here but instead I get
>Resource ID #2 printed wtf?
>
>
>
>
>
>
>
>
>
>
>Any help would be great!
>Jas
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] resource id#2 - ????

2002-06-12 Thread Paul DuBois

At 11:42 -0600 6/12/02, Jas wrote:
>Not sure how to over come this,  the result of a database query keeps giving
>me this:
>/* Get Ip address, where they came from, and stamp the time */
>if (getenv(HTTP_X_FORWARDED_FOR)){
> $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
>} else {
> $ipaddy = getenv(REMOTE_ADDR); }
>
>$referrer = $HTTP_REFERER;
>$date_stamp = date("Y-m-d H:i:s");
>
>/* Start session, and check registered variables */
>session_start();
>if (isset($HTTP_SESSION_VARS['ipaddy']) ||
>isset($HTTP_SESSION_VARS['referrer']) ||
>isset($HTTP_SESSION_VARS['date_stamp'])) {
>  $main = "Video clips stored in Database";
>
>/* Insert client info to database table */
>  require('/path/to/connection/class/con.inc');
>   $table_sessions = "dev_sessions";
>   $sql_insert = "INSERT INTO $table_sessions
>(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp')";
>   $result = @mysql_query($sql_insert,$dbh) or die("Couldn't execute
>insert to database!");
>
>/* Pull video info from database table into an array */
>   $table_content = "dev_videos";
>   $sql_content = @mysql_query("SELECT * FROM $table_content",$dbh);
>  while ($row = @mysql_fetch_array($record)) {

$record isn't defined anywhere.  Do you mean $sql_content?

> $id = $row['id'];
> $file_name = $row['file_name'];
> $file_size = $row['file_size'];
> $file_properties = $row['file_properties'];
> $file_codec = $row['file_codec'];
> $file_author = $row['file_author'];
>  $result = @mysql_query($sql_content,$dbh) or die("Couldn't execute
>query on database!");
>
>/* loop through records and print results of array into table */
>   $current .=
>"$id$file_name$file_size$file_properties<
>/td>$file_codec$file_author"; }
>   } else {
>   /* Start a new session and register variables */
>   session_start();
>   session_register('ipaddy');
>   session_register('referrer');
>   session_register('date_stamp'); }
>?>
>Just to make sure everything is working correctly I have echoed every
>statement to the screen so I may see what's going on like so:
>
>
> // my results should be here but instead I get
>Resource ID #2 printed wtf?
>
>
>
>
>
>
>
>
>
>
>Any help would be great!
>Jas
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] resource id#2 - ????

2002-06-12 Thread Leotta, Natalie (NCI/IMS)

The quick answer is that that is what it's supposed to return...  that's all
the result is.  A nicer, longer answer is to give you some of my code so you
can see one way that you actually get the data out (I use sybase_fetch_row,
but you can also use _fetch_array which returns an associated array or
something - check the manual):

$dataResult = sybase_query($sql);
while ($array_ref = sybase_fetch_row($dataResult)) {
if ($array_ref[4] == 1) {
if ($array_ref[0] == $male ) {  
$left[$i] = $array_ref[2];
$names[$i] = $array_ref[3];
$ages[$i] = $array_ref[1];
$i++;   
}
elseif ($array_ref[0] == $female ) { 
$right[$j] = $array_ref[2];
$j++;
}
}
}//while

Last note - the index of the array ref refers to something in your SQL
starting with 0 (so my sql started with select sex...)

-Natalie

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 1:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] resource id#2 - 


Not sure how to over come this,  the result of a database query keeps giving
me this: $id$file_name$file_size$file_properties<
/td>$file_codec$file_author"; }
  } else {
  /* Start a new session and register variables */
  session_start();
  session_register('ipaddy');
  session_register('referrer');
  session_register('date_stamp'); }
?>
Just to make sure everything is working correctly I have echoed every
statement to the screen so I may see what's going on like so:// my
results should be here but instead I get Resource ID #2 printed wtf?
   


Any help would be great!
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource ID#2 ????

2002-05-29 Thread Jas

How can I get the form below to list the single record in a db that matches
the request of $user_id?
$table = "auth_users";
 $record = @mysql_query("SELECT * FROM $table WHERE user_id =
'$user_id'",$dbh);
   while ($row = mysql_fetch_row($record)) {
$user_id = $row['user_id'];
$f_name = $row['f_name'];
$l_name = $row['l_name'];
$email_addy = $row['email_addy'];
$un = $row['un'];
$pw = $row['pw']; }
$var_form .= "
  Edit Account
$user_id
First Name:i.e. John
Last Name:i.e. Doe
  Email:i.e.
[EMAIL PROTECTED]
User Name:i.e. j-doe
Password:(password must be alpha-numeric, i.e.
pAs5w0rd)
Confirm Password:please confirm password
entered
   
   ";
echo $record;
Thanks in advance,
Jas


"Natalie Leotta" <[EMAIL PROTECTED]> wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024AC420@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024AC420@SSIMSEXCHNG...
> I could be missing something, but it looks like you are using the result
of
> the mysql_query as the actual result.  It actually returns some weird
> identifier.  To access the real info you'd have to use something like
> mysql_fetch_array to get it.
>
> Check out this and see if it helps:
>
> http://www.php.net/manual/en/function.mysql-query.php
>
> -Natalie
>
> -Original Message-
> From: Jas [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 12:18 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Resource ID#2 
>
>
> Ok here is my problem, I set this up so a user selects a name form a
select
> box and that name or $user_id is then  passed to this page so the user can
> edit the contact info etc.  However it does not pull the selected $user_id
> and place each field into my form boxes, all I get is a Resource ID #2.
Not
> sure how I can over come this...
>
> $table = "auth_users";
>  $record = @mysql_query("SELECT * FROM $table WHERE user_id =
> '$user_id'",$dbh);
> $var_form .= " name=\"$user_id\" method=\"post\" action=\"del_account.php\">
>   Edit Account
> $user_id
> First Name: type=\"text\" name=\"$f_name\" size=\"30\" maxlength=\"30\"
> value=\"$f_name\">i.e. John
> Last Name: type=\"text\" name=\"$l_name\" size=\"30\" maxlength=\"30\"
> value=\"$l_name\">i.e. Doe
>   Email: type=\"text\" name=\"$email_addy\" size=\"30\" maxlength=\"30\"
> value=\"$email_addy\">i.e.
> [EMAIL PROTECTED]
> User Name: type=\"text\" name=\"$un\" size=\"30\" maxlength=\"30\"
value=\"$un\"> class=\"copyright\">i.e. j-doe
> Password: type=\"password\" name=\"$pw\" size=\"30\" maxlength=\"30\"> class=\"copyright\">(password must be alpha-numeric, i.e.
> pAs5w0rd)
> Confirm Password: width=\"80%\"> maxlength=\"30\">please confirm password
> entered
>   type=\"submit\" name=\"add\" value=\"edit user\">   type=\"reset\" name=\"reset\" value=\"reset\">
>";
> echo $record;
> } else {
> blah blah
> }
> Thanks in advance,
> Jas
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource ID#2 ????

2002-05-29 Thread Jason Wong

On Thursday 30 May 2002 00:41, Jas wrote:
> If you look at the previously posted code at the bottom of the form there
> is a echo for the sql select statement that is echoing "Resource id #2" on
> the page.  Now that error is the correct field id number in the database, I
> am just not sure how to itemize the data from that table, at least I think.
> Any help would be great!

You are confused -- #2 just happens to coincide with your field id.

You're not RFTM.

mysql_query() returns a result_id ("Resource id #2").

You feed this into a mysql_fetch_row() (or any of the other similar functions) 
to actually retrieve records.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
1: No code table for op: ++post
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Resource ID#2 ????

2002-05-29 Thread Leotta, Natalie (NCI/IMS)

I could be missing something, but it looks like you are using the result of
the mysql_query as the actual result.  It actually returns some weird
identifier.  To access the real info you'd have to use something like
mysql_fetch_array to get it.

Check out this and see if it helps:

http://www.php.net/manual/en/function.mysql-query.php

-Natalie

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 12:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resource ID#2 


Ok here is my problem, I set this up so a user selects a name form a select
box and that name or $user_id is then  passed to this page so the user can
edit the contact info etc.  However it does not pull the selected $user_id
and place each field into my form boxes, all I get is a Resource ID #2.  Not
sure how I can over come this...

$table = "auth_users";
 $record = @mysql_query("SELECT * FROM $table WHERE user_id =
'$user_id'",$dbh);
$var_form .= "
  Edit Account
$user_id
First Name:i.e. John
Last Name:i.e. Doe
  Email:i.e.
[EMAIL PROTECTED]
User Name:i.e. j-doe
Password:(password must be alpha-numeric, i.e.
pAs5w0rd)
Confirm Password:please confirm password
entered
   
   ";
echo $record;
} else {
blah blah
}
Thanks in advance,
Jas




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource ID#2 ????

2002-05-29 Thread Jas

If you look at the previously posted code at the bottom of the form there is
a echo for the sql select statement that is echoing "Resource id #2" on the
page.  Now that error is the correct field id number in the database, I am
just not sure how to itemize the data from that table, at least I think.
Any help would be great!
Jas

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thursday 30 May 2002 00:17, Jas wrote:
> > Ok here is my problem, I set this up so a user selects a name form a
select
> > box and that name or $user_id is then  passed to this page so the user
can
> > edit the contact info etc.  However it does not pull the selected
$user_id
> > and place each field into my form boxes, all I get is a Resource ID #2.
> > Not sure how I can over come this...
> >
> > $table = "auth_users";
> >  $record = @mysql_query("SELECT * FROM $table WHERE user_id =
> > '$user_id'",$dbh);
>
> Make liberal use of error checking (see manual) and mysql_error().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
>
> /*
> grep me no patterns and I'll tell you no lines.
> */
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource ID#2 ????

2002-05-29 Thread Jason Wong

On Thursday 30 May 2002 00:17, Jas wrote:
> Ok here is my problem, I set this up so a user selects a name form a select
> box and that name or $user_id is then  passed to this page so the user can
> edit the contact info etc.  However it does not pull the selected $user_id
> and place each field into my form boxes, all I get is a Resource ID #2. 
> Not sure how I can over come this...
>
> $table = "auth_users";
>  $record = @mysql_query("SELECT * FROM $table WHERE user_id =
> '$user_id'",$dbh);

Make liberal use of error checking (see manual) and mysql_error().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
grep me no patterns and I'll tell you no lines.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Resource Id #2

2002-01-23 Thread Dan Brunner

AHAHAHHAHA

AHHAHAHAH


Dan


On Wednesday, January 23, 2002, at 02:19 PM, 
[EMAIL PROTECTED] wrote:

> Dan,
>
>> Good, I'm glad it worked!!!
>>
>> I see a lot of people using mysql_fetch_array().
>>
>> Which is fine...But I'm more into Object Oriented programming...and
>> that's why I always use mysql_fetch_object()
>
>
> hey this is a family show - but I guess 'what you do in the privacy 
> of' ...
>
> - and I'm just plain object-ionable, so I favor mysql_fetch_assoc()


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Resource Id #2

2002-01-23 Thread DL Neil

Dan,

> Good, I'm glad it worked!!!
> 
> I see a lot of people using mysql_fetch_array().
> 
> Which is fine...But I'm more into Object Oriented programming...and 
> that's why I always use mysql_fetch_object()


hey this is a family show - but I guess 'what you do in the privacy of' ...

- and I'm just plain object-ionable, so I favor mysql_fetch_assoc()

=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Resource Id #2

2002-01-23 Thread Dan Brunner

Good, I'm glad it worked!!!

I see a lot of people using mysql_fetch_array().

Which is fine...But I'm more into Object Oriented programming...and 
that's why I always use mysql_fetch_object()

Good luck!!!


Dan


On Wednesday, January 23, 2002, at 11:45 AM, [EMAIL PROTECTED] wrote:

> My thanks for your quick response!
>
> Here's the problem I'm dealing with:
>
> I am inserting info with a unique identifier that auto-increments, then 
> take
> that ID and place it into another table for later reference.
>
> I was trying to use something like:
>
> $query="select var1 from table1 where var2='$var3'
> and var4='$var5'";
>
> $somevar=mysql_query($query) or die.. yada yada
> echo $somevar;
>
> I tried your code, and it works wonderfully!  Thanks so much. :)
>
> J. Wharton
> [EMAIL PROTECTED]
>
> - Original Message -
> From: "Dan Brunner" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 23, 2002 12:21 PM
> Subject: Re: [PHP-DB] Resource Id #2
>
>
>> Use something like this...
>>
>> ...
>> ...
>> ...
>> $rows = mysql_num_rows($result);
>> for ($y = 0; $y < $rows; $y++){
>> $data = mysql_fetch_object($result);
>>
>> echo $data->Field_Name;
>> ...
>> ...
>> ...
>>
>> }
>>
>>
>> A Little more code would Help!!!
>>
>>
>>
>>
>> On Wednesday, January 23, 2002, at 10:56 AM, [EMAIL PROTECTED] wrote:
>>
>>> I'm having a problem with retrieving data from MySQL databases. I can
>>> input
>>> with no problems, but when I try to pull the data back out (single
>>> field)
>>> and echo it I get something showing up saying Resource Id #2.  Any
>>> ideas?
>>>
>>>
>>>
>>>
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> To contact the list administrators, e-mail: php-list-
>>> [EMAIL PROTECTED]
>>>
>>
>>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Resource id #2 ?

2002-01-18 Thread Patrick Emond

You have to fetch the row that contains the count in it.  Try this:

$resource = mysql_query("SELECT COUNT(*) cnt FROM catalogs WHERE PROCESSED
IS NULL");
$countreq = mysql_fetch_array($resource);
echo $countreq[cnt];

(note as well that if no row is returned by the query then $countreq will be
set to false, so checking that before using it as an array is a good idea)

- Patrick

- Original Message -
From: "James Kupernik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 12:05 PM
Subject: [PHP-DB] Resource id #2 ?


> I run this query $countreq = mysql_query("SELECT COUNT(*) FROM catalogs
> WHERE PROCESSED IS NULL"); then try to echo $countreq but end up getting
> Resource id #2 instead of the count total. What would cause this?
>
> Thanks for any advise!
>
> James
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] resource id #2, #3, #4......

2001-11-28 Thread Jason Wong

On Thursday 29 November 2001 01:29, Kevin Ruiz wrote:

> I've come across yet another problem.

[snip]

> $ci = "select contactid from users where username='$username' and
> password='$password'";
> $cir = mysql_query($ci)
> or die("Couldn't execute");
> $query = "select * from my_contacts where contactid='$cir'";
>
> $result = mysql_query($query) or
>  die( mysql_error() );
>
> When I try to print $cir to see if anything's getting passed I keep getting
> something that reads "resource id #2".

[snip]

> Does anyone know what this means and how I can work around it.

$cir does NOT contain the actual results of your query. It is only a 
*pointer* to your results. To get at the actual result(s):

  print "\n";
  while ($line = mysql_fetch_array($cir)) {
  print "\t\n";
  while(list($col_name, $col_value) = each($line)) {
  print "\t\t$col_value\n";
  }
  print "\t\n";
  }
  print "\n";

Read the manual for full details.

hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Total strangers need love, too; and I'm stranger than most.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Resource id #2

2001-10-29 Thread Rick Emery

Change code as follows:

".$row['msg']."";
 ?>

-Original Message-
From: Andrew Duck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 28, 2001 7:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resource id #2


I am trying to select a message from a table in a database. the message will
will be in column 'msg' and will be in same row as id='0'.
I need that msg put to the screen. With the code below I get the error:
Resource id #2

Can someone please explain how I can fix this..

Thankyou in advance.

$msg";
 ?>




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Resource id #2

2001-10-28 Thread DL Neil

I am trying to select a message from a table in a database. the message will will be 
in column 'msg' and will be
in same row as id='0'.
I need that msg put to the screen. With the code below I get the error: Resource id #2

Can someone please explain how I can fix this..

Thankyou in advance.

$msg";
 ?>


Andrew,

Although the assignment statement looks as though the LHS (left-hand side) should 
contain the result of the
query, it does not (as you have discovered). Instead of being an integer or string, it 
is something called a
'resource'. You have already 'met' a resource in connection with the db connect 
process. After issuing a query,
you must then use one of the mysql_fetch_... functions to extract the data, one field, 
or one row at a time,
from the 'resource'. Please check out the manual at 
http://uk2.php.net/manual/en/ref.mysql.php. Also you might
consider working through one of the many excellent texts and/or online articles 
discussing the PHP/MySQL
combination.

Regards,
=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]