argument is not a valid

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default argument is not a valid

    I have installed PHP 5.


    When I test various php/mysql scripts I`ve written earlier (php 4) I get
    this kind of warning on every one
    (Connecting (mysql_connect()) to mysql works fine):

    "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
    resource in
    c:\Inetpub\wwwroot\php_testing_01\databases\databa ses_in_vtc_php_course\feed
    back\resultsbygenre.php on line 37"

    Every mysql function generates a "supplied argument is not a valid MySQL
    result resource" warning.

    Anybody have a clue ?

    Oeyvind


    --
    [url]http://home.online.no/~oeyvtoft/ToftWeb/[/url]




    oeyvind toft Guest

  2. Similar Questions and Discussions

    1. #39259 [NEW]: imap_delete argument is not a valid imap resource
      From: mark at runryder dot com Operating system: Linux 2.6.11.4-21.14-bigsmp PHP version: 5CVS-2006-10-25 (snap) PHP Bug Type: ...
    2. mysql_num_rows(): supplied argument is not a valid MySQL result resource
      I've got the following error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in...
    3. #24720 [Opn->Fbk]: mysql_result(): supplied argument is not a valid MySQL result resource
      ID: 24720 Updated by: sniper@php.net Reported By: adrian at smartcall dot ro -Status: Open +Status: ...
    4. #24721 [NEW]: mysql_result(): supplied argument is not a valid MySQL result resource
      From: adrian at smartcall dot ro Operating system: linux slackware PHP version: 4.3.2 PHP Bug Type: *Database Functions Bug...
    5. #24720 [NEW]: mysql_result(): supplied argument is not a valid MySQL result resource
      From: adrian at smartcall dot ro Operating system: linux slackware PHP version: 4.3.2 PHP Bug Type: *Database Functions Bug...
  3. #2

    Default Re: argument is not a valid

    You really should add the code to your post as its impossible to locate
    the problem without it. Usually its a screwy variable or a bum SQL
    statement that raises this error.
    -J

    root@seraphim.jspazi.com Guest

  4. #3

    Default Re: argument is not a valid

    I forgot to mention that the scripts that now generates warnings worked
    perfect
    in php 4. I didnt expect the scripting to be the problem.

    Here is the part of a script that doesnt work:

    $db = mysql_connect("localhost",'vinyl_user','vinyl_pass ');
    mysql_select_db("vinyldealers", $db);
    $query = "SELECT * FROM shops";
    $result = mysql_query($query);
    $table = mysql_field_table($result, 0);
    echo $table;

    This and similar mysql/php scripts generates this warning:

    "Warning: mysql_field_table(): supplied argument is not a valid MySQL result
    resource in
    c:\Inetpub\wwwroot\php_testing_01\databases\databa ses_in_vtc_php_course\feed
    back\resultsbygenre.php on line 37"

    Oeyvind

    --
    [url]http://home.online.no/~oeyvtoft/ToftWeb/[/url]



    <root@seraphim.jspazi.com> skrev i melding
    news:Pine.LNX.4.58.0407151459420.21924@seraphim.js pazi.com...
    > You really should add the code to your post as its impossible to locate
    > the problem without it. Usually its a screwy variable or a bum SQL
    > statement that raises this error.
    > -J
    >

    oeyvind toft Guest

  5. #4

    Default Re: argument is not a valid

    The error indicates your query was not successful at some point. Try
    adding in some error checking along the way to help yourself debug the
    problem. For example, try rewriting this part of the script to
    something like:

    function merror($error) {
    trigger_error($error, E_USER_WARNING);
    }

    $db = mysql_connect("localhost", "vinyl_user", "vinyl_pass");

    if (!empty($db)) {
    mysql_select_db("vinyldatabase", $db) Or
    merror(mysql_error());

    $query = "SELECT * FROM shops";
    $result = mysql_query($query);

    if (!empty($result)) {
    $table = mysql_field_table($result, 0);
    echo $table;
    }
    else {
    merror(mysql_error());
    }
    }
    else {
    merror(mysql_error());
    }

    YMMV, but you get the general idea of what this does. Basically it
    should pinpoint exactly where in your script it's flopping.

    On Thu, 15 Jul 2004 22:46:18 +0200, "oeyvind toft"
    <oeyvtoft@online.no> wrote:
    >I forgot to mention that the scripts that now generates warnings worked
    >perfect
    >in php 4. I didnt expect the scripting to be the problem.
    >
    >Here is the part of a script that doesnt work:
    >
    >$db = mysql_connect("localhost",'vinyl_user','vinyl_pass ');
    > mysql_select_db("vinyldealers", $db);
    > $query = "SELECT * FROM shops";
    > $result = mysql_query($query);
    > $table = mysql_field_table($result, 0);
    > echo $table;
    >
    >This and similar mysql/php scripts generates this warning:
    >
    >"Warning: mysql_field_table(): supplied argument is not a valid MySQL result
    >resource in
    >c:\Inetpub\wwwroot\php_testing_01\databases\datab ases_in_vtc_php_course\feed
    >back\resultsbygenre.php on line 37"
    >
    >Oeyvind
    eclipsboi Guest

  6. #5

    Default Re: argument is not a valid

    Thanks for the input eclipsboi...

    However, I`m embarassed to say that the problem was
    that I didnt set up proper grants for the users after reinstalling
    my system and mysql...

    Sorry....

    Oeyvind




    --
    [url]http://home.online.no/~oeyvtoft/ToftWeb/[/url]



    "eclipsboi" <eclipsboi@hotmail.com> skrev i melding
    news:n9sdf0lqqegim1gs5hnqc67usuro2hen4e@4ax.com...
    > The error indicates your query was not successful at some point. Try
    > adding in some error checking along the way to help yourself debug the
    > problem. For example, try rewriting this part of the script to
    > something like:
    >
    > function merror($error) {
    > trigger_error($error, E_USER_WARNING);
    > }
    >
    > $db = mysql_connect("localhost", "vinyl_user", "vinyl_pass");
    >
    > if (!empty($db)) {
    > mysql_select_db("vinyldatabase", $db) Or
    > merror(mysql_error());
    >
    > $query = "SELECT * FROM shops";
    > $result = mysql_query($query);
    >
    > if (!empty($result)) {
    > $table = mysql_field_table($result, 0);
    > echo $table;
    > }
    > else {
    > merror(mysql_error());
    > }
    > }
    > else {
    > merror(mysql_error());
    > }
    >
    > YMMV, but you get the general idea of what this does. Basically it
    > should pinpoint exactly where in your script it's flopping.
    >
    > On Thu, 15 Jul 2004 22:46:18 +0200, "oeyvind toft"
    > <oeyvtoft@online.no> wrote:
    >
    > >I forgot to mention that the scripts that now generates warnings worked
    > >perfect
    > >in php 4. I didnt expect the scripting to be the problem.
    > >
    > >Here is the part of a script that doesnt work:
    > >
    > >$db = mysql_connect("localhost",'vinyl_user','vinyl_pass ');
    > > mysql_select_db("vinyldealers", $db);
    > > $query = "SELECT * FROM shops";
    > > $result = mysql_query($query);
    > > $table = mysql_field_table($result, 0);
    > > echo $table;
    > >
    > >This and similar mysql/php scripts generates this warning:
    > >
    > >"Warning: mysql_field_table(): supplied argument is not a valid MySQL
    result
    > >resource in
    >
    >c:\Inetpub\wwwroot\php_testing_01\databases\datab ases_in_vtc_php_course\fee
    d
    > >back\resultsbygenre.php on line 37"
    > >
    > >Oeyvind
    >

    oeyvind toft Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139