Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 114/1273 | < Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >

  • accessing private variable from member function in PHP

    - by Carson Myers
    I have derived a class from Exception, basically like so: class MyException extends Exception { private $_type; public function type() { return $this->_type; //line 74 } public function __toString() { include "sometemplate.php"; return ""; } } Then, I derived from MyException like so: class SpecialException extends MyException { private $_type = "superspecial"; } If I throw new SpecialException("bla") from a function, catch it, and go echo $e, then the __toString function should load a template, display that, and then not actually return anything to echo. This is basically what's in the template file <div class="<?php echo $this->type(); ?>class"> <p> <?php echo $this->message; ?> </p> </div> in my mind, this should definitely work. However, I get the following error when an exception is thrown and I try to display it: Fatal error: Cannot access private property SpecialException::$_type in C:\path\to\exceptions.php on line 74 Can anyone explain why I am breaking the rules here? Am I doing something horribly witty with this code? Is there a much more idiomatic way to handle this situation? The point of the $_type variable is (as shown) that I want a different div class to be used depending on the type of exception caught.

    Read the article

  • Problem with thumbnails after newly added - PHP on-the-fly method

    - by Wayne
    Hey again... to those that may have read my previous question that got solved a couple minutes ago .< The on-the-fly php script works perfectly, but when I went to upload new images into a gallery which I made myself, the images are resized to 150 x 150 for what I wanted... however, when it comes to new images being added it is all black... As you can see the three black images that were uploaded to the folder and the directory added to the database. What is causing this? If I view the source, the code is fine... the while loop in the PHP generates an output like this: <div class="view-wrap" id="photo-10"> <div class="view-icon"> <div class="img-label"> <a href="#" id="10" class="delete"><img src="img/small-delete.png" /> Delete</a> </div> <a href="img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg"> <img src="image.php?dir=img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg" alt="" width="110" height="110" /> </a> </div> </div> An example of one block. If I view the source (in Firefox) and click on the image.php?dir=img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg by exmaple, I can see the thumbnail at it's 150 x 150 size but in the layout, it shows a black thumbnail... Does anyone know why this is happening?

    Read the article

  • Image generated with PHP dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • php, image dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • Creating an HTML file by combining multiple PHP files via the command line?

    - by FishOrDie
    Is it possible to combine multiple PHP files via the command line and create an HTML file? For example, this will save the rendered version of a single PHP file as HTML: php /path/to/my/file/filename.php > /path/to/my/file/test.html I need it to combine multiple files, but I can't seem to get it it to work. Ideally, it would be something like this: php /path/to/my/file/filename.php + /path/to/my/file/filename2.php + /path/to/my/file/filename3.php > /path/to/my/file/test.html Is this possible? If so, how?

    Read the article

  • PHP GET issue - it aint workin!

    - by benhowdle89
    I have a simple PHP form which displays inputs with values from a mysql DB and send the form results to another page which updates a db table based on the GET results: echo "<form method='get' action='updateprojects.php'>"; echo "<table>"; echo "<tr>"; echo " <th>Project No</th> <th>Customer Name</th> <th>Description</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><input value=" . $row['project_no'] . "></input></td>"; echo "<td><input value='" . $row['cust_name'] . "'></input></td>"; echo "<td><input value='" . $row['description'] . "'></input></td>"; echo "</tr>"; } echo "</table>"; echo "<input type='submit' value='Update' />"; echo "</form>"; on updateprojects.php i have set up the GET variable and even echoed them to check but nothing comes through! Cannot see why!? This is the start of updateprojects.php: echo $_GET['project_no'].$_GET['cust_name'].$_GET['description'];

    Read the article

  • Any PHP MVC framework planning to use 5.3 features?

    - by alexandrul
    I would like to get started with PHP, and 5.3 release seems to bring many nice features (namespaces, lambda functions, and many others). I have found some MVC frameworks, and some of them support only PHP 5: PHP Frameworks PHP MVC Frameworks Model–view–controller on Wikipedia but can anyone recommend one of those MVC frameworks that plans to actively use PHP 5.3 features, not just being compatible with PHP 5.3? Update Results so far: Zend Framework 2.0 (in development) Lithium (in development, based on CakePHP) Symfony (in development) FLOW3 (in development, alpha)

    Read the article

  • List of Big-O for PHP functions?

    - by Kendall Hopkins
    After using PHP for a while now, I've noticed that not all PHP built in functions as fast as expected. Consider the below two possible implementations of a function that finds if a number is prime using a cached array of primes. //very slow for large $prime_array $prime_array = array( 2, 3, 5, 7, 11, 13, .... 104729, ... ); $result_array = array(); foreach( $array_of_number => $number ) { $result_array[$number] = in_array( $number, $large_prime_array ); } //still decent performance for large $prime_array $prime_array => array( 2 => NULL, 3 => NULL, 5 => NULL, 7 => NULL, 11 => NULL, 13 => NULL, .... 104729 => NULL, ... ); foreach( $array_of_number => $number ) { $result_array[$number] = array_key_exists( $number, $large_prime_array ); } This is because in_array is implemented with a linear search O(n) which will linearly slow down as $prime_array grows. Where the array_key_exists function is implemented with a hash lookup O(1) which will not slow down unless the hash table gets extremely populated (in which case it's only O(logn)). So far I've had to discover the big-O's via trial and error, and occasionally looking at the source code. Now for the question... I was wondering if there was a list of the theoretical (or practical) big O times for all* the PHP built in functions. *or at least the interesting ones For example find it very hard to predict what the big O of functions listed because the possible implementation depends on unknown core data structures of PHP: array_merge, array_merge_recursive, array_reverse, array_intersect, array_combine, str_replace (with array inputs), etc.

    Read the article

  • PHP - How can I check if return() was called from an include()'d file?

    - by John Himmelman
    How can I tell if return() was called from within the included file. The problem is that include() returns 'int 1', even if return() wasn't called. Here is an example... included_file_1.php <?php return 1; included_file_2.php <?php echo 'no return here, meep'; main.php <?php $ret = include('included_file_1.php'); // This file DID return a value, int 1, but include() returns this value even if return() wasn't called in the included file. if ($ret === 1) { echo 'file did not return anything'; } var_dump($ret); $ret = include('included_file_2.php'); // The included file DID NOT return a value, but include() returns 'int 1' if ($ret === 1) { echo 'file did not return anything'; } var_dump($ret);

    Read the article

  • PHP IIS problems downloading file says it is corrupt

    - by Matt
    Hi, I am running PHP on IIS 6 with mssql. I have uploaded a file to my webserver through a php script. Upon checking the file on the server the file is ok and not corrupt. However, when i then have a link on my website to try and download the file, it says the file is corrupt. I know the file isnt corrupt as i can view it perfectly if i look at the file on the server. Is seems like this is a common problem as a similar problem was posted here: http://www.bigresource.com/Tracker/Track-php-1pAakBhT/ Any help would be much appreciated. Thanks, M My download code is as follows: $filesize = $rows->filesize; $filepath = $rows->filepath; header("Content-Disposition: attachment; filename=$filename"); header("Content-length: $filesize"); header("Content-type: application/pdf"); header("Cache-control: must-revalidate"); header("Content-Description: PHP Generated Data"); readfile($filepath);

    Read the article

  • Adding with PHP to a MySQL database

    - by shinjuo
    I am pretty new to PHP and I am trying to make an inventory database. I have been trying to make it so that a user can enter a card ID and then amount the want to add to the inventory and have it update the inventory. For example someone could type in test and 2342 and it would update test. Here is what I have been trying with no success: add.html <body> <form action="add.php" method="post"> Card ID: <input type="text" name="CardID" /> Amount to Add: <input type="text" name="Add" /> <input type="submit" /> </form> </body> </html> add.php <?php $link = mysql_connect('tulsadir.ipowermysql.com', 'cbouwkamp', '!starman1'); if (!$link){ die('Could not connect: ' . mysql_error()); } mysql_select_db("tdm_inventory", $link); $add = $_POST[Add] mysql_query("UPDATE cardLists SET AmountLeft = '$add' WHERE cardID = 'Test'"); echo "test successful"; mysql_close($link); ?>

    Read the article

  • Unzip .zip file uploaded from Android via PHP to IIS 7

    - by HaOx
    I'm sending compressed file in .zip extension from Android via PHP to IIS server. Almost is working everything, but I cannot achieve unzip files with php. I've this code: <?php $target_path1 = "C:/Windows/Temp/"; $target_path1 = $target_path1 . basename( $_FILES['uploaded_file']['name']); /* I'm making the folder */ $directorio = substr($target_path1, 0, 32); if (!is_dir($directorio)) { mkdir($directorio); } /* I declare a path */ $barra = "/"; $target_path1 = $directorio . $barra . basename( $_FILES['uploaded_file']['name']); $target_path2 = $directorio . $barra; if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path1)) { /* Here I want to unzip the uploaded file */ } else{ echo "There was an error uploading the file, please try again!"; echo "filename: " . basename( $_FILES['uploaded_file']['name']); echo "target_path: " .$target_path1; } ?> So, how can I unzip uploaded file? I tried so many methods but no one worked. I'd be appreciated if someone could tell what I have to do to unzip the uploaded file. And if I have to configure some parameters in php.ini or IIS server. Thanks in advance.

    Read the article

  • php script randomly hangs up

    - by sergdev
    I install php 5 (more precisely 5.3.1) as apache module. After this one of my application becomes randomly hang up on mysql_connect - sometimes works, sometimes no, sometimes reload of page helps. How can this be fixed? I use Windows Vista, Apache/2.2.14 (Win32) PHP/5.3.1 with php module, MySql 5.0.67-community-nt. After a minute I obtain the error message: Fatal error: Maximum execution time of 60 seconds exceeded in path\to\mysqlcon.php on line 9 I run MySql locally and heavy load could not be a reason: SHOW PROCESSLIST shows about 3 process SHOW VARIABLES LIKE 'MAX_CONNECTIONS' is 100. UPDATE: At first I thought that this is connected with mysql_connect. But now I can't say for certain. More difficult thing is when I insert the line to debug: $fh = fopen("E://_debugLog", 'a'); fwrite($fh, __FILE__ . " : " . __LINE__ . "\n"); fclose($fh); script start working near that location as a rule.

    Read the article

  • PHP class to C# class?

    - by LordSauron
    I work for a company that makes application's in C#. recently we got a customer asking us to look in to rebuilding an application written in PHP. This application receives GPS data from car mounted boxes and processes that into workable information. The manufacturer for the GPS device has a PHP class that parses the received information and extracts coordinates. We were looking in to rewriting the PHP class to a C# class so we can use it and adapt it. And here it comes, on the manufacturers website there is a singel line of text that got my skin krawling: "The encoding format and contents of the transmitted data are subject to constant changes. This is caused by implementations of additional features by new module firmware versions which makes it virtually impossible to document it and for you to properly decode it yourself." So i am now looking for a option to use the "constantly changing" PHP class and access it in C#. Some thing link a shell only exposing some function's i need. Except i have no idea how i can do this. Can any one help me find a solution for this.

    Read the article

  • how to pass session_id() throught out the php pages?

    - by Piyush
    when user clicks on login button(index.php) I am calling chechlogin.php where I am checking loginId an password as- if($count==1) { // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); $_SESSION['UserId'] = $myusername; $_session['SessionId'] = session_id(); header("location:LoggedUser.php"); } in LiggedUser.php <?php session_start(); //starting session if (!isset($_SESSION['SessionId']) || $_SESSION['SessionId'] == '') { header("location:index.php"); } ? Problem: It is always going back to index.php page although I am entering right userid and password.I think session_id() is not working properly or ??

    Read the article

  • Connection to mysql works through php but not through a form submission?

    - by Legend
    I have a download.php file that connects to a remote mysql database. If I run it using php download.php it works fine. But if I create another php file form.php and then submit the form to this download.php, it complains the following: Can't connect to MySQL server on '<IP_ADDRESS>' (13) Does anyone know why this might be happening? I can't see a reason why this works directly but fails to work upon form submission...

    Read the article

  • php lampp permissions of fopen function

    - by marmoushismail
    hi i'm programming php using: netbeans 6.8 lampp for ubuntu (xampp) apache which came with xampp $fh = fopen("testfile2.txt", 'w') or die("Failed to create file"); $text ="hello man cool good"; fwrite($fh, $text) or die("Could not write to file"); fclose($fh); echo "File 'testfile.txt' written successfully"; //i get the next error: Warning: fopen(testfile2.txt) [function.fopen]: failed to open stream: Permission denied in /home/marmoush/allprojects/phpprojects/myindex.php on line 91 Failed to create file anyway i know what this error is; it's about folder and files permissions; i looked into the folder permission tab made access available for "others" group ( to read and write) the program worked result was a file (test.txt) so i looked at the created file permission it appears to be that (php , xampp or whoever) creates file with (nobody permission) I have 2 QUESTIONS: 1- what if i need the file created by (php code and xampp ) to have the "root or user or myname" permissions ?? where to set this setting 2-also my concern (what if i send this files to actual web server will it make nobody permissions also nobody ? when they create files

    Read the article

  • PHP Foreach statement issue. Multiple rows are returned

    - by Daniel Patilea
    I'm a PHP beginner and lately i've been having a problem with my source code. Here it is: <html> <head> <title> Bot </title> <link type="text/css" rel="stylesheet" href="main.css" /> </head> <body> <form action="bot.php "method="post"> <lable>You:<input type="text" name="intrebare"></lable> <input type="submit" name="introdu" value="Send"> </form> </body> </html> <?php //error_reporting(E_ALL & ~E_NOTICE); mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("robo") or die(mysql_error()); $intrebare=$_POST['intrebare']; $query = "SELECT * FROM dialog where intrebare like '%$intrebare%'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); ?> <div id="history"> <?php foreach($row as $rows){ echo "<b>The robot says: </b><br />"; echo $row['raspuns']; } ?> </div> It returns me the result x6 times. This problem appeared when I've made that foreach because I wanted the results to stuck on the page one by one after every sql querry. Can you please tell me what seems to be the problem? Thanks!

    Read the article

  • Upload to a PHP Server, using Ajax ( XMLHttp POST)

    - by Krishnanunni
    Right now i'm using the below method to Upload a file to PHP <form enctype="multipart/form-data" action="http://sserver.com/fileupload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="30000000" /> <input type="hidden" name="filename" value="file_uploaded.gif" /> <input type="hidden" name="username" value="foobar"/> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> I read the $_POST and $_FILE in php to complete upload like this. $target = $_SERVER['DOCUMENT_ROOT']."/test/upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; echo $target; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } My questions is , can i change the above said code (HTML) to an Ajax XMLHttpRequest without changes in PHP.

    Read the article

  • using a href (html)tag along with PHP

    - by dexter
    i have tried: <?php include("delete.php") ?> <?php .... .... .... if($result=mysql_query($sql)) { echo "<table><th>Id</th><th>Name</th><th>Description</th><th>Unit Price</th>"; while($row = mysql_fetch_array($result)) { echo "<tr><td>".$row['Id']."</td><td>".$row['Name']."</td><td>".$row['Description']."</td><td>".$row['UnitPrice']."</td> <td><a href='delproduct($row[Id])' onclick = 'return MsgOkCancel()'>Delete</a></td></tr>"; echo "<br/>"; } } ?> following javascript is in the same page: <script type="text/javascript" language="javascript"> function MsgOkCancel() { if (confirm("Are You Sure You Want to Delete?")) { return true } else {return false} } </script> where delproduct is a javascript function in delete.php written like: <script type="javascript"> function delproduct(Id) { alert('Id '+ Id); } <script> ** after ** clicking Delete a okcancel message-box appear asking conformation ** but ** after clicking 'ok' it should execute statements inside delproduct function but it doesn't it gives error like: Object Not Found :The requested URL was not found on this server. what would be the problem? pls help, thanks

    Read the article

  • Write to PDF using PHP from android device

    - by Brent Mitchell
    I am trying to write to a pdf file on php server. I have sent variables to the server, create the pdf document, then have my phone download the document to view on device. The variables seem not to write on the php file. I have my code below public void postData() { try { Calculate calc = new Calculate(); HttpClient mClient = new DefaultHttpClient(); StringBuilder sb=new StringBuilder("myurl.com/pdf.php"); HttpPost mpost = new HttpPost(sb.toString()); String value = "1234"; List nameValuepairs = new ArrayList(1); nameValuepairs.add(new BasicNameValuePair("id",value)); mpost.setEntity(new UrlEncodedFormEntity(nameValuepairs)); } catch (UnsupportedEncodingException e) { Log.w(" error ", e.toString()); } catch (Exception e) { Log.w(" error ", e.toString()); } } And my php code to write the variable "value" onto the pdf document: //code to reverse the string if($_POST[] != null) { $reversed = strrev($_POST["value"]); $this->SetFont('Arial','u',50); $this->Text(52,68,$reversed); } I am just trying to write the variable in a random spot, but the variable the if statement is always null and I do not know why. Thanks. Sorry if it is a little sloppy.

    Read the article

  • Increasing understanding of validating a string with PHP string functions

    - by user1554264
    I've just started attempts to validate data in PHP and I'm trying to understand this concept better. I was expecting the string passed as an argument to the $data parameter for the test_input() function to be formatted by the following PHP functions. trim() to remove white space from the end of the string stripslashes() to return a string with backslashes stripped off htmlspecialchars() to convert special characters to HTML entities The issue is that the string that I am echoing at the end of the function is not being formatted in the way I desire at all. In fact it looks exactly the same when I run this code on my server - no white space removed, the backslash is not stripped and no special characters converted to HTML entities. My question is have I gone about this in the wrong approach? Should I be creating the variable called $santised_input on 3 separate lines with each of the functions trim(), stripslashes() and htmlspecialchars()? By my understanding surely I am overwriting the value of the $santised_input variable each time I recreate it on a new line of code. Therefore the trim() and stripslashes() string functions will never be executed. What I am trying to achieve is using the "$santised_input" variable to run all of these PHP string functions when the $data argument is passed to my test_input() function. In other words can these string functions be chained together so that I only need to create $santised_input once? <?php function test_input($data) { $santised_input = trim($data); $santised_input = stripslashes($data); $santised_input = htmlspecialchars($data); echo $santised_input; } test_input("%22%3E%3Cscript%3Ealert('hacked')%3C/script%3E\ "); //Does not output desired result "&quot;&gt;&lt;script&gt;alert('hacked')&lt;/script&gt;" ?>

    Read the article

  • Why is my php script freezing?

    - by William
    What is causing my php code to freeze? I know it's cause of the while loop, but I have $max_threads--; at the end so it shouldn't do that. <html> <head> <?php $db = mysql_connect("host","name","pass") or die("Can't connect to host"); mysql_select_db("dbname",$db) or die("Can't connect to DB"); $sql_result = mysql_query("SELECT MAX(Thread) FROM test_posts", $db); $rs = mysql_fetch_row($sql_result); $max_threads = $rs[0]; $board = $_GET['board']; ?> </head> <body> <?php While($max_threads >= 0) { $sql_result = mysql_query("SELECT MIN(ID) FROM test_posts WHERE Thread=".$max_threads."", $db); $rs = mysql_fetch_row($sql_result); $sql_result = mysql_query("SELECT post FROM test_posts WHERE ID=".$rs[0]."", $db); $post = mysql_fetch_row($sql_result); $sql_result = mysql_query("SELECT name FROM test_posts WHERE ID=".$rs[0]."", $db); $name = mysql_fetch_row($sql_result); $sql_result = mysql_query("SELECT trip FROM test_posts WHERE ID=".$rs[0]."", $db); $trip = mysql_fetch_row($sql_result); if(!empty($post)) echo'<div class="postbox"><h4>'.$name[0].'['.$trip[0].']</h4><hr />' . $post[0] . '<br /><hr />[<a href="http://prime.programming-designs.com/test_forum/viewthread.php?thread='.$max_threads.'">Reply</a>]</div>'; $max_threads--; } ?> </body> </html>

    Read the article

  • Redirecting Pages with PHP causing problems

    - by psp
    I have a page which has a link to a php page which takes data from $_GET and updates a database. After that it returns the user to the homepage with: header("Location: http://localhost/"); The thing is that this seems to "interrupt" the mysql part of the code. If I remove this redirect, everything in the database is updated, but when I put it back, nothing gets updated... This is the database update code, I am using a class of mine as a mysql wrapper: $conn->where('hash',$data1['hash']); $conn->update(TABLE_ITEMS,$newData1); $conn->where('hash',$data2['hash']); $conn->update(TABLE_ITEMS,$newData2); Notes: -There is no text or echo()'s on the page and no space before the <?php tag Order of Code: Data received from $_SESSION and $_GET Data processed and placed into arrays Data placed into mysql database header(); used to redirect page Code <?php require_once('config.php'); import(); if ( isset ( $_GET['g'] ) && isset ( $_SESSION['itemA'] ) && isset ( $_SESSION['itemB'] ) ) { $itemA = $_SESSION['gameA']; $itemB = $_SESSION['gameB']; $newData1 = processData($itemA); $newData2 = processData($itemB); $conn->update(TABLE_ITEMS,$newData1); $conn->update(TABLE_ITEMS,$newData2); header('Location: http://localhost/'); } else { header('Location: http://localhost/'); }

    Read the article

  • PHP classes, parse syntax errors when using 'var' to declare variables

    - by jon
    I am a C# guy trying to translate some of my OOP understanding over to php. I'm trying to make my first class object, and are hitting a few hitches. Here is the beginning of the class: <?php require("Database/UserDB.php"); class User { private var $uid; private var $username; private var $password; private var $realname; private var $email; private var $address; private var $phone; private var $projectArray; public function _construct($username) { $userArray = UserDB::GetUserArray($username); $uid = $userArray['uid']; $username = $userArray['username']; $realname = $userArray['realname']; $email = $userArray['email']; $phone = $userArray['phone']; $i = 1; $projectArray = UserDB::GetUserProjects($this->GetID()); while($projectArray[$i] != null) { $projectArray[$i] = new Project($projectArray[$i]); } UserDB.php is where I have all my static functions interacting with the Database for this User Class. I am getting errors using when I use var, and I'm getting confused. I know I don't HAVE to use var, or declare the variables at all, but I feel it is a better practice to do so. the error is "unexpected T_VAR, expecting T_VARIABLE" When I simply remove var from the declarations it works. Why is this?

    Read the article

< Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >