| | |
Image Scrolling using PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
•
•
I'm developing a WAP site using wml and PHP.
i want to display some images from database (mysql).
The problem is , how can i display more than one image in a single wml page ?
Is it possible to implement "Image Scrolling " using PHP ?
please help me .....
You can't implement image scrolling with PHP. The scrolling of the images would have to be invoked on the HTTP client, which in this case is the WAP enabled phone. The only way to do this is to have a script execute on the client, hence the use of JavaScript or VBScript for IE etc. I don't think a WAP phone would support JavaScript, but if it does, thats how you'd do it - not PHP.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Index.php
=========
<?php
header('Content-type:text/vnd.wap.wml');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\" >";
?>
<wml>
<card id="homepage" title="Mobile Coupons">
<p align="center">
<img src="show_image.php?id=1" width="34" height="37"/>
<anchor>Next
<go href="#image"/>
</anchor>
</p>
</card>
<card id="image" title="Mobile Coupons">
<p align="center">
<img src="show_image.php?id=2" width="78" height="84"/>
<anchor>
Back
<prev/>
</anchor>
</p>
</card>
</wml>
show_image.php
===============
<?php
function db_connect($user='root', $password='admin', $db='Mobile')
{
mysql_connect('localhost', $user, $password) or die('I cannot connect to db: ' . mysql_error());
mysql_select_db('Mobile);
}
db_connect();
$id = $_GET['id'];
$sql = "select Image1 from WAPdata where CId = '{$id}'";
$result = mysql_query("$sql");
while($row = mysql_fetch_assoc($result))
{
$bytes = $row['Image1'];
}
header("Content-type: image/jpeg");
echo $bytes;
exit ();
mysql_close();
?>
===============================================
This is my sample code that im trying....
here im loading 2 images by passing ids (id=1 , id =2 )
there r lot of images in the database. so this way is not possible.
can anybody tell me how to generalise it...?
if i click "next", the id should increment by one... like that .......
=========
<?php
header('Content-type:text/vnd.wap.wml');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\" >";
?>
<wml>
<card id="homepage" title="Mobile Coupons">
<p align="center">
<img src="show_image.php?id=1" width="34" height="37"/>
<anchor>Next
<go href="#image"/>
</anchor>
</p>
</card>
<card id="image" title="Mobile Coupons">
<p align="center">
<img src="show_image.php?id=2" width="78" height="84"/>
<anchor>
Back
<prev/>
</anchor>
</p>
</card>
</wml>
show_image.php
===============
<?php
function db_connect($user='root', $password='admin', $db='Mobile')
{
mysql_connect('localhost', $user, $password) or die('I cannot connect to db: ' . mysql_error());
mysql_select_db('Mobile);
}
db_connect();
$id = $_GET['id'];
$sql = "select Image1 from WAPdata where CId = '{$id}'";
$result = mysql_query("$sql");
while($row = mysql_fetch_assoc($result))
{
$bytes = $row['Image1'];
}
header("Content-type: image/jpeg");
echo $bytes;
exit ();
mysql_close();
?>
===============================================
This is my sample code that im trying....
here im loading 2 images by passing ids (id=1 , id =2 )
there r lot of images in the database. so this way is not possible.
can anybody tell me how to generalise it...?
if i click "next", the id should increment by one... like that .......
![]() |
Similar Threads
- Firefox Compatibility help with script (JavaScript / DHTML / AJAX)
- Iframe inside close - Is there a better way? (JavaScript / DHTML / AJAX)
- PHP and TEXT FILES (PHP)
- Moving iFrames (JavaScript / DHTML / AJAX)
- iframe help - Height (HTML and CSS)
- Python and the JPEG Image File, Part 2, The Image (Python)
Other Threads in the PHP Forum
- Previous Thread: Web Service in PHPٌ
- Next Thread: Lab scheduling
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms snippet soap source space speed sql static structure syntax system table tutorial up-to-date update upload url validation validator variable video web wordpress xml youtube






