Code Comments
Programming Forum and web based access to our favorite programming groups.I am a beginner in PHP. On my website, I have pages with photos thumbnails. Each thumbnail is a link opening a html page with a larger photo and some text. I saw on some web sites that it is possible to do the same with PHP with the great advantage of always reusing the same html page to load different photos and descriptive text. Links to tutorials explaning how is it done? Many thanks! Pascal --- Ce courriel est exempt de virus. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 2004-10-25
Post Follow-up to this message"Pascal Bouchard" <forum@mitan.ca> schreef in bericht news:W6xid.263$ab.145059@weber.videotron.net... > I am a beginner in PHP. > On my website, I have pages with photos thumbnails. Each thumbnail is a link > opening a html page with a larger photo and some text. > I saw on some web sites that it is possible to do the same with PHP with the > great advantage of always reusing the same html page to load different > photos and descriptive text. > Links to tutorials explaning how is it done? > Many thanks! > Pascal > Create a database pictures(id, pic, text) etc dont forget to connect to ur database first see www.php.net index.php <?php $sql = "SELECT pic,id " . "FROM pic "; $query = mysql_query("$sql") or exit ("Ongeldige query " . mysql_error()); while($row = mysql_fetch_array($query)) {echo '<a href="picpage.php?pic_id='.$row[id].'"><img src="thumbs/'.$row[pic].'"> </a>';} ?> picpage.php <?php $sql = "SELECT pic,text " . "FROM pic " . "WHERE id =$_GET[id]"; $query = mysql_query("$sql") or exit ("Ongeldige query " . mysql_error()); $row = mysql_fetch_array($query); echo '<img src="'.$row[pic].'">'; echo '<p>'.$row[text].'</p>'; ?>
Post Follow-up to this messageMany thanks, Floortje. Now I know for sure it can be done and that I have to do my part and do some tutorials! Dans un message précédent, Floortje <floortje- apestaartjexs4allpuntnl@hetminnetjehoort .erbij> a écrit: > "Pascal Bouchard" <forum@mitan.ca> schreef in bericht > news:W6xid.263$ab.145059@weber.videotron.net... > > Create a database > pictures(id, pic, text) etc > dont forget to connect to ur database first see www.php.net > > index.php > <?php > $sql = "SELECT pic,id " > . "FROM pic "; > $query = mysql_query("$sql") > or exit ("Ongeldige query " . mysql_error()); > while($row = mysql_fetch_array($query)) > {echo '<a href="picpage.php?pic_id='.$row[id].'"><img > src="thumbs/'.$row[pic].'"> </a>';} > > > > picpage.php > <?php > $sql = "SELECT pic,text " > . "FROM pic " > . "WHERE id =$_GET[id]"; > $query = mysql_query("$sql") > or exit ("Ongeldige query " . mysql_error()); > > $row = mysql_fetch_array($query); > > echo '<img src="'.$row[pic].'">'; > echo '<p>'.$row[text].'</p>'; --- Ce courriel est exempt de virus. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 2004-10-26
Post Follow-up to this message"Pascal Bouchard" <forum@mitan.ca> schreef in bericht news:HdMid.48183$ab.598808@weber.videotron.net... > Many thanks, Floortje. > Now I know for sure it can be done and that I have to do my part and do some > tutorials! Actually the code is allmost done. All u need to do is quickly read over some basic PHP syntax, basic SQL and google for phpmyadmin Floortje
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.