开发者

Warning: mysql_query() expects parameter 1 to be string,

I get this

*Warning: mysql_query() expects parameter 1 to be string*

when I am trying to run this query in my PHP-code and I don't un开发者_开发知识库derstand why.

The query runs when entered from the commandline, but I cant get it to run in PHP. Could someone please help me with this?

$pickass = mysql_query("SELECT MAX(aid) FROM asset");
$pickassssult = mysql_query($pickass);

Thanks.


Why exactly are you running two mysql_query() statements on one another?

You should simply need to do something like this:

<?php
    // Set up connection parameters (mysql_connect() for example)

    $query = "SELECT MAX(aid) FROM asset";
    $result = mysql_query($query);

    // mysql_fetch_array() etc etc...
?>

Hope that helps.


$pickass = "SELECT MAX(aid) FROM asset" ;
$pickassssult = mysql_query($pickass) ;


Well you're running "mysql_query", putting the result in $pickass, and then run mysql_query again on the resultset. Mysql_query (in the second line) wants a string, not a resultset. Don't you mean to do a fetch there?


I think you would want to do something like that

$pickass = mysql_query("SELECT MAX(aid) FROM asset");
$pickassssult=mysql_result($pickass, 0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜