Hi guys, I really need help with this one...have spent 3 hours trying to figure it out...
Basically, I have 3 tables necessary for this function to work (the query and PHP)... Authors, Books and Users.
An author can have many books, and a user can have many books - that's it.
When the admin user selects to update a book, they are pres...
How can I get an array of values from an associative array ?
Associate array Example:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
[1] => Array
(
[0] => 4
[1] => 5
[2] => 6
)
[2] => Array
(
[0] ...
I'm writing a script to download files from an FTP server using cURL + PHP, at the moment I am just trying to build a complete file structure, here's the code I'm using so far:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "ftp://www.example.com");
curl_setopt($curl, CURLOPT_USERPWD, "user:pwd");
curl_setopt...
First, the premises: PHP loaded on IIS6 on Win2003 STD R2 SP2, PHP_5213 using FastCGI, MySQL_5145.
Customer sent me the site files, which I unzipped to C:\InetPub\wwwroot\<site root>, then I created a new site in IIS, pointed to <site root>, added test.php to the site files for testing and it works, but visiting index.php produces a bla...
This is not a real bug BUT for sure it is not what you would expect.
I have this sample code to upload images:
if($type=="image/jpg" || $type=="image/jpeg" || $type=="image/pjpeg" || $type=="image/tiff" || $type=="image/gif" || $type=="image/png") {
// make upload
else echo "Incorrect format ....";
The problem is that if I modify...
Hi guys,
I'm sure many of you have visited amazon.com. When you do, amazon creates a list of browsed menu items at the very bottom of the home page.
I am currently doing a project that applies personalisation and customisation and wanted to implement something similar. My prototype is based on an institution, so I want to display a lis...
After using PHP for a while now, I've noticed that not all PHP built in functions as fast as expected. Consider the below two possible implementations of a function that finds if a number is prime using a cached array of primes.
//very slow for large $prime_array
$prime_array = array( 2, 3, 5, 7, 11, 13, .... 104729, ... );
$result_arra...
Hi all,
In my update form, I want the fields to recall the values that are already stored. This is very simple in a text field, but for my drop down () I'm having trouble with PHP reading the already stored name of user. Here is my query and code:
$sql = "SELECT users.user_id, users.name FROM users";
$result = mysql_que...
I've noticed that magento keeps the URL to the logo it uses for each store you setup in the "core_config_data" table.
If I run this SQL:
SELECT *
FROM `core_config_data`
WHERE path = 'design/header/logo_src'
I get a list of stores and their associated logo. I also get a config_id and a scope_id.
I'd like to be able to update the...
I've set up a CRON to call a URL in Kohana 3.
php /home/user/public_html/index.php my/route/in/bootstrap.php
It seems to access the URL fine.
However, I have received this error (send back in an email that my host sends per CRON)
Undefined index: HTTP_HOST
SYSPATH/classes/kohana/url.php [ 40 ]
Source of url.php
Which is in a Ko...
is there a java version of the php function checkdnsrr?
...
I have written a function to print database table to an array like this
$db_array=
Array(
ID=>1,
PARENTID =>1,
TITLE => LIPSUM,
TEXT =>LIPSUM
)
My function is:
function dbToArray($table)
{
$allArrays =array();
$query = mysql_query("SELE...
I'm using a JQuery Tabbed Menu which holds different types of forms and when I select a different form located under a different tab and submit the form the tab will jump to the default tab instead of the current tab the form is located in.
I was wondering how would I go about fixing this so that when the form is submitted the current t...
If i’ve got 2(or more) model methods which do (for example, in billing system) enrolling/withdrawing, and one controller’s method that calls 2(or more) of these model methods.
Is it a good way(maybe, any suggestions how to do it better) to write/use 2model methods like these:
public function start_transaction(){
$this->db->trans_s...
I plan on storing regular expression codes in a database, but not sure how to get them from a variable to function.
Any advise?
$i = "([wx])([yz])"
$j = "[^A-Za-z0-9]"
$k= "([A-Z]{3}|[0-9]{4})"
//Wold this execute properly, this really is the extent of my question?
preg_match($i, $string);
...
i wonder how i could store a xml structure in a persistence layer.
cause the relational data looks like:
<entity id="1000070">
<name>apple</name>
<entities>
<entity id="7002870">
<name>mac</name>
<entities>
<entity id="7002907">
<name>leopard</name>
...
OK, I hope this is my last question about CRON jobs and Kohana 3. Note: others are not duplicates, just other problems.
Here is my CRON job (setup in cPanel)
php /home/user/public_html/index.php --uri=properties/update
As per this answer.
I have set it up so it emails me the output. It is running every 5 mins.
Unfortunately, it alw...
I'm creating a set of search panes that allow users to tweak their results set after submitting a query. We pull commonly occurring values in certain fields from the results and display them in order of their popularity - you've all seen this sort of thing on eBay. So, if a lot of rows in our results were created in 2009, we'll be able t...
Ok, so I want to send AJAX requests to my website from my Flash games to process data, but I don't want people downloading them, decompiling them, then sending fake requests to be processed, so I'm trying to figure out the most secure way to process in the PHP files. My first idea was to use Apache's built in Authorization module to requ...
I use VIM editor for PHP, i know many people will point to PDT but somehow I like to stay with VIM and so
What are your suggestions for ideal VIM configuration for PHP Development ?
...