Jump to content

elindithas

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

elindithas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. oops, that was a stupid mistake the one ive been getting all along is Notice: Undefined index: submit in C:\wamp\www\website\update.php on line 13 nm, fixed that too, was a capital S somwhere just need to work out this update thing now actually i need it to check the name and the foil status, and if its the same to update the stock for the difference
  2. hiya again, I have a form set to upload info to my database, all laid out working well etc, I know basically how to do an upsert but im getting lost on actually where to punch in the code, also this script is giving me an error on submit, even tho its updating my info what i want is if the name is the same to update the stock value +whatever they add for stock, instead of making a new entry to just update the row <?php $Name = $_POST['Name']; $Color = $_POST['Color']; $Type = $_POST['Type']; $Rarity = $_POST['Rarity']; $Price = $_POST['Price']; $Stock = $_POST['Stock']; $Added = $_POST['Added']; $Added = $_POST['Foil']; $Added = $_POST['Buy']; $Added = $_POST['Buyprice']; $submit = $_POST['submit']; mysql_connect ("localhost", "jmartens", "jason23") or die ('Error: ' . mysql_error()); mysql_select_db ("mtgshack"); $query="INSERT INTO m10 (ID, Name, Color, Type, Rarity, Price, Stock, Added, Foil, Buy, Buyprice)VALUES ('NULL', '".$Name."', '".$Color."', '".$Type."', '".$Rarity."', '".$Price."', '".$Stock."', '".$Added."', '".$Foil."', '".$Buy."', '".$Buyprice."')"; mysql_query($query) or die ('Error updating database'); echo "Database Updated With " .$Name. " " .$Color. " " .$Type. " " .$Rarity. " " .$Price. " " .$Stock. " " .$Added. " " .$Foil. " " .$Buy. " " .$Buyprice ; ?> the error im getting is Notice: Undefined index: submit in C:\wamp\www\website\update.php on line 13 Notice: Undefined variable: Foil in C:\wamp\www\website\update.php on line 19 Notice: Undefined variable: Buy in C:\wamp\www\website\update.php on line 19 Notice: Undefined variable: Buyprice in C:\wamp\www\website\update.php on line 19 Notice: Undefined variable: Foil in C:\wamp\www\website\update.php on line 24 Notice: Undefined variable: Buy in C:\wamp\www\website\update.php on line 24 Notice: Undefined variable: Buyprice in C:\wamp\www\website\update.php on line 24 is it my php setup? or am i missing something?
  3. back again, got everything set (getting to the update over insert a bit later) im wondering what in my code is giving me a Notice: Undefined index: Name in C:\wamp\www\website\dwc.php on line 11 for all my variables, im sure its something stupid <?php require_once("Connections/connection.php"); //database connection /////////////////////////////////// $query = sprintf("SELECT * FROM m10"); $result = @mysql_query($query); $row = mysql_fetch_array($result); /////////////////////////////////// ////////////////////////////////// $Name = $_POST['Name']; $Color = $_POST['Color']; $Type = $_POST['Type']; $Rarity = $_POST['Rarity']; $Price = $_POST['Price']; $Stock = $_POST['Stock']; $Added = $_POST['Added']; $submit = $_POST['submit']; ///////////////////////////////// if ($submit && $Name && $Color && $Rarity && $Price && $Stock && $Added) { $query = sprintf("Insert into m10 (Name, Color, Type, Rarity, Price, Stock, Added) values ('$Name', '$Color', 'Type', 'Rarity', 'Price', 'Stock', 'Added')"); mysql_query($query)or die(mysql_error()); }elseif ($submit){ echo "One of your fields is empty !"; } /*do { echo $row['field3']. "<br>"; }while ($row = mysql_fetch_array($result))*/ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p> </p> <form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <table width="400" border="1" cellspacing="0" cellpadding="0"> <tr> <td>Name</td> <td>Color</td> <td>Type</td> <td>Rarity</td> <td>Price</td> <td>Stock</td> <td>Added</td> </tr> <tr> <td><label> <input name="Name" type="text" id="Name" /> </label></td> <td><label> <select name="Color" id="Color"> <option>White</option> <option>Blue</option> <option>Black</option> <option>Red</option> <option>Green</option> <option>Gold</option> <option>Colorless</option> </select> </label></td> <td><label> <select name="Type" id="Type"> <option>Land</option> <option>Instant</option> <option>Sorcery</option> <option>Artifact</option> <option>Enchantment</option> <option>Creature</option> <option>Planeswalker</option> </select> </label></td> <td><label> <select name="Rarity" id="Rarity"> <option>Common</option> <option>Uncommon</option> <option>Rare</option> <option>Mythic</option> </select> </label></td> <td><label> <input name="Price" type="text" id="Price" size="8" /> </label></td> <td><label> <input name="Stock" type="text" id="Stock" size="8" maxlength="3" /> </label></td> <td><label> <input name="Added" type="text" id="Added" size="10" maxlength="10" /> </label></td> </tr> <tr> <td colspan="7"><label> <div align="center"> <input type="submit" name="Submit" id="Submit" value="Submit" /> <input name="Submit" type="hidden" id="Submit" value="1" /> </div> </label></td> </tr> </table> </form> <p> </p> <table width="456" border="1"> <tr> <td>Name</td> <td>Color</td> <td>Type</td> <td>Rarity</td> <td>Price</td> <td>Stock</td> <td>Added</td> </tr> <?php do {?> <tr> <td><?php echo $row['Name'];?></td> <td><?php echo $row['Color'];?></td> <td><?php echo $row['Type'];?></td> <td><?php echo $row['Rarity'];?></td> <td><?php echo $row['Price'];?></td> <td><?php echo $row['Stock'];?></td> <td><?php echo $row['Added'];?></td> </tr> <?php }while ($row = mysql_fetch_array($result)); ?> </table> </body> </html>
  4. oohh, i think thats what i needed, I love you now as well.
  5. worked perfectly, <3 u one more question, i have my database all set up, the fields are name, color, type, rarity, price, stock, and date added im curious as to how i set a script to insert new data into the database (basicly thats no prob) the thing is how do i set it so if you fill in a name and value of something that is already there lets say as an example (magic cards) Lightning Bolt. thats the name and the price etc would all be the same, how do i get it to just add into the previous entry and change the stock value up by 1? otherwise just to post a new card as a completely new entry thanks in advance, you guys have been super helpful!
  6. hmm, its not resulting in all the names the print_r did, just 1 name repeated for some reason sorry about the hassle im very new at this, but with each step its making more sense
  7. id like it to display in a simple table, would i just put my information where the print array is?
  8. wow, worked! thanks it is however printing results like this Array ( [0] => Array ( [iD] => 1 [Name] => Garruk Wildspeaker => Green [Type] => Planeswalker [Rarity] => Mythic [Price] => 23 [stock] => 000 [Added] => 2009-07-22 ) [1] => Array ( [iD] => 2 [Name] => Ajani Goldmane => White [Type] => Planeswalker [Rarity] => Mythic [Price] => 20 [stock] => 003 [Added] => 2009-07-22 ) ) anyway to clean it up as it displays?
  9. Hi, just getting started here, got to where i can connect, setup database, call info etc what im trying to do is call something from my database "mtgshack" the table is "m10" by date "Added" (is the id field 2000/10/10 or whatever) I want to call everything that was added to the database within the last like month, so as to be able to display something like "New Product" as its a card singles website any one able to help? I think i know what to do kinda, im just not used to the system yet
×
×
  • 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.