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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.