php

PHP: saving multiple tuples to the same table

Hi all, I am trying to save data into the same table several times from the same $_POST array. You see, on my registration form a family is allowed to specify the names, gender and age of all members they wish to bring along. This data is being stored in a database table called aditional_member. Based on family size, I am dynamically ge...

java or php tip for small problem

Hi All, I am having a weird mind gogling problem. Sorry in advance, If I confuse you. I have following data 1 3 5 5 1 2 2 4 8 3 2 9 3 8 4 first column = source 1 second column = source 2 third column = result column First and second column will can create 3rd column and that 3rd column can be used in 1st or 2nd column to make a new...

Using PHP substr() and strip_tags() while retaining formatting and without breaking HTML

I have various HTML strings to cut to 100 characters (of the stripped content, not the original) without stripping tags and without breaking HTML. Original HTML string (288 characters): $content = "<div>With a <span class='spanClass'>span over here</span> and a <div class='divClass'>nested div over <div class='nestedDivClass'>there</di...

Non-static method mysqli::init() cannot be called statically

http://php.net/manual/en/mysqli.init.php $ConnectionResource = mysqli::init(); The above code fails with: Fatal error: Non-static method mysqli::init() cannot be called statically How come? ...

Display MySQL BLOB'd image on webpage without separate script (PHP)

So I've got some images stored in a MySQL database as BLOB's (I know it's better to just store the directory and do it that way, but this is what I need to do for now) and I need to display them on a webpage. Now, I know how to make a script and give it an image header and pull the img src from there, but I have a lot of images from diff...

php imap get connection failed error

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/happy/public_html/source/imap/fet_mail_from_email_add.php on line 7 can't connect: Can't connect to gmail-imap.l.google.com,993: Connection timed out my snippet is $mbox = imap_open("{imap.gmail.com:993/imap/ssl}INBOX", ...

Sorting Arrays by More the One Value, and Prioritizing the Sort based on Column data.

I'm looking for a way to sort an array, based on the information in each row, based on the information in certain cells, that I'll call columns. Each row has columns that must be sorted based on the priority of: timetime, lapcount & timestamp. Each column cotains this information: split1, split2, split3, laptime, lapcount, timestamp. ...

What are the fundamental differences between ASP.net and PHP?

Possible Duplicate: .NET & ASP vs PHP Are there speed differences, performance issues, and what reasons do businesses have when they choose one or the other, is the learning curve steeper for one over the other? Also... are you likely to be paid more using one over the other? ...

PHP templating challenge (optimizing front-end templates)

Hey all, I'm trying to do some templating optimizations and I'm wondering if it is possible to do something like this: function table_with_lowercase($data) { $out = '<table>'; for ($i=0; $i < 3; $i++) { $out .= '<tr><td>'; $out .= strtolower($data); $out .= '</td></tr>'; } $out .= "</table>"; ...

Good practice for storing and retrieving session values in PHP

I was wondering what the best way is for storing and retrieving session values in PHP. I am building a php framework with an MVC structure. Now i have a registry class with inmportant object. I have a class for the session, with some defined functions concerning the session. Now I was wondering if it is a good practice to just use $_S...

PHP Array in MySQL IN() function?

Is it possible to assign php array in MySQL IN() function? for example, $numbers = array('8001254656','8886953265','88864357445','80021536245'); $sql = mysql_query("SELECT * FROM `number_table` WHERE `number` IN ($numbers)"); Any Ideas? Thanks, ...

jquery hide load url

how to hide load url in jquery?i want to hide pmscount.php { $('#notification').load('pmscount.php').fadeIn("slow"); }, 10000); ...

Find what functions were called (from a variable's perspective)

Hey all, I'm trying to figure out how to know what has been done to a variable. Here's an example: function a($hello) { $out .= strtoupper(ucwords(strtolower($hello))); return $out; } echo function_trace('$hello') // returns array(strtoupper,ucwords,strtolower) Thanks! Matt ...

how to pass values from one page to another on jquery form submit

I'm trying to build a form using php & jquery, but I'm a little confused as to what to do with the jquery portion of it... Basically, when the user submits the first form, I want to direct them to the "next step" form, but I want to retain the values submitted from the first one in a hidden input field... If someone can either show...

how to store data with many categories and many properties efficiently?

We have a large number of data in many categories with many properties, e.g. category 1: Book properties: BookID, BookName, BookType, BookAuthor, BookPrice category 2: Fruit properties: FruitID, FruitName, FruitShape, FruitColor, FruitPrice We have many categories like book and fruit. Obviously we can create many tables for them (M...

Pagination links do not work after first page

Hello, I am trying to fix this pagination script. It seems when I click on the pagination links [1][2][3][4]or[5] , it doesn't work. It just shows the first page and when clicking on the next numbers nothing happens. I hoping someone can see something in the script that I can not see. The main page looks like this (pagination.php): <?p...

Query XML file with PHP to return certain bookmarks...

I have an XML file full of bookmarks from Google Bookmarks. (File: http://gist.github.com/324844) I want to pull the bookmark based on this path: xml_api_reply->bookmarks-bookmark->labels->label. So, my question is How can I use SimpleXML to grab the bookmarks that have the label Inspiration? Some bookmarks may have more than one bookm...

str_replace() with associative array

You can use arrays with str_replace(): $array_from = array ('from1', 'from2'); $array_to = array ('to1', 'to2'); $text = str_replace ($array_from, $array_to, $text); But what if you have associative array? $array_from_to = array ( 'from1' => 'to1'; 'from2' => 'to2'; ); How can you use it with str_replace()? Speed matters - arra...

PHP: How to find out the position of a value in an array?

How to find out that foo is at the position of 2?: array('boo', 'moo', 'foo'); ...

Problem making system calls with PHP scripts

I have the following PHP script: <?php $fortune = `fortune`; echo $fortune; ?> but the output is simply blank (no visible errors thrown). However, if I run php -a, it works: php > echo `fortune`; Be careful of reading health books, you might die of a misprint. -- Mark Twain php > Am I missing a config directive or some...