Jump to content

NickG21

Members
  • Posts

    146
  • Joined

  • Last visited

    Never

Everything posted by NickG21

  1. hey guys thanks for the suggestions, unfortunately, i'm not able to get either of them working. BlueSky, I can't seem to get the array to properly store all the values from the SQL result rows, only 1 value is being stored in the $items array. ignace: it seems like you're code leaves at least one of the <div> tags open when it is executed, I got yours to begin displaying how I wanted but it would only display the first and 4th results, as i set the num of rows per column to only 3, displaying like this; 1 4 instead of: 1 4 2 3 thanks again for the help guys, ill keep plugging
  2. Hey Everyone, I'm creating a site that will show images uploaded for certain days working on a job site. Kind of a day-to-day photo journal for the customer. On the site, the user gets here, sees 3 large images, and a series of thumbnails if more than 3 images exist for that day (works fine). However, underneath that I want to display a 3-4 column setup of "Archived Dates" that provide a link to the images of the other dates. I have this working correctly, but the results are displayed as follows: Date 1: Date 2: Date 3: etc.... I want them to display like this; Day 1 Day 4 Day 2 Day 5 Day 3 Day 6 and so on..... in a 3 column format. Here is the code I have right now just looping through to display these link results, not the rest of the page. I am trying to do it tableless right now, but if that isn't the right way to go, please let me know. Thanks to anyone in advance, Nick $SQLRowe = "SELECT DISTINCT RoweImgDate from tblRowe WHERE RoweImgDate !='" . $_GET['date'] . "' Order by RoweImgDate DESC Limit 0, 30"; //echo $SQLRowe; $rsSQLRowe = mysql_query($SQLRowe); <span class="rowe">Archived Photos:</span><br/> <div id="archive"> <?php while($row = mysql_fetch_array($rsSQLRowe)){ //echo "<a href='index.php?id="' . $row[RoweImgID] . '"' class='link'>$row[RoweImgDate]</a></br>"; echo "<div id='archivedates'>"; echo "<a href='index.php?date=" . $row[RoweImgDate] . "' class='link'>$row[RoweImgDate]</a>"; echo "</div>"; //echo "<img src='images/$row[RoweImage]'/><br/>"; //echo "<span class='FeatDesc'><p>$row[RoweImgDesc]</p></span><br/>"; } ?> </div>
  3. i've actually went through and viewed the source after every reload and change i made to the file and they remain the same. i have also been echoing the values of $i, which increment correctly, but when viewed through the source, i can see that everything is echoing as follows: value of i is 0 ----all hidden values for all results----- value of i is 1 value of i is 2 etc.... so it is obviously in the syntax of everything im just unsure of where my mistakes are being made, and where to go through and increment these values. thanks for the help
  4. hey thanks for the suggestion with using arrays, if i was to echo the hidden inputs such as this echo "<input type='hidden' name='LDESC[]' value='blah'>"; inside of the while loop iterating through the resultset, does it automatically assign the proper array id values such as LDESC[0] etc.. for each result? thanks again for the input
  5. hey guys thanks for the responses wolphie, yes the integer was positive, i had echoed the final values and have been messing with the db's as well wildteen, i tried your suggestion and continue to get the same results, with $i being equal to 0, or 1, depending on what i set the value to. Also tried using $i += 1; to make sure that it wasn't just trying to increment by 0, and got the same results.
  6. Hey everyone, my problem is that Im trying to get variables to increment inside of a nested while loop that is displaying formatted MySQL results. Getting stuck on something this simple makes me feel a little ridiculous but I need to. Here is the code I have right now, but the for() loop isn't incrementing the value of $i by 1 after each ind. product is displayed, just remains as a value of 1 for every iteration. to shorten this up and make it easier i just included the query strings and the results im trying to pass, nothing else really matters. $CartSQL = "SELECT * from tblCart Where CartSessionID = '" . $_SESSION['SessID'] . "'"; $rsCartSQL = mysql_query($CartSQL); for($i = 1; $i < mysql_num_rows($rsCartSQL); $i++){ while($PrIDs = mysql_fetch_array($rsCartSQL)){ $sql = "SELECT * from tblProduct where PrID='" . $PrIDs['CartPrID'] . "'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ echo "<input type='hidden' name='L_NAME$i' value='$row[PrDispName]'>"; echo "<input type='hidden' name='L_AMT$i' value='$row[PrPrice]'>"; echo "<input type='hidden' name='L_QTY$i' value='$PrIDs[CartPrQty]'>"; echo "<input type='hidden' name='L_DESC$i' value='$row[PrDesc]'>"; echo '<tr><td width="65%"><a href="products.php?id=' . $row['PrID'] . '"> ' . $row['PrDispName'] . '</a></td><td><img src="' . $row['PrImage'] . '" alt=' . $row['PrName'] . '" height="50px" width="50px"></td>'; echo '<td>$' . $row['PrPrice'] . '</td>'; echo '<td>Qty:' . $PrIDs['CartPrQty'] . '</td>'; echo '<tr><td colspan="4"><hr/></td></tr>'; echo '</tr>'; $total = $row['PrPrice'] * $PrIDs['CartPrQty']; } $_SESSION['total'] += $total; } } as you can see im trying to increment for the hidden values, which eventually will be Name-Value pairs sent to a secure server for transaction, right now with this code they are being sent as LNAME1 LNAME1 LDESC1 LDESC1 no incrementing. thanks for any help guys, it's appreciated.
  7. I have also tried executing the initial cart query outside of the switch statement, thinking that maybe it caused things to reiterate and the same problem persists.....
  8. Hey everyone my problem is as follows. I have a custom shopping cart that i've been building for my store, and when I go to add a new product, I query the tblCart table to see if the PrID (ProductID) exists in the cart. If it doesn't I insert the proper values with a qty of 1 and proceed. My problem is that when I insert the item initially with a value of 1, it acts like a page refresh and requeries the cart table, then having the ProductID in the cart, and updating it to a qty of 2 (as if a customer had clicked "Add to Cart" again on the product page after having one in the cart already). My code is below, just for the "add_item" case in my switch statement. Please let me know if you need anything more from me and thank you in advance for your help. Lastly, this is from me starting over this morning on this switch case and still getting the same problem. switch($action) { //decide what to do case "add_item": /*check if product already in cart*/ $ExistSQL = "SELECT * from tblCart Where CartPrID ='" . $PrID . "'AND CartSessionID='" . $_SESSION['SessID'] . "'"; echo $ExistSQL . '<br/>'; $rsExistSQL = mysql_query($ExistSQL); //if there are no results aka the product doesnt exist in this users cart then insert the product with a qty of 1 if(mysql_num_rows($rsExistSQL)==0){ echo "There are 0 results in this set<br/>"; $InsCartPr = "INSERT into tblCart (CartID, CartSessionID, CartPrID, CartPrOpt, CartPrQty, CartDateAdded) values ('','$_SESSION[sessID]','$PrID','$PrOpts','1',now())"; echo $InsCartPr . '<br/>'; $rsInsCartPr = mysql_query($InsCartPr); }else{ //If there is a result, then the product is in the cart, update the cart qty by 1 $row = mysql_fetch_array($rsExistSQL); $qty = $row['CartPrQty'] + 1; echo $qty . '<br/>'; echo "Weve got something in the db, time to update<br/>"; $UpdCartPr = "Update tblCart set CartPrQty='" . $qty . "' WHERE CartSessionID = '" . $_SESSION['SessID'] . "' AND CartPrID='" . $PrID . "' AND CartPrOpt = '" . $PrOpts . "'"; echo $UpdCartPr . '<br/>'; //$rsUpdCartPr = mysql_query($UpdCartPr); } break; in the case of a switch statement like this, is it normal for it to iterate through the process again after a DB query has been executed? im not a complete novice in PHP, but im no expert either. Thanks again everyone, Nick
  9. Hey everyone, below is a script that I got online and have modified to be used for up to 5 images, instead of just 1. The script is supposed to take the uploaded file, resize it to 350px wide x (whatever heights end up), and also create a thumbnail that is 50x50px, then store into a database. The script works great with everything except resizing the initial image to 350px. when using this by itself, the script worked great but now i cant figure out the resize for multiple images. if anyone could help me out it would be greatly appreciated. Thanks in advance, NickG P.S. I've commented everything that needs to be looked at so you dont need to sieve through everything to find it. <?php include('header.inc.php'); include('dbinfo.inc.php'); error_reporting(0); $change=""; $abc=""; $max_img_no=5; //Maximum images to be set here define ("MAX_SIZE","40000"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if($_SERVER["REQUEST_METHOD"] == "POST"){ foreach($_POST as $key => $value){ $$key = $value; //echo "Key is: " . $key . '<br/>'; //echo "Value is: " . $value . '<br/>'; } //Error check for open fields if((empty($PropTitle)) || (empty($PropDesc)) || (empty($PropPrice))){ $error++; echo "There were unfilled areas, only the picture is optional, all other areas must be filled out."; }else{ $PropTitle = mysql_real_escape_string($PropTitle); $PropDesc = mysql_real_escape_string($PropDesc); $x = 1; $image1 = $_FILES["file"]["name"][$x]; //echo "image 1 is" . $image1; $InsPropSQL = "INSERT into tblProperty(PropID, PropTitle, PropDesc, PropPrice, PropImage)values('','$PropTitle','$PropDesc','$PropPrice','$image1')"; //echo $InsPropSQL; $rsInsPropSQL = mysql_query($InsPropSQL); //Select last row in tblProperty after inserted, to get newest Property ID $query = mysql_query("SELECT * FROM tblProperty WHERE PropID = (SELECT MAX(PropID) FROM tblProperty)"); while($row=mysql_fetch_array($query)){ $_SESSION['PropID'] = $row['PropID']; //echo $_SESSION['PropID']; } //Loop through the files that were chosen to be uploaded, resize them, upload and insert into other DB for($i=1; $i<=$max_img_no; $i++){ $image = $_FILES["file"]["name"][$i]; //echo $image . '<br/>'; $filename = stripslashes($_FILES['file']['name'][$i]); $extension = getExtension($filename); $extension = strtolower($extension); if(($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")){ $change='<div class="msgdiv">Unknown Image extension </div> '; $errors=1; }else{ $size=filesize($_FILES['file']['tmp_name'][$i]); if ($size > MAX_SIZE*1024){ $change='<div class="msgdiv">You have exceeded the size limit!</div> '; $errors=1; } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $_FILES['file']['tmp_name'][$i]; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $_FILES['file']['tmp_name'][$i]; $src = imagecreatefrompng($uploadedfile); }else{ $src = imagecreatefromgif($uploadedfile); } //echo $src; list($width,$height)=getimagesize($uploadedfile); //set the newwidth for the initial image as well as newwidth1 for the thumbnail image $newwidth=350; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); $newwidth1=50; $newheight1=($height/$width)*$newwidth1; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height); //set the directories to be uploaded to as well as the filename to be stored in DB $filename = "../images/". $_FILES['file']['name'][$i]; $ImageName = $_FILES['file']['name'][$i]; $filename1 = "../images/small/small". $_FILES['file']['name'][$i]; $ImageName1 = $_FILES['file']['name'][$i]; imagejpeg($tmp,$filename,100); imagejpeg($tmp1,$filename1,100); //destroy the temporary image and src then loop through imagedestroy($src); imagedestroy($tmp); imagedestroy($tmp1); } $uploadedfile = $_FILES['file']['tmp_name'][$i]; //if the file successfully uploaded, then insert new row into Property Images table if(move_uploaded_file($uploadedfile, $filename)){ $InsImgSQL = "INSERT into tblImage(ImgID,ImgPropID,ImgName,ImgThumb) value('','$_SESSION[PropID]','$ImageName','small$ImageName')"; //echo $InsImgSQL; $rsInsImgSQL = mysql_query($InsImgSQL); } } } } //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { // mysql_query("update {$prefix}users set img='$big',img_small='$small' where user_id='$user'"); echo ' <div class="msgdiv">Image Uploaded Successfully!</div>'; } ?>
  10. Hello, Please review my new online retail store at http://www.yourlifeoutdoors.com and leave any and all feedback. This is my first online store creation and I would appreciate everyone's recommendations. Thank you very much in advance, Nicholas Girard www.yourlifeoutdoors.com [attachment deleted by admin]
  11. Hey everyone, I believe I'm aware of what the problem is and why im getting this error. I read in other places online that it's because you can't write to an HTML URL directly and I understand that. My question is how do I reference this upload to a different director containing the /images/ folder that i want them to be stored in. Here is the error followed by my code for the upload and directory structure. Thanks in advance for taking the time to look at this. NickG Error: Warning: move_uploaded_file(http://www.yourlifeoutdoors.com/images/yourlife_logo_v1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in /home/alloutd1/public_html/admin/insertproduct.php on line 100 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php0JgELx' to 'http://www.yourlifeoutdoors.com/images/yourlife_logo_v1.jpg' in /home/alloutd1/public_html/admin/insertproduct.php on line 100 Stored in: images/yourlife_logo_v1.jpg Code: <?php if(isset($_POST['submit'])){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 200000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("http://www.yourlifeoutdoors.com/images/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], Line 100: "http://www.yourlifeoutdoors.com/images/" . $_FILES["file"]["name"]); echo "Stored in: " . "images/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; }?> the directory I would like the files stored in is yourlifeoutdoors.com/images/ but the page doing this insertion is located in an admin section of the site... how do i reference to this directory?
  12. Hey guys, I was wondering if someone could point me in the right direction here. Basically im trying to be able to update multiple rows of a database depending on the ID value posted in the variable. Here is what I mean. I loop through a query that retrieves all the products in the respect order and create a select box for each like this; <?php $OrProds = mysql_query("SELECT * from tblOrderProduct Inner Join tblProduct on tblOrderProduct.OpID = tblProduct.PrID Inner Join tblOrder on tblOrderProduct.OpOrID = tblOrder.OrID where OpOrID ='" . $OrID . "'"); while($rsOrProds = mysql_fetch_array($OrProds)){ ?> <tr> <td>Product ID:</td><td>Product Name:</td><td>Price:</td><td>Quantity:</td><td>Total:</td><td>Maker:</td><td>Image</td> </tr> <tr> <td><?php echo $rsOrProds['OpID']; ?></td><td><?php echo $rsOrProds['PrName']; ?></td><td><?php echo '$' . $rsOrProds['OpPrPrice']; ?></td><td align="center"><?php echo $rsOrProds['OpCartPrQty']; ?></td><td><?php echo '$' . ($rsOrProds['OpCartPrQty'] * $rsOrProds['OpPrPrice']); ?></td><td><?php echo $rsOrProds['OpPrMaker']; ?></td><td><img src="<?php echo $rsOrProds['PrImage']; ?>" height="40" width="40"></td> </tr> <? $total = $total + ($rsOrProds['PrPrice'] * $rsOrProds['OpCartPrQty']); ?> <tr> <td colspan="3">Product Status</td> Create select box using OpID <td><select name="OpStatus[<?php echo $rsOrProds['OpID']; ?>]"> <option value=""<?php if ($rsOrProds['OpStatus'] == ""){?> selected="selected" <?php } ?>></option> <option value="New"<?php if ($rsOrProds['OpStatus'] == "New"){?> selected="selected" <?php }?>>New</option> <option value="Pending"<?php if ($rsOrProds['OpStatus'] == "Pending"){?> selected="selected" <?php } ?>>Pending</option> <option value="Waiting Tracking"<?php if ($rsOrProds['OpStatus'] == "Waiting Tracking"){?> selected="selected" <?php } ?>>Waiting Tracking</option> <option value="Shipped"<?php if ($rsOrProds['OpStatus'] == "Shipped"){?> selected="selected" <?php } ?>>Shipped</option> <option value="Complete"<?php if ($rsOrProds['OpStatus'] == "Complete"){?> selected="selected" <?php } ?>>Complete</option> </td> <?php } ?> What I want to do is be able to update the row depending on the OpID that is found in the select box submitted. The values are being submitted correctly as i've printed all $_POST variables to the screen and received these as the array values; [OpStatus] => Array ( [6] => Waiting Tracking [310] => Shipped ) I am just unsure of what steps to take to update the database? Any suggestions would be great, this is what my thought process is; foreach value in OpStatus update tblOrderProduct set OpStatus = new status Where OpID = OpID associated with the array? thanks in advance to any help you can give me?!
  13. that didn't change anything, i've been using this indenting in all of my pages and there has never been an error with it
  14. Do you think you could give me an example of what they are? i've been using crimson forever and this site was working earlier, i can't figure out what change i've made that made this error start happening.
  15. Hey Guys, I just started getting this error and I have no idea why, Parse error: syntax error, unexpected '>' in /home/.....php on line 25. I can't figure out at all why this would be going on as there are no open tags near this line in the code. any help you guys can give is apprecaited, thank you! <?php include("header.inc.php"); if(isset($_POST['order'])){ /*Get Customer Info*/ $SQLUser = "SELECT * from tblCustomer Where CuSessID ='" . $_COOKIE[phpSESSID] . "'"; $rsSQLUser = mysql_query($SQLUser); $CuInfo = mysql_fetch_array($rsSQLUser); /*Update Customer CC Info*/ $SQLCCUpdate = "Update tblCustomer set CuCCType='" . $_POST['CCardType'] . "' ,CuCCNum='" . $_POST['CCNum'] . "' ,CuCCSVC='" . $_POST['CCCSV'] . "' ,CuCCName='" . $_POST['CCName'] . "' ,CCExpDate='" . $_POST['CCMonth'] . '/' . $_POST['CCYear'] . "' Where CuSessID='" . $_COOKIE[phpSESSID] . "'"; $rsSQLCCUpdate = mysql_query($SQLCCUpdate); /*Log order before individual products*/ $SQLOrder = "INSERT into tblOrder (OrID,OrDate,OrCuID, OrCuShipFName,OrCuShipLName,OrCuShipAddress,OrCuShipCity,OrCuShipState,OrCuShipZip,OrCuShipEmail,OrCuShipPhone,OrCuBillFName,OrCuBillLName,OrCuBillAddress,OrCuBillCity,OrCuBillState,OrCuBillZip,OrCuBillEmail,OrItemTotal,OrShippingTotal,OrAuthorization,OrStatus) values('',now(),'$CuInfo[CuID]','$CuInfo[CuFName]','$CuInfo[CuLName]','$CuInfo[CuShipAddress]','$CuInfo[CuShipCity]','$CuInfo[CuShipState]','$CuInfo[CuShipZip]','$CuInfo[CuEmail]','$CuInfo[CuShipPhone]','$CuInfo[CuBillFName]','$CuInfo[CuBillLName]','$CuInfo[CuBillAddress]','$CuInfo[CuBillCity]','$CuInfo[CuBillState]','$CuInfo[CuBillZip]','$CuInfo[CuBillEmail]','$_SESSION[total]','','','')"; $rsSQLOrder = mysql_query($SQLOrder); /*Retrieve OrderID for use in tblOrderProduct*/ $SQLOrID = mysql_query("SELECT OrID from tblOrder where OrCuShipFName='" . $CuInfo[CuFName] . "' AND OrCuShipLName='" . $CuInfo[CuLName] . "' AND OrCuBillEmail='" . $CuInfo[CuBillEmail] . "'"); $rsSQLOrID = mysql_fetch_array($SQLOrID); /*Get Products from Cart*/ $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID ='" . $_COOKIE[phpSESSID] . "'"; Line 25: $rsSQLCuCart = mysql_query($SQLCuCart); /*var_dump(mysql_fetch_array($rsSQLCuCart));*/ /*Log individual products*/ while($row = mysql_fetch_array($rsSQLCuCart)){ $SQLPrInfo = "SELECT PrPrice,PrProvider from tblProduct where PrID='" . $row['CartPrID'] . "'"; $rsSQLPrInfo = mysql_query($SQLPrInfo); $PrInfo = mysql_fetch_array($rsSQLPrInfo); $SQLCuOrder = "INSERT into tblOrderProduct (OpID, OpOrID, OpCartPrQty, OpPrPrice, OpPrTotal, OpPrMaker) values('$row[CartPrID]','$rsSQLOrID[OrID]','$row[CartPrQty]','$PrInfo[PrPrice]','$PrInfo[PrPrice] * $row[CartPrQty]','$PrInfo[PrProvider]')"; $rsSQLCuOrder = mysql_query($SQLCuOrder); } /*Remove tblCart Entries after Order is Placed*/ $EmptyCartSQL = mysql_query("DELETE FROM tblCart Where CartSessionID='" . $_COOKIE[phpSESSID] . "'"); session_destroy(); }?>
  16. hey Sasa, when I use that syntax for the Insert statement, all of the field values are blank except for my Session variable, and the statement does not execute properly anyway. When I plug in the Insert statement, even with the blank values, into a query window in PHPMyAdmin, I receive this error; SQL query: NSERT INTO tblOrder( OrID, OrDate, OrCuShipFName, OrCuShipLName, OrCuShipAddress, OrCuShipCity, OrCuShipState, OrCuShipZip, OrCuShipEmail, OrCuShipPhone, OrCuBillFName, OrCuBillLName, OrCuBillAddress, OrCuBillCity, OrCuBillState, OrCuBillZip, OrCuBillEmail, OrItemTotal, OrShippingTotal, OrAuthorization, OrStatus ) VALUES ( '', now( ) , ',', '', '', '', '', '', '', '', '', '', '', '', '', '', '1499.5', '', '', '' ) MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NSERT into tblOrder (OrID, OrDate, OrCuShipFName,OrCuShipLName,OrCuShipAddress,O' at line 1 any ideas about this? thanks again
  17. Hey Everyone, Could someone tell me if im getting this error because of a syntax error or possibly because there is an empty variable? And if an empty variable could someone tell me how to error check for this now and in the future? thanks in advance for any help Nick Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/alloutd1/public_html/test/YourLife/checkout2.php on line 20 <?php include("header.inc.php"); $CuID = $_COOKIE['PHPSESSID']; /*Get Customer Info*/ $SQLUser = "SELECT * from tblCustomer Where CuBillAddress ='" . $_GET['addr'] . "' AND CuEmail='" . $_GET['email'] . "'"; $rsSQLUser = mysql_query($SQLUser); $CuInfo = mysql_fetch_array($rsSQLUser); /*Get Products from Cart*/ $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID ='" . $_GET['id'] . "'"; $rsSQLCuCart = mysql_query($SQLCuCart); if(isset($_POST['order'])){ /*Get Customer Info*/ $SQLUser = "SELECT * from tblCustomer Where CuBillAddress ='" . $_GET['addr'] . "' AND CuEmail='" . $_GET['email'] . "'"; $rsSQLUser = mysql_query($SQLUser); $CuInfo = mysql_fetch_array($rsSQLUser); /*Get Products from Cart*/ $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID ='" . $_GET['id'] . "'"; $rsSQLCuCart = mysql_query($SQLCuCart); /*Log order before individual products*/ Line 20: $SQLOrder = "INSERT into tblOrder (OrID, OrDate, OrCuShipFName,OrCuShipLName,OrCuShipAddress,OrCuShipCity,OrCuShipState,OrCuShipZip,OrCuShipEmail,OrCuShipPhone,OrCuBillFName,OrCuBillLName,OrCuBillAddress,OrCuBillCity,OrCuBillState,OrCuBillZip,OrCuBillEmail,OrItemTotal,OrShippingTotal,OrAuthorization,OrStatus) values('',now(),'$CuInfo['CuShipFName'],$CuInfo['CuShipLName']','$CuInfo['CuShipAddress']','$CuInfo['CuShipCity']','$CuInfo['CuShipState']','$CuInfo['OrCuShipZip']','$CuInfo['OrCuShipEmail']','$CuInfo['CuShipPhone']','$CuInfo['OrCuBillFName']','$CuInfo['OrCuBillLName']','$CuInfo['OrCuBillAddress']','$CuInfo['OrCuBillCity']','$CuInfo['OrCuBillState']','$CuInfo['OrCuBillZip']','$CuInfo['OrCuBillEmail']','$_SESSION['total']','','','')"; echo $SQLOrder; /*Log individual products*/ while($row = mysql_fetch_array($rsSQLCuCart)){ $SQLPrInfo = "SELECT * from tblProduct where PrID='" . $row['CartPrID'] . "'"; $rsSQLPrInfo = mysql_query($SQLPrInfo); $PrInfo = mysql_fetch_array($rsSQLPrInfo); echo $PrInfo['PrID'] . "<br/>"; /*$SQLCuOrder = "INSERT into tblOrderProduct(OpID, OpOrID, OrCartPrID, OpCartPrQty, OpPrPrice, OpPrMaker) values('$row['CartPrID']',' */ } ?>
  18. everything's working perfectly! thank you all for your help i appreciate it a ton! couldn't have done it without you (obviously!)
  19. also i've tried other syntax for the same query that seemed to go through and i would get either an UNEXPECTED_T_STRING on the same line or the same Parse error on line 27, the query inside the while{} loop thanks for your help,
  20. Here's the entire page; <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); include("header.inc.php"); foreach ($_POST as $key => $value) { $$key = $value; echo $$key; } /*Update tblCustomer with CC Information*/ $sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCYear . "',CCName='" . $CCName . '" WHERE CuSessID = "' . $_COOKIE['PHPSESSID'] . '"; echo $sqlCCUpdate; $rssqlCCUpdate = mysql_query($sqlCCUpdate); /*Get Products from Cart*/ Line 17 Error Line: $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID = '" . $_COOKIE['PHPSESSID'] . "'"; $rsSQLCuCart = mysql_query($SQLCuCart) or die("Query Unsuccesful using CartSessION"); echo $SQLCuCart; ?> <div id="content"> <table> <?php while($PrIDs = mysql_fetch_array($rsSQLCuCart)){ $PrID = $PrIDs['CartPrID']; $ProdSQL = "SELECT PrName,PrImage,PrPrice from tblProduct where PrID ='$PrID'"; $rsProdSQL = mysql_query($sql) or die("No PrID associated"); while($row = mysql_fetch_array($result)){ echo $row['PrName']; } } ?> </table> </div> <?php include("footer.inc.php"); ?>
  21. Hey guys, i keep receiving this parse error of: Parse error: syntax error, unexpected '"' in /.../order.php on line 13 Line 13 is as follows: /*Get Products from Cart*/ Line 13: $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID = '" . $_COOKIE["PHPSESSID"] . "'"; $rsSQLCuCart = mysql_query($SQLCuCart); echo $SQLCuCart; The real issue im having is that im using the exact same query on the page before which is a type of "Order Overview" page and everything is working perfectly. I have been using this same method of querying throughout this project and it has worked fine the entire way until i made this order.php page. Any insight would be excellent, thank you, NickG
  22. sorry but that didnt work, still receiving the same error
  23. Hey everyone, im getting this error on a page where im trying to redisplay cart info from a temporary table that's setup. Here's the error and the code: Parse error: syntax error, unexpected '>' in .../order.php on line 25 Line 25: echo '<tr><td width="250px"><a href="products.php?id=' . $row['PrID'] . '"> ' . $row['PrDispName'] . '</a></td><td rowspan="2"><img src="' . $row['PrImage'] . '" alt=' . $row['PrName'] . '" height="50px" width="50px"></td></tr>'; code: /*Update tblCustomer with CC Information*/ $sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCMonth . $CCYear . "',CCName='" . $CCName . '" WHERE CuSessID ="' . $_COOKIE['PHPSESSID'] . '"; echo $sqlCCUpdate; $rssqlCCUpdate = mysql_query($sqlCCUpdate); /*Get Products from Cart*/ $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart WHERE CartSessionID = ' . $CuID . '"; $rsSQLCuCart = mysql_query($SQLCuCart); ?> <div id="content"> <table> <?php while($PrIDs = mysql_fetch_array($rsSQLCuCart)){ $sql = "SELECT * from tblProduct where PrID=' . $PrIDs['CartPrID'] . '"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ echo '<tr><td width="250px"><a href="products.php?id=' . $row['PrID'] . '"> ' . $row['PrDispName'] . '</a></td><td rowspan="2"><img src="' . $row['PrImage'] . '" alt=' . $row['PrName'] . '" height="50px" width="50px"></td></tr>'; echo '<tr><td>$' . $row['PrPrice'] . '</td></tr>'; echo '<tr><td>Qty:' . $PrIDs['CartPrQty'] . '<hr/></td>'; echo '</tr>'; $total = $row['PrPrice'] * $PrIDs['CartPrQty']; } $_SESSION['total'] += $total; } ?> </table> </div> thanks for anything in advance!!
  24. Hey guys, I know there are plenty of posts on here for this but I cant figure itout, i've been plugging non-stop for hours. i've tried 4 different tutorials to modify etc etc andstill i can't get this thing to upload an image at all. it says its successful and the image never shows up in the directory. any help would be absolutey fantastic. thank you. here's my code and the success on the page after it's passed through. <tr><td>Image Name:</td><td><input type = "file" name ="file" id="file"></td></tr> if(isset($_POST['submit'])){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 200000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("images/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . $_FILES["file"]["name"]); echo "Stored in: " . "images/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } and here is the page after submission and success of an image named "2.jpg" Upload: 2.jpg Type: image/pjpeg Size: 1301.08398438 Kb Temp file: /tmp/phpQrLfn8 this isn't ever last bit of code there is also a query that is created from the informationd depending on everything being set etc.. and that works perfectly and inserts the proper values into the DB, i just can't figure out this image uploader. Thanks again in advance!
×
×
  • 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.