|
here is an example that I found in php tutorials
<br />
< ? php<br />
<br />
require_once( "icepay.php" );<br />
$icepay = new ICEPAY( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );<br />
if ( $icepay->;OnPostback() )<br />
{<br />
$data = $icepay->;GetPostback();<br />
switch ( strtoupper($data->status) )<br />
{<br />
case "OK":
break;<br />
case "OPEN":
break;<br />
case "ERR":
break;<br />
case "REFUND":
break;<br />
case "CBACK":
break;<br />
}<br />
}<br />
<br />
?> <br />
<br />
|
|
|
|
|
Hi everybody,
I was implementing an image gallery from one of tutorials. In this tutorial PHP opens a directory and loops through it and outputs all image files. I am looking for code solution how to change this loop to output only those images that belongs to particular image album. There should be way to run SQL query and select files and then output them, problem is I have no idea how.
When I upload image I store some data to following table:
CREATE TABLE tbl_image (
im_id INT NOT NULL AUTO_INCREMENT,
im_user_name VARCHAR(25) NOT NULL,
im_album_id INT NOT NULL,
im_title VARCHAR(64) NOT NULL,
im_description TEXT NOT NULL,
im_type VARCHAR(30) NOT NULL,
im_image VARCHAR(60) NOT NULL,
im_date DATETIME NOT NULL,
PRIMARY KEY(im_id)
);
here is the code piece that should be changed:
<?php
$thumb_directory = 'img/thumbs';
$orig_directory = 'img/original';
$stage_width=600;
$stage_height=400;
$allowed_types=array('jpg','jpeg','gif','png');
$file_parts=array();
$ext='';
$title='';
$i=0;
$dir_handle = @opendir($thumb_directory) or die("There is an error with your image directory!");
$i=1;
while ($file = readdir($dir_handle))
{
if($file=='.' || $file == '..') continue;
$file_parts = explode('.',$file);
$ext = strtolower(array_pop($file_parts));
$title = implode('.',$file_parts);
$title = htmlspecialchars($title);
if(in_array($ext,$allowed_types))
{
$left=rand(0,$stage_width);
$top=rand(0,400);
$rot = rand(-40,40);
if($top>$stage_height-130 && $left > $stage_width-230)
{
$top-=120+130;
$left-=230;
}
echo '
<div id="pic-'.($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
<a class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank">'.$title.'</a>
</div>';
}
}
closedir($dir_handle);
?>
any thoughts or suggestions are appreciated.
Thanks
|
|
|
|
|
You need to read image names from database instead of scanning the directory, using a query like:
SELECT * FROM tbl_image WHERE im_album_id = XXX
Reading a basic PHP/MySQL Tutorial[^] will help.
|
|
|
|
|
I do understand that bit, but how to output query results the same way as they are in while loop?
|
|
|
|
|
wartotojas wrote: how to output query results the same way as they are in while loop?
Many of the most basic tutorials demonstrate this. This Tizag Tutorial[^] is a good example.If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Problem solved, thanks for suggestions everybody
|
|
|
|
|
anybody pls suggest me how to write code for device drivers in linux.. i ve no idea abt programming those.. if any body has code for the device drivers pls give me
|
|
|
|
|
Your question implies you are not sure what a device driver does. I suggest you take a look here[^] for help, and be prepared for a lot of hard work. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Read the book[^] first.
The code of Linux device drivers is available here[^].
|
|
|
|
|
how to open and read .zip file in php example :-"http://www.nseindia.com/content/historical/EQUITIES/2010/FEB/cm03FEB2010bhav.csv.zip".
which function need to use.
|
|
|
|
|
did you consider googling PHP zip ?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
|
How can i take a menu made in javascript inside a particular column of a table ???
|
|
|
|
|
your question is not so clear. provide some code so that it can be answered.
|
|
|
|
|
I am going to presume you mean a html table made in php.
answer is just like you would in html.
If you have designed the code in html and have it working then to get the same results in php just echo or print the html + javascript.
for example if this:
<table><tr>
<td>
<script>
my_js_menu();
</script>
</td>
</tr></table>
works in an html page, then to get the same from a php page you can echo the html text of weave the php around the html.
inside php it would look like....
or weaving the php around the html would look like...
<table><tr>
<td>
<script>
my_js_menu();
</script>
</td>
</tr></table>
|
|
|
|
|
Hi!
I'm new to linux, and find it very interesting, I decide to learn linux ARM after days,could someone give me some advise,also introduce some good book,thanks!
modified on Sunday, January 31, 2010 7:10 PM
|
|
|
|
|
start by reading this[^] book which explains application programming in Linux. Also you need to learn vi editor and if you want to do GUI development then learn QT.
|
|
|
|
|
Himanshu Joshi / Black belt programmer wrote: Also you need to learn vi editor
That's a cruel thing to do to a newbie. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
Yeah, me to , I think we can study linux together! my OS is ubuntu
and my email is wbgjj@163.com
|
|
|
|
|
you can login to the www.verycd.com website,where you may find some books that you want.I have a book(Wiley Linux Bible 2010 Edition)!!
|
|
|
|
|
Hi everybody!
1. I registered with google analysis already. This tool help me to report visitors and so on...
2.I im finished my site at http://soft-overtime.com
3.I verified this site with google successfully(sitemap and meta tag).
When i point these bellow items(in googleWebmaster tools), no data available.
# Your site on the web
* Top search queries
* Links to your site
* Keywords
* Internal links
* Subscriber stats
I've got some question:
1. How can i do to let google know which keywords users searched on my site.
The same question for others Items.
Thanks !
|
|
|
|
|
1. Set page encoding (UTF-8)
2. The text page should be about 5-7% of your keywords.
3. Apply with <strong> these keywords
4. If your site is new, it is in the sandbox Google - must wait until released from the sandbox.
Take these simple steps and you will get an answer to many of your questions.
More information - html tutorials
|
|
|
|
|
hey, ok its going to take some time for some data to arrive such as links, search terms etc, also on the right hand side of the webmaster tools page you can change the time range from 7days to dec, jan etc.
|
|
|
|
|
Okay, I tried using W3Schools to "UPDATE" a timestamp, upon logging in, here is my code:
$sql = mysql_query('UPDATE `DBNAME`.`TABLENAME` SET `lastactive` = NOW() WHERE `TABLENAME`.`username` = $username ;');
Here is the login code:
if(isset($_POST['login'])){
$username= trim($_POST['username']);
$password = trim(md5($_POST['password']));
if($username == NULL OR $password == NULL){
$final_report.="Please complete all the fields below..";
}else{
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report.="The username that you submitted does not exist..";
}else{
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] == $password){
$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
That is the code above the timestamp issue. The page loads and everything, it just doesn't update it into the database... Please Help. Thanks!
|
|
|
|