Fatal error: Function name must be a string

Fatal error: Function name must be a string

am 02.01.2008 22:58:28 von Adam Williams

--------------080207040901070506050507
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I'm getting the following error and I don't see whats wrong with my
line. Any ideas?

*Fatal error*: Function name must be a string in
*/var/www/sites/intra-test/contract/perform.php* on line *57*

and my snippet of code is:

if ( $_POST["perform"] == "View Contracts" )
{

$mysqli_get_userid = "SELECT user_id from user where email =
'".$_SESSION["username"]."'";

$mysqli_get_userid_result = $mysqli_query($mysqli, // line 57
$mysqli_get_userid) or die(mysqli_error($mysqli));

while ($userid_result =
mysqli_fetch_array($mysqli_get_userid_result))
{
$user_id = $userid_result["user_id"];
}
}

--------------080207040901070506050507--

Re: Fatal error: Function name must be a string

am 02.01.2008 23:00:17 von parasane

On Jan 2, 2008 4:58 PM, Adam Williams wrote:
> I'm getting the following error and I don't see whats wrong with my
> line. Any ideas?
>
> *Fatal error*: Function name must be a string in
> */var/www/sites/intra-test/contract/perform.php* on line *57*
>
> and my snippet of code is:
>
> if ( $_POST["perform"] == "View Contracts" )
> {
>
> $mysqli_get_userid = "SELECT user_id from user where email =
> '".$_SESSION["username"]."'";
>
> $mysqli_get_userid_result = $mysqli_query($mysqli, // line 57
> $mysqli_get_userid) or die(mysqli_error($mysqli));
>
> while ($userid_result =
> mysqli_fetch_array($mysqli_get_userid_result))
> {
> $user_id = $userid_result["user_id"];
> }
> }
>

Change:

$mysqli_query($mysqli,

.... to:

mysqli_query($mysqli,

Otherwise you're declaring mysqli_query() as a variable.

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Fatal error: Function name must be a string

am 02.01.2008 23:10:48 von Tularis

Adam Williams wrote:
> I'm getting the following error and I don't see whats wrong with my
> line. Any ideas?
>
> *Fatal error*: Function name must be a string in
> */var/www/sites/intra-test/contract/perform.php* on line *57*
>
> and my snippet of code is:
>
> if ( $_POST["perform"] == "View Contracts" )
> {
>
> $mysqli_get_userid = "SELECT user_id from user where email =
> '".$_SESSION["username"]."'";
>
> $mysqli_get_userid_result = $mysqli_query($mysqli, // line 57
> $mysqli_get_userid) or die(mysqli_error($mysqli));
$mysqli_query should be mysqli_query (note: no $ ). You have an unset
value, ie. null and you can't have a function called NULL (as the value).

>
> while ($userid_result =
> mysqli_fetch_array($mysqli_get_userid_result))
> {
> $user_id = $userid_result["user_id"];
> }
> }
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php