Mutley Posted November 26, 2006 Share Posted November 26, 2006 [quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 7[/quote][code]require_once("connection.php");mysql_select_db("rufc");if(isset($_GET['team'])){$team = $_GET['team'];$result = mysql_query("SELECT id, team, against, kickoff, against, side, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, date DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE team=".$team." ");while($row = mysql_fetch_array( $result )) {[/code]What is wrong above^?Also, can I asterix* everything apart from date to order it? Like:[code]SELECT * date DATE_FORMAT(date,'%d-%m-%Y') AS dstamp [/code] Link to comment https://forums.phpfreaks.com/topic/28570-fetch_array-warning/ Share on other sites More sharing options...
Mutley Posted November 26, 2006 Author Share Posted November 26, 2006 Error info:[code]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE team=1' at line 1[/code] Link to comment https://forums.phpfreaks.com/topic/28570-fetch_array-warning/#findComment-130733 Share on other sites More sharing options...
btherl Posted November 27, 2006 Share Posted November 27, 2006 You're missing a comma..[code=php:0]"SELECT id, team, against, kickoff, against, side, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, date, DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE team=".$team." "[/code]Also, you should check for errors after each mysql_query().[code=php:0]if ($result === false) die(mysql_error());[/code]And yes, you can * everything else, while also adding extra columns. Link to comment https://forums.phpfreaks.com/topic/28570-fetch_array-warning/#findComment-130775 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.