Skip to main content

Posts

Remotely accessing web server, and connecting to local mysql (via php)

I am trying to connect to my local mysql server via php. so my code looks as follows: $con = mysql_connect("localhost", "user", "password"); mysql_select_db("database", $con) or die('ERROR 4'); ok, we've all seen that before. So when I run this PHP script on the machine with the mysql database, everything runs fine. But once I access this script remotely (on the server, with the local mysql database) it cannot connect to the database. Is there any way to make it so the PHP code connects to the mysql database via a local reference? Or do I need to look into connecting to the mysql database through an IP address? edit: To clarify, when I access the script on the server from somewhere else, it doesn't work edit 2: When I check the error log it states "Call to undefined function mysql_connect()"

Error when load library of zend framework

I using library of Zend Framework and code php (no using struct zend, only use library of zend framework), when I load library of zend is error: Fatal error: require_once() [function.require]: Failed opening required 'Zend/Search/Lucene/Storage/File/Filesystem.php' (include_path='.;C:\php\pear;C:\wamp\www\Zend') in C:\wamp\www\...\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349 I put library of Zend in C:\wamp\www\Zend I call library of Zend in code php here: ini_set("include_path", ini_get("include_path") . ";C:\\wamp\\www\\Zend"); require_once 'Zend/Search/Lucene.php'; How to load library of zend in this case ?

What"s wrong with this PHP Regex code?

The x modifier code in this tutorial Php regex tutorial gives me the following error: Warning: preg_match() [function.preg-match]: Unknown modifier ' ' in C:\xampp\htdocs\validation\test.php on line 16 Pattern not found What's wrong with it? <?php // create a string $string = 'sex'."\n".'at'."\n".'noon'."\n".'taxes'."\n"; // create our regex using comments and store the regex // in a variable to be used with preg_match $regex =" / # opening double quote ^ # caret means beginning of the string noon # the pattern to match /imx "; // look for a match if(preg_match($regex, $string)) { echo 'Pattern Found'; } else { echo 'Pattern not found'; } ?>

jQuery Mobile Form Date Input Format

I've got a simple form as part of a jQuery Mobile site which includes a date field: <input type="date" name="contactNewInspectionDate" id="contactNewInspectionDate" /> I'm trying to establish the format of what is submitted for these type="date" fields. So far I'm seeing something like this: 2012-02-16 for February 16, 2012. Is YYYY-MM-DD always the submitted format for these date fields? If that is the case can anyone recommend the easiest way to parse the individual elements out using PHP (Date, Month, Year)? Many thanks, Steve

Dynamic Dropdown Menu if-else does not become dynamic

I have two dropdown menus, im having trouble with making the options for the second dropwdown to be dependent on the choice on the first dropdown menu. $city=""; $formcontent =<<<EOT <label>Assumed Bitten City : </label> <select name="AssumedBittenCity" id="AssumedBittenCity"> <option value="0">Make a Selection</option> <option value="Caloocan City">Caloocan City</option> <option value="Las Pi&#241;as City">Las Pi&#241;as City</option> <option value="Makati City">Makati City</option> <option value="Malabon City">Malabon City</option> <option value="Mandaluyong City">Mandaulyong City</option>

How to put different host entries on same linux server, for different virtual hosts? [closed]

The setup is : Two applications are hosted on same linux server using vhost entries in apache configuration. say : http://greatapp.example.com and http://superapp.example.com Both of them have a functionality where they do server side http request to a third url (using php cURL / file_get_contents) : http://apis.example.com Now there is a host entry of an in the hosts file '/etc/hosts' xx.xx.xx.xx apis.example.com This is only intended for greatapp.example.com code, and not for superapp.example.com. How to configure the server such that greatapps.example.com uses the host entry, but superapp.example.com uses the public ip of apis.example.com