Hi, I'm having trouble with grep.. Which four patterns should I use with PHP's preg_grep to extract all instances the "____" stuff in the strings below?
1. <h2><a ....>_____</a></h2>
2. <cite><a href="_____" .... >...</a></cite>
3. <cite><a .... >________</a></cite>
4. <span>_________</span>
The dots denote some arbitrary characters ...
Hi guys,
Probably, this question has been asked before, though, I'll ask it again.
Currently, I'm facing a problem with form encoding. When posting my form, all spaces are replaced by the "+" character. I would like to replace this "+" character by a real space.
Does someone has a PHP solution for this?
Thanks in advance.
Cheers, ...
I was trying to do it with "getElementsByTagName", but it wasn't working, I'm new to using DOMDocument to parse HTML, as I used to use regex until yesterday some kind fokes here told me that DOMEDocument would be better for the job, so I'm giving it a try :)
I google around for a while looking for some explains but didn't find anything ...
I've added a custom "save_post" action to my theme (code is below). However, when I place images or video code in the post, its stripped away. The only way I can get it to stay is to comment out the add_action line. What do I need to do in order to keep all the post info intact?
add_action('save_post', 'custom_add_save');
function cust...
I would like to set up a foundation of classes for an application, two of which are person and student. A person may or may not be a student and a student is always a person. The fact that a student “is a” person led me to try inheritance, but I can't see how to make it work in the case where I have a DAO that returns an instance of pers...
I have written a very simple function:
function editCategory() {
$ID = urlencode($_GET['id']);
$cname = mysql_fix_string($_POST['cname']);
$kabst = mysql_fix_string($_POST['kabst']);
$kselect = $_POST['kselect'];
$subsl = $_POST['subsl'];
$kradio = $_POST['kradio'];
$ksubmit = $_POS...
I have this table:
fourn_category (id , sub)
I am using this code to count:
function CountSub($id){
$root = array($id);
$query = mysql_query("SELECT id FROM fourn_category WHERE sub = '$id'");
while( $row = mysql_fetch_array( $query, MYSQL_ASSOC ) ){
array_push($root,$row['id...
i have doubt on this particular problem : Global variabe initiation. i got this code and has global variable named conditional_random here :
function hello_testing() {
global $conditional_random;
if (isset($conditional_random)) {
echo "foo is inside";
}
}
As it's name, the global variable (conditional_random) can be or...
Hello, is there any way how in this situation insert and update DB with single queries?
$message = 'Hello to all group members';
$userdata = mysql_query("SELECT memberid, membernick FROM members WHERE groupid='$cid'") or die('Error');
while(list($memberid, $membernick) = mysql_fetch_row($userdata)) {
$result1 = mysql_query("I...
Let's say I'm including a file which contains html. The html have characters as exclamation symbols, Spanish accents (á, ó). The parsed included text gets processed as symbols instead of their correct value. This happens on FF but not on IE (8).
I have tried the following functions:
htmlspecialchars, htmlentities, utf8_encode
include ...
Hello there,
I am trying to get some form data from POST method.
Here's the code of form -
<form action="" method="post" name="form1" id="form1">
<input type="hidden" value="15" name="ad_id">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="block">
<tbody><tr>
<td valign="top"> </td>
<...
Hello, i have this code to get the search resutls from the api:
querygoogle.php:
<?php
session_start();
// Here's the Google AJAX Search API url for curl. It uses Google Search's site:www.yourdomain.com syntax to search in a specific site. I used $_SERVER['HTTP_HOST'] to find my domain automatically. Change $_POST['searchquery'] to ...
Hello,
I have this code which will include "template.php" file from inside each of these folders: "content/templates/id1", "content/templates/id2", "content/templates/id3" etc. etc.
$page_file = basename(__FILE__, ".php");
require("content/" . $page_file . "/content.php");
$iterator = new RecursiveIteratorIterator(
new ...
Using PHP, I have a query that goes through my DB looking for pending tasks with reminder triggers at certain times of the day. I have a cronjob that runs every 10 mins and checks the DB for any rows that has "remind_me" field set to go off within the next 10 mins. If it does find something, what's the best way to queue an email with the...
Each student in my school, has to develop a Technology Summer Project. I was thinking in doing something in PHP, using MySQL databases, and something that has some utility for the real life.
I'm an advanced PHP developer (not an expert one :). The project has to follow that rules:
It's in PHP
It's a front-end and a backend
Has to be so...
ereg and eregi functions will be deleted from Php. Please help to find alternatives for the following ereg functions:
1) To allow IP addresses only for specific ranges:
$targetAddr = "60.37..*..*";
if (!ereg($targetAddr, $_SERVER['REMOTE_ADDR'])) {
die;
}
2) To replace series of points like .......................
$message = ere...
Hello Everyone,
So I have my upload script working just fine, but now it's a matter of making it look the way I want for my layout.
<input type="file" name="userfile" id="userfile"/>
This obviously shows a textbox with a Choose File button. What I really need is my own custom button (which will ultimately be an image) that upon succ...
Hello, I want to Remove the Sessions from this php code, actually if someone searches i get this url search.php?searchquery=test but if I reload the page, the results are cleaned. how can I remove the Sessions to get the Results still, if someone reloads the page? this are the codes:
search.php
<?php
session_start();
?>
<form method="...
Hey guys...
$bookA = "123";
$crack = "A";
I want to do something similar to this:
echo $book$crack;
Such that the output is 123.
What is the correct syntax for the echo command?
Thanks.
...
Hi folks
My problem is that I'm trying to count which tag has been used most in a table of user-submitted code. But the problem is with the database structure.
The current query I'm using is this:
SELECT tag1, COUNT(tag1) AS counttag
FROM code
GROUP BY tag1
ORDER BY counttag DESC LIMIT 1
This is fine, except, it only counts the ...