I'm trying to run the following PHP script to do a simple database query:
$db_host = "localhost";
$db_name = "showfinder";
$username = "user";
$password = "password";
$dbconn = pg_connect("host=$db_host dbname=$db_name user=$username password=$password")
or die('Could not connect: ' . pg_last_error());
$query = 'SELECT * FROM sf_ba...
I have seen some questions similar to this on the internet, none with an answer.
I want to return the source of a remote XML page into a string. The remote XML page, for the purposes of this question, is:
http://www.test.com/foo.xml
In a regular webbrowser, I can view the page and the source is an XML document. When I use file_get_co...
Here is my code
<?php
error_reporting(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit(0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush();
$address = 'localhost';
$port = 10000;
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) ...
The code:
<?php
error_reporting(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit(0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush();
$address = '127.0.0.1';
$port = 11100;
if (($sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UP)) === fals...
Server:
<?php
error_reporting(E_ALL | E_STRICT);
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($socket, '127.0.0.1', 11104);
$from = "";
$port = 0;
socket_recvfrom($socket, $buf, 12, 0, $from, $port);
//$buf=socket_read($socket, 2048);
echo "Received $buf from remote address $from and remote port $port" . PHP_EO...
I'm trying to match a string that may appear over multiple lines. It starts and ends with a specific string:
{a}some string
can be multiple lines
{/a}
Can I grab everything between {a} and {/a} with a regex? It seems the . doesn't match new lines, but I've tried the following with no luck:
$template = preg_replace( $'/\{a\}([.\n]+)\{...
Further to my question yesterday (here), I am working on a webpage that has a section that shows 'live' order details.
The top half of my webpage has Spry Tabbed Panels. One of the panels contains an include call to a separate php page that I have created (getOpenOrders.php). This contains an SQL query to obtain all open orders and then...
I once ran a home-made forum system for a small group of online deathmatch players. These forums have long since been shut down, and are currently offline. What I want to do is create static HTML files that contain all of the data for the entire system, in the interest of having an online archive that the former users could search.
...
I'm looking for some examples of how you would show the status of a ventrilo server on your website. What I would like is the ability to show who is logged on and what channel they are logged into. I have found sites that you can purchase, but would like to either find a open source or free solution.
If there is not a solution already...
Is it possible to get client IP address through Flash (swf) Action Script 3 and then pass it to php file to store it in database?
...
I have a members site which I'd like to add chat to (LAMP on a dedicated box). It doesn't need to be too complex, but must use the already-logged-in members' usernames for chat.
This is a bit of a side project for me, so I'd rather not write it from scratch if possible & an existing script or class would be ideal. I've done a bit of sea...
How do I retrieve all src value using regex in php?
<script type="text/javascript" src="http://localhost/assets/javascript/system.js" charset="UTF-8"></script>
<script type='text/javascript' src='http://localhost/index.php?uid=93db46d877df1af2a360fa2b04aabb3c' charset='UTF-8'></script>
The retrieved value should only contains:
http:...
I am retrieving XML from a web service and then loading it into MiniXml (PHP). When the file is smaller than 100k it parses just fine. Larger, and I get an error:
Call to a member function getElement() on a non-object
This is happening when I try to get the first element off of the root element.
$parsedDoc = new MiniXMLDoc();
$par...
Uhh... kinda strange to put it into words that short.
Anyway what I want is in PHP to update an entry in a table if it does exist, otherwise create a new one filling it with the same data.
I know that's easy, but I'm relatively new to MySQL in terms of how much I've used it ._.
...
Here is the table of interest when exported via phpMyAdmin:
CREATE TABLE IF NOT EXISTS `users` (
`ip` varchar(20) NOT NULL,
`lastcheck` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `ip` (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Here is the query:
mysql_query("REPLACE INTO users SET i...
I have a largish table of data pulled from my database (~1500 rows, each with 10-15 fields) and I'm doing a number of filters and generating some stats and storing these in an excel spreadsheet for the user to download.
Rather than hit the database with the same fairly-complicated query over and over with only minor modifications (to th...
function outputscores($mysqlquery,$reverse=false)
{
while($row = mysql_fetch_array($mysqlquery))
{
echo '<img src="img/date.png" /> ' . date("j M Y",strtotime($row['timestamp'])) . '
<img src="img/time.png" /> ' . date("H:i:s",strtotime($row['timestamp'])) . '
<img src="img/star.png" /> '.$row['score'].$_GET["score...
I'm starting a job soon where I will be dealing with PHP solutions and Magento , I have looked through the Magento wiki etc and played around with an install for it .
But im still quite confused by how it works. Especially the MVC side of things (most of my PHP experience comes from working with wordpress).
I would like to know if anyo...
We are creating a unix timestamp with the mktime method giving following attributes:
print_r(mktime(0,0,0,3,1,2009));
print_r(mktime(null,null,null,3,1,2009) / 60 / 60 / 24) . "days");`
this creates a result of
1235862000
14303.958333333 days
this should be 14304 days. The problem in this case is the winter hour.
You can use the i...
Hi,
in a PHP project we already have separated business logic from database access. All database tasks are encapsulated in different database classes grouped by database and topic.
Theses classes look very horrible, half the source are SQL strings, that get filled with params and so on. We thought of putting the SQL in "other" locations...