array / mysql问题 [英] array / mysql question

查看:43
本文介绍了array / mysql问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了一段时间来创建相册。不久,宣布了一张

照片阵列,最初它们显示为缩略图,

点击缩略图显示更大的照片,并且有链接到

缩略图列表以及上一张和下一张照片的功能

会记住照片在阵列中的位置。

现在我试图通过从一个mysql数据库中检索照片来做同样的事情

(这很实用)通过搜索以

某个字符串开头的文件名。它仍然可以工作,但奇怪的是,对于下一张和上一张照片的参考

失败了。指示符foto 1 van 10,foto 2

van 10在这个版本中没有正常工作。

我不完全确定错误是在这些函数中的一个,但我想

它必须与它有关


这是数组的代码,我在
使用它 http://www.parochiebeekendonk.nl/fconinck.php

function addThumbnails()//创建要添加的文件数组{

$ numargs = func_num_args();

$ arg_list = func_get_args();

// $ teller = 0;

for ($ i = 0; $ i< $ numargs; $ i ++)

{

$ this-> foto_array [] = $ arg_list [$ i]; < br $>
// $ teller ++;

}

}


//调用班级

$ f = new fotoAlbum();

$ f-> addThumbnails(" foto1.php"," foto2.php",...)


现在我使用的数据库代码
http://www.parochiebeekendonk.nl/ceci2k6.php


功能getFromMySql($ bestandspatroon)

{

$ this-> mysql = true;

$ lengte = strlen($ bestandspatroon);

$ db = mysql_connect(" servername" ;,"登录","密码");

mysql_select_db(QUOT;数据库",$分贝)或死亡(" FOUT:OPENEN

DATABASE MISLUKT" );

$查询=请求mysql_query(QUOT;从照片SELECT bestandsnaam其中

LEFT(bestandsnaam,$ lengte)= '' $ bestandspatroon '' 通过bestandsnaam ASC顺序" ;,

$ db);

while(list($ bestandsnaam)= mysql_fetch_row($ query))

{

$ this-> foto_array [] = $ bestandsnaam;

}

mysql_close($ db);

}
<登记/>
//调用类

$ F =新fotoAlbum();

$ F-> getFromMySql(QUOT; ceci2k6")<无线电通信/>

正如您在页面上看到的那样,两个页面都会加载一个列表缩略图,但

后者只允许导航到缩略图页面,而不是

上一页或下一页。


感谢您的任何建议,


Martien,

I have been using for a while a class to create photo albums. Shortly, an
array of photo''s is declared, initially they are shown as thumbnails, by
clicking on a thumbnail a larger photo is shown and there are links to the
thumbnail list but also to the previous and next photo as the function
remembers which position the photo has got in the array.
Now I tried to do the same thing by retrieving photos from a mysql database
(which is much practical) by searching for filenames that start with a
certain string. It still works but curiously enough the reference to the
next and previous photo fails. Also the indicator "foto 1 van 10", "foto 2
van 10" doesn''t work correctly in this variant.
I am not completely sure the error is in one of these functions but I guess
it must have to do with it

This is the code for the array, I used it at
http://www.parochiebeekendonk.nl/fconinck.php
function addThumbnails()//create an array of files to add {
$numargs = func_num_args();
$arg_list = func_get_args();
//$teller = 0;
for ($i = 0; $i < $numargs; $i++)
{
$this->foto_array[] = $arg_list[$i];
//$teller++;
}
}

//calling the class
$f = new fotoAlbum();
$f->addThumbnails("foto1.php","foto2.php",...)

Now the database code I used for
http://www.parochiebeekendonk.nl/ceci2k6.php

function getFromMySql($bestandspatroon)
{
$this->mysql = true;
$lengte = strlen($bestandspatroon);
$db = mysql_connect("servername", "login","password");
mysql_select_db("database",$db) or die ("FOUT: OPENEN
DATABASE MISLUKT");
$query = mysql_query("SELECT bestandsnaam from fotos where
LEFT(bestandsnaam, $lengte)=''$bestandspatroon'' order by bestandsnaam ASC",
$db);
while (list($bestandsnaam) = mysql_fetch_row($query))
{
$this->foto_array[] = $bestandsnaam;
}
mysql_close($db);
}

//calling the class
$f = new fotoAlbum();
$f->getFromMySql("ceci2k6")

As you can see on the pages, both pages load a list of thumbnail but the
latter only allows navigation by going to the thumbnail page, not to the
previous or next pages.

Thanks for any suggestions,

Martien,

推荐答案

numargs = func_num_args() ;
numargs = func_num_args();


arg_list = func_get_args();

//
arg_list = func_get_args();
//


teller = 0;

for(
teller = 0;
for (


这篇关于array / mysql问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆