Jump to content

JakeMogul

Members
  • Posts

    13
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

JakeMogul's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks guys. Putting a space between $array and [$key] did the trick.
  2. Hi, I decided to learn PHP & MySQL from scratch with "PHP & MySQL in Easy Steps" by Mike McGrath. Page 35 is a tutorial on Describing Dimensions. I think I've done exactly what it says, but my output is weird. The php code I wrote: <?php $letters = array('A','B','C','D','E','F','G'); $numbers = array(1,2,3,4,5,6); $matrix = array('Letters'=> $letters,'Number'=> $numbers); echo "<p>Start: {$matrix['Letter'][0]}</p>"; foreach($matrix as $array => $list) { echo '<ul>'; foreach($list as $key => $value) {echo "<li>$array[$key]=$value";} echo '</ul>'; } ?> According to the book should display like this: Start: A - Letter [0] = A - Letter [1] = B - Letter [2] = C - Number[0] = 1 - Number[1] = 2 - Number[2] = 3 I've checked my code twice. And had a friend check it. Can't find a difference between the book and my code, yet mine appears like this: Start: L=A e=B t=C t=D e=E r=F s=G N=1 u=2 m=3 b=4 e=5 r=6 What's wrong with it!?
  3. But, being a n00b, I've forgotten to involve the ItemID in the tCurrentOrder, so while the code doesn't bring up errors, it doesn't do anything either. My fault. How do I copy the ItemID from the tMasterPriceList to tCurrentOrder? I'm trying to use SELECT INTO but don't know whether it needs to be a separate command to the current INSERT INTO command used above. $ItemID = "INSERT INTO tCurrentOrder (ItemID) SELECT ItemID FROM tMasterPriceList" And then alter the VALUES part of the script to VALUES ($ItemID,'$_POST[item]','$count','now()') Am I on the right lines?
  4. I'm making a page which shows from a table only items that are cheapest from a certain supplier using <. The problem I'm encountering is that the prices are stored in a different table, a master price list. I have a query SELECT * FROM tablename WHERE column1 < column 2 but the WHERE part of the clause needs to apply to a different table than the table I'm selecting records from.
  5. I'm creating a system for compiling orders for my business. The script basically is supposed to compile a summarised list of items to order from our various suppliers. I currently have a script that allows me to add items from a list of products via search of drop down menu to a current list of products that need to be ordered. What I'm trying to do now is make is so that if the same item is added to the order twice, it only takes up one row in the table and therefore in the list and adds the quantities together. My current attempt at the script looks like this... <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database name", $con); $count='1'; $TotalQuantity= '$count + tCurrentOrder(Quantity)'; $sql="INSERT INTO tCurrentOrder (Item, Quantity, Date) VALUES ('$_POST[item]','$count','now()') ON DUPLICATE KEY UPDATE tCurrentOrder (Quantity) VALUES ('$TotalQuantity')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo ("Item Added To Order. <a href=\"http page address">here</a> to continue."); $url = 'http page address'; echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; mysql_close($con); ?> The $totalquantity seems to be the current problem. What should it be? Thank you in advance.
  6. Yes, I could do this, but there'll be more than 2000 items in the list. I don't know how practical it would be...
  7. So this has been bugging me for a while. I'm trying to create an ordering system for my work. Any product that needs to be restocked has to be typed into a text box. All entries are added to a list. BUT... Anything that's typed into the text box has to match with the product name in an existing table of data in the database. This is to prevent staff from ordering items that they shouldn't because fewer and fewer suppliers are willing to accept returns these days. If it was free text I could easily create this, but I'm not sure how to go about having the character string entered into the text box compared to product names in a table? Any help? Thanks...
  8. I'm very new to MySQL and trying to learn the basics. My question is this: I've created a simple database containing details of items owed to various patients by the pharmacy. I have made a search feature so that the staff can search quickly. In the search results, each patient's name is hyperlinked. When the hyperlink is clicked, I want it to go to a page where it displays all data from that row in the database table related to that patient. I have done this with an OwingID auto-incrementing variable in the table. I have the page set up where the data will display and can make it display any record I choose with this command: $displayowing = mysql_query("SELECT Date, FirstName, LastName, Item, Quantity FROM tOwings WHERE OwingID=1"); but I have to change the OwingID in the code myself from the server side. How do I make the links from the search results do this for me? Thanks...
  9. Solved it. It seems to depend on where in the index.php file you put the divs. IE is seemingly more sensitive to placement while Firefox and other browsers don't care too much.
  10. <?php include('nameofseparatefile.php'); ?> Won't that work?
  11. Hi there, I've begun building a wordpress theme for a blog which looks fine in FireFox. The trouble is that IE7 is not displaying the page the same way. Have a look: http://www.jakemogul.com In IE certain elements are not shown as they should be, namely the navigation and the footer. If anybody can tell me why this is and what code I need to add or change to accomodate IE, I'd much appreciate it. Thanks in advance.
×
×
  • 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.