I wrote this code
require('Database.class.php');
function get_info (){
$db = new Database($config['server'], $config['user'], $config['pass'], $config['database'], $config['tablePrefix']);
$db->connect();
$sql = $db->query('SELECT * FROM ja_cat');
while ($options = $db->fetch_array($sql)) {
$cat[]...
Hi,
I am new to Web Programming and I hear that there are many biggies like Java, .Net and PHP for Web Application Development.
I would certainly appreciate if I can get some insights on how this technology stack up in comparison and in what scenarios one would prefer one technology over the other.
Thanks for all guidance in advanc...
What is the fastest way to get YouTube videos for over 100.000 songs? I'm currently using PHP and SimpleXML to parse YouTube's feed, but it seems to be pretty slow. Any other ideas?
...
I do not want to pass GET or POST variables to a script. I want to use the filename and use it to lookup the product from the phpscript for example:
......./DELL1500.php
......./COMPAQ1213.php
I have three questions:
Where does PHP get the data from $_SERVER["SCRIPT_NAME"] is it from the server or the clients browser?
Can anyone thin...
We are using SuperSlidShow Plugin to display gallery of images in our post. However when I write shortcode [gallery] in my post/page images appear correctly, but can anyone guide me if I want to fix this [gallery] shortcode in the theme itself like page.php/post.php so that images will appear on all pages. We have images for every page/p...
Background
I am developing my blog application in Cake PHP. I aim to provide an intro text for each post on the home page. The user can then click on the "Read more" link to read the entire post. Following is my posts table.
$query = 'CREATE TABLE posts (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255)...
if (file_exists("pages/$page.php")) {
include($page.'.php');
}
Is this safe?
With Safe i mean that you cant include remote scripts etc
...
I'm a Joomla developer and I'am trying to build a component(in J!1.5) that uses urlparam for creating custom menu links in the admin.
I want my component to work like the built-in polls component that allows users to select the id of an item in my component.
I tried the xml file for the component but that doesn't work. But I know it's ...
Is there a preferred class or method for working with timespans in PHP? The primary functionality I am interested in is checking if a date is within the timespan, or generating timestamps for the lower and upper limits.
...
Hey all, I am wondering what the best way to do the following is:
Query up to 5 tables (depends on user input) pull back the results and return a single array. Lets say I query table A and have the results stored as a result handle (return from the pg_query() fn), shall I go ahead and convert those to an array, and then continue append...
hey there :-)
Okay, i have a job to do before tomorrow morning..
i'm working on some jquery.
Where i load some external file data..
What i really want to know, is how am i going to load some data when i $.post / or $.get some data through jquery
Send request into jquery <a href="javascript:;" onclick="$.view.load('prices');">hey ...
I have a few modules with some functionality overlap. In accordance with DRY, I'd like to move this out to another location, so I will have less code to maintain. Where is the best place to do this? If I just make a module (and make it a dependency of the ones that need it), will I be guaranteed that the constants, functions and variable...
I have a array with a variable amount of values.
Is there a more efficient or better way to INSERT them into my DB besides a loop with a query inside it?
...
$query = "SELECT A.Agent_Name, C.Country_Name, J.Job_Type FROM Line_Items LI, Agents A,
Country C, Job J WHERE LI.Agent_ID = 1 AND LI.Agent_ID = A.Agent_ID AND
LI.Country_ID = C.Country_ID AND LI.Job_ID = J.Job_ID";
$result = mysql_query($query);
while($row = mysql_fetch_query($result)) {
echo "Agent:" . $row['A...
Following Uncle Bob's avice in Clean Code, I'd like to have no SQL in my PHP code. Presently I'm making use of Prepared Statements and I've factored my database access code into model classes.
My initial thought is to break out my SQL into separate SQL files and then load them at runtime. Since this involves more disk IO (my gut feeli...
Hi, my questions pertain to class objects defined for mysql/php interface:
Which of the following method is best from a design point and why (relative advantages/disadvantages to each other):
To use a single class like ezSQL towards abstracting the mysql/php interface?
To use a combination of a DB Connection Class and a Results Class...
I am downloading a CSV file from another server as a data-feed from a vendor.
I am using curl to get the contents of the file and saving that into a variable called $contents.
I can get to that part just fine, but I tried exploding by (both "\r" and "\n") to get an array of each line but it tells me "the fatal error, memory allocation"...
My company has a very real problem with patch management on our web servers. The public servers are out of date, and now management considers this a priority. However, rather than simply updating and patching the existing servers (and all the testing that goes along with that) they have embarked on the process of migration to Solaris s...
How can I display the last time the current document was updated in PHP?
...
Is it possible in PHP 4/5 to specify a named optional parameter when calling, skipping the ones you don't want to specify (like in python) ?
Something like:
function foo($a,$b='', $c='') {
// whatever
}
foo("hello", $c="bar"); // we want $b as the default, but specify $c
Thanks
...