I have a table in my database that has about 200 rows of data that I need to retrieve. How significant, if at all, is the difference in efficiency when retrieving all of them at once in one query, versus each row individually in separate queries?
...
How can I match the three words in the following string with a Perl compatible regular expression?
word1#$word2#$word3
I don't know the actual words "word1, word2 and word3" in advance. I only know the separator, which is #$.
And I can't use the word boundary as I have a multibyte encoding. This means for instance that the string can ...
I have been working in trying to optimize a webservice that is required to return somewhat quickly (less than 1 second) and is required to maintain a high load of requests (greater than 1000/second). We are using memcached as a way to store objects "in memory". It seems we are getting a large number of timeout errors from memcache.
[Thu...
Hello, all SO users!
I have a bit of PHP code (for the module feature of my CMS (not drupal) which allows people to view pages, comments, forum posts, blog posts, etc...):
if(isset($_GET["m"]))
{
//Does the module exist and activated, and has it a function called view?
if(isset($module_exists[$_GET["m"]]) && method_exists($_GET...
I've got a string:
$string = "Hello World!";
I want to turn it into a URL friendly tag, and I've developed a function to do it:
function stripJunk($string){
$string = str_replace(" ", "-", $string);
$string = preg_replace("/[^a-zA-Z]\s/", "", $string);
$string = strtolower($string);
return $string;
}
However, when I...
I have a text file Qfile.txt and the contents are follows, and want to create another file with the same informations and but answers are diffrent. Qfile1.txt,Qfile2.txt
Qfile.txt
Question "What is your age?"
Answer ""
Question "What you doing?"
Answer ""
Question "What is you name?"
Answer ""
Qfile1.txt
Question "What is your age...
I have a multidimensional array, that is a few levels deep. I am trying to loop through some of the lower levels of array items, but when I do, it seems to only return one of the array items.
foreach ($items as $item) {
foreach ($item as $id) {
echo $id;
}
}
For some reason, echoing $id only returns the first item in the $ite...
So in a nutshell on "page1.php" I have a calculator that consists of an html form, and then the php code totals the input and displays the total price. Below the price, it also displays a link to "page2.php" which contains an html form where they can enter their contact information and upon submitting the form the selections they made on...
I have this PHP code that I use to make a dropdown form selection of country's
I would like to eliminate this extra mysql query though and just store the output like in code to on the page
However I am lost on how I would have the users country SELECTED If I do not use the query to get the data
Please advice
<select name="country" styl...
I solved this question my own. The filename was wrong lolz.
Hello everyone!
I'm building a CMS like Drupal and Joomla. I'm working on the module feature (plugins), and I got the following error:
Fatal error: Class 'settings' not found in C:\wamp\www\SYSTEM\view.php on line 22
Here is my code:
start.php
<?php
//First of all, start ...
I recently installed Zend Server CE but I can't get php-win to do anything. When I run a cmd script using the standard php call it works perfectly but any call using php-win just fails to do anything. No output; nothing.
For example:
php C:\path\to\script
The above works.
But the below doesn't do anything:
php-win c:\path\to\scrip...
I have an on line project "question of the week"; this project allows the users to submit their questions. These questions are saved in a mysql table; the question is also sent over to another simplepost.php which stores the question in a phpBB.
I want to use this phpBB for every question, for discussions on that question.
So now, my ...
if($country == 224 || $country == 223 || $country == 39 && $zip == '' ){
$_SESSION['sess_msg'] = "Please enter a Valid zipcode";
header("location: $SITE_PATH?p=account.profile.name");
exit;
}
variable value
-------- -----
$country 224
$zip 11111
I know that $zip isn't empty, but the code executes as if it i...
What is the difference between bindParam and bindValue for PDO in PHP?
http://www.php.net/manual/en/pdostatement.bindparam.php
http://www.php.net/manual/en/pdostatement.bindvalue.php
...
Below is my code, it is a script I need to run just 1 time to update a new mysql table I have added, I have 60,000 users and it ran and added 268 rows, it did not show any errors or anything, it just didnt add the rest and I have no idea why?
<?PHP
require_once "../config/functions.inc.php";
// get users
$sql = 'SELECT * FROM fri...
I am developing a website in PHP and I would like to use a mvc framework to do this as I want to gain experience with PHP frameworks.
I have looked at Zend, CakePHP, and CodeIgniter and I have not been able to find an intuitive way to accomplish this.
What I need to do is create a layout that will be for example:
<html>
<head>
<!--scr...
Hi guys,
I know that include, isset, require, print, echo, and some others are not functions but language constructs.
Some of these language constructs need parentheses, others don't.
require 'file.php';
isset($x);
Some have a return value, others do not.
print 'foo'; //1
echo 'foo'; //no return value
So what is the internal dif...
Does Oracle have an equivalent column type to MySQL's TEXT type?
If not, how are larger blobs of text typically stored? BLOB, varchar(32767)? It's Oracle 10 being accessed via PHP, if it matters. Historical context is more than welcome.
...
Hey there SO,
I was just wondering if there was any way to make my object return false if placed in an if statement. The reason is I'm making a custom exception class. I would like to be able to do something along the lines of
class Dog{
public function lookAround()
{
if(seeDog())
{
return bark;
...
Hello all,
I am trying to update a field in a table by increasing its integer value by 1. Here is what I am using:
function updateViews($id){
$sql = "UPDATE tweets SET tweet_views = tweet_views + 1 WHERE tweet_key = '$id'";
$result = mysql_query($sql) or die("DB Error : ". mysql_error());
return $result;
}
However, I find its inc...