Hi all i got a php script that works perfectly in my localhost but when i use it in a site which is in remote i get the following error:
Code:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home2/method/public_html/music/singerIndex.php on line 72
When i load the page no output and i get the above error. Is there any connection problem here? or sql syntax ?I be happy if an expert tell me how to fix it.Thanks
Code:<?php //alone script that reads folder but but not subfolder and wirtes it file name to db // change below is your assigned mySQL username $user = "root"; // change to the pw below is your assigned mySQL password $pw = ""; // change to the database you have permission to connect to $db = "method_music"; //mysql_connect("localhost", "root", ""); $mysql_access = mysql_connect("localhost", $user, $pw); mysql_select_db($db, $mysql_access); $query = "select distinct artist from songs order by artist"; $result = mysql_query($query); //echo $query; //exit(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled </title> </head> <body> <br> <br> <br> <br> <br> <table border="1" cellspacing="1" width="100%" bordercolorlight="#008ED2" id="table1" style="BORDER-COLLAPSE: collapse"> <tr> <td colspan="3" bgcolor="#323E8D"><p align="center"><font color="#FFFFFF"><b>:.Singers ..:</b></font></p> </td> </tr> <tr> <td valign="top"><table border="0" cellpadding="2"> My code. The red line shows the line 72: <? //this line for dropdownbox $option = ""; $numbers=0; while($row = mysql_fetch_assoc($result)) ==> error point { $numbers++; // counting number of records //This 2 line for drop downbox extract ($row); $option .= "<option value=\"$artist\">$artist</option>\r\n"; //echo "<br>Id : {$row['id']} <br>" . // "filename :{$row['filename']} <br>" . // "artist : {$row['artist']} <br>" . // "album : {$row['album']} <br>" . // "title : {$row['title']} <br><br>"; ?> <tr> <td style="BORDER-BOTTOM-STYLE: dotted"><a href="albums.php?albumname=<?=strval( $row['artist'] );?>"><? echo $numbers; ?>=><?=strval( $row['artist'] );?></a> [<a href="javascript:newWindow('RateSingers.php?SingerID=1378')">Rate Me</a>] Hits:<b>???</b></td> </tr> <? } ?>




Reply With Quote