Jump to content

dannybrazil

Members
  • Posts

    178
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dannybrazil's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. This is the command (again it is NOT mine I just copied it) /** * @return the items/products list in this payment request */ public function getItems() { return $this->items; } /** * Sets the items/products list in this payment request * @param array $items */ public function setItems(Array $items) { if (is_array($items)) { $i = Array(); foreach ($items as $key => $item) { if ($item instanceof PagSeguroItem) { $i[$key] = $item; } else if (is_array($item)) { $i[$key] = new PagSeguroItem($item); } } $this->items = $i; } } /** * Adds a new product/item in this payment request * * @param String $id * @param String $description * @param String $quantity * @param String $amount * @param String $weight * @param String $shippingCost */ public function addItem($id, $description = null, $quantity = null, $amount = null, $weight = null, $shippingCost = null) { $param = $id; if ($this->items == null) { $this->items = Array(); } if (is_array($param)) { array_push($this->items, new PagSeguroItem($param)); } else if ($param instanceof PagSeguroItem) { array_push($this->items, $param); } else { $item = new PagSeguroItem(); $item->setId($param); $item->setDescription($description); $item->setQuantity($quantity); $item->setAmount($amount); $item->setWeight($weight); $item->setShippingCost($shippingCost); array_push($this->items, $item); } } example they gave - as it is // Add another item for this payment request $paymentRequest->addItem('0002', 'Notebook rosa', 2,560.00); what I want to do it getting the variables from my DB and with a WHILE loop adding the products. hope it is easier to understand now. the thing is that when I am in the WHILE loop it seems that the ($id) 0001...0002...000n is not being passed correctly in the while loop cus I am getting an error. when I just try to do it manually it is working so I guess something is wrong with the ECHO in the WHILE loop/
  2. I t is getting $productName and $price from $row_3. But it seems when I echo it , something goes wrong regarding this command (which is NOT mine I just copies it to use a shopping cart) $query_3=mysql_query("SELECT * FROM client_order WHERE Client_id = $cid AND order_number = $order_number ");[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]while ($row_3=mysql_fetch_assoc($query_3)){[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]$productName = $row_3['name']; $price = $row_3['price'];[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]echo '$paymentRequest->addItem("'.$start_number.'", "'.$productName.'", '.$price.')';[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]$start_number++; } I guess it has to be something with the echo or with the quotations or something. btw...I was trying to look for this online but couldn't : -> : what this mean...where can I find the manual for this operator (->)
  3. Hello, I have a WHILE loop that works fine, BUT when I add this to it I get an error. I guess my way is NOT how you suppose to do it My regular while: $query_3=mysql_query("SELECT * FROM client_order WHERE Client_id = $cid AND order_number = $order_number "); while ($row_3=mysql_fetch_assoc($query_3)){ echo 'smt....smt'; } I need to add: $paymentRequest->addItem('0001', 'Notebook prata', 2,430.00); // --- 0001 is increasing if I have more than 1 product 0002...000n The new one: $query_3=mysql_query("SELECT * FROM client_order WHERE Client_id = $cid AND order_number = $order_number "); while ($row_3=mysql_fetch_assoc($query_3)){ echo '$paymentRequest->addItem("'.$start_number.'", "'.$productName.'", '.$price.')'; $start_number++; } How to I write the code in a correct way that if I have lets say 3 products is will "print" 3 parts like this: $paymentRequest->addItem('1', 'Notebook prata', 2,430.00); $paymentRequest->addItem('2', 'Notebook red', 2,430.00); $paymentRequest->addItem('3', 'Notebook yello', 2,430.00); Thanks
  4. Hello I have a DB table which contains a col with information [code_of_product - quantity]: Example: 12345 - 12 , 6789 - 8 , 54321 - 3. Now as they are all in ONE CELL I wanted to know if there is a way to SEPARATE them according to the "," and "-" Like this: Product 12345 - Quantity 12 (<br>) Product 6789 - Quantity 8 . . . etc any help?
  5. Hello, I have noticed, in the last few days after uploading via DW one of my pages keeps adding ">" sign after the closing HTML. Example: </html>>>>> Lets say I delete it....and after again it appears, sometimes more ">" </html>>>>>>>>>>>> The things is that it is NOT in the middle of the code, so I didn't forget to "close" some TAGS. any idea about what it is? Danny.
  6. The part called "collation" in the DB, should be UTF8, you mean? ok I have a list of 20+ utf8_ there is no utf8_portuguese . should I choose. utf8_unicode_ci ??
  7. Hello My site is in PORTUGUESE (charset=iso-8859-1"). so a users name could be, for example: Marcus Marcos M?rcos Marc?s ?,?,?, ?, ?, etc.... I have an option that allows to search users on my page. I use %LIKE% in my code, but it is not working correctly. If the user name is Marcus and someone is looking for M?rcus it doesn't return anything Is there a way to disregard ACCENTS while SQL searching? just letters, pure? Danny.
  8. Hello there, I have a DB table where everyday I insert my meetings for the future. I want to ask you guys if anybody can help me with creating some sort of a weekly report. EXAMPLE: I have meeting from the beginning of the year (Mon-Sat)...could be 4-10 meeting per day, so a lot in general. I want them to appear , with sql, under the WEEK they were in for example: (a year has 52 weeks) WEEK 1 (01-01-2011 -> 08-01-2011) *M1 *M2 *M3 ... WEEK 2 (09-01-2011 -> 16-01-2011) *M4 *M5 *M6 ... etc... Is there a way to define the date's range after the week ended automatically? Thanks
  9. I have founf another code that works....shaped it and it is working smoothly foreach($_POST['student_id'] as $row=>$Act) { $student_id = mysql_real_escape_string($Act); $student_name = mysql_real_escape_string($_POST['student_name'][$row]); $student_email = mysql_real_escape_string($_POST['student_email'][$row]); $teacher_name = mysql_real_escape_string($_POST['teacher_name'][$row]); $grp = mysql_real_escape_string($_POST['grp'][$row]); $date = mysql_real_escape_string($_POST['date'][$row]); $date_dd = mysql_real_escape_string($_POST['date_dd'][$row]); $date_mm = mysql_real_escape_string($_POST['date_mm'][$row]); $date_yy = mysql_real_escape_string($_POST['date_yy'][$row]); $att = mysql_real_escape_string($_POST['att'][$row]); $involv = "INSERT INTO table (`student_id`,`student_name`,`student_email`,`teacher_name`, `grp`, `date`, `date_dd`, `date_mm`, `date_yy`, `att` ) VALUES('$student_id', '$student_name', '$student_email', '$teacher_name','$grp','$date','$date_dd','$date_mm','$date_yy','$att')"; mysql_query($involv); } Thnaks a lot for the people who help !!!!!!
  10. Hi I have this code: $insertVals = array(); foreach($_POST['att'] as $studentID => $attended) { $grp = $_POST['grp'][$studentID]; $date = $_POST['date'][$studentID]; $insertVals[] = "('$studentID','$grp','$date','$attended')"; } //Create and run INSERT query $query = "INSERT INTO student_attendance ('student_id','grp','date','att') VALUES " . implode(',', $insertVals); mysql_query($query) or die (mysql_error()); But get this problem: 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 ''student_id','grp','date','att') VALUES ('4','WE001','2011-08-19','Yes' at line 2 Any reason ?
  11. I do have MORE <input> to add <input type="hidden" name="student_id" value="'.$id_st.'" /> <input type="hidden" name="student_name" value="'.$st_name.'" /> <input type="hidden" name="student_email" value="'.$st_email.'" /> <input type="hidden" name="teacher_name" value="'.$teacher.'" /> <input type="hidden" name="grp" value="'.$grp.'" /> <input type="hidden" name="date" value="'.date('Y-m-d').'" /> <input type="radio" name="att['.$id_st.']" value="Yes" />Yes | <input type="radio" name="att['.$id_st.']" value="No" />No //original INSERT mysql_query("INSERT INTO student_attendance (`student_id`,`student_name`,`student_email`,`teacher_name`, `grp`, `date`, `date_dd`, `date_mm`, `date_yy`, `att` ) VALUES ('$_POST[student_id]','$_POST[student_name]','$_POST[student_email]','$_POST[teacher_name]','$_POST[grp]','$_POST[date]','$_POST[date_dd]','$_POST[date_mm]','$_POST[date_yy]','$_POST[att]' )") or die(mysql_error()); How to I add MORE var' to the code you gave me here: $insertVals = array(); foreach($_POST['attend'] as $studentID => $attended) { $insertVals[] = "('$studentID', '$attended')"; } //Create and run INSERT query $query = "INSERT INTO attendance (`studentID`, `attended`) VALUES " . implode(', ', $insertVals); $result = mysql_query($query) or die (mysql_error());
  12. I have found this code....work fine..but how can I add multipule form entries. In this example we have 'student_id' ONLY..how do I add for example: 'date' and 'name' etc... <form method="POST" action="insert.php"> <input type="checkbox" name="id[]" value="32">Article #32<br> <input type="checkbox" name="id[]" value="38">Article #38<br> <input type="checkbox" name="id[]" value="45">Article #45<br> <input type="checkbox" name="id[]" value="59">Article #59<br> <input type="Submit"> </form> $query = 'INSERT INTO related_articles (id) VALUES (' . implode('), (', $_POST['id']) . ')'; $result = mysql_query($query) or die('Could not execute INSERT query'); Now I want to add as well $_post['date'] / $_post['name']....where do I add it ?
  13. Hello, I have an attendance form that looks like that (It automatically adds the students names and info) student 1 DATE Att [yes/no] (radio) student 2 DATE Att [yes/no] (radio) . . student N SUBMIT Now I want that each student will get a DIFFERENT ROW in the DB table. id name date att 1 st1 2011-01-01 yes 2 st2 2011-01-01 no . . n Is there a smart way to do so ? Thanks
  14. Hello, I have a DB with lots of rows...some sort of comments for each article. Lets say the articles have an ID (AR001,AR002...AR100). Each author write articles freely, so I cant know how many each has. Now each article gets various numbers of comments, which I cannot know before hand, and the ROW ID is mixed. I want to print the authors, their articles (ordered) and comments for each. The thing is...how do I capture ONLY ONCE the article code? I mean id AR001 has 100 comments, how do I get JUST the article code ONCE and then another while loop to get the comments. Ex. Danny Sheps Article 1 comment 1 comment n Article 2 comment 1 comment n Article n comment 1 comment n hope you got it....Thanks
  15. $message = " $t_n, \n\n Your original comments:\n $o_comment\n\n <b>$s_n</b> commented about your assessment: \n $text "; mail($t_e , $header, $message, "From: \"E4U2 - Assessment\" <info@english4u2.com.br>\r\n" . "X-Mailer: PHP/" . phpversion());
×
×
  • 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.