php

SQL Server: PHP Queries via SQLCMD fail sometimes!

Hello all, I have a PHP script that queries SQL server using SQLCMD - I am using SQL Server Express 2008. Most of my queries go through to SQL Server fine but sometimes I get this: sqlcmd return output is: Array ( [0] => Msg 4060, Level 11, State 1, Server ABS-PC\SQLEXPRESS, Line 1 [1] => Cannot open database "test_v02" reques...

php array output problem

In php is there a function to increment the values of subsequent values twice(*2) in an array column based on an initial value? $beta = array( array('5', '1''1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'), array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'), array('5','2...

php html flash website design tools for beginner

I have 5 years of C#, Perl and SQL programming experience but I've just found a web designer and developer job. I dont know anything about it but need to design a website using PHP, flash and HTML, whatever it is. Can you give me pointers on where to start to learn it all ASAP and start designing the website? I downloaded WAMP and learne...

How do you get the current user logged in to an apache realm?

I'm writing a simple in-house frontend to Subversion. We've got an Apache setup serving up the SVN repositories thanks to WebDAV. Also, authentication is done through an Apache realm and Open Directory. For what it's worth, this is basically a pretty vanilla Mac OS X Server 10.6 setup. Now, some of the tasks our front end is responsible...

php battleship game not working

Okay, so I have this partially working game, I know the solutions should be simple in terms of game play,but for a noob nothing is ever simple, so here, I am requesting help, as a noob, what am I doing wrong, I think it's the way I setup the check-boxes, but I need other eyes, thank you. <form action="<?php echo $_SERVER['PHP_SELF']; ?>...

Mailing by PHP with HTML format with form/page

I am sending mail to mail id with a form/page in a html format. Page is showing on mail id but my css is not applying on mail and images are not showing. Only text is showing without CSS and Images. ...

How to run, monitor and stop a PHP script using SSH on a shared webserver?

Can a normal member (not an admin) of a shared webserver with (limited) SSH access run, monitor and stop a PHP script through SSH? If so, how would all three actions be done by the user? I tried to use the command "top", but it only listed actual top level processes, not PHP scripts. I have also managed to start a PHP script using the...

Zend_JSON:Encode messing up - why!?!??!

My Zend_Json is messing up in encoding an object here. I'm encoding an associative array which has two elements: Element one is another associative array while element 2 is an HTML string. He's goofing up such that the Html string part contains just NULL!!?!?!?!? Heres the element UNencoded when I do a var_dump on it...sorry for the loo...

Any way to calculate the pixel length of a string?

I'm using the GD library for PHP, and using functions like imagestring() and imagestringup() to add text to pictures. I am using the built-in fonts with latin2 encoding. Is there a way, with a given string, to calculate the length (in pixels) of the string? I want to calculate the length in pixels of the strings because the strings ...

facebook api key problems php

I get an invalid API key which is definitly correct- no whitespaces or nothing- im stuck Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Invalid API key' in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php:3112 Stack trace: #0 /home/maxer/domains/follor.com/public_h...

Somewhat simple PHP array intersection question

Maybe I'm going insane, but I could have sworn that there was an PHP core function which took two arrays as arguments: $a = array('1', '3'); $b = array('1'=>'apples', '2'=>'oranges', '3'=>'kiwis'); And performs an intersection where the values from array $a are checked for collisions with the keys in array $b. Returning something like...

Why is PDO better for escaping MySQL queries/querystrings than mysql_real_escape_string?

I've been told that I'd be better using PDO for MySQL escaping, rather than mysql_real_escape_string. Maybe I'm having a brain-dead day (or it may be the fact I'm by no stretch of the imagination a natural programmer, and I'm still very much at the newbie stage when it comes to PHP), but having checked out the PHP manual and read the en...

Selenium RC sending blank screenshots through (winxp/winserver)

Hello everyone. I'm trying to set up my virtual (xen) win xp instances, a dedicated windows server, and a dedicated windows xp desktop pc for web app UI testing, using selenium-rc and the selenium PHP API from pear (the php script running the tests sits on its app server, on the same local network as the remote-controlled windowses). E...

storing shared paths in mysql using file input in php

Hi, I am trying to use a input type=file for the user to select the path from a shared network drive in php web app. I am just using this to get the file name and not doing anything with the selected file. Now, I am storing this path in the mysql database. I am not sure why, but it gets stored as ' say for example, if the path contains...

Need help choosing a Commercial CMS!

Hi, We currently use Joomla or Silverstripe for our CMS websites. The time has come where we need to expand and adopt a more commercial CMS (whitelabel) which is easy to customise, create templates, expand, has a lot of powerful feature and is also easy to use for a client. Before I start to research I thought id seek your knowledge/ex...

Most appropriate API for URL shortening service

Hi Folks, I've just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I'm thinking about the API for developers - at the moment you can send URLs with SOAP to the service, but I am not sure if this is a good solution. What is the be...

using jquery/ajax to send/update div when link is clicked

I have 2 layers that i need to update individually if a user clicks on either of them. <div id=wrapper> <div id=upvote> //This div can be filled by upvote.php?id=X <? echo getUpVote(); ?> <a href=#><img src=upv.png></a> </div> <div id=downvote> //This div can be filled by downvote.php?id=X ...

Using PHP to find part of a URL

Take this domain: http://www.?.co.uk/elderly-care-advocacy/mental-capacity-act-advance-medical-directive.html How could i use PHP to find the everything between the first and second slash regardless of whether it changes or no? Ie. elderly-care-advocacy Any helo would be greatly appreciated. ...

PHP - Foreach loops and ressources

I'm using a foreach loop to process a large set of items, unfortunately it's using alot of memory. (probably because It's doing a copy of the array). Apparently there is a way to save some memory with the following code: $items = &$array; Isn't it better to use for loops instead? And is there a way to destroy each item as soon as they ...

validating input type="password" created in php?

I have a page with PHP and HTML. The PHP section contains an input-type="password" I want to put the value of the password fields inside a hidden-input on the HTML side of the page (in a form)... <?php INPUT PASSWORD ?> <HTML> <form with password inputs> </HTML> How can I do this? I cant put the password inside the form directly bec...