Hi All,

Im getting and error from the following mysql statement when running it in the browser. Any help would be appreciated.

"you have an error in your sql syntax near -nextq accounts" on line 1"

this is the code

<?php $result = mysql_query("SELECT DISTINCT(source) FROM accounts WHERE source NOT IN ('')") or die(mysql_error());
        				    while($row = mysql_fetch_array($result)){ ?>
								 <option<?php if(!empty($_REQUEST['source']) && $_REQUEST['source']==$row['source']) echo " selected"; ?>><?=$row['source'];?>
								 <? } ?>
                                 <? $result = mysql_query("SELECT DISTINCT(original_source) FROM web146-nextq.accounts") or die(mysql_error());
        				    while($row = mysql_fetch_array($result)){ ?>
								 <option value="<? echo "3 Month Survey - " . $row['original_source'];?>"<? if(!empty($_REQUEST['source']) && $_REQUEST['source']== "3 Month Survey - " . $row['original_source']) echo " selected"; ?>>3 Month Survey - <?=$row['original_source'];?>

								 <? } ?>
                                 <? $result = mysql_query("SELECT DISTINCT(original_source) FROM web146-next6.accounts") or die(mysql_error());

Instead of using $result multiple times, try using $result, $result2, $result and seee if that works

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.