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 .....

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.

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;


$sql = "select Image1 from WAPdata where CId = '{$id}'";


$result = mysql_query("$sql");


while($row = mysql_fetch_assoc($result))


{


$bytes = $row;


}


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 .......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.