PHP - Fatal Error: Function Name Must Be A String
Hey guys! I know there are a lot of topics about this, but mine is a bit different. I am creating my first contact form with php and I ran across this error after twinking with the php file:
Fatal error: Function name must be a string in /www/zymichost.com/m/t/l/mtlproductions/htdocs/Contact2.php on line 11 Here is what my code looks like currently: Code: [Select] <html> <body> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/header.inc.php';?> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/menu.inc.php';?> <?php if ($missing || $errors) { ?> <p class="warning">You did not enter the required information. Please try again.</p> <?php }; ?> <?php ($errors); ($missing); if ($isset($_POST['send'])) { $to = 'tate.mikey@gmail.com'; $subject = 'New Feedback Received on MikeyTateLive Productions website'; } $expected = array('name', 'email', 'comments'); $required = array('name', 'comments'); ?> <div id="wrapper"> <div id="maincontent"> <h2>I am here when you need me!</h2> <p>Enter the information below and click send. Hope to hear back from you soon. =)</p> <p>*=required</p> </div> </div> <form id="feedback" method="get" action=""> <p> <label for="name">*Name:</label></br> <input name="name" id="name" type="text" class="formbox"> </p> <p> <label for="email">Email:</label></br> <input name="email" id="email" type="text" class="formbox"> </p> <p> <label for="comments">*Comments:</label></br> <textarea name="comments" id="comments" cols="60" rows="8"></textarea> </p> <p> <input name="send" id="send" type="submit" value="Send" </p> </form> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/footer.inc.php';?> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/processmail.inc.php';?> </body> </html> I originally had lines 9 and 10 set up like this except for the php opening and closing tags, lol: Code: [Select] <?php $errors(); $missing(); ?> But as you can see on my full code at lines 9 and 10, I made a minor change to it and now the error comes from line 11 instead of 9 and 10. And now I could use some help with this..... Similar TutorialsI am having more trouble with my code, please see the error below when loading my browser: Here is my blog Fatal error: Function name must be a string in W:\www\blog\index.php on line 14 My code is: Code: [Select] <?php mysql_connect ("localhost", "root", "gwalia"); mysql_select_db("blog"); ?> <html> <head> <title>Show My Blog</title> </head> <body> Here is my blog<hr/> <?php $sql = mysql_query("SELECT * FROM blogdata ORDER BY id DESC"); While($row = mysql_fetch_array($sql)){ $title = $row('title'); $content = $row('content'); $category = $row('category'); ?> <table border='1'> <tr><td><?php echo $title; ?></td><td><?php echo $category; ?></td></tr> <tr><td colspan='2'><?php echo $content; ?></td><td></tr> </table> <?php } ?> </body> </html> Line 14 is '$title = $row('title');'. But i do not know what is wrong with my code, help please?
In PHP Version 8.0 shows error as : In previous versions of PHP it does not show any error. Please resolve the issue. Hello , I have a made a PHP website where users signup and send their Date of Birth and gets an OTP on their email after signup. The OTP is recieved but when we enter the OTP this problem occurs QuoteError! Something went wrong and I am facing this error in the error log QuotePHP Fatal error: Uncaught Error: Object of class DateTime could not be converted to string This is my config.php code <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Confirmation Page - Kanha Stories</title> <style> body { background-color: #330000; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 800 400'%3E%3Cdefs%3E%3CradialGradient id='a' cx='396' cy='281' r='514' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23D18'/%3E%3Cstop offset='1' stop-color='%23330000'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='400' y1='148' x2='400' y2='333'%3E%3Cstop offset='0' stop-color='%23FA3' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23FA3' stop-opacity='0.5'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23a)' width='800' height='400'/%3E%3Cg fill-opacity='0.4'%3E%3Ccircle fill='url(%23b)' cx='267.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='532.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='400' cy='30' r='300'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; padding: 20px; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; color:#ffffff; overflow-x: hidden; } .cont { padding: 20px 40px; position: relative; border-right: 4px solid rgb(184, 182, 182); border-bottom: 4px solid rgb(184, 182, 182); border-radius: 15px; display: flex; flex-direction: column; align-items: center; } #left{ float: left; } #right{ float: right; } input{ margin: 10px 0px; } s{ padding: 5px; } .error{ padding: 5px; color: #ffffff; } .resend{ color: rgb(14, 14, 196); padding: 5px; } .s:hover{ cursor: pointer; background-color:gray; color: rgb(243, 237, 237); border-radius: 5px; } </style> </head> <body> <?php $code=""; $err=""; $error=""; if(($_SERVER["REQUEST_METHOD"]=="GET" && $_SESSION['xyz'] === 'xyz') || isset($_POST['verify']) || isset($_POST['resend'])) { unset($_SESSION["xyz"]); if($_SERVER["REQUEST_METHOD"] ==="POST") { if(isset($_POST['verify'])) { if(empty($_POST['code'])) { $err="Enter the code!"; } else { $code=$_POST['code']; if(password_verify($code,$_SESSION['code'])) { $name=$_SESSION['name']; $email=$_SESSION['email']; $tel=$_SESSION['tel']; $dob=$_SESSION['dob']; $password=$_SESSION['password']; $age_category=$_SESSION['age_category']; require_once('./all_utils/connection.php'); $sql="INSERT INTO identity_table(name,email,password,tel,dob,age_category) VALUES ('$name','$email','".$password."','$tel','$dob','$age_category')"; if(mysqli_query($conn,$sql) === TRUE) { unset($_SESSION["name"]); unset($_SESSION["password"]); unset($_SESSION["dob"]); unset($_SESSION["tel"]); unset($_SESSION["age_category"]); header("location:welcome/welcome.php"); } else { $err="Error! Something went wrong"; } } else { $err="Incorrect code!"; } } } elseif(isset($_POST['resend'])) { require_once('./all_utils/mail.php'); $error="OTP has been sent again!"; } } } else{ header("location:signup.php"); } ?> <div class="cont"> <h2> Email Verification</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST"> <label for="verification">Enter the 5 digit code</label> <br/> <p> Didn't got the mail? Please check your spam folder </p> <input type="text" name="code" placeholder="Eg. 12345" value="<?php echo $code; ?>"> <br/> <div class="error"><?php echo $err; ?></div> <div class="resend"><?php echo $error;?></div> <input type="submit" name="resend" class="s" id="left" value="Resend OTP"> <input type="submit" name="verify" class="s" id="right" value="Verify"> </form> </div> </body> </html>
This is my signup.php code <?php session_start(); if(!empty($_SESSION['email'])) { require_once('./all_utils/connection.php'); $query="SELECT * FROM identity_table WHERE email='".$_SESSION['email']."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { header("location:welcome/welcome.php"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SignUp - Kanha Stories</title> <style> * { margin: 0; padding: 0; } body { width: 100vw; height: 100vh; display: flex; align-items: center; background-color: #ff9d00; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 1600 800'%3E%3Cg stroke='%23000' stroke-width='66.7' stroke-opacity='0' %3E%3Ccircle fill='%23ff9d00' cx='0' cy='0' r='1800'/%3E%3Ccircle fill='%23f27d00' cx='0' cy='0' r='1700'/%3E%3Ccircle fill='%23e55f00' cx='0' cy='0' r='1600'/%3E%3Ccircle fill='%23d84400' cx='0' cy='0' r='1500'/%3E%3Ccircle fill='%23cb2c00' cx='0' cy='0' r='1400'/%3E%3Ccircle fill='%23bf1600' cx='0' cy='0' r='1300'/%3E%3Ccircle fill='%23b20300' cx='0' cy='0' r='1200'/%3E%3Ccircle fill='%23a5000e' cx='0' cy='0' r='1100'/%3E%3Ccircle fill='%2398001c' cx='0' cy='0' r='1000'/%3E%3Ccircle fill='%238b0027' cx='0' cy='0' r='900'/%3E%3Ccircle fill='%237e0030' cx='0' cy='0' r='800'/%3E%3Ccircle fill='%23710037' cx='0' cy='0' r='700'/%3E%3Ccircle fill='%2364003b' cx='0' cy='0' r='600'/%3E%3Ccircle fill='%2358003c' cx='0' cy='0' r='500'/%3E%3Ccircle fill='%234b003a' cx='0' cy='0' r='400'/%3E%3Ccircle fill='%233e0037' cx='0' cy='0' r='300'/%3E%3Ccircle fill='%23310030' cx='0' cy='0' r='200'/%3E%3Ccircle fill='%23210024' cx='0' cy='0' r='100'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; overflow-x: hidden; } .cont { color: #ffffff; width: 500px; margin: auto; } h2 { color: #ffffff; text-align: center; padding: 1.5px; } .error { text-align: center; padding: 20px; font-size: 1rem; color: rgb(233, 76, 76); } form { font-size: 1.2rem; /* width: 40%; */ /* margin: auto; */ } .in{ margin: 5px 0; } input { border: 2px solid white; padding: 10px; margin: 5px 0; font-size: 1rem; width: 100%; } input:hover { border: 2px solid rgb(228, 81, 81); cursor: text; } p,a{ text-align: center; font-size: 1rem; } a{ color: deepskyblue; font-size:20px; } #s{ text-decoration:none; border-radius: 12px; } #s:hover { cursor: pointer; } a { text-decoration: none; } @media only screen and (max-width: 600px){ .cont{ width: 300px; } .error,input{ font-size: 0.8rem; } } @media only screen and (max-width: 400px){ .cont{ width: 70%; } h2{ font-size: 1.3rem; } a,p{ font-size: 0.7rem; } label{ font-size: 1.0rem; } input{ padding: 4px; } } </style> </head> <body> <?php $name=""; $email=""; $tel=""; $dob=""; $err=""; $name_err=""; $email_err=""; $tel_err=""; $dob_err=""; $password_err=""; if($_SERVER["REQUEST_METHOD"]=="POST") { if(isset($_POST['signup'])) { if(empty($_POST['name']) || empty($_POST['dob']) || empty($_POST['tel']) || empty($_POST['email']) || empty($_POST['password'])) { if(empty($_POST['name'])) { $name_err="Name is required!"; } else{ $name=$_POST['name']; } if(empty($_POST['email'])) { $email_err="Email is required!"; } else{ $email=$_POST['email']; } if(empty($_POST['tel'])) { $tel_err="Contact Number is required!"; } else{ $tel=$_POST['tel']; } if(empty($_POST['dob'])) { $dob_err="D.O.B is required!"; } else{ $dob=$_POST['dob']; } if(empty($_POST['password'])) { $password_err="Password is required!"; } } else { $today = new DateTime(date('m.d.y')); $dob = new DateTime($_POST['dob']); $diff1 = $today->diff($dob); $age = $diff1->y; if($age > 15 || $age <3) { $dob = $_POST['dob']; $dob_err = "Age criteria not satisfied , child's age must be between 3-15 years"; } else { require_once("./all_utils/connection.php"); $email=$_POST['email']; $query="SELECT * FROM identity_table WHERE email='".$email."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { $err="Email alredy registered!"; $name=$_POST['name']; $email=$_POST['email']; } else { if($age < 7) { $_SESSION['age_category'] = '1'; } else { $_SESSION['age_category'] = '2'; } $_SESSION['name']=$_POST['name']; $_SESSION['email']=$_POST['email']; $_SESSION['password'] = password_hash($_POST['password'],PASSWORD_DEFAULT); $_SESSION['tel']=$_POST['tel']; $_SESSION['dob']=$_POST['dob']; $_SESSION['xyz']='xyz'; require_once("all_utils/mail.php"); header("location:conf.php"); } } } } } ?> <div class="cont"> <h2>SignUp - Kanha Stories</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'])?>" method="POST"> <span class="error"><?php echo $err; ?></span> <br/> <label for="name">Name</label><br /> <input type="text" name="name" placeholder="Enter your name" value="<?php echo $name; ?>"> <span class="error"><?php echo $name_err; ?></span> <br/> <label for="email">Email</label><br /> <input type="email" name="email" placeholder="Enter your Email ID" value="<?php echo $email; ?>"> <span class="error"><?php echo $email_err;?></span> <br/> <label for="tel">Mobile Number</label><br /> <input type="tel" name="tel" placeholder="Enter Mobile Number" value="<?php echo $tel; ?>"> <span class="error"><?php echo $tel_err;?></span> <br/> <label for="date">D.O.B. of Child (Click on Calander icon)</label><br /> <input type="date" name="dob" placeholder="Enter date of birth " value="<?php echo $dob;?>"> <span class="error"><?php echo $dob_err;?></span> <br/> <label for="password">Password</label><br /> <input type="password" name="password" placeholder="Enter your Password"> <span class="error"><?php echo $password_err; ?></span> <br/> <div class="sub"> <input type="submit" name="signup" id="s" placeholder="Submit"><br /> </div> </form> <p>Already registered? <a href="./login.php">log in here</a></p> </div> </body> </html>
I don't know what I can do now , Please try to give me the solutions as soon as possible. Thanks Hi, when I run my script I get the following error message. These are array variables I am passing into the playerAttack function. I can't figure out what is wrong it looks fine to me. Any help greatly appreciated. Thanks. Derek Code: [Select] attack posted Fatal error: Cannot use string offset as an array in C:\wamp\www\SUN_DRAGON_GAME\gamestart.php on line 202 Code: [Select] $currentMonster='octalisk'; ///////////////////////////////////////////////////////////battle//////////////////////////// //function monsterEncounter($echoMonster,$monsterImage) if(!empty($_POST['attack'])) { echo "attack posted"; playerAttack($currentMonster,$player['stats']['playerHitRollLow'],$player['stats']['playerHitRollHigh'], $player['stats']['playerDmgLow'],$player['stats']['playerDmgHigh'],$monsters['Ocean']['octalisk']['defense'],$monster['Ocean']['octalisk']['hp'],$player['faction']['Teardrop_Ocean_Protectors']); $doesItAttack=encounter($monsters['ocean']['octalisk']['seeInvis'],$monsters['ocean']['octalisk']['aggro'],$player['factions']['Teardrop_Ocean_Protectors']); //insert octalisk stats into monsterattack function. if($doesItAttack =='yes') { monsterAttack($currentMonster,$monsters['Ocean']['octalisk']['hitRollLow'],$monsters['Ocean']['octalisk']['hitRollHigh'] , $monsters['Ocean']['octalisk']['dmgLow'],$monsters['Ocean']['octalisk']['dmgHigh'], $player['stats']['playerDefense'],$player['stats']['playerHp'],$monsters['Ocean']['octalisk']['hp']); } else { echo "do nothing"; } } here is the attack function Code: [Select] function playerAttack($currentMonster,$hitRollLow,$hitRollHigh,$dmgLow,$dmgHigh,$monsterDefense, $monsterHp,$playerFaction) { echo "in player attack"; $playerRoll= rand($playerHitRollLow, $playerHitRollHigh); if($playerHitRoll>=$monsterDefense) { global $theMessage; //shit had to make it global $playerDamage= rand($playerDmgLow,$playerDmgHigh); $theMessage = "You have hit a ". $currentMonster." for "."<strong>". $playerDamage."</strong> points of damage!"; $monsterHp= $monsterHp- $playerDamage; $theMessage.=" The ".$currentMonster."'s hp is now ".$monsterHp; if($monsterHp<=0) { if($playerFaction<=0) { $theMessage="Your faction standing with ".$playerFaction. "could not possibly get any worse."; } } $theMessage.=" You have killed the ".$currentMonster. "Your faction standing with ".$playerFaction." is now ".$playerFaction-1; } else { global $theMessage; //WTF i dont know what im doing. $theMessage= " Whoa! You missed the ".$currentMonster; } } Can anyone help me with this error? Fatal error: Call to a member function require_login() on a non-object in /home/wallls/public_html/index.php on line 27 Lines 26-33 below: <?php $smilek = $_GET['id']; $ppalout = $_GET['payout']; $healthy = array("%", "!", "=", "'", ",", "OR", "?", "<", "&", ";"); $yummy = array("", "", "", "", "" ,"", "", "", "", ""); $peee = str_replace($healthy, $yummy, $smilek); $chnpay = str_replace($healthy, $yummy, $ppalout); require_once 'appinclude.php'; require_once 'mystyle.php'; echo '<div align="center"><img src="'.$appcallbackurl.'main.png" width="300" height="150"></div>'; require_once 'ads/topads.php'; ?> <fb:tabs> <fb:tab-item href='<? echo $appCanvasUrl; ?>' title='Lottery' selected='true' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>earn.php' title='Get Tickets' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>payment.php' title='Payment Info' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>history.php' title='Lottery History' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>forum.php' title='Forum' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>invite.php' title='Invite Friends' /> </fb:tabs> <div align="center"> <? $fbid = $facebook->require_login(); $theirip = $_SERVER['REMOTE_ADDR']; if ($fbid == "") { ?>
Hello everyone Hi there, I have a local server set up on my computer which I have used before and it worked flawlessly. It is running apache with PHPand mySQL set up as services. Recently I attempted to copy a project I have worked on at school onto my server. I have the database up and running, however when I try to run a PHP file it gives me the error: Quote Fatal error: Cannot redeclare getText() in C:\Server\htdocs\projects\tournament\includes\functions.php on line 20 When I rename that function (which I know is not being redeclared) I get a browser error: Quote This webpage is not available. The webpage at http://localhost/projects/tournament/index.php might be temporarily down or it may have moved permanently to a new web address. More information on this error Below is the original error message Error 101 (net::ERR_CONNECTION_RESET): Unknown error. Has anybody else experienced this error and have a solution to fix it? My guess is that it has to do with the function gettext() being available on this machine but not on the machine at school, however I thought PHP was case sensitive? I have the following script: <?php $tijd[] = '2012-05-23T02:00:00'; $date = new DateTime($tijd[0]); echo $date; ?> However it is not working and resulting in: Quote Catchable fatal error: Object of class DateTime could not be converted to string in time3.php on line 7 I think to solve this issue, I have to convert $tijd[0] into a string. Right? If this is correct, how do I do that? Hi everyone, I get this error: Catchable fatal error: Object of class Category could not be converted to string The code: public static function list_all_cat_names() { $result_array = self::find_by_sql("SELECT name FROM ".self::$table_name); return !empty($result_array) ? array_shift($result_array) : false; } $categories = Category::find_all(); foreach ($categories as $cats): echo $cats; endforeach; Where could be the problem? I'm getting this error for a blog script that is on my site :- PHP Fatal error: Uncaught TypeError: Unsupported operand types: string - int
The line in questions is this :- $prev = $page - 1; If I comment out this block of code the blog appears (with other errors, but I'll move on to those if I can fix this first!).
/* Setup page vars for display. */
Any idea's on what's needed to fix this script? I've contacted the original author but they haven't got back to me, I guess PHP8 maybe a little too new for them. Thanks for any help....
Here is the code: // Count files function filecount($FolderPath) { $filescount = 0; // Open the directory $dir = opendir($FolderPath); // if the directory doesn't exist return 0 if (!$dir){return 0;} // Read the directory and get the files while (($file = readdir($dir)) !== false) { if ($file[0] == '.'){ continue; } //if '.' it is a sub folder and call the function recursively if (is_dir($FolderPath.$file)){ // Call the function if it is a folder type $filescount += filecount($FolderPath.$file.DIRECTORY_SEPARATOR); } else { // Increment the File Count. $filescount++; } } // close the directory closedir($dir); return $filescount; } function getfilenames($location) { // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($location); // open directory and walk through the filenames while ($file = readdir($handler)) { // if file isn't this directory or its parent, add it to the results if ($file != "." && $file != "..") { $results[] = $file; } } // tidy up: close the handler closedir($handler); // done! return $results; } function readfile($file) { $fh = fopen('./Data/' . $file, 'r'); $data = fread($fh, filesize($file)); fclose($fh); return $data; } Now, when I try to get the text from a textfile via the function readfile I get this error: Quote Fatal error: Cannot redeclare readfile() in ***Path\FileManagement.php on line 62 Whats wrong? Regards Worqy I am trying to create a class and I ran into a problem. The connect function is returning a fatal error on the line below and I can't figure out the issue. $result = $this->conn->query("SELECT unit FROM address");
class database { private $server = "localhost"; private $db_user = "my user"; private $db_pass = "my pass"; private $db_name = "my database"; private $conn; private $result = array(); function connect(){ // Create connection $this->conn = new mysqli($this->server, $this->db_user, $this->db_pass, $this->db_name); if ($this->conn->connect_error) { echo "Not connected, error: " . $mysqli_connection->connect_error; } else { //echo "Connected."; return $this->conn; } public function displayHeader(){ $result = $this->conn->query("SELECT unit FROM address"); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo '<li>' . $row["unit"] . '</li>'; } } else { echo "0 results"; } $conn->close(); } } }
Something strange is happning, line producing the error: if( ($this->subject == "") || ($this->message == "") ){ Any ideas guys? thanks lots!! Hi guys. I need some help, because i'm stuck I'm getting this error and cand figure out what im doin wrong. Fatal error: Call to a member function fetch_array() on a non-object in C:\xampp\htdocs\cms\webklex\theme\admin\edit_content.php on line 16. The Code around it: Code: [Select] include "../config/config.php"; $host = htmlspecialchars($_SERVER["HTTP_HOST"]); $uri = rtrim(dirname(htmlspecialchars($_SERVER["PHP_SELF"])), "/\\"); $extra = "show_content.php"; if (empty($_POST["titel"])) { $id = (isset($_GET["id"])) ? (int)$_GET["id"] : false; $result = $db->query("SELECT * FROM `content` WHERE `id` = ".$db->real_escape_string($id).""); $row = $result->fetch_array(MYSQLI_ASSOC); $db->free_result; unset($result); } $ide = (isset($_GET["id"])) ? (int)$_GET["id"] : false; $result = $db->query("SELECT `id_position` FROM `content` WHERE `id` = ".$db->real_escape_string($ide).""); $zeile = $result->fetch_array(MYSQLI_ASSOC); ---->This is line 16 $db->free_result; unset($result); $id_position_real = $zeile['id_position']; if ($id_position_real == 1) { $id_position_real = 1; }else{ $id_position_real= 0; } if ($id_position_real == 1) { $id_position_real_none = 0; }else{ $id_position_real_none = 1; } ?> thanks ThatMSG Hello, i use MySQL with PHP. My php version is 5.2.0. After i connect to the db i use mysql_set_charset in order to change the system variables (character_set_client , character_set_results ,character_set_connection). i do: Code: [Select] if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); mysql_set_charset('utf8',$$link); } else { $$link = mysql_connect($server, $username, $password); mysql_set_charset('utf8',$$link); } I take the error: Fatal error: Call to undefined function mysql_set_charset(). In the manual page for mysql_set_character says: 1."(PHP 5 >= 5.2.3)" --> that means that i have an old php version?? 2."Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended. " What shall i do in order to solve my problem?? thanks, in advance! Fatal error: Call to a member function qstr() on a non-object in C:\xampp\htdocs\ipod\functions.php on line 14 <?php require_once('config.php'); function checkwork() { header("location: underwork.php"); echo 'Sorry we are under going work :('; } function get_username ( $id ) { global $db; $query = "SELECT `login` FROM `" . DBPREFIX . "members` WHERE `member_id` = " . $db->qstr ( $id ); if ( $db->RecordCount ( $query ) == 1 ) { $row = $db->getRow ( $query ); return $row->login; } else { return FALSE; } } ?> this being line 14 $query = "SELECT `login` FROM `" . DBPREFIX . "members` WHERE `member_id` = " . $db->qstr ( $id ); MySQL Client Version: 5.1.50-community PHP Version: 5.3.5 Apache Version: 2.2.17 Okay, I am trying to get MySQL to cooperate with PHP. All of my attempts have been unsuccessful. Before you post a reply, please note I have taken these steps before I posted this topic: 1. My libmySQL.dll is in both my php and C:\Windows folder 2a. (Mental note: my installation directory is C:\Program Files\Apache 2.2\php\ext) 2b. The extension_dir in my php.ini file is as follows: Code: [Select] extension_dir = "C:\Program Files\Apache 2.2\php\ext"3. The php.ini file is also in the C:\Windows folder. 4. The extensions that are enabled for php are as follows: Code: [Select] [PHP_MYSQL] extension=php_mysql.dll [PHP_MYSQLI] extension=php_mysqli.dll [PHP_PDO_MYSQL] extension=php_pdo_mysql.dll5. Any section referencing to MySQL in my php info is not showing up. 6. I have tried replacing my php_mysql.dll, didn't work either. Okay, so when I try to install my forums for my website, it returns with this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache 2.2\htdocs\forum\upload\includes\class_core.php on line 312 Please notify me of anything that has or will work(ed). I am using tidy_repair_string() function as part of a string filter, the except is below.
/* Tell Tidy to produce XHTML */ $xhtml = tidy_repair_string($html, array('output-xhtml' => true));I am getting a fatal error thrown up as below. I thought tidy_repair_string() is an inbuilt PHP function or is it not? Fatal error: Call to undefined function tidy_repair_string() in C:\wamp\www\APPLICATION-FOLDER\contituency-manager\filter.php on line 14 Im taking my on-the-job. Code: [Select] <?php $zip = zip_open("zip.zip"); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen("zip/".zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } ?> my supervisor said that i have a library to add.. im searching on it but i cant find anything.. help pls.. i run this on linux. After I did enable the following error reporting: Code: [Select] Default Value: E_ALL & ~E_NOTICE I am getting the error message described in the title of this thread. I do have the php_mysqli.dll extension enabled as well - AND the function used to work as is, before I changed the error reporting, thus the function actually should be defined, what could be another reason, that PHP thinks it is not a defined function? |