SV: [PHP-DB] Parse Problem
Isn't it simply a question of having a variable $category that would be updateted each time you have a line starting with CATEGORY? Regards Henrik Hornemann The Royal Library Copenhagen Universitylibrary Facultylaíbrary for Science and Medicine -Oprindelig meddelelse- Fra: Andy Rolls-Drew [mailto:[EMAIL PROTECTED] Sendt: 9. maj 2006 11:04 Til: php-db@lists.php.net Emne: [PHP-DB] Parse Problem Prioritet: Høj All, I am fairly new to parsing XML using PHP and wonder if anyone has a solution to the following. I have a file eg:- ?xml version=1.0 ? STOREITEMS CREATED value=Wed Mar 15 8:07:27 GMT 2006 CATEGORY id='67' name='Herbal Pharmacy' PRODUCT ITEM='603' NAME/NAME MODEL/MODEL PRICE/PRICE PRODUCT ITEM='608' NAME/NAME MODEL/MODEL PRICE/PRICE CATEGORY id='69' name='Extras' PRODUCT ITEM='1123' NAME/NAME MODEL/MODEL PRICE/PRICE PRODUCT ITEM='2034' NAME/NAME MODEL/MODEL PRICE/PRICE And so on. I have managed to parse a little of it using Magic Parser but I still cant manage to split the products and categories correctly. If there weren't multiple products for each category I think I would have it. Any help would be a start. Thanks in advance Andy ARD Drive Consultants Drive to Perfection Rolls-Drew, Andrew Director ARD Drive Consultants Ltd 169 Nottingham Road Melton Mowbray Leicestershire UK mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] AIM: DarkoneARDDrive tel: fax: mobile: Skype ID: +44 7092 162782 +44 7092 162782 +447929418215 andyrd https://www.plaxo.com/add_me?u=30065438052v0=1330159k0=-1748648187 Add me to your address book... http://www.plaxo.com/signature Want a signature like this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] new guy with stupid question
Well, that might, or might not be true. I dont use mysql, but in the manual for mssql_fetch_arry() you will find the exact same phrase. But in my experience mssql_fetch_row() IS significantly faster than mssql_fetch_array(). So you should definitely at least do a test, if you are at all interested in performance and user satisfaction. Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Julien Bonastre [mailto:[EMAIL PROTECTED] Sendt: 21. januar 2006 06:08 Til: Jeffrey; php-db@lists.php.net Emne: Re: [PHP-DB] new guy with stupid question In reference to Jeffrey's comment about the performance of mysql_fetch_row vs mysql_fetch_array, which I always have used the _array implementation: From the horses mouth: Performance: An important thing to note is that using mysql_fetch_array() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value [source: www.php.net/manual/en/function.mysql-fetch-array.php ] tata! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Detailed Report
How about: $sqlstmt1 = select category, name, code, city from table order by category; $categry=''; while ($row1 = mysql_fetch_object ($rs1) { if ($old_category != $row1-category) { $ category = $row1-category; Print($category.br); } Print($row1-name. '-' .$row1-code. '-' .$row1-city. \n'); } Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Shahmat Dahlan [mailto:[EMAIL PROTECTED] Sendt: 27. oktober 2005 12:29 Til: Danny Cc: php-db@lists.php.net Emne: Re: [PHP-DB] Detailed Report Not sure whether this would be such a good idea. Does anybody else have a better one than this? #main loop, gather distinct / unique category names $sqlstmt = select distinct(category) as category from table; $rs = mysql_query ($sqlstmt); while ($row = mysql_fetch_object ($rs)) { print $row-category . \n; # output Customers / Providers $sqlstmt1 = select name, code, city from table; $rs1 = mysql_query ($sqlstmt); # inner loop, display those which category is from the main loop while ($row1 = mysql_fetch_object ($rs1) { print $row1-name . '-' . $row1-code . '-' . $row1-city . \n';# output John - A36 - City } } Danny wrote: Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards. -- Best Regards, Shahmat Dahlan Research and Development SAINS Mobile: (60)16 882 6130 Office: (60)82 426 733 ext 5512 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Detailed Report
Hi, Sorry about the stupid mistakes, should ofcourse have been: $sqlstmt1 = select category, name, code, city from table order by category; $rs1 = mysql_query ($sqlstmt1); $category=''; while ($row1 = mysql_fetch_object ($rs1) { if ($category != $row1-category) { $category = $row1-category; Print($category.br); } Print($row1-name. '-' .$row1-code. '-' .$row1-city. \n'); } Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Henrik Hornemann [mailto:[EMAIL PROTECTED] Sendt: 27. oktober 2005 14:24 Til: php-db@lists.php.net Emne: SV: [PHP-DB] Detailed Report How about: $sqlstmt1 = select category, name, code, city from table order by category; $categry=''; while ($row1 = mysql_fetch_object ($rs1) { if ($old_category != $row1-category) { $ category = $row1-category; Print($category.br); } Print($row1-name. '-' .$row1-code. '-' .$row1-city. \n'); } Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Shahmat Dahlan [mailto:[EMAIL PROTECTED] Sendt: 27. oktober 2005 12:29 Til: Danny Cc: php-db@lists.php.net Emne: Re: [PHP-DB] Detailed Report Not sure whether this would be such a good idea. Does anybody else have a better one than this? #main loop, gather distinct / unique category names $sqlstmt = select distinct(category) as category from table; $rs = mysql_query ($sqlstmt); while ($row = mysql_fetch_object ($rs)) { print $row-category . \n; # output Customers / Providers $sqlstmt1 = select name, code, city from table; $rs1 = mysql_query ($sqlstmt); # inner loop, display those which category is from the main loop while ($row1 = mysql_fetch_object ($rs1) { print $row1-name . '-' . $row1-code . '-' . $row1-city . \n';# output John - A36 - City } } Danny wrote: Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards. -- Best Regards, Shahmat Dahlan Research and Development SAINS Mobile: (60)16 882 6130 Office: (60)82 426 733 ext 5512 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] PHP and MySql question
Hi, Your problem is that your variables $Lat1,$Lat2,$Lon1,$Lon2 all reffer to resultsets and not the Latitudes or Longitudes. Try something like this: $res = mysql_query( SELECT ZG_LATITUDE, ZG-LONGITUDE FROM zip_code where zg_zipcode = '$zip'); List($Lat,$Lon) = mysql_fetch_row($res); $Lat1=Lat-2; $Lat2=Lat+2; $Lon1=Lon-2; $Lon2=Lat+2; Now you can use the values in your final query. Hth Henrik Hornemann -Oprindelig meddelelse- Fra: ReClMaples [mailto:[EMAIL PROTECTED] Sendt: 16. april 2005 22:38 Til: php-db@lists.php.net Emne: [PHP-DB] PHP and MySql question Hello, I'm kinda new at PHP programming with MySQL. I am having an issue and am not sure if this is the corret way to do this: Here is my code, I'll start there: ?php $Lat1 = mysql_query( SELECT (ZG_LATITUDE-2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lat1) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lat2 = mysql_query( SELECT (ZG_LATITUDE+2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lat2) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lon1 = mysql_query( SELECT (ZG_LONGITUDE-2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lon1) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lon2 = mysql_query( SELECT (ZG_LONGITUDE+2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lon2) { echo(PError performing query: . mysql_error() . /P); exit(); } $ZipCode = mysql_query( SELECT * FROM zip_code where ZG_LATITUDE = '$Lat1' and ZG_LATITUDE = '$Lat2' and ZG_LONGITUDE = '$Lon1' and ZG_LONGITUDE = '$Lon2'); if (!$Zipcodesearch) { echo(PError performing query: . mysql_error() . /P); exit(); } while ( $row = mysql_fetch_array($ZipCode) ) { echo(bCity: /b . $row[ZG_CITY]. br); echo(bState: /b . $row[ZG_STATE]. br); echo(bZip Code: /b . $row[ZG_ZIPCODE]. br); echo(bArea Code: /b . $row[ZG_AREACODE]. br); echo(bCounty FIPS: /b . $row[ZG_COUNTY_FIPS]. br); echo(bCounty Name: /b . $row[ZG_COUNTY_NAME]. br); echo(bTime Zone: /b . $row[ZG_TIME_ZONE]. br); echo(bDay Light Savings?: /b . $row[ZG_DST]. br); echo(bLatitude: /b . $row[ZG_LATITUDE]. br); echo(bLongitude: /b . $row[ZG_LONGITUDE]. P); } ? Basically I'm trying to have a user input a zip code and then have a php script pull all zip codes that are in a region of that submitted zip code. Can you have a look at my code and see what I'm doing wrong? When using this it returns no results but makes the connection to the database so I have to believe that it's within here that I have my issue. I have Apache/2.0.47 (Win32) PHP/4.3.9 Server and MySql 4.0.14 (I know I can upgrade and be able to do subselects but I would like to know what I'm doing wrong here. Thanks in advance for any help. Thanks -rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Accents! Pls help. Still very confused.
Hi, It is not quite clear what you want to do. You can translate UTF-8 characters into html characters like this: $str = htmlentities($str,ENT_NOQUOTES,'UTF-8'); Or you can translate them in a costumizesd way with strtr() For instance: $translation = array( = , = , = , = , = , = , '' = , = , = , = , = , = , = , = , = ccedil;, = , = , = , = , = eth;, = uacute, = aacute, = acirc ); $str = strtr($str, $translation); Both methods are simpler and a lot faster than regexps. Hth Henrik Hornemann -Oprindelig meddelelse- Fra: mario [mailto:[EMAIL PROTECTED] Sendt: 23. februar 2005 19:34 Til: php-general@lists.php.net; php-db@lists.php.net Cc: Burhan Khalid; Guillermo Rauch Emne: [PHP-DB] Accents! Pls help. Still very confused. Hello, I am still very puzzled. If you a couple of minutes of spare time, pls give a look at http://www.chiari.org/help/ and suggest a way out. Thanks a lot. mario -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] i am lost (php warning)
Hi, Probably because $user is not in the database. Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Earl Clare [mailto:[EMAIL PROTECTED] Sendt: 18. januar 2005 07:59 Til: php-db@lists.php.net Emne: [PHP-DB] i am lost (php warning) Prioritet: Høj Hi ya'll, I am lost as to why I am getting this error in my script. Can anyone kindly explain why this is so. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/cm/public_html/cell/login.php --- My script --- if($_POST['submit'] == 'Log In') { $user=$_POST[email]; $pass=$_POST[pass]; $sql_query = mysql_query(SELECT * FROM cm_customer WHERE emial='$user'); $sql_query = mysql_num_rows($sql_query); if (($sql_query) 0) { $valid = $user; session_start(); session_register(valid); } } if (session_is_registered(reg)) { echo ok; } else { echo sorry; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] MultSelect ListBox hell!
On 22 September 2004 18:45, Stuart Felenstein wrote: Given the conditions you want your WHERE phrase to test, you're going to need more parentheses to force the ORs to be evaluated before the ANDs; this is where the IN syntax, IMO, is more readable. So you want either: $sql .= (state='.implode(' OR state=',$_POST['state']).'); or: $sql .= state IN ('.implode(',',$_POST['state']).'); I agree, the IN syntax is more readable. But if the field is indexed, the OR syntax is faster, though not noticeably so in small tables. Regards Henrik Hornemann -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] bags o beans - filtering rows/array by value of an aggregated attribute
Hi, Mysql_fetch_row() fetches an enumerated array, so it should be: If ($row[1] 100) while ($row = @ mysql_fetch_row($result)) { foreach($row as $data) if ({sum(number_o_beans)} (100)) if($row['total_number_of_beans']) 100) print \n\ttd {$data} /td; print \n/tr; } Thanks ahead of time for your thoughts and recipes :) Grant -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:4112b26a148642019194572! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] how to iterate over fields names with mysql_fetch_assoc
Try rhis: while ($row = mysql_fetch_assoc($result)) { foreach ($row as $fieldName - $value) echo 'fieldName is: '.$fieldName.\n; } hth Henrik Hornemann -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sendt: 19. juni 2004 22:26 Til: [EMAIL PROTECTED]; [EMAIL PROTECTED] Emne: [PHP-DB] how to iterate over fields names with mysql_fetch_assoc How do I iterate over fields when I perform the below script: each row has: artist_name,urlPath,biography as fields while ($row = mysql_fetch_assoc($result)) { # if the current field name is 'artist_name', do something switch($GetCurrentFieldNameintheCurrentRow) { case $row[ 'field name is now: artist_name'] //do something break; } If I write the below code, I only get the first field name of each row...which makes sense In this case, I get 'artist_name' while ($row = mysql_fetch_assoc($result)) { $fieldName= key($row); echo 'fieldName is: '.$fieldName.\n; } many thanks :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Drawing table by while
Something like this: echo 'table'; $count=1; while ($myrow = mysql_fetch_array($sql)) { If ($count==5) { echo /tr; $count=1; } If ($count==1) echo tr; $count++; echo $myrow[0]; } echo '/table'; Hth Henrik Hornemann -Oprindelig meddelelse- Fra: nabil [mailto:[EMAIL PROTECTED] Sendt: 26. maj 2004 14:28 Til: [EMAIL PROTECTED] Emne: [PHP-DB] Drawing table by while Hiya, How can i draw a new tr AFTER FIVE td in the following loop (i want to echo the records in 5 columns width tables whatever the number of records will be fetched) .. echo 'table'; while ($myrow = mysql_fetch_array($sql)) { echo $myrow[0]; } echo '/table'; -- | x | y |z | o | -- |f|q| h| hj | -- . . . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] I am new to PHP
Hi, I would guess your problem is in the third file: mysql_query( UPDATE books SET isbn='$ud_isbn' ,title='$ud_title', author='$ud_author',edition='$ud_edition',course_id='$ud_course_id',quan tity = '$ud_quantity', stack_no = '$ud_stack_no' WHERE isbn='$ud_id'); The WHERE clause should probaly be id='$ud_id' Otherwise try to elaborate on what happens. Hth Henrik Hornemann -Oprindelig meddelelse- Fra: andy amol [mailto:[EMAIL PROTECTED] Sendt: 15. april 2004 06:18 Til: [EMAIL PROTECTED] Emne: [PHP-DB] I am new to PHP Hi, I have a problem with the second file. I am not able to update the data from the php program. Any help on that would be appreciated. Any modification which would be reduce the code like directly using the Update command would be appreciated. thanks in advance. Here are the 3 files. File1 --- htmlheadtitleBook Update Form/title/head body ? $db=project; $link = mysql_connect(localhost,name,passwd); if (! $link) die(Couldn't connect to MySQL); mysql_select_db($db , $link) or die(Couldn't open $db: .mysql_error()); $result = mysql_query( SELECT * FROM books ) or die(SELECT Error: .mysql_error()); $num_rows = mysql_num_rows($result); print There are $num_rows records.P; print table width=800 border=1\n; while ($get_info = mysql_fetch_row($result)){ print tr\n; foreach ($get_info as $field) print \ttdfont face=arial size=2/$field/font/td\n; print /tr\n; } print /table\n; mysql_close($link); //form method=POST action=book_change_form.php ? br form method=POST action=book_change_form.php pre Enter ISBN Number to Edit: input type=text name=id size=10 input type=submit value=Submitinput type=reset /pre /form /body /html File 2 - htmlheadtitleBook change form/title/head body ? $id=$_POST['id']; $db=project; //mysql_connect(localhost,$_POST['username'],$_POST['pass']); $link = mysql_connect(localhost,name,passwd); if (! $link) die(Couldn't connect to MySQL); mysql_select_db($db , $link) or die(Couldn't open $db: .mysql_error()); $query= SELECT * FROM books WHERE id='$id'; $result=mysql_query($query); $num=mysql_num_rows($result); //echo $num; $i=0; while ($i $num) { $isbn=mysql_result($result,$i,isbn); $title=mysql_result($result,$i,title); $author=mysql_result($result,$i,author); $edition=mysql_result($result,$i,edition); $course_id=mysql_result($result,$i,course); $quantity=mysql_result($result,$i,quantity); $stack_no=mysql_result($result,$i,stack_no); ? table width=300 cellpadding=10 cellspacing=0 border=2 tr align=center valign=top td align=center colspan=1 rowspan=1 bgcolor=#64b1ff h3Edit and Submit/h3 form action=book_change_record.php method=post input type=hidden name=username value=?php print $_POST['username']? input type=hidden name=pass value=?php print $_POST['pass']? input type=hidden name=ud_id value=? echo $id ? ISBN:input type=text name=ud_isbn value=? print $isbn?br Title: input type=text name=ud_title value=? print $title?br Author: input type=text name=ud_author value=? print $author?br Edition: input type=text name=ud_edition value=? print $edition?br Course Id: input type=text name=ud_course_id value=? print $course_id?br Quantity:input type=text name=ud_quantity value=? print $quantity?br Stack Number:input type=text name=ud_stack_no value=? echo $stack_no?br input type=Submit value=Update /form /td/tr/table ? ++$i; }//end while ? /body /html // File 3 htmlheadtitleBook Change Record/title/head body ? $user=$_POST['username']; $password=$_POST['password']; $ud_id=$_POST['ud_id']; $ud_isbn=$_POST['ud_isbn']; $ud_title=$_POST['ud_title']; $ud_author=$_POST['ud_author']; $ud_edition=$_POST['ud_edition']; $ud_course_id=$_POST['ud_course_id']; $ud_quantity=$_POST['ud_quantity']; $ud_stack_no=$_POST['ud_stack_no']; $db=project; $link = mysql_connect(localhost,name,passwd); if (! $link) die(Couldn't connect to MySQL); mysql_select_db($db , $link) or die(Couldn't open $db: .mysql_error()); mysql_query( UPDATE books SET isbn='$ud_isbn' ,title='$ud_title', author='$ud_author',edition='$ud_edition',course_id='$ud_course_id',quan tity = '$ud_quantity', stack_no = '$ud_stack_no' WHERE isbn='$ud_id'); echo Record Updated; mysql_close($link); ? form method=POST action=book_update_form.php input type=hidden name=username value=?php print $_POST['username']? input type=hidden name=pass value=?php print $_POST['password']? input type=submit value=Change Another /formbr form method=POST action=book.php input type=hidden name=username value=?php print $_POST['username']? input type=hidden name=pass value=?php print $_POST['password']? input type=submit value=Book Interface /form /body /html - Do you Yahoo!? Yahoo! Tax Center - File online by April 15th -- PHP Database Mailing List (http://www.php.net/) To unsubscribe
SV: [PHP-DB] checkboxes and loops
Hi, Try: $counter = 1; while (whatever) { $varname = 'box'.$counter; if ($$varname == 'delete') do whatever $counter++; } Hth Henrik Hornemann -Oprindelig meddelelse- Fra: matthew perry [mailto:[EMAIL PROTECTED] Sendt: 29. marts 2004 07:45 Til: [EMAIL PROTECTED] Emne: [PHP-DB] checkboxes and loops OK lets see if I can figure out how to ask this: I am setting up a system for my company to filter through employee applications. Most of the applications do not fit the criteria and I want to allow my bosses a checkbox to the right of them which they can check or uncheck to remove an applicant. So I run a loop that generates a bunch of check boxes with the name box1, box2, box3... by running a loop that runs this and increments counter every time: { input type = checkbox name = box?echo $counter;? value = delete $counter++; } But when I try to create my query that updates the table I have a problem generating these variable again by referring to them indirectly: *Bad solution 1 (to much work)*** if ($box1 == 'delete') do whatever if ($box2 == 'delete') do whatever if ($box3 == 'delete') do whatever if ($box4 == 'delete') do whatever if ($box5 == 'delete') do whatever if ($box6 == 'delete') do whatever *** *Bad solution 2 (doesn't work)*** $counter = 1; while (whatever) { if ($box . $counter == 'delete') do whatever $counter++; } *** How do I get around this problem? Hopefully someone understands what I am trying to say. Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mssql - Invalid Column Name
Hi, I hope someone can help me on this one. The following script: ?php include(../includes/include.php); $connect=new db_open(dnlbweb); foreach($_POST as $key = $val) { $$key=$val; } $res=mssql_query(SELECT Titel FROM indeks join indholdstyper on indholdstyper.id=indholdstypeid WHERE Titel='$titel' AND indholdstyper.DataTypeID=$dt); if (mssql_num_rows($res) 0) echo h1pDenne titel eksisterer allerede: $titel / $engTitel/p; else { $dis=(isset($dis))?-1:0; $oprettet = date('d-m-y'); $query =INSERT INTO Indeks (Titel, Ptitel, Beskrivelse, AnsvarligID, DaligLederID, InstitutionID, KildeTypeID, engTitel, engPtitel, engBeskrivelse, Indholdstypeid, disable, oprettelse) VALUES ( '$titel', '$ptitel', '$bes', $ans, $dag, $inst, $kilde, '$engtitel', '$engptitel', '$engbes', $itype, $dis, getdate() ); $res=mssql_query($query) ; // Line 24 $res=mssql_query(SELECT ID FROM Indeks WHERE Titel='$titel' AND Ptitel='$ptitel' ORDER BY id DESC); list($nyid) = mssql_fetch_row($res); if (!$slut' ') mssql_query(UPDATE Indeks SET SlutDato='$slut' WHERE id=$nyid); if (!$start ' ') mssql_query(UPDATE Indeks SET StartDato='$start' WHERE id=$nyid); mssql_close(); echo pre$query/pre; //header(Location:ny_index3.php?id=$nyiddt=$dt); } ? Produces the following output: Warning: mssql_query() [http://www.php.net/function.mssql-query]: message: Invalid column name 'DataTypeID'. (severity 16) in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 24 Warning: mssql_query() [http://www.php.net/function.mssql-query]: Query failed in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 24 Warning: mssql_query() [http://www.php.net/function.mssql-query]: message: Line 1: Incorrect syntax near '='. (severity 15) in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 28 Warning: mssql_query() [http://www.php.net/function.mssql-query]: Query failed in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 28 INSERT INTO Indeks (Titel, Ptitel, Beskrivelse, AnsvarligID, DaligLederID, InstitutionID, KildeTypeID, engTitel, engPtitel, engBeskrivelse, Indholdstypeid, disable, oprettelse) VALUES ( 'TEST', '', 'VR', 0, 0, 0, 11, 'VDS', '', 'RG', 9, 0, getdate() ) So how does DataTypeID get into it? There used to be a column called 'DataTypeID' in the 'indeks' table, but I dropped it during a major cleanup operation. If i create the column DataTypeID in 'indeks' without changing the script, I get the following message: RAISERROR could not locate entry for error 779069 in sysmessages Still produced by line 24 in the script. Anyone got an idea about what is going on??? Regards Henrik Hornemann -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Passing the value of a variable from PHP to JavaScript.
Hi, Where is the value of $vtes comming from? If it's a parameter in the call of your script, try something like ?php $vtes = $_GET[vtes]; echo Or even better dont use php to echo all of your javascript or html, but just the relevant values, like this: html script language='JavaScript' function tes(){ document.write('pJavaScript/p'); window.location.replace('http://192.168.23.1/coba/coba.php?vtes=?=$_GET [vtes]?'); } /script body diforward ke javascript select onchange='tes()' name='vtes' option value=''/option option value='1'1/option option value='2'2/option /select /body /html Hth Henrik Hornemann -Oprindelig meddelelse- Fra: Prabu Subroto [mailto:[EMAIL PROTECTED] Sendt: 27. februar 2004 10:03 Til: [EMAIL PROTECTED] Emne: [PHP-DB] Passing the value of a variable from PHP to JavaScript. Dear my friends... I have my code like this : == ?php echo html script language='JavaScript' function tes(){ document.write('pJavaScript/p'); window.location.replace('http://192.168.23.1/coba/coba.php?vtes=$vtes'); } /script body ; echo diforward ke javascript; echo select onchange='tes()' name='vtes' option value=''/option option value='1'1/option option value='2'2/option /select ; ? /body /html == I expect this result on url column of my internet browser: http://192.168.23.1/coba/coba.php?vtes='1' or http://192.168.23.1/coba/coba.php?vtes='1' But I only get this unexpected result: http://192.168.23.1/coba/coba.php?vtes= Lookslike the value of $vtes was not passed to JavaScript interpreter. Anybody of you have a solution for me? Please teach me. Thank you very much. -- _ Web-based SMS services available at http://www.operamail.com. From your mailbox to local or overseas cell phones. Powered by Outblaze -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Results with ledger stripes?
Or even simpler: echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; while ($mongorow = mysql_fetch_row($mongo, MYSQL_NUM)) { $color = (#e4e4e4)? #ff : #e4e4e4; echo tr bgcolor=$colortd$mongorow[0]/tdtd$mongorow[1]/td/tr\n; } echo /table; Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Paul Fitz [mailto:[EMAIL PROTECTED] Sendt: 26. januar 2004 12:34 Til: 'PHP DB' Emne: RE: [PHP-DB] Results with ledger stripes? Hi, You can use the modulus operator to create alternate colour rows. A bit simpler in code ;) See below - echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; // Define count variable which is tested in loop $count = 1; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { // If $count divides evenly by 2, white, if not then #efefef $color = ($count % 2)? #ff : #e4e4e4; echo tr bgcolor=$colortd$mongorow[0]/tdtd$mongorow[1]/td/tr\n; $count++; } echo /table; --- // Done :) -Original Message- From: Ricardo Lopes [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 7:29 PM To: [EMAIL PROTECTED] Cc: PHP DB Subject: Re: [PHP-DB] Results with ledger stripes? I dont see what is your problem, your code do almost anything. Is you pretend to generate the output in html as you show in the example, you just have to add the color property in the td or tr tag, take care with the in the code. ex: $dummy_var = 0; $dummy_array = array(#dd, #ff); while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo tr bgcolor= .$dummy_array[$dummy_var].td$mongorow[0]/tdtd$mongorow[1]/td /tr \n; $dummy_var++; } And thats is it. You could use css or other things, thats up to you. Hope thats solved. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 26, 2004 1:42 AM Subject: [PHP-DB] Results with ledger stripes? Hello all, I'm in the midst of creating an internet speed test system thingamabob for my website. It's basically finished...but ugly as sin. What I'd like to do is have the results (an average of each domain tested) listed in a nice pretty table with alternating background colors, kinda like a ledger. How on earth do I do this? Here's what I've got thus far: ?php echo Average speeds of each domain tested:br; $mongo = @mysql_query (SELECT substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC); echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo trtd$mongorow[0]/tdtd$mongorow[1]/td/tr\n;} echo /table; ? And I'd like it to spit out something along these lines: table tr bgcolor=#ddtddomain1.com/tdtd666.6 kbps/td/tr tr bgcolor=#fftddomain2.com/tdtd3000.0 kbps/td/tr repeat until done /table The gizmo is up and running at http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a gander. Thanks a bunch, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Results with ledger stripes?
Hi, Sorry, it should of course be $color = ($color==#e4e4e4)? #ff : #e4e4e4; -Oprindelig meddelelse- Fra: Henrik Hornemann Sendt: 26. januar 2004 13:38 Til: PHP DB Emne: SV: [PHP-DB] Results with ledger stripes? Or even simpler: echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; while ($mongorow = mysql_fetch_row($mongo, MYSQL_NUM)) { $color = (#e4e4e4)? #ff : #e4e4e4; echo tr bgcolor=$colortd$mongorow[0]/tdtd$mongorow[1]/td/tr\n; } echo /table; Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Paul Fitz [mailto:[EMAIL PROTECTED] Sendt: 26. januar 2004 12:34 Til: 'PHP DB' Emne: RE: [PHP-DB] Results with ledger stripes? Hi, You can use the modulus operator to create alternate colour rows. A bit simpler in code ;) See below - echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; // Define count variable which is tested in loop $count = 1; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { // If $count divides evenly by 2, white, if not then #efefef $color = ($count % 2)? #ff : #e4e4e4; echo tr bgcolor=$colortd$mongorow[0]/tdtd$mongorow[1]/td/tr\n; $count++; } echo /table; --- // Done :) -Original Message- From: Ricardo Lopes [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 7:29 PM To: [EMAIL PROTECTED] Cc: PHP DB Subject: Re: [PHP-DB] Results with ledger stripes? I dont see what is your problem, your code do almost anything. Is you pretend to generate the output in html as you show in the example, you just have to add the color property in the td or tr tag, take care with the in the code. ex: $dummy_var = 0; $dummy_array = array(#dd, #ff); while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo tr bgcolor= .$dummy_array[$dummy_var].td$mongorow[0]/tdtd$mongorow[1]/td /tr \n; $dummy_var++; } And thats is it. You could use css or other things, thats up to you. Hope thats solved. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 26, 2004 1:42 AM Subject: [PHP-DB] Results with ledger stripes? Hello all, I'm in the midst of creating an internet speed test system thingamabob for my website. It's basically finished...but ugly as sin. What I'd like to do is have the results (an average of each domain tested) listed in a nice pretty table with alternating background colors, kinda like a ledger. How on earth do I do this? Here's what I've got thus far: ?php echo Average speeds of each domain tested:br; $mongo = @mysql_query (SELECT substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC); echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo trtd$mongorow[0]/tdtd$mongorow[1]/td/tr\n;} echo /table; ? And I'd like it to spit out something along these lines: table tr bgcolor=#ddtddomain1.com/tdtd666.6 kbps/td/tr tr bgcolor=#fftddomain2.com/tdtd3000.0 kbps/td/tr repeat until done /table The gizmo is up and running at http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a gander. Thanks a bunch, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Selecting between using letters
How about Select LastName from sometable where LastName = 'A' and LastName 'F' Hth Henrik Hornemann -Oprindelig meddelelse- Fra: Doug Parker [mailto:[EMAIL PROTECTED] Sendt: 29. december 2003 23:18 Til: [EMAIL PROTECTED]; [EMAIL PROTECTED] Emne: [PHP-DB] Selecting between using letters How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] PHP/DB speed
Hi, As others have pointed out, the real problem is the huge OPTION list. You may however get a slightly lower time by using mysql_fetch_row instead of mysql_fetch_array. Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sendt: 21. december 2003 23:16 Til: PHP DB Group Emne: [PHP-DB] PHP/DB speed Good afternoon! I am writing a project and have a speed concern... The code I am using is thus and is retrieving around 2,500 records: $result = mysql_query($sql) while ($row = mysql_fetch_array($result)) { build OPTION stmt } Is there a faster method? Timed this with microtime and .9 seconds to retrieve the data and output the web page seems REAL slow. Now this is on a T-Base-100 network but I imagine it would be like watching paint dry in a 56K modem. Any thoughts, ideas on accelerating this? I did try ob_start() and ob_end_flush() and no help... Thank for any help in advance. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] parse error.
Hi, There are at least two errors in your script: $query=insert into dene (day,start_time) values (2003.09.25,22:30) ; should be $query=insert into dene (day,start_time) values ('2003.09.25','22:30') ; And if ($result)) should be if ($result) regards Henrik Hornemann -Oprindelig meddelelse- Fra: Mücella Erdem Efe [mailto:[EMAIL PROTECTED] Sendt: 26. september 2003 00:52 Til: [EMAIL PROTECTED] Emne: [PHP-DB] parse error. I am a new programmer of PHP4.3.3 an MySql 3.23 . When below script is executed Parse error: parse error, unexpected T_DNUMBER in c:\program files\apache group\apache\htdocs\ilkdeneme21.php on line 17 is being seen. This may be very simple but I could not solve it.Could you help me for this error? Thanks for your attention [EMAIL PROTECTED] ? $dbname = 'mycmpe'; mysql_connect(localhost,username); if (mysql_select_db($dbname)) { echo connected;} else { echo not connected;} $query=insert into dene (day,start_time) values (2003.09.25,22:30) ; $result=mysql_query($query); if ($result)) { echo data girildi;} else { echo data girilemedi; exit;} ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] inputting datetime to mssql
Hi, I had this problem that was driving me crazy. I was trying to input a datetime to a mssql table, formated the same way as I use in all my other tables i.e d-m-Y. But no matter which variations of the basic format I tried, it didn't understand the date correctly. In desperation I tried something stupid, inverting the format to Y-m-d, which actually worked. My question is, how can this be possible that datetime fields in two tables in the same datebase requires the input date to be formated in different ways?? And is there any way to fix the odd one out? Regards Henrik Hornemann -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] Re: A complex query problem
Hi, You could try something like: SELECT school_name, sID FROM schools WHERE sID in (select sid from school_highlight_details where hid = 2) and sID in (select sid from school_highlight_details where hid = 4) GROUP BY sID If you are using mysql this probably won't work. I think mysql doesn't like subselects. hth Henrik Hornemann -Oprindelig meddelelse- Fra: Jason Givhan [mailto:[EMAIL PROTECTED] Sendt: 3. juli 2003 22:39 Til: [EMAIL PROTECTED] Emne: [PHP-DB] Re: A complex query problem Im sorry, let me clarify the problem: I have some schools with multiple highlights. I want to search for a school that has BOTH highlights Sports AND Graduation. I can search for a school that has EITHER Sports OR Graduation using this query: SELECT schools.school_name, schools.sID FROM schools, school_highlight_details WHERE schools.sID = school_highlight_details.sid AND (school_highlight_details.hid = 2 OR school_highlight_details.hid = 4 ) GROUP BY schools.sID But now I want to search for a school that has BOTH highlights Sports AND Graduation. I have 3 tables: 1. school (sID, school_name) 2. highlights (hID,highlight) 3. school_highlight_details (dID,sid,hid). Jason Givhan wrote: I have 3 tables: 1. school (sID, school_name) 2. highlights (hID,highlight) 3. school_highlight_details (dID,sid,hid). I have set up a search to allow the user to submit a school name OR highlights(highlights is set up in an array of checkboxes), and then displaying any school name that fullfill the requirements. What I need to do now is set up an array to search for a school name AND highlights. If a person types in a name (or just one letter from a name, like 'm') AND they check off a couple of highlights checkboxes(ex: Sports and Graduation), a query should return the results of any school name starting with 'm' that has the highlights of 'Sports' and 'Graduation'. If you think you can help me, just email me at [EMAIL PROTECTED] If you need more information, let me know. Thank you, Jason Givhan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] User Defined Function Problem
Hi, It seems as if you use your parameters for check4Entry in the wrong order when you call it. In your call you have check4Entry($username, $round, $region); and in your definition you have function check4Entry($name, $reg, $rnd). So you might want to switch $region and $round in yor call. regards Henrik Hornemann -Oprindelig meddelelse- Fra: The Cossins Fam [mailto:[EMAIL PROTECTED] Sendt: 17. marts 2003 22:07 Til: [EMAIL PROTECTED] Emne: [PHP-DB] User Defined Function Problem Does anyone see anything I might be missing as to why this won't work? From the file calling the function: ?php $round = Round 1; $region = East; include check.php; isAuthorized($_COOKIE['username'], $_COOKIE['password']); include checkEntry.php; check4Entry($username, $round, $region); ... From checkEntry.php: ?php function check4Entry($name, $reg, $rnd) { $connection = mysql_connect(localhost, root) or die(mysql_error()); $db = mysql_select_db(marchmadness, $connection) or die(mysql_error()) ; $checking = SELECT * FROM pick WHERE userID = \$uname\ AND round = \$rnd\ AND region = \$reg\; $result = mysql_query($checking, $connection) or die(mysql_error()); $numRows = mysql_num_rows($result) or die(mysql_error()); if ($numRows 0) { print(htmlheadlink rel=\stylesheet\ type=\text/css\ href=\bbb.css\/headbodycentertable class=\outTbl\trth align=\center\ class=\outTh\ Oops! There are already selections made for $uname in $reg - $rnd. /th/tr trtd$uname, if you'd like to modify your selections, please click a href=\modifyEntry.php\here/a./td/tr/table/center /body/html); exit; } } ? == When I submit the form, I get a blank screen as a result. There aren't any errors ouput to the screen. I've compared this with another function I've created, and there doesn't appear to be anything different. The latter works. BTW, I bet you'll never guess what this is for...;-) Thanks for your help! --Joel _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP-DB] LEFT JOIN not working
Hi, You might want to try something like: SELECT ads_displayrate.name, SUM(ads_displayrate.count) as display, SUM( IF( ads_clickrate.date IS NULL, 0, 1 ) ) as click FROM ads_displayrate LEFT JOIN ads_clickrate ON ads_displayrate.name = ads_clickrate.name HAVING YEAR(ads_displayrate.date) = '2003' AND MONTH(ads_displayrate.date) = '01' AND DAYOFMONTH(ads_displayrate.date) = '05' GROUP BY ads_displayrate.name ORDER BY ads_displayrate.name regards Henrik Hornemann -Oprindelig meddelelse- Fra: Lisi [mailto:[EMAIL PROTECTED]] Sendt: 14. januar 2003 18:47 Til: Ignatius Reilly Cc: PHP-DB Emne: Re: [PHP-DB] LEFT JOIN not working Still not working. I made the change, and I'm still getting all results. I even tried it without the leading '0' in front of the 1, no good. Here's my current query, with suggested changes: SELECT ads_displayrate.name, SUM(ads_displayrate.count) as display, SUM( IF( ads_clickrate.date IS NULL, 0, 1 ) ) as click FROM ads_displayrate LEFT JOIN ads_clickrate ON ads_displayrate.name = ads_clickrate.name AND YEAR(ads_displayrate.date) = '2003' AND MONTH(ads_displayrate.date) = '01' AND DAYOFMONTH(ads_displayrate.date) = '05' GROUP BY ads_displayrate.name ORDER BY ads_displayrate.name ads_displayrate.date is a column of date type, so as far as I understand this should work. Is there some typo I'm missing? At 07:15 PM 1/9/03 +0100, you wrote: Oops! I missed again. If you specify conditions pertaining to the right-hand table, such as: ads_clickrate.date = '2001', Then you will lose all result rows for which the right-hand data is NULL. Not the expected result. So your restricting WHERE clauses must apply to the left-hand table only. Therefore: WHERE YEAR(ads_displayrate.date) = '2003' AND MONTH(ads_displayrate.date) = '01' (if your table ads_displayrate has such date fields). HTH Ignatius - Original Message - From: Lisi [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 6:54 PM Subject: Re: [PHP-DB] LEFT JOIN not working Cool! It's mostly working now, the only problem is it's ignoring the other clauses in the ON clause that select the desired date. Perhaps it's not supposed to be connected this way? How would I select specific dates? Thanks again, -Lisi At 01:20 PM 1/9/03 +0100, you wrote: Oops! Sorry, I missed it the first time. Your query should start as: SELECT ads_displayrate.name instead of SELECT ads_clickrate.name then you will always have a non-NULL name (coming from the table on the left of the LEFT JOIN). HTH Ignatius, from Brussels Where the fuck is Belgium? D. Ivester, CEO, Coca Cola - Original Message - From: Lisi [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 1:11 PM Subject: Re: [PHP-DB] LEFT JOIN not working Exactly my question - why does it not have a name? How would I modify my query to get a row with a name but null value for date? I thought the join would take care of this, but I'm obviously not doing it right. You mention a unique identifier, there is a separate table with a row for each ad, containing name, URL, and a unique ID number (autoincrement). Should this table be included somehow in the query? How would this help? Thanks, -Lisi At 12:45 PM 1/9/03 +0100, Ignatius Reilly wrote: Your 4th row ought to have an identifier of some sort. From your SELECT statement, this seems to be the name. Why does it not have a name? Probably what you want is a row with a name but a NULL value for ads_clickrate.date. (by the way it is EXTREMELY advisable to use an abstract identifier, such as an id, unique and required, instead of name) Ignatius - Original Message - From: Lisi [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 12:18 PM Subject: Re: [PHP-DB] LEFT JOIN not working OK, this helped a bit. Now I have, in addition to the three rows of ads that have ben clicked on, a fourth row with no ad name, 0 clickthroughs, and 24 displays. That plus the other three account for all the displayed ads. However, since it is returning a null value for any ad name that has not been clicked on, and then it's grouped by ad name, it lumps all non-clicked ads into one row. What I need is to see each ad on a separate row, which is what I thought a LEFT JOIN was supposed to do. Any suggestions? Thanks, -Lisi At 11:07 AM 1/9/03 +0100, Ignatius Reilly wrote: problem 1: move the WHERE clauses
SV: [PHP-DB] Current row of query
Actually you dont need to keep track of the row number. Yoy could just alternate the two colors like this: while ( $row = mysql_fetch_array($result) ) { $bgCol = ( $bgCol == #EADBC6}?#EFE1CE:#EADBC6; echo ..; } hth Henrik Hornemann -Oprindelig meddelelse- Fra: Patrick Lebon [mailto:[EMAIL PROTECTED]] Sendt: 26. september 2002 17:20 Til: [EMAIL PROTECTED] Emne: Re: [PHP-DB] Current row of query Thanks, im currently doing something similar to this but I was wondering if there was an already defined variable that i could use rather then have to create a value and increment it myself. I guess am being picky, but was just curious as im new to php. This is how im currently doing it... $rowNum = 0; while ( $row = mysql_fetch_array($result) ) { $rowNum++; if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; } echo ..; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php