Jump to content

Please help Fatal error: Function name must be a string


AEDELGOD

Recommended Posts

Fatal error: Function name must be a string in [XXX] on line 36

 

<?
include("include/session.php");
?>

<html>
<title>Dykes Publishing Group :: Data Edit</title>
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><link href="style.css" rel="stylesheet" type="text/css"></head>
<body>
<center>
<?

if(isset($_SESSION['useredit'])){
   unset($_SESSION['useredit']);
   
   echo "<h1>User Account Edit Success!</h1>";
   echo "<p><b>$session->username</b>, your account has been successfully updated. "
       ."<a href=\"index.php\">Main Page</a>.</p>";
}
else{
?>

<?

if($session->logged_in){
?>

<h1>User Account Edit : <? echo $session->username; ?></h1>
<?
if($form->num_errors > 0){
   echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
}
?>
<?php
$sql = "SELECT * FROM SR_ WHERE username = '".mysql_real_escape_string($POST['username'])."'";

$result = $msql_query($sql, $link);

$row = mysql_fetch_array($result);

?>
<tr><td> <?php $row['field_1']; ?> </td><td> <?php $row['field_2']; ?></td></tr>

<?
}
}

?>
</center>
</body>
</html>

Thanks for noticing that but that did not resolve my problem, I pasted the entire file, and it gives me the same problem, that line you pointed out was line 36 yet it still throws at me Fatal error: Function name must be a string in /xxx.php  on line 36. :\

That did something, Now I get the errors:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /***.php  on line 36

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /***.php on line 38

 

:\

Now it shows:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /***.php  on line 36

Error :

 

and it doesnt display any of my data i think the line:

$sql = "SELECT * FROM SR_ WHERE username = '".mysql_real_escape_string($POST['username'])."'";

may be wrong

 

is there another way i could approach that? I want to be able to display and edit the mysql information based on the username of the session.

Read the error -

mysql_query(): supplied argument is not a valid MySQL-Link resource

 

There is no mysql link resource (connection) in the $link variable at the time the query was executed. Either your code is not attempting to make a connection to the database server at all or it did not set the $link variable or the code that is attempting to make the connection failed. What is in the include("include/session.php"); file?

 

 

Thanks for your help, I thought I had that declared in session.php but I guess i forgot.

 

and wouldn't you mean:

$link = mysql_connect('localhost','username','password');
mysql_select_db('yourdbname',$link);

You left out a '

 

;)

 

The only problem I have now is my data wont display.

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.