[PHP-DB] font options
hello, what is the proper way to get a block of echoes to echo with the same font, size, color, etc... as in: ? echo $row-property_type; ? ? echo $row-bedrooms; ? ? echo $row-baths; ? ? echo $row-description; ? ? echo $row-distance; ? ? echo $row-date_available; ? ? echo $row-price; ? ? echo $row-contact; ? thank you and best regards, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: font options
add some html: echo font family= color= size..., or use a style sheet where you define a DIV. Then echo div [class=...]. At the end of your echo, don't forget to close the tag. Edwin Addison Ellis wrote: hello, what is the proper way to get a block of echoes to echo with the same font, size, color, etc... as in: ? echo $row-property_type; ? ? echo $row-bedrooms; ? ? echo $row-baths; ? ? echo $row-description; ? ? echo $row-distance; ? ? echo $row-date_available; ? ? echo $row-price; ? ? echo $row-contact; ? thank you and best regards, addison -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] list menu
hi and thank you for your time... how do i, as my text fields are echoing a selected value, get my list menus to do the same? text field has: ? echo $arow-contact; ? list menu has: select name=property option value=? echo $row-property_type; ? selected ? echo $row-property_type; ? /option option value=househouse/option option value=condocondo/option option value=duplexduplex/option option value=apartmentapartment/option option value=landland/option /select thank you again, addison ellis -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: to connect access mdb
Sorry, I wasn't looking good and sent the post too fast :-( I have these strange reactions on M$ stuff. Micah Stevens wrote: looks like PHP to me. COM connections to Access only handle a few connections at a time. The use of a real DB server is reccommended in your situation.i Edwin Boersma wrote: To: [EMAIL PROTECTED] Date: Sat, 01 Feb 2003 18:41:49 +0200 From: Edwin Boersma [EMAIL PROTECTED] Subject: [PHP-DB] Re: to connect access mdb Use the correct ng for your problems. this is for PHP, not ASP. Qt wrote: Dear Sirs, I try to connect my access mdb with following script but I can not succed. I get following error. This server is currently overloaded - please try again later Any idea where is the my mistake. I am using xitami server under windows 98. ? $conn = new COM(ADODB.Connection) or die(Cannot start ADO); // Microsoft Access connection string. $conn-Open(Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=C:\\Xitami\\webpages\\sigorta.mdb); // SQL statement to build recordset. $rs = $conn-Execute(SELECT ad FROM baydar); echo pBelow is a list of values in the MYDB.MDB database, MYABLE table, MYFIELD field./p; // Display all the values in the records set while (!$rs-EOF) { $fv = $rs-Fields(ad); echo Value: .$fv-value.br\n; $rs-MoveNext(); } $rs-Close(); ? -- 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] Re: list menu
You mean, with font? For this, you need a style sheet, or at least style entry in 'select', like this: select style='font-family: ...; font-size: ...;' name=property, etc. See http://www.w3.org/Style/ for more info on styles. BTW: if the values are the same a what you are displaying, you don't need value=. Edwin Addison Ellis wrote: hi and thank you for your time... how do i, as my text fields are echoing a selected value, get my list menus to do the same? text field has: ? echo $arow-contact; ? list menu has: select name=property option value=? echo $row-property_type; ? selected ? echo $row-property_type; ? /option option value=househouse/option option value=condocondo/option option value=duplexduplex/option option value=apartmentapartment/option option value=landland/option /select thank you again, addison ellis -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Retrieving field name of Database
Helloo people, I have to build a database abstraction class with support for XML output. My XML output has to look like this: ?xml version=1.0 ? result query=SELECT * FROM books row number=1 field name=namevalue/field field name=namevalue/field ... /row row number=2 field name=namevalue/field field name=namevalue/field ... /row /result Well i almost got it, but how do i get all the field names of my MySQL tables? This is my code, a part of my database class. : /** * getXMLDocument * * Get the result of your query back in XML document * @authorDavy Obdam */ function getXMLDocument() { //Create XML document if(!$this-xmlDoc = domxml_new_doc(1.0)) { die([ERROR] Cant create XML document); } // Create root element $this-root_element = $this-xmlDoc-create_element(result); $this-root_element-set_attribute(query, $this-sqlQuery); //Get database fields and values $count = 0; while($this-fetchRow()) { $row_element = $this-xmlDoc-create_element(row); $n_row = $this-root_element-append_child($row_element); $row_number = $row_element-set_attribute(number ,$count); $count++; // Get fieldnames and values for($i=0; $isizeof($this-sqlQuery); $i++) { $field_element = $this-xmlDoc-create_element(field); $n_field = $row_element-append_child($field_element); $field_name = $field_element-set_attribute(name, name); $field_content = $field_element-append_child($this-xmlDoc-create_text_node(utf8_encode(text))); } $this-moveNext(); } // Put everything together and show it $append_root = $this-xmlDoc-append_child($this-root_element); header(content-type:text/xml); echo $this-xmlDoc-dump_mem(); } Now all i get is one field field name=namewhatever/field in my XML output, but i should get 10 with this particular query.. Any help is appreciated, thanks for you time. Best regards, Davy Obdam mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] page splitting
Hello all! First of all i'd like to say thanks. many of you helped me here a lot, and I can't thank you enough for it. For my next question. I have a query. it takes up all the rows from a certain database, and displays them. I want to do the simple thing, page splitting. make it show a certain number of records everytime, let's say, 10, and then automatically show the links like [] 1 2 3 [] to move between the pages. I'm looking for the most simple and easy way to do it, as it should be a very easy thing to do. Thank you all, once again :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] page splitting
you should get a class that does that. PHP Classes (phpclasses.org) is a good place to start -- Maxim Maletsky [EMAIL PROTECTED] On Sun, 2 Feb 2003 17:37:12 +0200 Shahar Tal [EMAIL PROTECTED] wrote: Hello all! First of all i'd like to say thanks. many of you helped me here a lot, and I can't thank you enough for it. For my next question. I have a query. it takes up all the rows from a certain database, and displays them. I want to do the simple thing, page splitting. make it show a certain number of records everytime, let's say, 10, and then automatically show the links like [] 1 2 3 [] to move between the pages. I'm looking for the most simple and easy way to do it, as it should be a very easy thing to do. Thank you all, once again :) -- 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
Re: [PHP-DB] page splitting
Or try the attached code Nikos - Original Message - From: Maxim Maletsky [EMAIL PROTECTED] To: Shahar Tal [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, February 02, 2003 7:30 PM Subject: Re: [PHP-DB] page splitting you should get a class that does that. PHP Classes (phpclasses.org) is a good place to start -- Maxim Maletsky [EMAIL PROTECTED] On Sun, 2 Feb 2003 17:37:12 +0200 Shahar Tal [EMAIL PROTECTED] wrote: Hello all! First of all i'd like to say thanks. many of you helped me here a lot, and I can't thank you enough for it. For my next question. I have a query. it takes up all the rows from a certain database, and displays them. I want to do the simple thing, page splitting. make it show a certain number of records everytime, let's say, 10, and then automatically show the links like [] 1 2 3 [] to move between the pages. I'm looking for the most simple and easy way to do it, as it should be a very easy thing to do. Thank you all, once again :) -- 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 ? $conn=mysql_connect($hostname, $user, $pass); $rows_per_page=20; $sql=SELECT * FROM table; $result=mysql_db_query($database, $sql, $conn) or Die (mysql_error()); $total_records=mysql_num_rows($result); $pages=ceil($total_records / $rows_per_page); mysql_free_result($result); ? html code ? if (!isset($screen)) $screen=0; $start=$screen * $rows_per_page; $sql=SELECT col1, col2, ... FROM table; $sql.=LIMIT $start, $rows_per_page; $result=mysql_db_query($database, $sql, $conn) or Die (mysql_error()); while (list($col1, $clo2, ...)=mysql_fetch_row($result)) { echo ; } if ($screen0) { $url=$PHP_SELF?screen=$screen-1; echo a href=\$url\ /a\n; } for ($i=0; $i$pages; $i++) { $I=$i+1; $url=$PHP_SELF?screen= . $i; echo a href=\$url\.$I./a; } if ($screen $pages-1) { $url=$PHP_SELF?screen=; $url .= $screen+1; echo a href=\$url\ class=\menu3\ /a; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] print
hello, i have a form someone fills out, say with the field # of bedrooms. they submit. data goes into db. how can i get the # of bedrooms to print 4 Bedrooms instead of just 4? thank you, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] print resolved- thank you
hello, i have a form someone fills out, say with the field # of bedrooms. they submit. data goes into db. how can i get the # of bedrooms to print 4 Bedrooms instead of just 4? thank you, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] print
with php: echo $result['field_number_of_bedrooms'] . Bedrooms; wih SQL: SELECT CONCAT(field_number_of_bedrooms, ' Bedrooms') as field_number_of_bedrooms from table; echo $result['field_number_of_bedrooms']; -- Maxim Maletsky [EMAIL PROTECTED] On Sun, 2 Feb 2003 12:46:16 -0600 Addison Ellis [EMAIL PROTECTED] wrote: hello, i have a form someone fills out, say with the field # of bedrooms. they submit. data goes into db. how can i get the # of bedrooms to print 4 Bedrooms instead of just 4? thank you, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- 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] print
hi, i still am having a problem. can you see what is wrong with what i've got. and... thank you. best regards, addison ellis this is what is printing: 2Bedroom/2Bath great From Campus Available imm 500.00 Contact: 321-1791 it is not printing the property_type and it is not following my \n commands. here's the code: ? // Begin Ad Block $count = 0; $id = 50; $obj = mysql_db_query($dbname,select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked'); if ($obj mysql_num_rows($obj)0) { while($row = mysql_fetch_object($obj)) { $count++; ? ? echo {$row-bedrooms}Bedroom/{$row-baths}Bath{$row-property_type}\n {$row-description}\n {$row-distance} From Campus Available {$row-date_available}\n {$row-price}\n Contact: {$row-contact}; ? /fontfont color=#00 size=2 face=Arial, Helvetica, sans-serifbr / br img src=../images/thin_line.gif width=185 height=1br br ? } } // End Ad Block ? thanks again... -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED]
[PHP-DB] select
hi and thank you, is there a reason this will not work? i am trying to echo an option that has already been selected in a list menu. best, addison select name=property ? $obj = mysql_db_query($dbname,select * from ads where id=$id;); while($row = mysql_fetch_object($obj)) { if ($row-property_type == $row-id) { $selected = SELECTED; } else { $selected = ; } ? option value=? echo $row-id; ? ? echo $selected; ? selected ? echo $row-property_type; ? /option option value=househouse/option option value=condocondo/option option value=duplexduplex/option option value=apartmentapartment/option option value=landland/option /select -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Images-weird!!
Hi Mihai, Didn't try your code, but noticed your comment on colours. RBG values go from 0 - 255, not 1 - 256, so this may be your problem. Adam
[PHP-DB] Re: Images-weird!!
No, this is not the problem. $i and $j start from 0, anyway. The real problem, as I see it, is the following: I have a big loop, to create something like a checkerboard, but with 13 or so colors. If the loop iterates more than 256 times, then those cells with indexes bigger than 255 (or 256, does not matter) will have a single color: that of the 255th or 256th cell. It is as if I do not have only 13 colors, but 256! Try to run the code and see what I mean. Now I try to do my job by using JPGraph, but I succeded to ruin everything:) Oh, dear:) On Mon, 3 Feb 2003, Adam Royle wrote: Hi Mihai, Didn't try your code, but noticed your comment on colours. RBG values go from 0 - 255, not 1 - 256, so this may be your problem. Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Images-weird!!
On Sun, 02 Feb 2003 14:36:38 -0800 (PST) Mihail Bota [EMAIL PROTECTED] wrote: No, this is not the problem. I did not test your code but a color channel start at 0 and finished at 255, corresponding to 256 possibilities. pierre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Images-weird!!
Hello, If you have time, please run the code below. It is a very simple code which has 2 nested loops and assigns colors to a given value. If the product of $i and $j is smaller or equal to 256 (exactly the number of colors allowed), then you'll get a random pattern. If this product is bigger than 256, then the last rows (i.e. all those cells with indexes bigger than 256) of the rectangle will have the last color encountered (as if is the 256'th), even though I only have 13 possible colors in the code. Anybody has an indea to overcome this thing? Am I missing something, or this is due to a problem in PHP (PHP 4.2.1, Win 2k), or GD? I spent 3 days on this problem with no avail! Thanks! Mihai --- ?php $image=imageCreate(500,500); $white=imageColorAllocate($image,255,255,255); imageFilledRectangle($image,0,0,500,500,$white); for ($i=0; $i17; $i++) { for ($j=0; $j17; $j++) { $qq=rand(0,13); if ($qq==1) { $vstrong=imageColorAllocate($image, 255, 0, 0); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$vstrong); } elseif ($qq==0) { $nueste=imageColorAllocate($image, 255, 255, 0); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$nueste); } elseif ($qq==2) { $strong=imageColorAllocate($image, 255, 0, 100); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$strong); } elseif ($qq==3) { $smoderate=imageColorAllocate($image, 255, 100, 100); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$smoderate); } elseif ($qq==4) { $moderate=imageColorAllocate($image, 255, 210, 100); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$moderate); } elseif ($qq==5) { $color3=imageColorAllocate($image, 0, 255, 255); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color3); } elseif ($qq==6) { $color4=imageColorAllocate($image, 0, 255, 200); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color4); } elseif ($qq==7) { $color5=imageColorAllocate($image, 0, 100, 255); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color5); } elseif ($qq==8) { $color6=imageColorAllocate($image, 0, 100, 200); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color6); } elseif ($qq==9) { $color7=imageColorAllocate($image, 200, 0, 0); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color7); } elseif ($qq==12) { $justis=imageColorAllocate($image, 0, 0, 138); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$justis); } else { $ciudat=imageColorAllocate($image, 0, 0, 255); imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$ciudat); } } } Header(Content-type: image/png); imagePNG($image); imageDestroy($image); ? --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Images-weird!!
On Sun, 02 Feb 2003 14:36:38 -0800 (PST) Mihail Bota [EMAIL PROTECTED] wrote: No, this is not the problem. $i and $j start from 0, anyway. The real problem, as I see it, is the following: I have a big loop, to create something like a checkerboard, but with 13 or so colors. If the loop iterates more than 256 times, then those cells with indexes bigger than 255 (or 256, does not matter) will have a single color: that of the 255th or 256th cell. Random color, you create a palette based image, which has only 256 colors (0..255), the 1st allocated color is the backgroud color, you have only 255 colors to use, 1..255. You loop 16*16 (17), you reached the maximum amount of color at the 16th iteration. You can easily solve your problem by using a truecolor image, make your script a little bit more efficient by allocating before the loop, and cleaner without the ugly if else endless test. Find a quick cleanup at the footer As a side note, an image of 500x400 means a horizantal ranges from 0 to 499 and a vertical range from 0 to 399. hth pierre ?php $image=imagecreatetruecolor(500,500); $white=imageColorAllocate($image,255,255,255); imageFilledRectangle($image,0,0,499,499,$white); $colors = array( imagecolorallocate($image, 255, 255, 0), imagecolorallocate($image, 255, 0, 0), imagecolorallocate($image, 255, 0, 100), imagecolorallocate($image, 255, 100, 100), imagecolorallocate($image, 255, 210, 100), imagecolorallocate($image, 0, 255, 255), imagecolorallocate($image, 0, 255, 200), imagecolorallocate($image, 0, 100, 255), imagecolorallocate($image, 0, 100, 200), imagecolorallocate($image, 200, 0, 0), imagecolorallocate($image, 0, 0, 138), imagecolorallocate($image, 0, 0, 255) ); for ($i=0; $i17; $i++) { for ($j=0; $j17; $j++) { /* should be 0..11 to avoid the test */ $qq=rand(0,13); if($qq $qq12){ imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$colors[$qq]); } } } header(Content-type: image/png); imagepng($image); imagedestroy($image); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Images-weird!!
Yeah, I had the idea with truecolor, but I do not have GD2 installed. I have to install it, first. Still, I do not understand! I only have 13 colors, why is allocating only 255? I am not using the indexes in the color allocation. Thanks. On Mon, 3 Feb 2003, Pierre-Alain Joye wrote: On Sun, 02 Feb 2003 14:36:38 -0800 (PST) Mihail Bota [EMAIL PROTECTED] wrote: No, this is not the problem. $i and $j start from 0, anyway. The real problem, as I see it, is the following: I have a big loop, to create something like a checkerboard, but with 13 or so colors. If the loop iterates more than 256 times, then those cells with indexes bigger than 255 (or 256, does not matter) will have a single color: that of the 255th or 256th cell. Random color, you create a palette based image, which has only 256 colors (0..255), the 1st allocated color is the backgroud color, you have only 255 colors to use, 1..255. You loop 16*16 (17), you reached the maximum amount of color at the 16th iteration. You can easily solve your problem by using a truecolor image, make your script a little bit more efficient by allocating before the loop, and cleaner without the ugly if else endless test. Find a quick cleanup at the footer As a side note, an image of 500x400 means a horizantal ranges from 0 to 499 and a vertical range from 0 to 399. hth pierre ?php $image=imagecreatetruecolor(500,500); $white=imageColorAllocate($image,255,255,255); imageFilledRectangle($image,0,0,499,499,$white); $colors = array( imagecolorallocate($image, 255, 255, 0), imagecolorallocate($image, 255, 0, 0), imagecolorallocate($image, 255, 0, 100), imagecolorallocate($image, 255, 100, 100), imagecolorallocate($image, 255, 210, 100), imagecolorallocate($image, 0, 255, 255), imagecolorallocate($image, 0, 255, 200), imagecolorallocate($image, 0, 100, 255), imagecolorallocate($image, 0, 100, 200), imagecolorallocate($image, 200, 0, 0), imagecolorallocate($image, 0, 0, 138), imagecolorallocate($image, 0, 0, 255) ); for ($i=0; $i17; $i++) { for ($j=0; $j17; $j++) { /* should be 0..11 to avoid the test */ $qq=rand(0,13); if($qq $qq12){ imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$colors[$qq]); } } } header(Content-type: image/png); imagepng($image); imagedestroy($image); ? -- 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
Re: [PHP-DB] Re: Images-weird!!
On Sun, 02 Feb 2003 15:29:44 -0800 (PST) Mihail Bota [EMAIL PROTECTED] wrote: Yeah, I had the idea with truecolor, but I do not have GD2 installed. I have to install it, first. Still, I do not understand! I only have 13 colors, why is allocating only 255? I am not using the indexes in the color allocation. palette based image (imagecreate) can use a maximum of 256 colors. You allocate a new color in each iteration of the inside loop, 16*16=256 and greater than 255, do not forget you have already one color allocated for the background color, btw, you do no need to draw a white box with a palette image, the 1st allocated color is the background color. hth pierre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Images-weird!!
Got it. Thanks a lot, guys! On Mon, 3 Feb 2003, Pierre-Alain Joye wrote: On Sun, 02 Feb 2003 15:29:44 -0800 (PST) Mihail Bota [EMAIL PROTECTED] wrote: Yeah, I had the idea with truecolor, but I do not have GD2 installed. I have to install it, first. Still, I do not understand! I only have 13 colors, why is allocating only 255? I am not using the indexes in the color allocation. palette based image (imagecreate) can use a maximum of 256 colors. You allocate a new color in each iteration of the inside loop, 16*16=256 and greater than 255, do not forget you have already one color allocated for the background color, btw, you do no need to draw a white box with a palette image, the 1st allocated color is the background color. hth pierre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Adding Record to database
Hi. I am having a problem with adding a record into a table of a database. I have attached the code I am using to accomplish this. It works if the table is empty, but if there is already a record in the table, it won't add anything. Could anyone help me out with this? Here is the code I am using: $query = INSERT INTO TableName (SID,StudentLastName,StudentFirstName,StudentEmail,StudentLoginName,StudentP assword) VALUES ('$SID','$StudentLastName','$StudentFirstName','$StudentEmail','$StudentLogi nName','$StudentLoginPassword'); $results = mysql_query($query); Like I said, this works if the table is totally empty, but if there is already an entry in there, it does nothing. Please help if you can. Thanks. Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Adding Record to database
Matt, Check a couple of things: 1. Do you have a primary key with unique id? You could be getting a key violation. 2. Echo $query and confirm that it is as you expect. 3. Add code to trap for, or at least display any generated error. 4. Are you able to test this INSERT at the MySQL console? If so, and it works, compare what works in 4. with what you have at 2. HTH -Miles At 08:41 PM 2/2/2003 -0500, Matt wrote: Hi. I am having a problem with adding a record into a table of a database. I have attached the code I am using to accomplish this. It works if the table is empty, but if there is already a record in the table, it won't add anything. Could anyone help me out with this? Here is the code I am using: $query = INSERT INTO TableName (SID,StudentLastName,StudentFirstName,StudentEmail,StudentLoginName,StudentP assword) VALUES ('$SID','$StudentLastName','$StudentFirstName','$StudentEmail','$StudentLogi nName','$StudentLoginPassword'); $results = mysql_query($query); Like I said, this works if the table is totally empty, but if there is already an entry in there, it does nothing. Please help if you can. Thanks. 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
Re: [PHP-DB] Adding Record to database
Thanks a lot guys. I thought I had something auto incremented, but I didn't. That was the problem. Thanks for your help. Matt Miles Thompson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Matt, Check a couple of things: 1. Do you have a primary key with unique id? You could be getting a key violation. 2. Echo $query and confirm that it is as you expect. 3. Add code to trap for, or at least display any generated error. 4. Are you able to test this INSERT at the MySQL console? If so, and it works, compare what works in 4. with what you have at 2. HTH -Miles At 08:41 PM 2/2/2003 -0500, Matt wrote: Hi. I am having a problem with adding a record into a table of a database. I have attached the code I am using to accomplish this. It works if the table is empty, but if there is already a record in the table, it won't add anything. Could anyone help me out with this? Here is the code I am using: $query = INSERT INTO TableName (SID,StudentLastName,StudentFirstName,StudentEmail,StudentLoginName,Student P assword) VALUES ('$SID','$StudentLastName','$StudentFirstName','$StudentEmail','$StudentLog i nName','$StudentLoginPassword'); $results = mysql_query($query); Like I said, this works if the table is totally empty, but if there is already an entry in there, it does nothing. Please help if you can. Thanks. 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] best way to iterate through DB_Result the second time around?
Iterating over a result set is eaasy the first time; while( $group_data = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) { blah... } How come DB_Result doesn't have a reset() function so you can iterate over the result set a second time without having to resort to this sort of thing? for( $i = 0; $i $result-numRows(); $i++ ) // Have to iterate through // result set on the second pass { $group_data = $result-fetchRow( DB_FETCHMODE_ASSOC, $i ); blah.. } Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] best way to iterate through DB_Result the second time around?
Iterating over a result set is eaasy the first time; while( $group_data = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) { blah... } How come DB_Result doesn't have a reset() function so you can iterate over the result set a second time without having to resort to this sort of thing? for( $i = 0; $i $result-numRows(); $i++ ) // Have to iterate through // result set on the second pass { $group_data = $result-fetchRow( DB_FETCHMODE_ASSOC, $i ); blah.. } It depends on your database... If you're using MySQL, see if whatever class you're using has a wrapper for mysql_data_seek(). It will do what you want rather easily. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] form field rejection
hello, thank you for your time... what is the best way for me to have a form field, phone reject certain phone prefixes? for example: someone enters 321-1791 and 321 prefix can not be allowed as an entry... thank you again, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form field rejection
Try something like this (untested): $phonenumber = '(123)-123-1234'; $phonenumber = preg_replace('/[^0-9]/','',$phonenumber); if(!preg_match('/^([0-9]{3})([0-9]{3})([0-9]{4})$/',$phonenumber,$matches){ die('Invalid phone number.'); } $full_number = $matches[0]; $areacode = $matches[1]; $exchange = $matches[2]; $number = $matches[3] $banned_exchanges = array('321','654'); if(in_array($exchange,$banned_exchanges)){ die('Bad exchange.'); } Addison Ellis wrote: hello, thank you for your time... what is the best way for me to have a form field, phone reject certain phone prefixes? for example: someone enters 321-1791 and 321 prefix can not be allowed as an entry... thank you again, addison -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php