SourceTec Software

It is currently Thu Apr 24, 2014 3:41 pm

All times are UTC + 8 hours




Post new topic Reply to topic  [ 17 posts ] 
Author Message
PostPosted: Wed Mar 05, 2008 9:14 pm 
Offline
Member

Joined: Wed Mar 05, 2008 9:06 pm
Posts: 3
How can I put retrieved data from MySQL db and scroll on javascript 1.2.

thx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 3:34 am 
Offline
Guru

Joined: Wed Jan 31, 2007 4:21 am
Posts: 1116
huh???


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 9:46 am 
Offline
Support Team
Support Team
User avatar

Joined: Thu Aug 01, 2002 5:59 pm
Posts: 1808
Here is the database driven sample:
http://www.sothink.com/product/javascri ... /aspdb.htm


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 5:06 am 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Is there a php/mysql sample? Can anyone help out?

Please?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 8:56 am 
Offline
Support Team
Support Team
User avatar

Joined: Thu Aug 01, 2002 5:59 pm
Posts: 1808
Please reference the menu sample driven from PHP database:
http://www.sothink.com/product/dhtmlmen ... /index.htm

The scroller sample is not available now, however we will provide it ASAP.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 9:04 am 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Hi,

If you could just give me the correct code to plug into the prefix and suffix of the condition, I am sure that I could get it.

Pete


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 4:15 pm 
Offline
Support Team
Support Team
User avatar

Joined: Thu Aug 01, 2002 5:59 pm
Posts: 1808
Here is the PHP sample, please check.

Here is the PHP sample page.
http://www.sothink.com/product/javascri ... /phpdb.htm


You do not have the required permissions to view the files attached to this post.


Last edited by Ellie on Tue Mar 11, 2008 1:10 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 6:57 pm 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Perfect, Thankyou very much! It works like a charm. Keep up the good work.

Pete


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 08, 2008 11:53 pm 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Hi,

I have been struggling for hours to try and convert the sample to work with a MySql database and would really appreciate some help.

This is the code that I have in the test.php page:

<?
$username="USERNAME";
$password="PASSWORD";
$database="DATABASE";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database);
$query="SELECT * FROM Slideshow";
$result=mysql_query($query);
$numrows = mysql_numrows($result);
?>

<html>
<head>
<title>Scroller PHP Sample - MySql</title>
<script type="text/javascript" language="JavaScript1.2" src="stscode.js"></script>
</head>
<body>
<p>Image Scroller</p>
<p>
<script type="text/javascript" src="scroll_js.php"></script>
</p>
</body>
</html>

The database is connecting successfully and I am able to echo the variable $numrows.

The code that I have in the webscroller conditions prefix is:

/*
<?php
for ($i = 0; $i < $numrows; $i++)
{
$row = mysql_fetch_array($result);
$image_id=$row["image_id"];
$image_name=$row["image_name"];
$image_description=$row["image_description"];
$image_url=$row["image_url"];
$image_path=$row["image_path"];
?>
*/

When I try to view the test page, the webscroller is not visible. When I switch the conditions code back to the text example code it works so logic would dictate that I have something wrong with my conditions code.

Thanks for any help offered,

Pete


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 9:01 am 
Offline
Support Team
Support Team
User avatar

Joined: Thu Aug 01, 2002 5:59 pm
Posts: 1808
Please provide me your *.sjc file and URL (or your pages) to have a look.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 10:31 am 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Hi,

I have pm'd you the files.

Thanks,
Pete


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 11:28 am 
Offline
Support Team
Support Team
User avatar

Joined: Thu Aug 01, 2002 5:59 pm
Posts: 1808
Yes, I've received it.

It seemed that the scroller did not get any item data, which can be caused by the following reasons, please check:

1. $numrows = mysql_numrows($result), the red code should be mysql_num_rows.
2. No data in your database, or the query result returns empty.
3. PHP does not support short_open_tag. You should manually change <?=$image_path?> into <?php echo($image_path)?>

Have a try!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 7:21 pm 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Hi Ellie,

Thanks for your continued help but still no luck. You can see the results at: http://www.benesure.com/test.php. I am pretty sure that the query result is not returning empty and there definitely are two test rows in the database table. To test this, I created another page: http://www.benesure.com/testshow.php where I echo the two rows using:

echo "<table border='1'>";
echo "<tr> <th>Image Name</th> <th>Image Description</th> <th>Image URL</th> <th>Image Path</th></tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td>";
echo $row['image_name'];
echo "</td><td>";
echo $row['image_description'];
echo "</td><td>";
echo $row['image_url'];
echo "</td><td>";
echo $row['image_path'];
echo "</td></tr>";
}
echo "</table>";

and you can see for yourself that the data is showing on the page, but the scroller is not. I have attached the modified files that you suggested for your review.

Any other ideas?

Pete


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 4:25 pm 
Offline
Member

Joined: Tue Mar 11, 2008 3:54 pm
Posts: 2
the test.php and scroll_js.php are two files.
the database connection in test.php can not use in the file scroll_js.php.
the var $numrows has no value in scroll_js.php.
so use this,
/*
<?php
$username="user";
$password="password";
$database="database";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database);
$query="SELECT * FROM Slideshow";
$result=mysql_query($query);
$numrows = mysql_num_rows($result);
for ($i = 0; $i < $numrows; $i++)
{
$row = mysql_fetch_array($result);
$image_id=$row["image_id"];
$image_name=$row["image_name"];
$image_description=$row["image_description"];
$image_url=$row["image_url"];
$image_path=$row["image_path"];
?>
*/


PS:$password="password; ^_^ .......


Last edited by Grey on Tue Mar 11, 2008 4:32 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 4:28 pm 
Offline
Member

Joined: Tue Mar 11, 2008 3:54 pm
Posts: 2
Moreover:
use
"while($row=mssql_fetch_array($result))"
is better.
not "for"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 12, 2008 10:10 am 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Great! Thanks for your help. I finally have it working.

cheers,
Pete


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 29, 2008 5:23 am 
Offline
Member

Joined: Mon Dec 11, 2006 9:21 am
Posts: 17
Hi,

For anyone interested, attached is a working php/mysl sample.

Pete


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC + 8 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group