I want to generate multiple pdf reports on click of single print button and zip all the pdf's and store it in a folder.
Any help please. I need this functionality in my project.
Hi, I'm trying to loop through a database and output data into a div, if there are 3 divs horizontally accross it will the start a new tr until it reaches another 3 etc. It is currently outputted like :
[] [] []
[]
[] []
Currently I have it working when it reaches 3 it starts a new row, but I don't know how I can only echo a new tr once? As it creates a new table row each time.
echo '<table><tr>';
while ($result)
{
$i ++;
if ($i&3)
{
echo '<td>
<div>Row Data</div>
</td>';
}
else
{
echo '<tr>
<td>
<div>Row Data</div>
</td></tr>';
}
}
echo '</tr></table>';
The $result variable is the recordset from my sql query, everything works fine I just don't know how to only create a new table row once?
Thanks
i have a web portal running which involves basic data entry. The issue being that this is highly sensitive data. And the credibility of the data entry personel is very low.
Therefore i have implemented recording of IP when an entry is made.
The Problem i am facing is if this if this person starts forwarding his IP from a proxy server then i am unable to track authenticity of the data.
How do i detect if the IP forwarding is happening/ get the real ip address of the person.
this code was working, but now it doesn't! Can anyone help?
$rss = simplexml_load_file("http://search.twitter.com/search.atom?lang=en&q=charlton&rpp=100&page=1");
foreach($rss-entry as $item){
$title = $item-title;
print "$title";
}
Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code:
Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code:
$dbc = mysql_connect("localhost" , "root" , "") or die (mysql_error());
mysql_select_db('blog_data') or die (mysql_error());
$sql = "SELECT * FROM img_uploaded";
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result))
{
if ($rows)
{
echo "<tr><td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td></tr>";
}
else
{
echo "<td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td>";
}
}
I am studying about regex, i figured out some about matching one or more character, but i have a case, but don't know how to solve this..
For example i have:
$data = "bla bla -start- blu blu blu -end- bla bla";
$pattern = "/\-start\-[\w]\-end\- /";
preg_match($pattern, $data, $matches);
print_r($matches);
i intend to take anything between '-start-' and '-end-', so i expect to get
' blu blu blu '.
any suggestion ?
I've created a login page and registration page and now I want to use that to password protect pages and have pages which show information specific to that user.
Would storing the user ID of the user logged in in a Session variable be a safe and correct way of doing this?
How easy would it be for a user to change the session variable to a different ID and access another user's information, and not having to type the users login details in?
I want to display 1 random record from a database based on the week.
I need to determine if it's a new, and if it is a new week, then select the record and display the new record.
I'm thinking I can just use a single day of the week to generate the new record, either way will work.
I'm really having a hard time conceptualizing how I'll store the record id and not select a new one when someone visits again the same day or refreshes the page.
Any ideas? Let me know if I wasn't clear enough.
I have a multidimensional array like this
array[value][1][1]
Now i would like to implement if loop like this
if ($value = array[value][1][1]) {
echo "It works";
}
Now it works if i assign the values like [1][1],[2][1].
Is it possible to compare the whole array.
I mean if the array looks like
array[value][1][1],array[value][2][1],..........,array[value][n][1]
It works should be echoed.
I tried like this.
if ($value = array[value][][]) {
echo "It works";
}
But its not working. Can anyone give me the correct syntax?
i have an ajax script that check if the user name is available or not, but it keeps taking the newest user name and the rest are out
$result = mysql_query("Select username from customer");
while ($row = mysql_fetch_array($result)){
$existing_users=array(''.$row['username'].',');
}
i know i am doing something worng
Hi to all,
I'm trying to avoid the use of eval. I can dynamically instantiate a class like this:
class myclass {}
$my_class_name = 'myclass';
$obj = new $myclass();
If the constructor is like follows:
class myclass {
public function __construct( $argument1, $argument2 ) {}
}
and i have the values of the arguments in an array, how can i dynamically instantiate the class and pass it dynamic arguments? Mind that I have no way to modify the class, so I have to work on the way of using it.
Thanks
Hi everyone,i created an application that takes the excell output of a table.There are long numbers in table cell.When i took the output the cells that have long numbers are seen like that 1234+E34.how can i fix that?Thanks for advance...
I am trying to add the SQL_CALC_FOUND_ROWS into a query (Please note this isn't for pagination)
please note I am trying to add this to a cakePHP query the code I currently have is below:
return $this->find('all', array(
'conditions' => $conditions,
'fields'=>array('SQL_CALC_FOUND_ROWS','Category.*','COUNT(`Entity`.`id`) as `entity_count`'),
'joins' => array('LEFT JOIN `entities` AS Entity ON `Entity`.`category_id` = `Category`.`id`'),
'group' => '`Category`.`id`',
'order' => $sort,
'limit'=>$params['limit'],
'offset'=>$params['start'],
'contain' => array('Domain' => array('fields' => array('title')))
));
Note the 'fields'=>array('SQL_CALC_FOUND_ROWS',' this obviously doesn't work as It tries to apply the SQL_CALC_FOUND_ROWS to the table e.g. SELECTCategory.SQL_CALC_FOUND_ROWS,
Is there anyway of doing this? Any help would be greatly appreciated, thanks.
Okay im using a snippet I found on google to take a users uploaded image and put it in my directory under Content
But Im worried about duplicates so I was going have it upload the image as a Random number
well here is my code you can probably understand what im going for through it anyways
<label for="file">Profile Pic:</label> <input type="file" name="ProfilePic" id="ProfilePic" /><br />
<input type="submit" name="submit" value="Submit" />
$ProfilePicName = $_FILES["ProfilePic"]["name"];
$ProfilePicType = $_FILES["ProfilePic"]["type"];
$ProfilePicSize = $_FILES["ProfilePic"]["size"];
$ProfilePicTemp = $_FILES["ProfilePic"]["tmp_name"];
$ProfilePicError = $_FILES["ProfilePic"]["error"];
$RandomAccountNumber = mt_rand(1, 99999);
echo $RandomAccountNumber;
move_uploaded_file($ProfilePicTemp, "Content/".$RandomAccountNumber.$ProfilePicType);
And then basicly after all this Im going try to get it to put that random number in my database
I need to know how many days are involved in a date diff. \For example:
<?
$start = new DateTime('2014-06-29 14:00:00');
$ende = new DateTime('2014-07-02 05:45:00');
$diff = $start->diff($ende);
echo $diff->format('%R');
echo $diff->days;
?>
The above code echos +2
My desired result would be 4, because the 29th, 30th, 1st and 2nd of July are "touched".
I have no idea to achieve that with the given functions. Coding a day-subtraction seems to bean open door for errors.
Hi folks
Looking for suggestions as to the best way to do this (I know there are many options):
take a variable like this:
$args = ('post_type=post&order_by=DESC&limit=10');
the create a function to convert that variable into parts like this:
$post_type = post;
$order_by = DESC;
$limit= 10;
Reason is I want a client to be able to use a string like the first to pass variables to a sql query in much the same way (but doesn't have to be exact) as you can do it in WordPress.
Is it possible to use an if statement in a MySQL query in a similar what I'm showing? I want to grab some information for upcoming events(not ones with previous dates).
ini_set('date.timezone', 'America/New_York');
$timestamp = date('m/d/Y');
$sql = "select eventID,eventTitle,eventDate from events where eventLocationID = $locationID ORDER BY eventDate DESC IF(eventDate > $timestamp) ";
I really want to avoid doing post-query if statements that will only print if it's after today's date because I run it through a pagination function, and I'd really prefer to avoid tinkering with that.
I have a script which is reading values from an excel sheet and inserting them into an sql table. My problem is when the script reads in some of the date fields it is setting them to a default value : 1970-01-01 01:00:00
I have noticed that this is happening when it comes across a date where the 'day' is greater than 12 : 13/05/2012 18:52:33 (dd-mm-yyyy hh-mm-ss)
I thought this may be due to the script thinking that this is the month field (i.e american format) and it sees it as an invalid value, so I set the default timezone to my own hoping it may resolve the problem but it made no difference. date_default_timezone_set('Europe/Dublin');
Here is an example of what my code is doing:
Excel field value :
01/05/2012 18:32:45
Script:
$start_time = $data->val($x,5);
echo $start_time = date("Y-m-d H:i:s", strtotime($start_time));
Output:
2012-01-05 18:32:45
This is the exact format I am looking for (except for the fact that the day and month fields are switched around i.e american date format) but it doesnt work for the type of dates I mentioned above.
I need to pass a variable number of strings to instantiate different classes. I can always do a switch on the size of the array:
switch(count($a)) {
case 1:
new Class(${$a[0]});
break;
case 2:
new Class(${$a[0]}, ${$a[1]});
break;
etc...
There has to be a better way to do this. If I have an array of strings ("variable1", "variable2", 'variable3", ...), how can I instantiate a Class without manually accounting for every possibility?
I have a time that is being sent to me in UTC time, but I want to adjust it so its the outer edges of the days on East Coast time (EST/EDT). That is, I want the user to be able to enter in EDT/EST centric dates, and have it query with the UTC correct dates.
$start_date and $end_date are MM/DD/YYYY formatted dates passed via a GET variable.
$start_date = date('Y-m-d 00:00:00', $start_date);
$end_date = date('Y-m-d 23:59:59', $end_date);
These dates are for use in a database query, whose times are stored in UTC time.
So, I want the start date to be the day before at 8pm or 7pm, depending on daylight savings, and then to end at 7:59:59 or 6:59:59, again depending on daylight savings.
How would I do that?
hi,
i am doing a shopping cart.i had a variable $total.when i add 1st product of price 200 i get $total=200 , when i add 2nd product of price 100 i get $total=200100 when i add 3rd product of price 400 i get $total=200100400 . i want to get $total=700. how to fix this problem?
please help me........
thanks,
Hmwd