
matthew798
Members-
Posts
63 -
Joined
-
Last visited
Never
About matthew798
- Birthday 03/19/1992
Contact Methods
- MSN
-
Website URL
http://www.hudsonmcg.net
Profile Information
-
Gender
Male
-
Location
Canadia
matthew798's Achievements

Member (2/5)
0
Reputation
-
Hi guys! Once again i require your endless talents! I have 2 tables in my mysql DB. One table is a list of products a store offers, the other is the cart of the user. I need to find the most efficient way or retrieving the images and prices from the LIST OF PRODUCTS table based on the list of PRODUCT NUMBERS stored in the cart table of the user. List of products offered ************************* Prod # * Price * img src * ************************* 001 * 19.99* imgs/pic1.jpg * 002 * 29.99 * imgs/pic2.jpg * ************************* User's Cart ********************* Prod # * quantity * size * ********************* 001 * 10 * m * 002 * 4 * s * ******************** Basically i just want to retrieve ONLY the rows that i need (ones that the user has added to his/her cart) and ASSOCIATE the img src with the quantity and size so that i can lay it out in a table on a view_cart page... If you want a good laugh just take a look at what ive done so far... $cart = mysql_query("SELECT * FROM ".$session.""); $cart_row_count = mysql_fetch_assoc($cart); $cart_row_count = mysql_num_rows($cart_row_count); if($cart_row_count != 0){ $i = 1; while($cart_result = mysql_fetch_assoc($cart)){ ${"product$i"} = $cart_result['product']; ${"size$i"} = $cart_result['size']; $i++; } $i2 = 1; $query = "product = ".${"$product$i2"}." "; while($i2 <= $i){ $i2++; $query .= "AND ".${"$product$i2"}." "; } }
-
Hey all, Im just wondering what the best way to store a bunch of products numbers under a session id. I have a shopping cart that i want people to be able to add products to it. The product id numbers are around 4 digits each. Im just wondering what the most efficient way to store the cart is. Create an individual table for each session ID and store the products there? Create a table that stores each session ID and add the products in the same collumn then separae them when needed? I cant think of any efficient sounding way to do this. Heres some more info: session_id = 0000001 (for example) **************************** * SESS * PRODUCTS * **************************** *0000001* 1001,1002,1003,1004* **************************** Thats what im thinking of doing now, but im worried about how im going to store carts that have 20 or more products, 20*4+20 commas, im looking at 100+ characters in one collumn... I dunno... What do you guys think?
-
<html> <head></head> <body> <img src="../images/form_logo.png"></img><br><br><br> <p>Thank you for chosing Orion Design MTL!<br> You can contact us at any time at </p> <br><br> <form id="list" action="form_calc.php" method="post"> <table width="100%" style="border:1px #000000 solid"> <tr><td> <select> <?php session_start(); include '../dbconnect_form_fields.php'; $res = mysql_query("SELECT * FROM form_fields") or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo "<option value='".$row['id']."'>".$row['field']." ".$row['price']."</option>"; } echo "</select> </td></tr> <tr><td><select>"; while($row = mysql_fetch_assoc($res)){ echo "<option value='".$row['id']."'>".$row['field']." ".$row['price']."</option>"; } echo "</select>"; ?> </select> </td></tr></table> </form> </body></html> http://oriondesignmtl.com/forms/form1.php Check out the code, then check out the site... Why is it doing that!? The second dropdown menu is not drawing any values and it seems like the table is messing up as well... Any ideas?[/code]
-
i know about that i just forgot to mention it. I had tried that as a last ditch attempt to eliminate me being retarded and i guesse in doing it I only proved that i am ..
-
Yeah thats right! I think it should work my way! include '../dbconnect_form_fields.php'; $res = mysql_query("SELECT * FROM form_fields") or die(mysql_error()); while($res = mysql_fetch_assoc( $res )){ echo "<option value='".$res['id']."' > ".$res['field']." ".$res['price']."</option>\n"; } Why is this only returning the first row of the values in my DB? Why wont it display the second one as well?(as there are only 2) Thnx champs!
-
Hey guys! I just thought i'd let you know that your the first guys i come to when i've spent more than 20 minutes trying to fix a problem! <?php session_start(); include '../dbconnect_form_fields.php'; echo "<html><head></head><body> <form id='list' action='form_calc.php' method='post'> <select>"; $res = mysql_query("SELECT * FROM form_fields") or die(mysql_error()); while (list ($id, $field, $price) = mysql_fetch_row($res)) { echo "<option value='".$id."' > ".$field." </option>\n"; } echo "</select>"; ?> </form> </body></html> So this gives me an empty select box with only one option and no text whatsoever... What infinitesimally small detail am I unwittingly missing? Thanks in advance.
-
It just so happens that I have never used the PHP mail() function and i believe i've hit my first major snag. So if any of you brilliant minds out there can just take a second to error check the following code id GREATLY appreciate it! The db is connected earlier and i KNOW all the vars work because the script worked before i stuck in the mail() section. //REVISE else{ $q = mysql_query("INSERT INTO account (Username, Firstname, Lastname, Email, Active, User_type, User_language, User_registration, Pass) VALUES('$username', '$firstname', '$lastname', '$email', '$active', '$type', '$language', '$today', '$password')") or die(mysql_error()); $id = mysql_query("SELECT id FROM account WHERE Username = '$username'"); $message = "Welcome to the exciting world of Star Wars Galaxies : A New Hope! Your new username is ".$username."! Please click the following link or paste it in a web browser to complete the activation process. HTTP://www.swganh.com/account_activate.php?id=".$id;//LANGINSERT $headers = "From: [email protected]\r\n"; mail($email, 'SWG:ANH New account registration/confirmaton', $message, $headers);//LANGINSERT } The problem is that im just not getting a mail when i send it to myself... No errors, but no mail either. Thanks in advance guys!
-
hey! yeah i dont know why i didnt turn error reporting on... Anyways, heres the error... A bit too cryptic for me! Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/anhwebfrontend/admin.php:1) in /Applications/MAMP/htdocs/anhwebfrontend/admin.php on line 2 Notice: Undefined index: HTTPS in /Applications/MAMP/htdocs/anhwebfrontend/admin.php on line 19 3
-
Hey guys, plz tell me why the session var $_SESSION['return_url'] is not carrying from test.php to login.php The two echos in this file work perfectly, so i know the session var is registered... test.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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SWG:ANH • Bringing PreCU back to life...</title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="stylesheet" type="text/css" media="screen" href="theme/main.css" /> <?php session_start(); // This section will generate a var containing the current page URL. This will be used to allow the language script to redirect users back to the page they // were on, in the language they selected. It is registered as a session variuable that will change every time the page changes. function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } // Here we register the URL we grabbed earlier in the session var. $return_url = curPageURL(); $_SESSION['return_url'] = $return_url; echo $_SESSION['return_url']; echo $return_url; include 'lang/enus.php'; include 'menu.php'; ?> login.php <?php session_start(); echo $_SESSION['return_url'] ; include 'dbconnect.php'; $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $return_url = $_SESSION['return_url']; echo $return_url; $result = mysql_query("SELECT COUNT(*) FROM account WHERE Username='$username' and Pass='$password'") or die(mysql_error()); $result = mysql_fetch_row($result); $result = $result[0]; if($result == 1){ $_SESSION['username'] = $username; header("Location:".$return_url); } else { echo "Wrong Username or Password. Use the back button. If you think this message is incorrect, contact the webmaster."; } ?> I know its not carrying because the echo in login.php is not returning anything and the script cant execute the header function because it has nowhere to go! Ive narrowed it down to the session var not carrying.
-
Hey guys! The error is that it seems to display EVERYTHING regardless of the if and else statements. Also, it seems to stop evaluating the rest of the document that "includes" this as soon as its done with this one. dbconnect works and all the session vars carry properly... WTF is going on!? <?php session_start(); include 'dbconnect.php'; $username = $_SESSION['username']; $q = mysql_query("SELECT User_type FROM account WHERE username = '$username'") or die(mysql_error()); $permission = mysql_fetch_row($q); $permission = $permission[0]; if(isset($_SESSION['username']) && $permission >= 2){ echo"<div id='page-section-mainmenu'><ul><li><a href=''><span>"; echo $menu001; echo "</span></a></li><li><a href=''><span>"; echo $menu002; echo "</span></a></li><li><a href=''><span>"; echo $menu003; echo "</span></a></li><li><a href=''><span>"; echo $menu004; echo "</span></a></li><li><a href=''><span>"; echo $menu006; echo "</span></a></li>";} elseif($permission <= 1){ echo"<div id='page-section-mainmenu'><ul><li><a href=''><span>"; echo $menu001; echo "</span></a></li><li><a href=''><span>"; echo $menu002; echo "</span></a></li><li><a href=''><span>"; echo $menu003; echo "</span></a></li><li><a href=''><span>"; echo $menu004; echo "</span></a></li>";} else{ echo"<div id='page-section-mainmenu'><ul><li><a href=''><span>"; echo $menu001; echo "</span></a></li><li><a href=''><span>"; echo $menu002; echo "</span></a></li><li><a href=''><span>"; echo $menu003; echo "</span></a></li><li><a href=''><span>"; echo $menu005; echo "</span></a></li>"; echo "<span> <form action='login.php' method='POST'> <input type='text' value='username' name='username'> <input type='text' value='password' name='password'> <input type='submit'> </form> </span> </li> </ul> </div> </div>";} ?>
-
[SOLVED] httpd.conf not allowing external connections
matthew798 replied to matthew798's topic in Apache HTTP Server
there goes my headache. THANKS! -
Hey guys, I usually run wamp on my crappy server for learning purposes but it screwed up and now im using easy PHP. The config file for apache is slightly different. I did end up fixing my initial problem but i can no longer connect to the server from other computers in the lan. Yes the ports are forwarded, and yes i have "Allow from all" in <location> tags in the config. Also yes the port is 80 and no my ISP does not block that port. Attached is the config file! [attachment deleted by admin]
-
Hola boys! <form action="" method="POST"> <table width="100%" border="0"> <tr> <td> </td> <td> <span class="general">Subject: </span><input type="text" /> <span class="general"># Prefix: </span><input type="text" /> <span class="general">Room #: </span><input type="text" /> <span class="general">Teacher: </span><select name="teacher"> <?php $query = "SELECT name FROM teachers"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); echo '<option value="'.$row['name'].'">'.$row['name'].'</option>'; ?> </select> </td> </tr> </table> </form> I only ever get one option in the drop down menu, and it's the first in the database. What am i doing wrong?
-
Jeeze... Your asking for ALOTTTTT You realize (and i THINK this is how it works) that an image with only 500X500 resolution has 250000 pixels... Thats ALOT of ifs lol. (im sure there is an easier way. But not much easier) And, honestly. I don't think there is a way to do that in PHP that wouldn't amount to the same overhead... Because thats ALOT of checking. But good luck and i'll do some digging for you to see if i can turn anything up. I am by no means a PHP expert but i am trying to give back to this community that has given me so much! (looks like money is the only way i'm useful HAH)