I can't get the $result query to work. i keep getting a parse error. something to do with the quotes i think. can someone please help me?
$newartist = mysql_query("SELECT Distinct City, Genre_Select FROM Musicians_Network WHERE Date_Created > curdate()-7", $db);
if ($myfirstrow = mysql_fetch_array($newartist)) {
do {
$result = mysql_query("SELECT Contact FROM Musicians_Network WHERE (City = ". $myfirstrow['City'] ." or Genre_Select = ".
$myfirstrow['Genre_Select']) ." and Updates = 'Yes'",$db);
}while ($myrow = mysql_fetch_array($newartist));
PHP queries
Moderator: General Moderators
$newartist = mysql_query("SELECT Distinct City, Genre_Select FROM Musicians_Network WHERE Date_Created > curdate()-7", $db);
if ($myfirstrow = mysql_fetch_array($newartist)) { <-- this one isn't "ended"
do {
$result = mysql_query("SELECT Contact FROM Musicians_Network WHERE (City = ". $myfirstrow['City'] ." or Genre_Select = ".
$myfirstrow['Genre_Select']) ." and Updates = 'Yes'",$db);
}while ($myrow = mysql_fetch_array($newartist));
if ($myfirstrow = mysql_fetch_array($newartist)) { <-- this one isn't "ended"
do {
$result = mysql_query("SELECT Contact FROM Musicians_Network WHERE (City = ". $myfirstrow['City'] ." or Genre_Select = ".
$myfirstrow['Genre_Select']) ." and Updates = 'Yes'",$db);
}while ($myrow = mysql_fetch_array($newartist));
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
First of all, please do not cross-post, as mydimension pointed out in your other post (which has now been deleted) it is confusing for everyone.
Cavey's right, you're missing a closing bracket for your if statement. To make your code easier to read and to debug though, you should try moving your SQL queries into their own variables so you can echo them out to check they're alright. Instead of a do...while loop just use a while one:
Also consider whether you need multiple queries to pull information from the same table.
Mac
Cavey's right, you're missing a closing bracket for your if statement. To make your code easier to read and to debug though, you should try moving your SQL queries into their own variables so you can echo them out to check they're alright. Instead of a do...while loop just use a while one:
Code: Select all
while ($row = mysql_fetch_assoc($result)) {
// do stuff
}Mac