RE: [PHP-DB] MySQL / PHP Database Help
| From: | Rick Emery | Date: | Fri, 08 Feb 2002 14:04:02 +0000 |
| Subject: | RE: [PHP-DB] MySQL / PHP Database Help | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16675@lists.php.net to get a copy of this message | ||
Yes, you can re-select from the same database without opeing a new
connection.
I recommend that you print the contents od $newquery to verify it contains
the string you think it should. Perhaps the apostrophes you've enclosed the
$row[] variable are not expanding.
-----Original Message-----
From: Jonathan Underfoot [mailto:jonathan@underfoot.cc]
Sent: Friday, February 08, 2002 7:43 AM
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL / PHP Database Help
I'm trying to write a script that checks for multiple entries on a table in
a database. So far I've been plagued by MySQL errors. I'm fairly confident
my scripting is ok (Then again, I've been wrong before.) I think moreover
there might be some difficulty with my theory. Then again, I could try and
do this with MySQL join statements. Any feedback would be appreciated.
$sqlquery = mysql_query("SELECT * FROM local_shows");
while ($row = mysql_fetch_array($sqlquery)) {
$newquery = mysql_query("SELECT * FROM local_shows WHERE
show_date='$row[show_date]' AND venue='$row[venue]'");
while ($row2 = mysql_fetch_array($newquery)) {
$num_rows = mysql_num_rows($row2);
if ($num_rows>1) {
print "etc etc" (Do things with my $row2 data)
I get loads of:
Warning: Supplied argument is not a valid MySQL result resource in
/home/ufr2/underfoot-www/admin/dupeshows.html on line 51
Can you not reselect in another while while selecting? Does that make any
sense to anyone but me? I shouldent have to open another DB connection?
Anyhow... your I would appreciate any help.
-Jonathan