[PHP-DB] Adding Up MySQL Results
I hope someone can help with this frustratingly simple (I assume!) question I have. I run this mysql query: "select sum(quantity)*price,price from sale where dvd_id=1 group by price"; I get this result: sum(quantity)*price price 450.00 15.00 29.99 29.99 I want to display the sum of the values in the first column (450.00+29.99), but I cannot figure out how to do this! Can someone clue me in? Thanks a million, Nathan -- Nathan Mealey Website Manager & Administrative Director Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 [EMAIL PROTECTED] (413) 210-7984 (512) 681-7043 Fax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] last insert ID
Is there a PEAR::DB equivalent to the mysql_insert_id()? I can't figure out how to get the primary key ID from the last insert query, without doing a second query (which seems ridiculous). On that same note, are the mysql_insert_id() and pg_last_oid() equivalent? I thought they were, but when I used pg_last_oid() I got some crazy number that was definitely not the last primary key ID. Thanks, Nathan -- Nathan Mealey Director of Operations Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 [EMAIL PROTECTED] (413) 210-7984 (512) 681-7043 Fax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Redhat-MySQL Issues
I am trying to get PHP (4.3.2) to connect to MySQL 4.1.8 on a Redhat AS 3.0 server. I ran the command: up2date php-mysql And on the initial run-through, PHP connected to MySQL no problem. But then I changed something in the PHP.ini and the next time I ran a PHP to Mysql script, I got the following error message: Fatal error: Call to undefined function: mysql_connect() All I changed in the PHP.ini was the include path. What could have happened? I am so in the dark on how to fix this! Thanks, Nathan -- Nathan Mealey Director of Operations Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 [EMAIL PROTECTED] (413) 210-7984 (512) 681-7043 Fax
[PHP-DB] FPDF Help
Anyone who is familiar with using FPDF to generate PDFs, I'd really appreciate some suggestions here: I am using the following code, virtually identical to that used in the FPDF tutorial examples. But I keep getting a parse error for the first line containing the variable $this. In the tutorial they do not declare this variable prior to using it the same way as in the example below, but when I try and do this, it's a no go. Any ideas? Suggestions? the code -- define('FPDF_FONTPATH','../../../font/'); require('../fpdf.php'); class PDF extends FPDF { function Header() { //Arial 12 $this->SetFont('Arial','',12); //Move to the right $this->Cell(80); //Title $this->Cell(30,10,'Title',1,0,'C'); //Line break $this->Ln(20); } function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',8); //Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times','',12); for($i=1;$i<=40;$i++) { $pdf->Cell(0,10,'Printing line number '.$i,0,1); } $pdf->Output(); } Nathan Mealey Director of Operations Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 [EMAIL PROTECTED] (413) 587-3133 (413) 210-7984 Mobile (512) 681-7043 Fax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PDFLib
Has anyone had any experience extracting text from a fulltext field/column in a MySQL DB and, using the PDFLib library, converting it to a PDF on-the-fly? I can create the PDF, but it is taking all of the text (about 6300 characters) and putting it on just one line - which goes off of the viewable page (as you can imagine). If anyone has any ideas or experience with this, that'd be super. -- Nathan Mealey Director of Operations Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 [EMAIL PROTECTED] (413) 587-3133 (413) 210-7984 Mobile (512) 681-7043 Fax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php