Jump to content

wild_dog

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wild_dog's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=378007:date=May 29 2006, 02:24 AM:name=wild_dog)--][div class=\'quotetop\']QUOTE(wild_dog @ May 29 2006, 02:24 AM) [snapback]378007[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi there, Im trying to write a function that does the following: I have a form which has items from a mysql database. At the moment when you click on an item from the page and add it to a cart the items are being displayed in random order. I want the items to be displayed in the order they are clicked on Any ideas?? Cheers [/quote] Have a look below: I was thinking of somehow assigning a key/id to each item as they are entered and keep a count. Then you fecth the items from the DB as they are added and just display them in the order the keys were assigned (but im thinking another table or two might need to be created for this?? ) Also if the user was then to come back and add more items the function would look for the max count as they were entered and add to the end of the list. Got an idea?? ========================================================== <?php //WA eCart Include require_once("../WA_eCart/blade_cart_PHP.php"); session_start(); ?> <?php require_once('../Connections/blade.php'); ?> <?php $blade_cart->GetContent(); ?> <?php $maxRows_Recordset1 = 5; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_POST['size'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['size'] : addslashes($_POST['size']); } mysql_select_db($database_blade, $blade); $query_Recordset1 = sprintf("SELECT ProdID, ProdName, ProdPrice FROM products WHERE ProdID = %s", $colname_Recordset1); $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $blade) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?> <?php // WA eCart AddToCart if (isset($_POST["blade_cart_1_ATC"]) || isset($_POST["blade_cart_1_ATC_x"])) { $ATC_itemID = $_POST["blade_cart_1_ID_Add"]; $ATC_AddIfIn = 2; $ATC_RedirectAfter = "../shopping_cart/cart.php"; $ATC_RedirectIfIn = ""; $ATC_itemName = "".$row_Recordset1['ProdName'] ."";// column binding $ATC_itemDescription = "testdesc";// column binding $ATC_itemWeight = floatval("0");// column binding $ATC_itemQuantity = "".$_POST["blade_cart_1_Quantity_Add"] ."";// column binding $ATC_itemPrice = floatval("".$row_Recordset1['ProdPrice'] ."");// column binding $ATC_itemQuantity = floatval($ATC_itemQuantity); if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) { $blade_cart->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice); if ($ATC_RedirectAfter != "" && $blade_cart->redirStr == "") { $blade_cart->redirStr = $ATC_RedirectAfter; } if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") { $_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; } else { $_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']; } } } ?><?php =============================================================
  2. Hi there, Im trying to write a function that does the following: I have a form which has items from a mysql database. At the moment when you click on an item from the page and add it to a cart the items are being displayed in random order. I want the items to be displayed in the order they are clicked on Any ideas?? Cheers
  3. [!--quoteo(post=377781:date=May 28 2006, 04:26 AM:name=PMeres)--][div class=\'quotetop\']QUOTE(PMeres @ May 28 2006, 04:26 AM) [snapback]377781[/snapback][/div][div class=\'quotemain\'][!--quotec--] Cannot modify header information - headers already sent by This is the message when i enter the below easy and small source code FOR CREATING A FILLED RECTANGLE : <?php header("Content-Type: image/gif"); $im = ImageCreate(100, 100); // colors... $black = ImageColorAllocate($im, 0, 0, 0); $white = ImageColorAllocate($im, 255, 255, 255); // draw rectangle ImageFilledRectangle($im, 25, 25, 75, 75, $white); // Print and destroy the image ImageGIF($im); ImageDestroy($im); ?> After that message i get a lot of unrecognizable string characters ... What is wrong ????? Anyone? [/quote] If you can try and post a screenshot or an example of the error you are getting Cheers
  4. [!--quoteo(post=377768:date=May 28 2006, 01:51 AM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ May 28 2006, 01:51 AM) [snapback]377768[/snapback][/div][div class=\'quotemain\'][!--quotec--] ok... heres the script that uploads(pictures show up in folder and open fine) [code] <?PHP session_start(); $errors = array(); $user=$_SESSION['user']; echo "<a href=home.php>Return Home</a>"; if(empty($_POST['ti'])){         $errors[] = '<p><font color=\"yellow\">*Please enter a Title!</font></p>';         }else{         $ti=$_POST['ti'];         }         if(empty($_POST['pr'])){         $errors[] = '<p><font color=\"yellow\">*Please enter a Price!</font></p>';         }else{         $pr=$_POST['pr'];         }                  if(empty($_POST['de'])){         $errors[] = '<p><font color=\"yellow\">*Please enter a Description!</font></p>';         }else{         $de=$_POST['de'];         }         if(move_uploaded_file($_FILES['ph']['tmp_name'],         "listingphoto/{$_FILES['ph']['name']}")) {         }else{          $errors[] = '<p><font color=\"yellow\">*Sorry There was a Problem Uploading Your Picture, Please Try again!</font></p>';         } if(isset($_POST['submit'])){ if (empty($errors)) { $username="********"; $password="*********"; $database="*********"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); echo "<br><br>Your Listing Was successfully Posted!"; $query2="INSERT INTO listings VALUES('','$ti','$pr','$de','{$_FILES['ph']['name']}','$user')"; $result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());     }else{ foreach ($errors as $key){ echo "$key"; } }     }     echo "<form enctype=multipart/form-data method=post>     <p>Title:<input type=text name=ti size=20></p>     <p>Price:<input type=text name=pr size=12></p>     <p>Photo:<input type=file name=ph size=20></p>     <p>Description:<br>     <textarea rows=5 name=de cols=23></textarea></p>     <p><input type=submit value=Submit name=submit></p> </form>"; ?>[/code] and heres the page that should view them but the pics show up as x's!! [code] <?PHP session_start(); $id=$_GET['id']; $user=$_SESSION['user']; $username="*******"; $password="*******"; $database="********"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query2="SELECT * FROM listings WHERE id='$id'"; $result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error()); $num = mysql_num_rows ($result2); echo "<p align=center>Welcome $user! <font size=2>Not you? <a href=login.php>Sign in!</a></font><br><a href=home.php>Return Home</a><br><br>"; while($row = mysql_fetch_row($result2)){ echo "<title>$row[1]</title>"; echo "<font size=4>$row[1]</font><br><br><b>Listed By:</b> $row[5]<br><Br><b>Price:</b> $$row[2]<br><br><b>Description:</b><br>$row[3]<br><br><img border=0 src=listingphoto/$row[4] width=281 height=283>"; } ?>[/code] [/quote] Where is the html that reads the location of the pictures?? And what file format pics are you trying to view? Make sure they are compatible etc size
  5. [!--quoteo(post=377774:date=May 28 2006, 03:36 AM:name=valleydr)--][div class=\'quotetop\']QUOTE(valleydr @ May 28 2006, 03:36 AM) [snapback]377774[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello. I am somewhat familiar with php, I am learning more as I go. I have come up with an issue I can't figure out. I am setting up a script that uses a search form that searches a mysql db for the keyword and show the results. I have it set up to search a specific field in the db, but I want it to search more than one. what I have so far is: [code] if(!isset($HTTP_GET_VARS["keyword"]))     $keyword = ""; else     $keyword = $HTTP_GET_VARS["keyword"]; $filterKeyword = "AND (c.features LIKE '%$keyword%' OR '$keyword'='')"; [/code] keyword is the text box from the form, and c.features is the field it is currently searching from the c table. This works, but what I need is for it to basically search c.features and c.engine and c.drive, etc. For whatever reason, i cannot figure out the correct formatting for this. I'd appreciate any help I can get. Thanks. [/quote] If you are using MySQL then try use the array mysql_fetch_assoc() function. You can use it to search several columns, tables etc and then store that in an array
  6. [!--quoteo(post=377762:date=May 28 2006, 12:58 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 28 2006, 12:58 AM) [snapback]377762[/snapback][/div][div class=\'quotemain\'][!--quotec--] You can add a new field called date, cointaining the timestamp of the order. Then, just use ORDER BY (MySQL). [/quote] Yes i thought about that, however what i belive will happen in that case is this: Eveytime you go and add an item it will read the order the items are stored in the database and display them according to how they are stored. What i want to make sure is that whatever item(s) the user selects thats what they will see in their list so that they are displayed in the order clicked. I was thinking maybe: 1. Include MySQL query in PHP function to Store/Push them into an array as they are selected (Not sure how though) 2. Print the array to screen 3. ORDER by Category, Item ???
  7. Hi there, Im trying to write a function that does the following: I have a form which has items from a mysql database. At the moment when you click on an item from the page and add it to a cart the items are being displayed in random order. I want the items to be displayed in the order they are clicke on Any ideas?? Cheers
×
×
  • 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.