Jump to content

louroberto

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

louroberto's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If I thought it was a duplicate thread I would not have posted it.
  2. Could some one please guide me to a possible script to accomplish this task.... I want to pull and display two separate things that are in two separate places and display them as one link on a page. I have figured out how to display the data to a page and also how to display the files to a page separately but need to accomplish this and join the 3 things together. I have a library table in the database that stores the product_code and product_name example: pk-pen(product_code) traditional fountain pen(product_name) ---- (this is where I need to get the data from) Then I have a folder on the server that is called library that has the pdf files in it. Each pdf file has the same name as the product_code that is in the database. example: pk-pen_ins.pdf What I need to accomplish is grabbing the product_code and product_name for the database and then go to the folder on the server and add the correct pdf file with that data and display it as a link on a page for customers to download. bee struggling with this and pasted code that i have to do each task separately but cant seem to get it all in one script to do the above. I understand that this could be asking for a lot here but I am new to this and would be forever in debt to your kindness. Thanks on this in advance
  3. Yes there are two tables in the db one is library and the other is files which both contain a file_id. I need to grab the information but I also need to include in the displayed information which would be a list the pdf file that is attached to the product_code and that file is in a directory folder called library on the server. Sorry if my explanation is not clear but I am new to this and I greatly appreciate all the help. If I run the above select how would that actually display the pdf file from the directory folder and the correct prouduct code and name
  4. Would that also get the actual pdf file from the directory on the server though. I am going to try this thanks
  5. OK i am trying to display a list on a page that displays a product code, product name and a pdf file. The product_code and product_name are in the database and the pdf files are in a folder on the server. I figured out how to display the data from the data base and also how to display the files from the directory folder. Where I am having trouble is getting the 2 scripts to work together. My end result would display a link on the page that would read like this PK-PEN: Slimeline Pen Kit Instuctions (this would be a link to the pdf for download) In the database there is also a file table that has the name of the pdf file with a file_id and this file_id is also in the library table where i am pulling the product_code and product_name from if that helps. Here is my code for the data display <?php $username=""; $password=""; $database=""; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM library"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b>Pen Kits</b><br><br>"; $i=0; while ($i < $num) { $productcode=mysql_result($result,$i,"product_code"); $productname=mysql_result($result,$i,"product_name"); echo "<b>$productcode</b>: $productname</a><br>"; $i++; } ?> Here is the code for the pdf display from the directory.... <?php $username=""; $password=""; $database=""; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM library"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b>Pen Kits</b><br><br>"; if ($handle = opendir('/home/httpd/vhosts/pennstateind.com/httpdocs/library/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<a href="'.$file.'">'.$file.'</a>'; } } closedir($handle); } ?> <P>List of files:</p> <P><?=$thelist?></p> My question is how do I combine these 2 and make them return the result of a list that would display a link to download the PDF file. I am new to PHP and any help would be great. Thank you in advance a million times over!!!!! Lou
  6. OK so I am trying to figure out how to get things to display unique files for each product code and name. I posted some other threads but got no response and I am working through the code as a newbie. I am running Mysql 4.1.2 and I am trying to display a product code, product name and also in this display link to the appropriate pdf file for download. I got this far but now I need to link each product code to the PDF file for that product code. Cant seem to make the connection. any takers? <?php $username="root"; $password=""; $database="psi"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM library"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b>Pen Kits</b><br><br>"; $i=0; while ($i < $num) { $productcode=mysql_result($result,$i,"product_code"); $productname=mysql_result($result,$i,"product_name"); echo "<b><a href='library/PK-PEN_ins.pdf'>$productcode</b>: $productname</a><br>"; $i++; } ?> Here is the link to the page www.pennstateind.com/display-products.php Thanks any helpers...
  7. Hello all, I am new to php and was wondering if i could get some guidance here. I am using phpAdmin 2.6.0 and running Mysql 4.1.21. here is my situation.... I have a script that allows us to upload a new product name, product code, category and a PDF file to the data base. There is also a folder on the server that has the PDF files in it. I think I deleted the code on the page (library.php) that displays the files for the client to download. My goal here is after I upload everything I want it to then be displayed on the page with a link to the PDF file. Here is the page that has the links on it. I hope that I explained this correctly. I am not a programmer but do have some idea and have been reading up on php to try and figure this out. I am looking to create the script that would display the links on the library.php page. Any help would be great. The other link is to the script that allows us to upload. www.pennstateind.com/library.php www.pennstateind.com/lib-admin.php
  8. Hello all, I am new to this forum and I am not an avid programmer but do have some experience but very limited. I am trying to add a category at the bottom of this php page. You will see the assign category section. I need to have a radio at the end of that list to say Bushings. I am looking through the code but can not seem to figure it out. Do I need to add the category in the DB first. It seems like this is happening on the fly when the page is called up. Any help would be great. It is a SQL database. I know being a beginner I am out of my league here but I have to try to get this done. Thanks in advance for any tips. Here is the link to the page I am working on: http://www.pennstateind.com/lib-admin.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.