Jump to content

RynMan

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RynMan's Achievements

Member

Member (2/5)

0

Reputation

  1. RynMan

    HTML Forms

    Hi guys I've basically got a form, and I'd like it to email the results to my email. Though I'd like it to be formatted and layed out a particular way using html. Am I dreaming? Is this possible? Any third party applications that might recommend? Thanks for any help!
  2. Hi Guys I've constructed a modified shopping cart system using the tutorial here: http://v3.thewatchmakerproject.com/journal/276/ I'm not great at PHP but have managed to have it working great. My question is: How can I send the data stored in my session, via email using the form? On the final page before the submission is made to email the data - i've got contact detail inputs for the form, and the cart items shown. I just don't know how to send that info onwards. Many thanks....
  3. Ah yep, sorry! $QueryData = mysql_query("SELECT * FROM `Items` WHERE ItemCategoryShort = '$ItemCategory' ORDER BY UnitPrice ASC", $connection); if (!$QueryData) { die("Database query failed" . mysql_error()) ; } $ArrayData = mysql_fetch_array($QueryData);
  4. Hey guys I'm not amazing at PHP, but know just enough to be dangerous. Basically I'm trying to get these records from my database to display in rows of 4. For some reason every time, I'm missing a record (the first record returned in my query). It's probably something simple is my code. Would be grateful if anyone could lend a suggestion. <?php $a=0; $b=3; while ($ArrayData = mysql_fetch_array($QueryData)) { //if a=0, start new row if ($a==0) { echo '<tr>'; } //create cell //if thumbnail exists, use it, otherwise throw in the unavailable image if ($ArrayData["PhotoThumb"]!="") { $ImageToUse = $ArrayData["PhotoThumb"]; } else { $ImageToUse = "image_unavailable_thumb.jpg"; } echo ' <td width="33%" align="center" valign="top"><p><a href="item.php?ItemID='.$ArrayData["ItemID"].'"><img src="images/'.$ImageToUse.'" border="0" /></a></p> <p><a href="item.php?ItemID='.$ArrayData["ItemID"].'" class="cart_body_text">'.$ArrayData["ItemName"].'</a><br /> <span class="style1"> <strong>$'.sprintf("%01.2f", $ArrayData["UnitPrice"]).'</strong></span><br /> </p> </td>'; //increment by 1 $a++; //if a = 3 then close the row using </tr>, ready to start a new one if ($a==$b) { echo ' </tr>'; //reset counter, ready to start new row $a=0; } } if ($a > 0 ) { echo '</tr>'; } ?> Thanks guys!
  5. Hey guys! I'm trying to work through my shopping cart here and am having a problem. Everytime I start up a new session (clear my cookies in firefox) and start testing, I get the following error.... Notice: Undefined variable: cart in C:\wamp\www\Adept\action_handle.inc.php on line 16 It's pointing to my code here.... session_start(); $cart = $_SESSION['cart']; $action = $_GET['action']; $iquantity = $_POST['iquantity']; I'm guessing it's because the session has just started so naturally there will be nothing in the 'cart'. How is this usually avoided? Do we need to assign something to the cart to start with? I'm trying not to do that, as my cart counts the number of instances a number (ID) appears....so I can't really have any values in there to start. Thanks for any help!
  6. If someone else had any ideas id be extremely grateful.
  7. That site seems to be down right now. The same tutorial is posted here: http://www.studyblog.net/2008/11/a-simple-php-shopping-cart-script/
  8. What do you think? Where do you define $db - if anywhere? Well....that's my question. Is it defined somewhere that I'm missing? I can't see it defined anywhere in my code, nor the code the poster on that page has written, however that means very little (as I said I was a PHP novice).
  9. Hi guys I'm basically trying to implement this cart into my pages: http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart I understand it for the mostpart (I'm a novice at PHP but can generally figure out what's going on here). When I run this code on my cart display page I get the following error: <?php function showCart() { $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart_add.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM Items WHERE ItemID = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart_add.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$ItemName.' by '.$author.'</td>'; $output[] = '<td>£'.$UnitPrice.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>£'.($UnitPrice * $qty).'</td>'; $total += $UnitPrice * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: £'.$total.'</p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } showCart(); ?> Notice: Undefined variable: db in C:\wamp\www\Adept\cart_add.php on line 88 Fatal error: Call to a member function query() on a non-object in C:\wamp\www\Adept\cart_add.php on line 88 Line 88 is pointing to this line of code $result = $db->query($sql); I realise that $db isn't defined....but should it be? I think I'm missing something here. I looked through all of the poster's code and nowhere does he define that variable....maybe the function isn't returning anything? Thanks for any help guys.
  10. Thanks PFM! A little too late here, can't believe I missed that one.
  11. Hi guys I've got a set of records pulled via my query. The three fields are the year a production occurred, the name of the production, and the role the person played in it. I basically want to display it like this 2009 Romeo and Juliet - Romeo Walking Tall - John 2008 Another production - role Some other production - role Here's my code... $Year = 0; while($DataArray = mysql_fetch_array($dataquery)) { if ($Year != $DataArray["Year"]) { echo $DataArray["Year"]."<br />". $DataArray["Production"]." ".$DataArray["Role"]."<br />"; $Year = $DataArray["Year"]; } else { $DataArray["Production"]." - ".$DataArray["Role"]."<br />"; $Year = $DataArray["Year"]; } } So I'm basically trying to have it look at my year, and if it is the same as the previous record's year, create just the line without the year. It's not actually peforming my 'else' part of my if statement. What am I missing?
  12. Hi guys I'm struggling a little with the concept arrays, not sure why this doesn't work. I have this code: $result9 = mysql_query("SELECT * FROM `tblclientinformation` LEFT JOIN tblphotos ON tblclientinformation.KAMClientID = tblphotos.KAMClientID WHERE Current = 1 AND Gender='$Gender' AND Actor=TRUE $LocationQ ORDER BY LastName LIMIT $RecordNumber, $RecordsOnPage", $connection); if (!$result9) { die("Database query failed" . mysql_error()) ; } Then later on down the page I want to use it like this.... while ($row9 = mysql_fetch_array($result9)) { echo '<td width="125" align="center"><a class="actorsListLink" href="cvprofile.php?ID='.$row9["KAMClientID"].'"><img src="headshot/ListHeadShot/'.$ListHeadShot.'" border="0" width="72" height="90" /><br />'.$row9["FirstName"]."<br />".$row9["LastName"].'<br />'.$row9["KAMClientID"].'</a></td>'; } Everything echos here except "KAMClientID". The first and last names work fine, but the ID does not. I've done a print_r for my array and it is in there as the first item in the array [0]. When I substitute the "KAMClientID" for zero, it works perfectly. Why do my other accept the text, however this one does not?
  13. I have a lot of code, and I realise when ppl post every line of code they have, it deters other from taking a look at their problem. In this case, I made a mistake and apologised for it. Thanks for your understanding.
  14. My apologies PFM. I found this code also occurring in there.... $arrayWriters = mysql_fetch_array($resultWriters) ; This was the cause. Thanks for your help.
×
×
  • 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.