
ragrim
Members-
Posts
45 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
ragrim's Achievements

Member (2/5)
0
Reputation
-
Hi, Im having a wierd issue when building a search form i can get results using "like" or greater then less then but when ever i try to search with = i get no results, wether its a date field or a text field i get nothing, i tested the query in navicat and it works fine. the $expiresquery is a variable from a combo box if the user wants to search for < , > , = or like all of them work except = $query = "SELECT userinfo.User_ID, userinfo.FirstName, userinfo.LastName, userinfo.Phone , userinfo.Mobile , userinfo.Email2 , userinfo.Email , userinfo.PostCode , userinfo.Suburb , userinfo.Address , userinfo.State , userinfo.DOB , userinfo.SecondCardName , userinfo.BusinessName , userinfo.Concession , userinfo.CreatedBy , userinfo.Proof , subscribernumbers.SubNumber , subtransactions.Expires , subtransactions.`SubType` , userinfo.Datecreated , userinfo.LastModified , subtransactions.RecieptNum , subtransactions.TransDate , subtransactions.PaymentType , subtransactions.NewSubTrans FROM userinfo Inner Join subscribernumbers ON userinfo.User_ID = subscribernumbers.FKUserID INNER JOIN (SELECT FKSubNum, MAX(NewSubTrans) AS max_trans FROM subtransactions GROUP BY FKSubNum ) AS m ON m.FKSubNum = subscribernumbers.SubNumber Inner Join subtransactions ON subscribernumbers.SubNumber = subtransactions.FKSubNum AND subtransactions.NewSubTrans = m.max_trans"; $whereClause = " WHERE 1 = 1 "; if($fname != 'ANY' && !empty($fname)) { $whereClause .= " AND FirstName " . $fnamequery . "'%$fname%' "; } if($lname != 'ANY' && !empty($lname)) { $whereClause .= " AND LastName LIKE '%$lname%' "; } if($address != 'ANY' && !empty($address)) { $whereClause .= " AND Address LIKE '%$address%' "; } if($suburb != 'ANY' && !empty($suburb)) { $whereClause .= " AND Suburb LIKE '%$suburb%' "; } if($po != 'ANY' && !empty($po)) { $whereClause .= " AND PostCode LIKE '%$po%' "; } if($businessname != 'ANY' && !empty($businessname)) { $whereClause .= " AND BusinessName LIKE '%$businessname%' "; } if($expires != 'ANY' && !empty($expires)) { $whereClause .= " AND Expires " . $expiresquery . "'%$expires%' "; } when i echo out the query i get SELECT userinfo.User_ID, userinfo.FirstName, userinfo.LastName, userinfo.Phone , userinfo.Mobile , userinfo.Email2 , userinfo.Email , userinfo.PostCode , userinfo.Suburb , userinfo.Address , userinfo.State , userinfo.DOB , userinfo.SecondCardName , userinfo.BusinessName , userinfo.Concession , userinfo.CreatedBy , userinfo.Proof , subscribernumbers.SubNumber , subtransactions.Expires , subtransactions.`SubType` , userinfo.Datecreated , userinfo.LastModified , subtransactions.RecieptNum , subtransactions.TransDate , subtransactions.PaymentType , subtransactions.NewSubTrans FROM userinfo Inner Join subscribernumbers ON userinfo.User_ID = subscribernumbers.FKUserID INNER JOIN (SELECT FKSubNum, MAX(NewSubTrans) AS max_trans FROM subtransactions GROUP BY FKSubNum ) AS m ON m.FKSubNum = subscribernumbers.SubNumber Inner Join subtransactions ON subscribernumbers.SubNumber = subtransactions.FKSubNum AND subtransactions.NewSubTrans = m.max_trans WHERE 1 = 1 AND Expires ='%2022-06-28%'
-
Hi, I have a website that has cart and checkout and im rying to submit a form after i have a javascript popup asking to confirm order submit and clear cart, my form has 3 differant buttons and based on which button the form is submitted with the page does differant things, i just cant seem to get it to work as javascript tends to just "submit" the form not submit it by the id/name of the button i tried to submit with. heres my code. this is the form, ive cut alot of code out as its about 100 lines long <form id="order" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <a href="#" class="linkButton" onclick="clear_confirm()">Empty Cart</a> <input type="submit" class="formButton" name="update" value="Update Cart" /> <input type="submit" onclick="order_confirm()" value="Place Order" name="place_order" class="formButton" /> </form> heres the javascript function clear_confirm() { var r=confirm("Are you sure you want to empty the cart?") if (r==true) { window.location="index.php?location=cart.php&action=empty"; } else { } } function order_confirm() { var r=confirm("Are you sure you want to place the order") if (r==true) { document.forms["order"].submit(); } else { } } the clear and update work fine because the clear redirects to a new page, and the update self submits without going via javascript, but when i click on order confirm the java popup appears for confirmation but the page doesnt get submitted, when the page is submitted via order_confirm it should pick up this part if(isset($_POST['place_order'])) { echo "place order"; } am i missing something in the javascript to make it submit the form? thanks in advance
-
Hi, Im pretty much self taught when it comes to php, never read any books just picked things up as i go, and im looking for some advice on how i build my pages as i believe im not approaching it correctly. Basically i build an index.php, this contains my header, footer, and any menus i may have, then for my content pages, in this case products, contact, about us i use use an include so these content pages just have content. Now by doing this my address bar looks like this index.php?location=contact.php for the sake of google and search results and so on, am i limiting my ability to be found by not using a differant file for each page? should i include a header, footer, menu etc within my content pages rather than the other way around? Thanks in advance for any advice.
-
Hi Guys, Ive launched my first real website, ive done a few small things in the past but this is the largest project i have done, with product categories and customer logins etc. Any feedback about the performance and features would be appreciated. http://byronhealthfoods.com.au/ Cheers
-
i made a change to my code and have not recieved any errors as yet, but its hard to tell if i fixed it as this error is random and doesnt happen all the time. i changed it to if(isset($_SESSION['cart'][$pid])) { $_SESSION['cart'][$pid]=$_SESSION['cart'][$pid]+$q; } else { $_SESSION['cart'][$pid]=$q; } I was reading in the php manual that using isset may not be the right way to go about this but its the only way i could avoid the error as any other way seems to produce random errors. Any help would be appreciated.
-
Hi, Im encountering this error when i add items to my cart, im using sessions to store my cart items in an array. this error only happens the first time i add something, then if i go clear my session it works and no errors. Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/byronhea/public_html/oos/mini-cart.php on line 18 Here is the line its refering to if(array_key_exists($pid, $_SESSION['cart'])) and here is the block of code it belongs to if(!isset($_SESSION)) { session_start('cart'); } // Process actions $pid = $_POST['prodid']; $q = $_POST['qty']; if(array_key_exists($pid, $_SESSION['cart'])) { $_SESSION['cart'][$pid]=$_SESSION['cart'][$pid]+$q; } ELSE { $_SESSION['cart'][$pid]=$q; } Any help would be appreciated.
-
Hi, i have a script to import a csv into a database but some of my product descriptions have ' in the names, this causes mysql to error, how can i get around this? here is my code. if(isset($_POST['submit'])) { $i=0; $fname = $_FILES['sel_file']['name']; $chk_ext = explode(".",$fname); if(strtolower($chk_ext[1]) == "csv") { mysql_query("truncate table products") ; $filename = $_FILES['sel_file']['tmp_name']; $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if($i > 0) { $sql = "INSERT into products(prod_id,prod_name,prod_description,prod_cat,prod_sub_cat,tax,prod_price,active) values('$data[0]','$data[1]','$data[9]','$data[14]','$data[15]','$data[19]','$data[35]','$data[65]')"; mysql_query($sql) or die(mysql_error()); } $i++; } fclose($handle); echo "Successfully Imported<br>"; } else { echo "Invalid File"; } }