Re: [PHP-DB] Mutiple inserts with one query?

2002-05-31 Thread Patrick Emond
;INSERT INTO your_table VALUES'; for ($i=0; $i<100; $i++) { if (!$first) $query .= ', '; $query .= ' (0,1,2,3)'; $first = false; } mysql_query($query); // only one insert statement Hope that helps, Patrick Emond - Original Message - From: "Leif K-

Re: [PHP-DB] 1 query or 2 queries

2002-01-18 Thread Patrick Emond
Yes you can do that (that's what relational databases are all about). To join the two tables and fetch the data you need in a single query you would do something like this: SELECT Book.*, Chapter.* FROM Book, Chapter WHERE Book.BookTitle = Chapter.BookTitle Where "BookTitle" is whatever common

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 se