I have a class that retrieves its memeber (more or less 10 members) from a database.
My question is: is it more efficient to fetch them every time from the db (MySQL), leaving just an ID in the session's array or store them directly in the session's array?
And is the difference in performance terms so great? (given a database with say ...
<root>
<module label="Executive Library" >
<node label="Document one" link="http://www.google.com" />
<node label="Document Two" link="http://www.google.com" />
<node label="Document Three" link="http://www.google.com"/>
</module>
I have a page which displays these items, when i select the docume...
I was just wondering how prepared queries work. I am using PHP and MySQL.
I know that prepared queries compile the query and then repeated uses only have to change the parameters, so it saves time. But how long does that compiled query have an effect? At which point does it have to be reevaluated? Is it just as long as the PHP script is...
I have a MySQL database hosted on a remote server and it is enabled to accept only SSL connection. When I connect to this database using Java JDBC with SSL options, it works fine. There is a special jdbc string that I use for JDBC connection as below
"jdbc:mysql://:/?verifyServerCertificate=false&useSSL=true&requireSSL=true"
I need to u...
Hi, I'm fairly new to PHP so I have a small problem as I'm learning:
I built a Class called DataStrip.php
<?php
final class DataStrip
{
public function DataStrip()
{
// constructor
}
public function stripVars($vars)
{
return $vars;
}
}
?>
and then I'm trying to pass the public function stripVars a value:
<?php
inc...
i have problem to check if the picture is jpg
if ($_FILES["fname"]["error"] > 0) {
**$imgData = " hyperlink /holder.jpg";**
}
else {
$imgData ="hyperlink/".$_FILES["fname"]["name"];
}
// only accept jpg images pjpeg is for Internet Explorer.. should be jpeg
if (!($_FILES["fname"]["type"] == "image/pjpeg") ) {
...
I am using codeigniter php MVC framework to develop a web application. I have an input textarea that I would like to validate the input on. Basically it is similar to the textarea that I am typing in right now for stackoverflow, minus most (maybe all) of the formatting features that it has. Is there a simple built in way of doing this...
I have a local variable I'd like to be sent along with the rest of the POST data taken from an HTML form. Is there a function that lets me put more data from the current page into the POST array?
...
Hi Guys,
Trying to learning some more PHP. Here is what I'm after.
Essentially, I would like to search a website and return data to my own website.
Add a few keywords to a form.
Use those keywords to query a website such as monster.com for results that match the keywords entered.
Grab that data and return it to my own website.
How...
I've got a PHP application I wrote earlier that I'd like to add a RESTful API to. I'd also like to expand the site to behave more like a Rails application in terms of the URLs you call to get the items in the system.
Is there any way to call items in PHP in a Railsy way without creating all kinds of folders and index pages? How can I ca...
Hi, I am looking for an example of a simple, but functional example of a class extending the mySQLi class in PHP5. I am interested in stored procedures also. Basically what I need is an example of a practical and usable class. I learn best by example and unfortunately I have been unable to find any site or book that seems to have a reall...
Hi,
I have a query written as
mysql_query($query,$conn)
or
die(
"A MySQL error has occurred.<br />Your Query: " . $query . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
echo "You have been entered into our Database!";
This outputs
A MySQL error has occurred.
Your Query: INSERT INTO users (uid, twna...
I've got a couple of playlists I'd like to embed in a website. Rather than hard-coding them, I'm trying to use Youtube's Data API.
This basically amounts to parsing some XML from a URL in the form:
http://gdata.youtube.com/feeds/api/playlists/[feed-id]
This works great right up until the playlist is 26 videos long, at which point...
I have this multi-dimensional PHP array (below).
Array
(
[0] => Array
(
[2] => [email protected]
)
[1] => Array
(
[4] => [email protected]
)
[2] => Array
(
[3908] => [email protected]
)
[3] => Array
(
[2548] => eleve...
Need to check if $message length is 7 characters or less, if so, do action A, if not, do action B. Is this correct syntax? I think im doing something wrong?
<?
if (strlen($message) <= 7){
echo $actiona;
}
else
{
echo $actionb;
}
?>
...
I'll keep this nice and short.
I'm trying to post a value to a remote form.
This code is working perfectly:
$url = "http://eirestudio.net/blog/"; // URL to POST FORM.
$post_fields = "s=test";
$ch = curl_init(); // Initialize a CURL session.
curl_setopt($ch, CURLOPT_URL, $url); // Pass URL as parameter.
curl_setopt($ch, CURLOPT_POST...
I have a really long list of itinerary items with integer values. I was thinking about creating a database with each of these items with like fifty columns but that seemed a bit long-winded, and the itinerary may change. Is there a better way to store these name => value pairs in a database? serializing seems a bit crude, I was thinking...
Hello,
today my objective is to retrieve all PHP class names associated with
their namespace names but I got stuck. Here is an example of what I have:
$content =<<<END
<?php
namespace test;
class a { }
class b { }
namespace foo;
class bar { }
?>
END;
preg_match_all('~^\s*((?:namespace)\s+(\w+);)?\s*(?:abstract\s+|final\s+)?(?...
Is there a way to make the code continue (not exit) when you get a fatal error in PHP?
For example I get a timeout fatal error and I want whenever it happens to skip this task and the continue with others.
In this case the script exits.
...
Hi,
I have found what looks like a good, secure PHP login script, however i am having trouble figuring out how to implement it. (It is located here http://www.adesdesign.net/php/tutorials/php/php_login1.php)
I am new to PHP so don't know much yet. I can't figure out how you actually authenticate a user and return a message to them if i...