I'm working on a class which needs to be accessible via static function calls as well as object methods. One thing I have found is that I'm duplicating logic across multiple functions.
Simplified example:
class Configurable{
protected $configurations = array();
protected static $static_configurations = array();
public fu...
What's wrong with my code, Im just a beginner. The error said it was an undefined index.
A record is added to mysql but its just 0's. What' s the proper way of doing this
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Hospital", $con);
$hospnum = ...
currently i'm using this XAMPP Lite 1.7.3
+ Apache 2.2.14 (IPV6 enabled)
+ MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc
+ PHP 5.3.1 (PEAR)
+ Miniperl 5.10.1
+ XAMPP Control Version 2.5.8 (ApacheFriends Edition)
+ XAMPP CLI Bundle 1.6
+ XAMPP Port Check 1.5
+ XAMPP Security 1.1
+ SQLite 2.8.17
+ SQLite ...
I'm wondering what the best way is to prevent my server from being stressed when I want to get a lot of data using PHP.
Convert all my data to an XML sheet? Use caching?
The data comes from many different databases and different tables.
Any ideas?
Thanks in advance
...
How do I replace ampersands in a url from & > &
I use some rss feeds witch has URL containing & should I use
$link = str_replace('&', '&', $link);
or there are other options?
...
I'm fairly certain my professor will ask me why I chose to use MVC for my web application.
Truth be told, I'm new to MVC. I read about it, I'm building a blog application using it, I think it's very logical to approach a problem this way.
But why? O_O I draw a blank. How is better suited than say, building an N-tier application?
...
Hello, my site is a design on index.php and then a frame on it.. Now, i want to do so the titles changes When you browse to eg. Videos.php.
So how should i do this with window.parent and title?
The title needs to be changed on index.php.
So cant it be done like on videos.php:
<script>
window.parent.changeTitle("Videos - Mysit...
i want to retrieve following urls with a regex:
HREF="http://www.getty.edu/vow/TGNFullDisplay?find=&place=&nation=&english=Y&subjectid=7009830"
HREF="http://www.getty.edu/vow/TGNFullDisplay?find=&place=&nation=&english=Y&subjectid=7009830&ptype=PF"
the difference is the ending. the first one omit...
can anyone tell me how to encrypt and decrypt a URL string ?
I want to encrypt a hyperlink ...
...
$content = '<h3>popular tags »</h3><hr>';
$result = $db->sql_query("SELECT tags FROM ".DOWNLOAD_TABLE." ");
while($row = $db->sql_fetchrow($result)){
$dl_tags_id = $row['tags'];
$dl_tags_id_ex = explode(" ",$dl_tags_id) ;
$dl_tags_id = array_unique($dl_tags_id_ex);
$c = count($dl_tags_id);
for($i=1...
Hello. So i have this videosection, but i want to make a "sorting" option avaible for users.
Sorting Options: ALL (no WHERE in the sql statement), Videoklips (WHERE SCtry = 0), SC try (WHERE SCtry = 1)
Now, i know how to do it "my" way. I would have placed links on index.php:
?sort=video and ?sort=SCtry
Then make 2, if sort video, if ...
I change languages using php arrays which makes the URL look like this:
http://alexchen.zxq.net/index.php?lang=es
I added $lang=$_SERVER['HTTP_ACCEPT_LANGUAGE']; in my 'controller' file in default sections, and I choose another language in the preferred languages option (Mozilla Firefox),
but it didn't work.
common.php:
<?php
sessio...
Ive created an uplaod script in php that takes a file, resizes it, and creates a cropped square thumbnail. The script itself seems to work fine.
However, when i tried to upload an image through firefox, on clicking the submit button the browser shows the loading animation, but it never calls the script, it just stays on the current pag...
I'm a fairly experienced PHP coder, and am just wondering what the best way of echoing large chunks of HTML code is (best practise).
Is it better to do this:
<?php
echo "<head>
<title>title</title>
<style></style>
</head>";
?>
or this:
<?php
define("rn","\r\n");
echo "<head>".rn
."<title>title</title>".rn
."<style></style".rn
."</he...
How can I avoid to submit again the form when I hit refresh of the browser? Thank you.
...
In ASP.Net you'd create a MasterPage and have whatever pages use that.
I need my pages to use the same basic layout. Where do I create it?
...
Hi, I'm a newbby in Adobe AIR/Flex.
I have developed a simple Flex web app. that through 2 Php's, can connect to a DB and return an XML result of the query. I uploaded the PHP and Flex files to my internet server, and the app. works fine.
My question is:
How can I make the same app. work in Adobe AIR? In other words, I have made a new...
I need to assign the "active" theme via script. Anyone know the API call needed to do this? Also, how do I retrieve the current theme via script (PHP)?
...
I have code that looks like this:
function foobar(array& $objects, $con = null)
{
if (is_null($con))
$con = DbSingleton::getConnectio();
$con->beginTransaction(); // <- question 1
try
{
foreach($objects as $object)
{
// allocate memory for new object
$new_obj = new MyShiningNewObject();
...
i want to have a foreach loop where the initial array is changed inside the loop.
eg.
$array = array('red', 'blue');
foreach($array as $key => $value) {
$array[] = 'white';
echo $value . '<br />';
}
in this loop the loop will print out red and blue although i add another element inside the loop.
is there any way to change th...