Jump to content

fetch_array warning


Mutley

Recommended Posts

[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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.