Hi. I have a MySQL query
SELECT * FROM 'redirect'
WHERE 'user_id'= \''.$_SESSION['user_id'].' \'
ORDER BY 'timestamp'`
I want to paginate 10 results per page. How Can I do it?
At first I was going to use doctrine ORM as the main one but it was an overkill, unneeded features and probably excessive calls. One of the main reasons was the "helper" that handled traverse trees (the hierarchy tree) easily but I'm starting to prefer building my own class.
This is what I'm looking for:
1) Can manage multiple database connections, (sort of like doctrine manager)
2) Models
3) flexible
All suggestions are welcome
Hi, i was wondering if it was possible to create email forwading accounts on the fly as I have created subdomains for uses profiles i.e. user.profile.com and was wondering if I could create [email protected] to forward to their email account?
Regards,
Phil
I have the code below . it looks for the case and creates an array of rows and columns.
$pv->results[$row1][1][0] actually is $pv->result->[rownumber][coulmnnumber][0].
Now this is for only 2 columns as you can see. However I want an array like
$myArr = array(0=>1, 1=>7, 2=>8, 3=>9 ) to be added below for column. What it is doing, is adding 4 columns (0,1,2,3) into the code below. So now I will have 4 cases instead of 2 cases as I need to more columns. Also the case value will not be 1 and 2, it will be 1, 7, 8 and 9 respectively. How can I do that? Thanks.
for($i=0;$i<count($pv->rawData); $i++){
SWITCH ($pv->rawData[$i]->my ID){
CASE '1':
$row1++;
$pv->results[$row1][1][0] = $pv->rawData[$i]->data;
break;
CASE '2':
$row2++;
$pv->results[$row2][2][0] = $pv->rawData[$i]->data;
break;
}
I'm trying to get content from an RSS2 feed from one of my sites and use it in another site.
The feed is here. And the code I'm using is taken from this nice site and has been modified like the following:
$doc = new DOMDocument();
$doc->load('http://tripleax.com/john/?feed=rss2');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
print('<div style="width:100%" class="option"><strong>');
$a = $node->getElementsByTagName('title')->item(0)->nodeValue;
print("$a");
print('</strong><br /><span class="option">');
$a = $node->getElementsByTagName('description')->item(0)->nodeValue;
print("$a");`
}
The problem I'm having is, I want to display the entire post's contents. And the description is a sort of the teaser. Changing $node->getElementsByTagName('description')->item(0)->nodeValue to $node->getElementsByTagName('content')->item(0)->nodeValue gives me nothing, and content:encoded is no better.
Can someone please point me in the right direction to solving this?
Thanks!
Please help - i keep getting an error with this bit of code - it is probibly some thing small but dont seem to see what is wrong -
while($row = mysql_fetch_array($result))
{
$varp = $row['ustk_retail'];
if ($varp<80000) { $o1 = 1; }
if (($varp=80000) && ($varp<100000)) { $o2 = "1"; }
if (($varp=100000) && ($varp<120000)) { $o3 = "1"; }
if (($varp=120000) && ($varp<140000)) { $o4 = "1"; }
if (($varp=140000) && ($varp<160000)) { $o5 = "1"; }
if (($varp=160000) && ($varp<180000)) { $o6 = "1"; }
if (($varp=180000) && ($varp<200000)) { $o7 = "1"; }
if (($varp=200000) && ($varp<220000)) { $o8 = "1"; }
if (($varp=220000) && ($varp<240000)) { $o9 = "1"; }
if (($varp=240000) && ($varp<260000)) { $o10 = "1"; }
if (($varp=260000) && ($varp<280000)) { $o11 = "1"; }
if (($varp=280000) && ($varp<300000)) { $o12 = "1"; }
if ($varp=300000) { $o13 = "1"; }
}
Any ideas would help
I'm trying to use regular expressions (preg_match and preg_replace) to do the following:
Find a string like this:
{%title=append me to the title%}
Then extract out the title part and the append me to the title part. Which I can then use to perform a str_replace(), etc.
Given that I'm terrible at regular expressions, my code is failing...
preg_match('/\{\%title\=(\w+.)\%\}/', $string, $matches);
What pattern do I need? :/
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>
<td align="right">all fields are required</td>
</tr>
<tr>
<td valign="top"> </td>
<td align="center"></td>
</tr>
<tr>
<td valign="top" width="150"><label for="name">Advertisement Name</label>
*</td>
<td><input type="text" size="45" value="Banner" id="name" name="name">
e.g Home Banner</td>
</tr>
<tr>
<td valign="top"><label for="placement">Advertisement Placement</label></td>
<td><select id="placement" name="placement">
Wide Skyscrapper 160 x 600
</tr>
<tr>
<td valign="top"><label for="code">Advertisement Code</label></td>
<td><textarea rows="5" cols="45" id="code" name="code"></textarea></td>
</tr>
<tr>
<td>Status</td>
<td><label>
<input type="radio" checked="checked" value="1" name="status">
Active</label>
<label>
<input type="radio" value="0" name="status">
Inactive</label></td>
</tr>
<input type="hidden" value="1" name="banner_uploaded" id="banner_uploaded">
<tr>
<td>For Country - </td>
<td>
<select id="country" name="country">
<option>Not posting all the names of country</option>
</select>
</td>
</tr>
<tr>
<td><label for="Scheduling">Valid From </label></td>
<td><input type="text" value="" id="date-from" name="date-from"> Format : dd/mm/yyyy:hh/mm</td>
</tr>
<tr>
<td><label for="Scheduling">Valid Till </label></td>
<td><input type="text" value="" id="date-to" name="date-to"> Format : dd/mm/yyyy:hh/mm</td>
</tr>
<tr>
<td> </td>
<td align="right"><input type="submit" onclick="return validate_ad_form(add_adv)" value="Update Advertisement" class="button" name="update"></td>
</tr>
</tbody></table>
</form>
But I am getting $_POST['code'] empty when I am passing HTML code through it.
When I pass plain text, it works fine.
When I printed $_POST [i.e. used - print_r($_POST) ], I got the following output -
Array ( [ad_id] = 15 [name] = Banner [placement] = ad_468x60 [code] = [status] = 1 [banner_uploaded] = 1 [country] = IN [date-from] = [date-to] = [update] = Update Advertisement )
Please be known, I haven't entered the 'date-from','date-to' fields.
I have entered on purpose as StackOverflow don't allow me to post images!
People,any help will be highly appreciated.
Hi All,
Im wanting to organize a series of dates in the following format. As a bit of context, the dates are the dates of upcoming events that can be added by my users. The format:
January 2011
date - event
date - event
date - event
February 2011
date - event
date - event
date - event
with all events in a given month, arranged by the date on which they occur. All of my event dates are stored in my database as unix timestamps. Problem is, i dotn know where id start to develop a function that would order all of my events in this way. Can anyone help me out?
Cheers
I'm storing leads in a database, and each lead has a datetime field with a PST timezone based date & time.
I want my user to be able to display all leads from a certain date (e.g. today, yseterday), and choose the timezone.
E.g. if I want to see all leads that were generated yesterday in EST timezone, I need to first convert (or read) all the datetime values to EST, and then only select those who are in the right range (yesterday).
What would be the best way to do that?
Hi all,
I have have an array as follows:
$row[6]
This section of the array has 4 numbers within it that I can display and use without any problems, what I'd like to be able to do is sum the first two numbers and the last two numbers separately.
Is there any way to do this?
Thanks in advance,
Homer.
Hi everybody,
I want to create a function that returns the full path from a set node, back to the root value. I tried to make a recursive function, but ran out of luck totally. What would be an appropriate way to do this? I assume that a recursive function is the only way?
Here's the array:
Array
(
[0] => Array
(
[id] => 1
[name] => Root category
[_parent] =>
)
[1] => Array
(
[id] => 2
[name] => Category 2
[_parent] => 1
)
[2] => Array
(
[id] => 3
[name] => Category 3
[_parent] => 1
)
[3] => Array
(
[id] => 4
[name] => Category 4
[_parent] => 3
)
)
The result I want my function to output when getting full path of node id#4:
Array
(
[0] => Array
(
[id] => 1
[name] => Root category
[_parent] =>
)
[1] => Array
(
[id] => 3
[name] => Category 3
[_parent] => 1
)
[2] => Array
(
[id] => 4
[name] => Category 4
[_parent] => 3
)
)
The notoriously bad example of my recursive skills:
function recursive ($id, $array) {
$innerarray = array();
foreach ($array as $k => $v) {
if ($v['id'] === $id) {
if ($v['_parent'] !== '') {
$innerarray[] = $v;
recursive($v['id'], $array);
}
}
}
return $innerarray;
}
Thanks!
My question is about creating a secure log in routine. After comparing the user name and password to the stored values I set a session variable called logged to true. Then as the user surfs around the web page I just check the logged variable for true or false to determine if the user should have access.
This is my first time creating something like this. Is this secure? I feel like there is something else that I should be doing to make sure that users are valid.
Boy, this one is really weird. I expect the following code to print 1990, but it prints 1989!
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
$val = intval($val * 100);
echo $val;
Why on earth is this happening?
Edit: and this code:
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
echo $val . "<br>";
$val = $val * 100;
echo $val . "<br>";
$val = intval($val);
echo $val;
Prints:
19.9
1990
1989
Why does intval(1990) equal 1989???
hi
how can i find a word position in google search in my site (e.g there are several tool available which input as keyword and siteurl and display the keyword position in google)
is there any api to fetch the position ?
Thanks
i am trying it get that div displaying 5 in a row and then start a new line and display more
atm all that is happening is the are going under each other.
CODE
< div>Line1< br />Line2< br>Line3< /div>
Thank you
Hi,
I want to make a notification system. Shortly.. to compare two dates, the only problem is that i want to compare the months. to see if a month or two have passed from last notification.
i want to use one or two months from an entry in a mysql database.
the client must select when the notification must come, one or two months.
thank you,
Sebastian
i have $date variable 2009-04-29 which is Y-m-d
anybody can give idea how to extract into $d, $m, $y using simplest method as possible?
regex is preferable.
any more suggestion with simple method will be chosen. :)
I am trying to take a string of text like so:
$string = "This (1) is (2) my (3) example (4) text";
In every instance where there is a positive integer inside of parentheses, I'd like to replace that with simply the integer itself.
The code I'm using now is:
$result = preg_replace("((\d+))", "$0", $string);
But I keep getting a "Delimiter must not be alphanumeric or backslash" error.
Any thoughts? I know there are other questions on here that sort of answer the question, but my knowledge of regex is not enough to switch it over to this example.
Hello, i want to split the searchrequest into parts, if there's nothing to find.
example: "nelly furtado ft. jimmy jones" - no results - try to find with nelly, furtado, jimmy or jones..
i have an api url.. thats the difficult part.. i show you some of the actually snippets:
$query = urlencode (strip_tags ($_GET[search]));
and
$found = '0';
if ($source == 'all')
{
if (!($res = @get_url ('http://api.example.com/?key=' . $API . '&phrase=' . $query . ' . '&sort=' . $sort)))
{
exit ('<error>Cannot get requested information.</error>');
;
}
how can i put a else request in this snippet, like if nothing found take the first word, or the second word, is this possible? or maybe you can tell me were i can read stuff about this function?
thank you!!
hi guys,
i want to receive in a server a xml file sent by java by POST
how can e receive that ? and how can e parse the file, in this case a xml file...
regards.
I've been using prepared statements for a little while now and I've never had any problems.
Now I'm trying to:
$sql="SELECT PhotoID,Caption FROM Photos WHERE EntityID=? AND TypeID=? LIMIT ?,?";
$iDB = new mysqliDB(); // Extends mysqli
$stmt = $iDB->prepare($sql);
$stmt->bind_param('iiii',$entityID,$typeID,$minRange,$maxRange);
$stmt->execute();
$stmt->bind_result($photoID,$caption);
echo("Affected={$stmt->affected_rows}");
This prints -1. I have triple tested that all 4 values in bindParam are set, and that the sql query works when pasted into myAdmin with the respective values.
Any idea what may be causing this?
Hi guys,
I am here as a developer of a website. My website got different modules among which one function is to process credit card. In order to process credit card I need to implement SSL layer and process the pages. For rest of modules the SSL is optional.
Now my points are:
1.) Is the location of file for http and https same?
2.) Can the session of http and https be shared? this is required as i need user login information and cart item information.