Jump to content

rootKID

Members
  • Posts

    467
  • Joined

  • Last visited

Everything posted by rootKID

  1. hmm... ok, i think i understand now... i have now fixed it all, but cannot add anything to the cart yet... here is shop code: <?phpecho "<pre>";print_r($_SESSION);echo "</pre>";include ("shop_categories.php");echo "<br />";var_dump($_GET); /*$catID checking...*/if (isset($_GET['cat_id']))$catID = intval($_GET['cat_id']);else$catID = 0;/*$catID checking...*/if(isset($_GET['cat_id'])){$query = "SELECT * FROM shop_items WHERE FK_catID = " . $_GET['cat_id'];}else {$query = "SELECT * FROM shop_items";}$result = mysql_query($query)or die(mysql_error());/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if(!$catID == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}echo $catID;/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ if(mysql_num_rows($result)>0)//Checking to see if there is any rows to take...{echo "<form action='' method='post'>\n";echo "<table class='shop_table_100'>\n";echo "<tr class='shop_tr_holder_css'>\n";echo "<td>Add</td>\n";echo "<td>Amount</td>\n";echo "<td>Product Name</td>\n";echo "<td>Price</td>\n";echo "<td>More Info</td>\n";echo "</tr>\n";while ($row = mysql_fetch_assoc($result)){echo "<tr>\n";echo "<td><input type='checkbox' name='check_addbox[".$row['item_id']."]' /></td>\n"; ////extra array...echo "<td><input type='text' name='amount[".$row['item_id']."]' size='1' value='1' /></td>\n"; //With extra array...echo "<td>".$row['item_name']."</td>\n";echo "<td>".$row['item_price']." USD</td>\n";echo "<td><a href='shop_details.php?item_id=".$row['item_id']."'>Info</a></td>\n";echo "</tr>\n";}echo "</table>\n";echo "</form>\n"; echo "<form action='' method='post'>\n";echo "<table class='shop_table_100'\n";echo "<tr>\n";echo "<td><input type='submit' name='add_item' id='submit' class='shop_add_submit_button' value='Update Cart' /></td>\n";echo "</tr>\n";echo "</table>\n";echo "</form>\n";}//Ending IF (Num_Rows...)else{echo "<form action='' method='post'>\n";echo "<table class='shop_table_100'>\n";echo "<tr class='shop_tr_holder_css'>\n";echo "<td>ERROR!</td>\n";echo "</tr>\n";echo "</table>\n";echo "</form>\n";echo "<form action='' method='post'>\n";echo "<table class='shop_table_100'>\n";echo "<tr>\n";echo "<td>There are no Products to show yet.</td>\n";echo "</tr>\n";echo "</table>\n";echo "</form>\n";} if(isset($_POST['add_item'])){if(!empty($_POST['check_addbox'])){ foreach($_POST['check_addbox'] as $p_id => $check) { $amount = $_POST['amount'][$p_id]; //Getting the Amount from the box... [p_id] is indicating what product it is (the checkbox...) $_SESSION['cart'][$p_id] += $amount; //adding them to the session... header("location: shop.php"); }}}?>
  2. i uploaded a image with the errors... ... but anyways... here are the code now as i added it before the code i sended... shop.php: <?phpecho "<pre>";print_r($_SESSION);echo "</pre>"; include ("shop_categories.php"); echo "<br />";var_dump($_GET);$catID = $_GET['cat_id'];//if($_GET['cat_id'] == "")if(isset($_GET['cat_id'])){ $query = "SELECT * FROM shop_items"; $result = mysql_query($query)or die(mysql_error());}else { $query = "SELECT * FROM shop_items WHERE FK_catID = $catID"; $result = mysql_query($query)or die(mysql_error());} /*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if(!$catID == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ echo $catID; if(mysql_num_rows($result)>0)//Checking to see if there is any rows to take...{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr class='shop_tr_holder_css'>";echo "<td>Add</td>";echo "<td>Amount</td>";echo "<td>Product Name</td>";echo "<td>Price</td>";echo "<td>More Info</td>";echo "</tr>";while ($row = mysql_fetch_assoc($result)){echo "<tr>\n";echo "<td><input type='checkbox' name='check_addbox[".$row['item_id']."]' /></td>\n"; ////extra array...echo "<td><input type='text' name='amount[".$row['item_id']."]' size='1' value='1' /></td>\n"; //With extra array...echo "<td>".$row['item_name']."</td>\n";echo "<td>".$row['item_price']." USD</td>\n";echo "<td><a href='shop_details.php?item_id=".$row['item_id']."'>Info</a></td>\n";echo "</tr>\n";}echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'";echo "<tr>";echo "<td><input type='submit' name='add_item' id='submit' class='shop_add_submit_button' value='Update Cart' /></td>";echo "</tr>";echo "</table>";echo "</form>"; }//Ending IF (Num_Rows...)else{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr class='shop_tr_holder_css'>";echo "<td>ERROR!</td>";echo "</tr>"; echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr>";echo "<td>There are no Products to show yet.</td>";echo "</tr>"; echo "</table>";echo "</form>";} if(isset($_POST['add_item'])){if(!empty($_POST['check_addbox'])){ foreach($_POST['check_addbox'] as $p_id => $check) { $amount = $_POST['amount'][$p_id]; //Getting the Amount from the box... [p_id] is indicating what product it is (the checkbox...) $_SESSION['cart'][$p_id] += $amount; //adding them to the session... header("location: shop.php"); }}}?> category file: <?php$under_query = "SELECT * FROM shop_cat";$under_result = mysql_query($under_query)or die(mysql_error()); if(mysql_num_rows($under_result)>0)//Checking to see if there is any rows to take...{while($u_row = mysql_fetch_assoc($under_result)){echo "<a href='shop.php?cat_id=".$u_row['shop_cat_id']."'>".$u_row['shop_cat_name']."</a> ";}}//If ends...else {echo "No categories to show yet.";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if($under_query == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/?> Error: Notice: Undefined index: cat_id in C:\xampp\htdocs\shop\shop.php on line 80You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Hope it helps ...tell me if ya needing more... note that if your telling me there is a error somewhere else, then i dont know what to do since i dont have that much more to add...in anyways, then i can see somfthing is wrong with the SQL as it says up in the error field, and it did not tell me that part last time, so i suppose i did not look that part since it looked very much the same to me on the screen first time i looked... sorry for that part :/... in anyway... i suppose its the SQL that needs a little hand then?... .
  3. nono... i did try with the one on... then i tried change back to undo the errors ... just change that with the one right under it ...,
  4. hello, im home now... here is the code from shop.php file: <?phpecho "<pre>";print_r($_SESSION);echo "</pre>"; include ("shop_categories.php"); echo "<br />";var_dump($_GET);$catID = $_GET['cat_id'];//if(isset($_GET['cat_id']))if($_GET['cat_id'] == ""){ $query = "SELECT * FROM shop_items"; $result = mysql_query($query)or die(mysql_error());}else { $query = "SELECT * FROM shop_items WHERE FK_catID = $catID"; $result = mysql_query($query)or die(mysql_error());} /*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if(!$catID == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ echo $catID; if(mysql_num_rows($result)>0)//Checking to see if there is any rows to take...{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr class='shop_tr_holder_css'>";echo "<td>Add</td>";echo "<td>Amount</td>";echo "<td>Product Name</td>";echo "<td>Price</td>";echo "<td>More Info</td>";echo "</tr>";while ($row = mysql_fetch_assoc($result)){echo "<tr>\n";echo "<td><input type='checkbox' name='check_addbox[".$row['item_id']."]' /></td>\n"; ////extra array...echo "<td><input type='text' name='amount[".$row['item_id']."]' size='1' value='1' /></td>\n"; //With extra array...echo "<td>".$row['item_name']."</td>\n";echo "<td>".$row['item_price']." USD</td>\n";echo "<td><a href='shop_details.php?item_id=".$row['item_id']."'>Info</a></td>\n";echo "</tr>\n";}echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'";echo "<tr>";echo "<td><input type='submit' name='add_item' id='submit' class='shop_add_submit_button' value='Update Cart' /></td>";echo "</tr>";echo "</table>";echo "</form>"; }//Ending IF (Num_Rows...)else{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr class='shop_tr_holder_css'>";echo "<td>ERROR!</td>";echo "</tr>"; echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr>";echo "<td>There are no Products to show yet.</td>";echo "</tr>"; echo "</table>";echo "</form>";} if(isset($_POST['add_item'])){if(!empty($_POST['check_addbox'])){ foreach($_POST['check_addbox'] as $p_id => $check) { $amount = $_POST['amount'][$p_id]; //Getting the Amount from the box... [p_id] is indicating what product it is (the checkbox...) $_SESSION['cart'][$p_id] += $amount; //adding them to the session... header("location: shop.php"); }}}?> hope it helps ... here is code for categories file: <?php$under_query = "SELECT * FROM shop_cat";$under_result = mysql_query($under_query)or die(mysql_error());if(mysql_num_rows($under_result)>0)//Checking to see if there is any rows to take...{while($u_row = mysql_fetch_assoc($under_result)){echo "<a href='shop.php?cat_id=".$u_row['shop_cat_id']."'>".$u_row['shop_cat_name']."</a> ";}}//If ends...else {echo "No categories to show yet.";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if($under_query == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/?> hope it helps ...and yeah, will be posting the errors with words instead of pics from now on ...
  5. sorry, will post later. i dont have the code at my school. feedback later...
  6. hmm... did... and now im getting more errors X)... picture attached...hmm... code below: if(isset($_GET['cat_id'])){ $query = "SELECT * FROM shop_items"; $result = mysql_query($query)or die(mysql_error());}else { $query = "SELECT * FROM shop_items WHERE FK_catID = $catID"; $result = mysql_query($query)or die(mysql_error());}
  7. i was checking... but nofthing as far as i see... and same with the var.. here is the var: (PICTURE ADDED)... even true i tried adding a product again, then it still was on 0 in the (array (var))... but i did get a cat_id when i tried to enter a new category... and that part has allways worked... :/...
  8. ok, thanks alot body! ... and just tell if i ask to much, but any idea about this one?: http://w3schools.invisionzone.com/index.php?showtopic=43680 Thanks if possible ..
  9. well... thanks... but one question, just to play a little stupid... the third one you posted... the code, what do you mean?... i mean. the syntax... its doing the same?.. and i did knew about the if(!empty($r_row['r_imdb_link'])) part... but not the syntax after that... like this: ?"yes":"no").Ect... what does that syntax mean?... EDIT: by the way... thanks... working now... now what if i wish to put colors on the yes/no words... could i just put a normal div-box around them and then style them customly by there?... EDIT #2: what shall i edit in the SQL to make the latest Added showed up on the top?... not just DESC?... because i did, and it does shows up... but after i created 2, 1 called game of thrones and one this: 312414 then the second should be at top and not game of thrones, but the game of thrones was still at top... somfthing to do with the names?..
  10. hmm... thanks for the increased knowledge! ... but still.. i dont see how it should not get the whole SQL/Variable... this is the whole page code: <?phpinclude ("include/config.php");include ("include/database.php");include ("include/functions.php");?><!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=iso-8859-1" /><link rel="stylesheet" href="styles/<?php echo $css_file; ?>.css" type="text/css" /><link rel='shortcut icon' href='<?php echo $icon_name; ?>.ico' /><script type="text/javascript" src="scripts/java_klappe.js"></script><title><?php echo $sitename; ?></title></head><body> <center><div id="header"><?php include ("header_div.php"); ?></div></center> <center><div id="status_bar"><!--STATUS BAR--><div class="status_left"><?php include ("status_left.php"); ?></div><!--/********************/--><div class="status_right"><?php include ("status_right.php"); ?></div></div><!--STATUS BAR--></center> <center><div id="menu"><?php include ("menu.php"); ?></div></center> <center><div id="content_body"><center><!--/**********************/--><?php$req_added_succes = $_GET['req_added_succes'];if($req_added_succes){echo "Request added Succesfully!";} echo begin_box(" ");echo "<a href='request.php'>View Requestes</a> ";echo "<a href='request_add.php'>New Request</a>";echo end_box();echo "<br />"; echo begin_box("<center>View Requestes</center>"); $req_query = "SELECT * FROM requestes";/*$req_query = "SELECTrequestes.r_id,requestes.r_title,requestes.r_category,requestes.r_imdb_link,requestes.r_votes,requestes.r_descr,requestes.r_uID,requestes.r_date,requestes.r_completed,categories.id,categories.name,categories.image,categories.cat_desc,users.id,users.usernameFROMrequestes INNER JOINusers ON requestes.r_uID = users.idINNER JOINcategories ON requestes.r_category = categories.id";*/ $req_result = mysql_query($req_query)or die(mysql_error());if(mysql_num_rows($req_result) > 0){echo "<table id='request_view_page_table_start' align='center' border='1'>";echo "<tr>";echo "<td>Request Name</td>";echo "<td>Category</td>";echo "<td>Added</td>";echo "<td>IMDB</td>";echo "<td>Votes</td>";echo "<td>Completed?</td>";echo "<tr>";while($r_row = mysql_fetch_assoc($req_result)){echo "<tr>";echo "<td>".$r_row['r_title']."</td>";echo "<td>".$r_row['r_category']."</td>";echo "<td>".$r_row['r_date']."</td>"; /*IMDB Yes/No BOX*///echo "<td>".if(mysql_num_rows($r_row['r_imdb_link']) > 0){echo "Yes";}else {echo "No";}."</td>";echo "<td>";if(mysql_num_rows($r_row['r_imdb_link']) > 0){echo "Yes";}else {echo "No";}echo"</td>";//echo "<td>".$r_row['r_imdb_link']."</td>";/*IMDB Yes/No BOX*/ echo "<td>".$r_row['r_votes']."</td>";echo "<td>".$r_row['r_completed']."</td>";echo "<tr>";}//While ends...echo "</table>";}//If ends...else {echo "<center>There is no Rquestes Yet</center>";}echo end_box();?><!--/**********************/--></center></div></center> <center><div id="footer"><?php include ("footer.php"); ?></div></center></body></html> so it should take it correctly, since im giving a * for it as a beginning... and then i could myself later on put on the required stuff... that was the plan at least .. EDIT: Could it be possible that it cannot read the variable called ($r_row) since its outsite the if statement?...
  11. but its the same code... isn't it... what have you changed?... EDIT: well... it works... kinda... now i just see the word 'no' inside the boxes, and right beside it inside the box also this: Warning: mysql_num_rows() expects parameter 1 to be resource, string given inC:\xampp\htdocs\ss_tracker_2011\request.php on line 133 No ideas?...
  12. Hello w3 again... what im trying to is that im making a request page. and in this request page, then instead of taking the whole imdb URL out from the DB.then how can i do with a if so there is going to stand "Yes" if filled and "NO" if not?... i have tried this: echo "<td>".if(mysql_num_rows($r_row['r_imdb_link']) > 0){echo "Yes";}else {echo "No";}."</td>"; but got a error... but i also tried with a fetch_assoc before the num_rows... and that was the same... error was this: Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\ss_tracker_2011\request.php on line 101 and with num rows this: Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\ss_tracker_2011\request.php on line 101 The very same...ideas?... (Pictures added what i ment if no ideas got from my own words...)
  13. and like allways... thanks boys! ... its working greate not ... will just double-check the functions... just to see if all is correct ...
  14. what?... Sorry... still dont understand.. :/... do you mean i have a error inside one of the functions?... they seems fine to me... :/.
  15. may i ask what kinda paste this means?... :/... just to have a little idea about what your talking about? ... and thanks for the answer also ...
  16. ok... i tried to enter my localhost again today to edit a little more on my projects... then i get this error: (PICTURE ATTACHED...) What the heck is that?... i mean... this is the line its talking about: (?>) witch are my PHP ending tag... someone?... Attached my config file also...
  17. true... it was not.. the teacher told me that he changed the code so instead of showing the categories from #1 when comming into shop when no id is given in the URL...then its showing all the products untill a ID is given... :X... EDIT: could it be the URL link im clicking on a product when trying to add and then running the wrong word?...
  18. i see... but when i try to echo out the $catID... then i get nofthing... (PICTURE ATTACHED...) and i added this: echo $catID; right under the other (noob) echo...and yeah, i did knew about the ! on under_query... just did not explain that well i supose ... EDIT: so i must say... im clueless... i did as you said, and i dont see what to change since i do not get any value from the echo on catID... but still it tells me from the if that it does... or am i still wrong :/...
  19. hello again TST... i did as you told me to, and trying to echo everything all over the place to try see what did what...and this is my result: 1. i started to make a if statement like so: /*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if(!$catID == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ to see what it gave me... and i got the noob on the screen... that means no ID, and then i tried just for fun, to make the if as a true (by removing this (!))...and i got a succes... i suppose that im getting a ID still somewhere from then... then i maked the same if statement in the category file that im including on shop.php... and echo the SQL im making. just to try what you said, and see if anything was of meaning by that sql... like so: /*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if($under_query == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ and i got the noob from there... so i suppose that sql is the thing that is wrong... orr what?... 2. now i dont know what more to echo since i had that url, and 1 on shop... this is my shop.php file: echo "<pre>";print_r($_SESSION);echo "</pre>"; include ("shop_categories.php"); echo "<br />"; $catID = $_GET['cat_id'];if($_GET['cat_id'] == ""){ $query = "SELECT * FROM shop_items"; $result = mysql_query($query)or die(mysql_error());}else { $query = "SELECT * FROM shop_items WHERE FK_catID = $catID"; $result = mysql_query($query)or die(mysql_error());} /*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if(!$catID == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ if(mysql_num_rows($result)>0)//Checking to see if there is any rows to take...{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr class='shop_tr_holder_css'>";echo "<td>Add</td>";echo "<td>Amount</td>";echo "<td>Product Name</td>";echo "<td>Price</td>";echo "<td>More Info</td>";echo "</tr>";while ($row = mysql_fetch_assoc($result)){echo "<tr>\n";echo "<td><input type='checkbox' name='check_addbox[".$row['item_id']."]' /></td>\n"; ////extra array...echo "<td><input type='text' name='amount[".$row['item_id']."]' size='1' value='1' /></td>\n"; //With extra array...echo "<td>".$row['item_name']."</td>\n";echo "<td>".$row['item_price']." USD</td>\n";echo "<td><a href='shop_details.php?item_id=".$row['item_id']."'>Info</a></td>\n";echo "</tr>\n";}echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'";echo "<tr>";echo "<td><input type='submit' name='add_item' id='submit' class='shop_add_submit_button' value='Update Cart' /></td>";echo "</tr>";echo "</table>";echo "</form>";}//Ending IF (Num_Rows...)else{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr class='shop_tr_holder_css'>";echo "<td>ERROR!</td>";echo "</tr>"; echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'>"; echo "<tr>";echo "<td>There are no Products to show yet.</td>";echo "</tr>"; echo "</table>";echo "</form>";} if(isset($_POST['add_item'])){if(!empty($_POST['check_addbox'])){ foreach($_POST['check_addbox'] as $p_id => $check) { $amount = $_POST['amount'][$p_id]; //Getting the Amount from the box... [p_id] is indicating what product it is (the checkbox...) $_SESSION['cart'][$p_id] += $amount; //adding them to the session... header("location: shop.php"); }}} and this is my category file: $under_query = "SELECT * FROM shop_cat";$under_result = mysql_query($under_query)or die(mysql_error()); if(mysql_num_rows($under_result)>0)//Checking to see if there is any rows to take...{while($u_row = mysql_fetch_assoc($under_result)){echo "<a href='shop.php?cat_id=".$u_row['shop_cat_id']."'>".$u_row['shop_cat_name']."</a> ";}}//If ends...else {echo "No categories to show yet.";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/if($under_query == ""){echo "Succes! [CAT_ID ECHO]";}else {echo "Noob! [CAT_ID ECHO]";}/*ECHO THE CAT_ID FOR SEEING IF ANYTHING COMES OUT...*/ so... what now? :/... i mean, what to do with the SQL... if i dont get a ID for the shop... then i suppose i cannot add it to the cart...or am i wrong? :/...
  20. okay.i will try the thing you said tomorrow. and feedback.im not home right now, since overtime at job .but i still dont understand why, since the other did work X)...
  21. that is not the same i suppose... it stil dosent adding shop products to the cart, and the other did...the other was a problem to the output of the products when a category was not setted (NONE TO SHOW)... that is how i at least remember it ...but yes, i do agree... same error im getting... but still should not be a problem since this is for adding... and not showing... i suppose?...
  22. sorry for late reply, i will try right away... thanks ... Posting feedback in a momment ... EDIT: hmm... weird... its giving me these errors below: (ATTACHED)... and here is the shop.php code you did ask for...: <?phpinclude ("include/config.php");include ("include/database.php");session_start();ob_start();ini_set('display_errors', 1);error_reporting(E_ALL);?><!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=iso-8859-1" /><link rel="stylesheet" href="styles/1.css" type="text/css" /><link rel='shortcut icon' href='fav_icon.ico' /><title><?php echo $sitename; ?></title></head><body> <center><div id="header"><?php include ("banner.php"); ?></div></center> <center><div id="status_bar"><!--STATUS BAR--><div class="status_left"><?php include ("status_left.php"); ?></div><!--/********************/--><div class="status_right"><?php include ("status_right.php"); ?></div></div><!--STATUS BAR--></center> <center><div id="menu"><?php include ("menu.php"); ?></div></center> <center><div id="content_body"><!--/**********************/--><?phpecho "<pre>";print_r($_SESSION);echo "</pre>";include ("shop_categories.php");echo "<br />";$catID = $_GET['cat_id'];if($_GET['cat_id'] == ""){ $query = "SELECT * FROM shop_items"; $result = mysql_query($query)or die(mysql_error());}else { $query = "SELECT * FROM shop_items WHERE FK_catID = $catID"; $result = mysql_query($query)or die(mysql_error());} if(mysql_num_rows($result)>0)//Checking to see if there is any rows to take...{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr class='shop_tr_holder_css'>";echo "<td>Add</td>";echo "<td>Amount</td>";echo "<td>Product Name</td>";echo "<td>Price</td>";echo "<td>More Info</td>";echo "</tr>";while ($row = mysql_fetch_assoc($result)){echo "<tr>\n";echo "<td><input type='checkbox' name='check_addbox[".$row['item_id']."]' /></td>\n"; ////extra array...echo "<td><input type='text' name='amount[".$row['item_id']."]' size='1' value='1' /></td>\n"; //With extra array...echo "<td>".$row['item_name']."</td>\n";echo "<td>".$row['item_price']." USD</td>\n";echo "<td><a href='shop_details.php?item_id=".$row['item_id']."'>Info</a></td>\n";echo "</tr>\n";}echo "</table>";echo "</form>"; echo "<form action='' method='post'>";echo "<table class='shop_table_100'";echo "<tr>";echo "<td><input type='submit' name='add_item' id='submit' class='shop_add_submit_button' value='Update Cart' /></td>";echo "</tr>";echo "</table>";echo "</form>";}//Ending IF (Num_Rows...)else{echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr class='shop_tr_holder_css'>";echo "<td>ERROR!</td>";echo "</tr>";echo "</table>";echo "</form>";echo "<form action='' method='post'>";echo "<table class='shop_table_100'>";echo "<tr>";echo "<td>There are no Products to show yet.</td>";echo "</tr>";echo "</table>";echo "</form>";} if(isset($_POST['add_item'])){if(!empty($_POST['check_addbox'])){ foreach($_POST['check_addbox'] as $p_id => $check) { $amount = $_POST['amount'][$p_id]; //Getting the Amount from the box... $_SESSION['cart'][$p_id] += $amount; //adding them to the session... header("location: shop.php"); }}}?><!--/**********************/--></div></center> <center><div id="footer"><?php include ("footer.php"); ?></div></center></body></html> and if its for any help, then here is my shop_categories.php code also: <?php$under_query = "SELECT * FROM shop_cat";$under_result = mysql_query($under_query)or die(mysql_error());if(mysql_num_rows($under_result)>0)//Checking to see if there is any rows to take...{while($u_row = mysql_fetch_assoc($under_result)){echo "<a href='shop.php?cat_id=".$u_row['shop_cat_id']."'>".$u_row['shop_cat_name']."</a> ";}}//If ends...else {echo "No categories to show yet.";}?> i dont know if i did answer this on the #1 post... but what my teacher did to help me, was that once you are entering the page, then it will show all the products i have... and if a category is setted, (THEN) it will show the product for that category... and that is working also... its just the adding to the cart part... :/...
  23. ohh... my bad... i did not understand the post (#6), i suppose ^^'... anyways... like you said earlier. then i need to change the setting somewhere... and this i do allready now about...the thing is that when im posting a reply to a thread or somfthing like that. then inside the code (PHP,SQL,ECT LIKE THAT...), somewhere like after a ''div'' box orr somfthing like that,then i get the stupid codes like so: and that is not supposed to happends...so that is what im going to trying to change... im trying to change so the PHP,SQL,Codes and such are not going to be disturbed with such stuff that not are going/supposed to be there.
  24. hmm... let me explain the second question like this, its like this board. im still a normal member, but your guys can see my postes... on my forum, they simply can't since the moderator orr admin as a default needs to accept it... at least i think so, since the (POST) count on the user is still on 0 when i tried to add my very first post on a test account... and it did not go up before the admin/mod have accepted it as visible :/...
  25. Hello W3schools again, a problem has been showed up on my little shop project again, and some people in here might knows it still... anyways... the people that tried to help me, if you are one of them. please read on... else, well... just read ... anyways... i went to my school teacher (one of them) and asked for help, and we did solve it with some big issues he told me and pointed out for me... and that was a big help for the understanding...anyways. i came home... and now the weird part is comming... when im trying to add somfthing to my shop (the cart/session)... then its like it just wont listen, because the fun part is that it (DOES) redirects do shop.php as i told it to do in the function that i call to add the redirect... that... orr its just updating.. but seems like it redirects... anyways... here are the files of my related to the shop: (ATTACHED) and i must say, i dont really knows how to explain this... since it would be impossible to redirect without the function, and that i cannot see either on the URL... :/...so please tell me if you need more information on anything... dont knows what to tell... (NO PAGE ERRORS...) so i cannot really answer anymore questions on this problem unless you are asking me ... Hoping answers soon... Regards: rootKID EDIT: Note that the details page its just a beginning... but thinked that it would be ok to add it just in case you was wonder... lol ...
×
×
  • Create New...