Jump to content

lindenbridge612

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lindenbridge612's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have Wampserver installed on my PC, and I accidentally deleted index.php from the "www" directory folder, so when I turn on Wampserver and go to my localhost page, all I see is an "indexof" list of my folders instead of the old home page that has a link to phpmyadmin. Is there any way to retrieve index.php without having to reinstall Wampserver (which would delete all the folders I have inside the "www" directory)?
  2. I fixed my own problem, again. Using an FTP program to access the website, I had to individually right click on all php files and change the file permission number from 777 to 755. At least anyone else that encounters this problem will now know how to solve the issue
  3. I read this article: http://www.htmlite.com/php042.php, and it says to open up the site in a FTP program, right click on the folder, and change the file permissions. I looked at the number my folder is currently set to, and it says “715”. Should I change that number to 755?
  4. About a week ago, the webhosting company I am using on one of my websites decided to upgrade to PHP5 on their Apache Server. After that occurred, my formmailer.php file would no longer send emails. Then, I added the line: ini_set("sendmail_from", "user@domain.com"); just above this line: mail($to,$subject,$message,$from); Suddenly, the formmailer.php file started sending emails again. However, yesterday, all my php files on the website encountered the following message when I tried to view them online: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@chocolateaccents.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. So I checked the error log, and found this message for all my php files: Premature end of script headers: /hsphere/local/home/user/domain.com/formmailer.php Error in vphp.c on line 344: Inappropriate permissions set on script I checked the formmailer.php on one of my other websites (with a different web host), and it works there. I don't even know where to begin on how to fix this problem, and I cannot locate a php.ini file on the website. The web hosting company finally contacted me and said: ”It appears random php files you have are all set to 777 permissions instead of 755 permissions” How do I change file permissions?
  5. Here is the solution. After taking another look at my objective, I realized that I only needed to sort the data by the item name, which also involved addressing the item number in the process (see "The Display of the 'Previous' and 'Next' Links" section below). The Sorting Code (before head of document): <?php // Connect to the database server require('../../global.php'); /* Connecting, selecting database */ $link = mysql_connect("$hostname", "$username", "$password"); mysql_select_db("$database"); $itemID = $id; $result = @mysql_query("SELECT * FROM items , images WHERE items.id='$id' AND images.id = imageid"); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } $row = mysql_fetch_array($result); $name=$row['name']; if ($cat){ $catResult = @mysql_query("Select * FROM categories, item_lookup WHERE name = '$cat' AND categories.id = catID"); $catRow = mysql_fetch_array($catResult); } else { $catResult = @mysql_query("Select * FROM categories, item_lookup WHERE itemID= '$id' AND categories.id = catID"); $catRow = mysql_fetch_array($catResult); } $prevResult = @mysql_query("SELECT * FROM items, item_lookup WHERE name < '$name' AND catID = $catRow[catID] order by name DESC LIMIT 1"); $prevRow = mysql_fetch_array($prevResult); $nextResult = @mysql_query("SELECT * FROM items, item_lookup WHERE name > '$name' AND catID = $catRow[catID] order by name ASC LIMIT 1"); $nextRow = mysql_fetch_array($nextResult); ?> The Display of the "Previous" and "Next" Links: <?php if ($prevRow['name']){ echo"<a href=\"{$_SERVER['PHP_SELF']}?id={$prevRow['id']}&cat=&cat\">« Previous Product</a>";} if ($prevRow['name'] AND $nextRow['name']){ echo" | "; } if ($nextRow['name']){ echo"<a href=\"{$_SERVER['PHP_SELF']}?id={$nextRow['id']}&cat=&cat\">Next Product »</a>";} ?>
  6. I figured out how to do this over the weekend, FINALLY!!! It took a lot of experimentation with the "Order By" syntax to make it work.
  7. Ok, I am understanding the database better and realized that I made some mistakes in my original description. First, I am using PHPMyAdmin 2.9.0. The database is divided into four tables: categories, images, items, and item_lookup. Table categories has the following fields: id and name Table images has the following fields: id Table items has the following fields: id, name, and imageid Table item_lookup has the following fields: catID and itemID categories.id = item_lookup.catID item_lookup.itemID = items.id items.imageid = images.id I would like to display one item from the inventory at a time, with an option for “Previous” and “Next” item at the bottom of the page. I would like the data sorted alphabetically by categories.name (category name), then items.name (item name), so when the viewer clicks on previous and next, they will see the previous and next item alphabetically. Hypothetically speaking, if the item was a “Stuffed Teddy Bear” in the category “Stuffed Animals”, I would want the previous item to be “Stuffed Animals > Stuffed Rabbit” and the next item to be “Stuffed Animals > Stuffed Walrus”. If the 1st item in “Stuffed Animals” is “Stuffed Alligator”, I would want the previous item to be “Ceramic Animals > Walrus”, and if the last item in Stuffed Animals” is “Stuffed Walrus”, I would want the next item to be “Terra Cotta Animals > Alligator” Does that make sense?
  8. No, there are entries for them, but the database currently has ID numbers in two tables joined to each other. The items in each of these tables are set as equal in the PHP code (via their ID number): $itemID = $id; $result = @mysql_query("SELECT * FROM items , images WHERE items.id='$id' AND images.id = imageid"); so when I try to claim that the items are joined by name and not number, the results skip around the data and instead of posting the first alphabetical item that begins with A, it posts the first alphabetical item that does not have an ID number and skips to the next alphabetical item without an ID. There are only 2 items without an ID, so it only shows them. Hmmm. . . I feel like I may have touched closer to the problem.
  9. I tried using "ORDER BY name", and while the order became now alphabetical, many items were skipped. Basically, it would start from items beginning with "J" and jump to "Z". I did not write the original code, so I am having trouble rewriting it to be ordered by item name instead of item code. Any idea on how to include all items (A-Z) and not skip any?
  10. The PHP file I am currently editing has the MySql data sorted by item number. There are four fields (categories, items, item_lookup, and images), and under the field "items" is the table "names". I would like to select all data from these 4 fields and sort them alphabetically by the data in table "name". More specifically, the page is setup to click on the "Previous" and "Next" item, and I want the previous and next item to appear alphabetically. I have already tried editing the code and have had trouble displaying the newly sorted results. Here is the original code, which sorts the items by item number. Does anyone know how to edit this code to display my results alphabetically?: The Sorting Code (before head of document): $itemID = $id; $result = @mysql_query("SELECT * FROM items , images WHERE items.id='$id' AND images.id = imageid"); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } $row = mysql_fetch_array($result); if ($cat){ $catResult = @mysql_query("Select * FROM categories, item_lookup WHERE name = '$cat' AND categories.id = catID"); $catRow = mysql_fetch_array($catResult); } else { $catResult = @mysql_query("Select * FROM categories, item_lookup WHERE itemID= '$id' AND categories.id = catID"); $catRow = mysql_fetch_array($catResult); } $prevResult = @mysql_query("SELECT * FROM item_lookup WHERE itemID < '$id' AND catID = $catRow[catID] order by itemID DESC LIMIT 1"); $prevRow = mysql_fetch_array($prevResult); $nextResult = @mysql_query("SELECT * FROM item_lookup WHERE itemID > '$id' AND catID = $catRow[catID] order by itemID ASC LIMIT 1"); $nextRow = mysql_fetch_array($nextResult); The Display of the "Previous" and "Next" Links: if ($prevRow['itemID']){ echo"<a href=\"{$_SERVER['PHP_SELF']}?id={$prevRow['itemID']}&cat=&cat\">« Previous Product</a>";} if ($prevRow['itemID'] AND $nextRow['itemID']){ echo" | "; } if ($nextRow['itemID']){ echo"<a href=\"{$_SERVER['PHP_SELF']}?id={$nextRow['itemID']}&cat=&cat\">Next Product »</a>";} ?>
×
×
  • 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.