php

Javascript doesn't pull value

I have this piece of code: var categoryDetailId = $("#createEventForm-categoryDetail-idCategory").val(); and this html from myrendered page: http://erxz.com/pb/22844 When I hit the button it goes to Nan Update: I went in and set that and it didn't work still. I also have this one. var eventInformationId = $("#createEvent...

How to create object from String?

I tried the code below: $dyn = "new ". $className . "(" .$param1 . ", ". $param2 . ");"; $obj = eval($dyn); It compiles but it's null. How can you instance object in PHP dynamicaly? ...

Help translating .htaccess to web.config url rewrite

What would this rewrite rule from .htaccess translate to IIS7 web.config? RewriteRule .* index.php/$0 [PT,L] ...

Select a two-word field name in mySQL, called from PHP

trying to get information from a field and it's not recognizing the field name. $selectsecurityname = mysql_query("SELECT security name FROM securityinfo") or die(mysql_error()); Have a feeling it's because the fields name "security name" is two words. Is there a way to pass a two-word field name, or do I have to change everything to...

outputting all array values to file with php

Im working with a foreign API and im trying to get a fix on what all its sending to my file with the GET method. How can i output something like print_r($_GET) to a file so i can read what all its sending? ...

Is it possible to dynamically change the URL of a webpage?

Hi! I just wanted to know, is there any possible way to change the URL that appears in the address bar of a webpage dynamically? Like, maybe there are two buttons on the webpage, and when the user clicks one it will (or won't it does not matter) refresh the page and the url will be mysite.com/page1, or if the user clickes the second butt...

PHP array vs PHP Constant?

I am curious, is there any performance gain, like using less memory or resources in PHP for: 50 different setting variables saved into array like this $config['facebook_api_secret'] = 'value here'; Or 50 different setting variables saved into a Constant like this define('facebook_api_secret', 'value here'); ...

How to use mySQL WHERE clause in PHP?

Can't seem to pass anything from the "securityinfo" field. for ($k = 1; $k < $fieldscnt; $k++) { $selectsecurityname = mysql_query("SELECT `security name` FROM securityinfo WHERE symbol = '$symbol[$k]'") or die(mysql_error()); $securityname = mysql_fetch_array($selectsecurityname); $sym = $symbol[$k] echo "<td>$sec...

How does PHP handle variables in RAM?

I am curious how PHP handles variables in memory? If I have 100 constants or variables set that hold values related to my application and not on a per user basis, like site name, version number, things like that, which all users have the same value. Will PHP put these 100 variables into ram 100 times if 100 users are hitting the page a...

PHP cURL Warning during curl_multi_add_handle

My PHP code $urlArray = array('http://firsturl.com', 'http://secondurl.com'); $nodeCount = count($urlArray); $chContainter = array(); $mh = curl_multi_init(); for($i = 0; $i < $nodeCount; $i++) { $chContainter[$i] = curl_init(); curl_setopt($chContainter[$i], CURLOPT_URL, $urlArray[$i]); curl_...

Lambda Functions in PHP aren't Logical

Note: I have condensed this article into my person wiki: http://wiki.chacha102.com/Lambda - Enjoy I am having some troubles with Lambda style functions in PHP. First, This Works: $foo = function(){ echo "bar"; }; $foo(); Second, This Works: class Bar{ public function foo(){ echo "Bar"; } Third, This works: $fo...

PHP: How to sort values of an array in alphabetical order?

I want to sort values of an array in alphabetical order in PHP. If all values started with same character then they should be sorted using second character and so on. Ignore case sensitive. For Example: before: values[0] = "programming"; values[1] = "Stackoverflow"; values[2] = "question"; values[3] = "answers"; values[4] = "AA Systems...

making the home page require Auth (CakePHP)

Hello, I just started to learn CakePHP and i'm trying to make the homepage (views\pages\home.ctp) only available to logged users, so if an unlogged users enter to the homepage they should be redirected to Users controller, where it prompts for user data, using Auth Component. Where I can set the "controller" for the homepage? please co...

Passing Objects into PHP constructor error

Hello, Is it possible to pass an object into the constructor of a PHP class, and set that object as a global variable that can be used by the rest of the functions in the class? For example: class test { function __construct($arg1, $arg2, $arg3) { global $DB, $ode, $sel; $DB = arg1; $ode = arg2; $sel = $ar...

Connecting php to sql server

I'm using wamp server. And I use dreamweaver to create php files. Here is my code: -untitled.php <?php include 'E:\wamp\www\PHP\connection.php'; $query ="SELECT * FROM students"; $result = mysql_query($query); while($students = mysql_fetch_array($result)) { echo "<h3>".$students['LNAME'] ."</H3>"; } ?> <h1>Crea...

Can I have a class method include a header file for me in PHP?

Please review the example code below, I have a class file that is loaded into a config file. The config file is then loaded into any page I build. Is it possible to include a header file the way I have in the show_header() method? It doesn't seem to work so how can I achieve this result? // Core.class.php class Core { public fun...

Removing inline elements when importing HTML into DOMDocument or SimpleXML?

I have an external HTML source that I want to scrape and either transform into a local XML file or add to a MySQL DB. The external source is mostly normalized and (somewhat) semantic, so that all I need to do is use XPATH to get all td content or all li content, etc. The problem is that occasionally these items use <strong> or <b> or <i...

parse error in php code

I just started php and I want to know how to make this parse error work. This is the error: Parse error: parse error in E:\wamp\www\PHP\create.php on line 22 And here is my code, by the way I'm making a database manipulating system. And I use wampserver and dreamweaver. <?php include 'E:\wamp\www\PHP\connection.p...

Nitobi Grid remove the add row and remove row buttons.

Hi, I am using the Nitobi Grid in my php website. I would like to remove the buttons like add row and remove row on the grid toolbar. I cant remove the whole toolbar as i need the bar for paginating. Please let me know if there is any way to remove these buttons. Any ideas are appreciated. ...

Help with my codeigniter application!

ok, decided to use the tutorial from ibm.com for the addressbook to learn codeigniter, scrapped the first project, but after I submit the form, I get the following error:Fatal error: Class 'Mcontacts' not found in C:\xampp\htdocs\AddressBook\system\libraries\Loader.php on line 184 what am I doing wrong? please help! I really want to lear...