pdf view
Moderator: General Moderators
pdf view
hey guys im making a web site for a distributor and he hase a big catalogue..
now it is all in excell so what i did is converted them to pdf and merged the categories.
now when you view a pdf it is not that nice on a web site.does anybody have any suggestion?or is there a script out there allready made for catalogues?
now it is all in excell so what i did is converted them to pdf and merged the categories.
now when you view a pdf it is not that nice on a web site.does anybody have any suggestion?or is there a script out there allready made for catalogues?
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
the best way is to first save the excel files as CSV format. this is the easiest to deal with in PHP. After you do that search google for parseing a CSV file in PHP and you will get many results. As you are parsing it you will just insert the data into a database. After that you will use PHP again to output everything dynamically.
Lets start with the getting everything into a database. Steps: make all excel files CSV files. open and parse the csv files with PHP and save all information to a database.
If you need help just ask
Lets start with the getting everything into a database. Steps: make all excel files CSV files. open and parse the csv files with PHP and save all information to a database.
If you need help just ask
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i think it shold look like this?Code: Select all
<?PHP
//CONFIG VALUES TO SHOW WHICH COMPANY AND EMAIL LIST DATA IS ENTERED FOR
$list_id = "85";
$company_id = "40";
//CONNECTS TO THE MYSQL DATABASE WHERE DATA WILL BE STORED
$link = mysql_connect("localhost", "user","password") or die("Could not connect: ".mysql_error());
$db = mysql_select_db("email_newsletter") or die(mysql_error());
//SETS ROW VALUE OF 1
$row = 1;
//OPENS CSV FILE
$handle = fopen ("good_csv.csv","r");
//PARSES INFORMATION
while ($data = fgetcsv ($handle, 1000, ",")) {
//ONLY SELECTS RECORDS WITH A FIRST NAME, LAST NAME, AND EMAIL
if($data[0] != "" && $data[1] != "" && $data[2] != "") {
$data[0] = addslashes($data[0]);
$data[1] = addslashes($data[1]);
$data[2] = addslashes($data[2]);
//FIRST QUERY INSERTS EMAIL AND LIST INTO SUBSCRIBERS TABLE
$query = "INSERT INTO subscribers(`list_id`,`email`) VALUES('".$list_id."', '".$data[2]."')";
$result = mysql_query($query) or die("Invalid query: " . mysql_error().__LINE__.__FILE__);
//GRABS ID FROM QUERY FOR LOYALTYMAX CUSTOMER TABLE
$subscriber_id = mysql_insert_id();
//SECOND QUERY BUILDS CUSTOMER PROFILE IN LOYALTY CUSTOMER DATABASE
$query2 = "INSERT INTO loyaltymax_customer(`first_name`,`email`,`company_id`,`last_name`,`list_id`,`subscriber_id`) VALUES('".$data[0]."','".$data[2]."','".$company_id."','".$data[1]."','".$list_id."','".$subscriber_id."')";
$result2 = mysql_query($query2) or die("Invalid query: " . mysql_error().__LINE__.__FILE__);
//PRINTS EACH RECORD
echo("{$row}. {$data[0]}, {$data[1]}, {$data[2]} ");
//IF MYSQL RESULT 1 & 2 ARE TRUE THEN PRINTS RECORD INSERTED, ELSE PRINTS ERROR
if($result = "1" && $result2 = "1") {
echo(" => RECORD INSERTED <br>");
} else {
echo(" => ERROR <br>");
}
}
//NEXT ROW
$row++;
}
//CLOSES CSV FILE WHEN COMPLETE
fclose ($handle);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]found this to
http://www.csvreader.com/csv_samples.php
http://www.csvreader.com/csv_samples.php
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
that is only for ASP it seams. The first example you posted there looks good except for a few things such as this line:techker wrote:found this to
http://www.csvreader.com/csv_samples.php
Code: Select all
if($result = "1" && $result2 = "1") {Code: Select all
if($result && $result2) {try that one out and see if you can get it to work properly.
and watch out when doing comparisons in if statements
you had
this should have been
spot the double == signs, your if statement would never have worked.
you had
Code: Select all
if ($result = "1" && $result2 = "1"){
Code: Select all
if ($result == "1" && $result2 == "1"){