hi there. i am so stuck. i want to use a php/mysql navigation type setup. i have written the mysql code which is this:
CREATE TABLE profile (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
picture CHAR(30) NOT NULL,
PRIMARY KEY (id)
)
load data infile "c:/apache/htdocs/lojsite/database/profiletable1.txt" into table profile
fields terminated by ','
the profiletable1.txt contains lines like this:
6, /pics/pics6.jpg, text 6 text 6 text 6 text 6 text 6 text 6
(it is comma delimited)
i want to show each row as a page so in effect you get this view.php?id=23 where the 23 record that i insert into mysql is what will be shown.
i would love it if you could help me out in this.
how to mysql/php page navigate?
Moderator: General Moderators
You have a id and a picture field in the table, but looking at:
Neverless, this is just a small example, untested but the ideas are there for you to lookup in the manual:
I'm wondering where the6, /pics/pics6.jpg, text 6 text 6 text 6 text 6 text 6 text 6
part ends up..., text 6 text 6 text 6 text 6 text 6 text 6
Neverless, this is just a small example, untested but the ideas are there for you to lookup in the manual:
Code: Select all
<?php
// apage.php
// db connection here
$result = mysql_query("select id, picture from profile");
while ($row = mysql_fetch_array($result)) {
echo '<a href="image.php?id='.$row['id'].'">'.basename($row['picture']).'</a><br />';
}
?>Code: Select all
<?php
// image.php
// db connection here
if (!empty(instval($_GET['id']))) {
$result = mysql_query("select * from profile where id = $_GET['id']");
while ($row = mysql_fetch_array($result)) {
echo 'ID: '.$row['id'].'<img src="'.$row['picture'].'">';
}
}