[PHP] PHP-MySQL?!
Hello people: I'm building a Site which contains this: ? echo form method=\POST\ action=\pesquisar.php\ select name=\esp\ option value=\Escolha uma espécie\Escolha uma espécie/option option value=\---\--/op tion ; $db = mysql_connect(localhost,user,pass); mysql_select_db(listing); $list = mysql_query(SELECT nome FROM listagem); while ($list_especies = mysql_fetch_row($list)) { for ($i=0;$i1;$i++) { echo option value=\$list_especies[$i]\$list_especies[$i]/option ; } } echo/select/form; mysql_close($db); ? where: localhost - it's my server name user - my mysql username pass - my mysql password listing - my table, which contains one only column, with more than 3877 lines (named nome). Problem is, when I try to execute the .PHP page with this stuff, it keeps blinking until it tells me that the page could not be found. NOTE: If I use in the query: ... LIMIT 1000, it show the 1000 lines with no problem. Thanks people, bsantos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT MULTIPLE...
Hello: I'm building an internal messaging system for small biz companies and I can't really go longer Problem is, I use some fields to make the message form and one of them must be a select multiple form element wich refers to messaging persons. This is my form: table tr td height=15 valign=topP class=P1Para:/P/td td SELECT NAME=receptor[] size=6 multiple ? //Legenda: eu - significa eusers || pu - significa preparar lista de utilizadores $eu_pu_result = mysql_query(SELECT u.name, u.email FROM users u); while ($eu_pu = mysql_fetch_row($eu_pu_result)) { for ($i=0;$i1;$i++) { echooption$eu_pu[0]; } } ? /select /td /tr tr td height=15 valign=topP class=P1Prioridade:/P/td td select name=priority option value=MínimaMínima/option option SELECTED value=NormalNormal/option option value=PrioritáriaPrioritária/option option value=UrgenteUrgente/option /select /td /tr tr td height=15 valign=topP class=P1Assunto:/P/td tdinput type=text name=title size=66 value=? pv($frm[title]) ?/td /tr tr td height=15 valign=topP class=P1Descrição:/P/td tdtextarea name=description cols=50 rows=8? pv($frm[description]) ?/textarea/td /tr tr tdnbsp;!--EmptyCellContent--/td tdinput type=submit value=?=$frm[submit_caption] ?/td /tr /table After this, the page should reload on submit, but I keep getting the warning: Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: categories in c:/apache/htdocs/sites/mail/admin/eusers.php on line 120 All but the last, I think they appear because then page reloaded can't see any more the array of people (select form). But... How can I solve the problem? This is the file that is the page itself, as above in the warnings, called by:eusers.php: ? /*** *** * FUNCTIONS */ function print_add_product_form($category_id = 0) { /* print a blank product form so we can add a new product */ global $mfi, $ME; /* set default values for the reset of the fields */ $frm[categories] = array($category_id); $frm[newmode] = insert; $frm[receptor] = ; $frm[recipient] = ; $frm[priority] = ; $frm[title] = ; $frm[description] = ; $frm[on_special] = ; $frm[submit_caption] = Enviar; /* build the categories listbox options, preselect the top item */ build_category_tree($category_options, $frm[categories]); include(templates/eusers_form.php); } function print_edit_product_form($id) { /* print a product form so we can edit the selected product */ global $mfi, $ME; /* load up the information for the product */ $qid = db_query( SELECT receptor, recipient, priority, title, description, stage, on_special FROM products WHERE id = $id ); $frm = db_fetch_array($qid); /* load up the categories for the product */ $qid = db_query( SELECT category_id FROM products_categories WHERE product_id = $id ); $frm[categories] = array(); while ($cat = db_fetch_object($qid)) { $frm[categories][] = $cat-category_id; } /* set values for the form */ $frm[newmode] = update; $frm[submit_caption] = Enviar; /* build the categories listbox options, preselect the selected item */ build_category_tree($category_options, $frm[categories]); include(templates/eusers_edit_form.php); } function delete_product($id) { /* delete the product specified by $id, we have to delete the product and then * the appropriate entries from the products_categories table. this should be * wrapped inside a transaction, unfortunately MySQL currently does not support * transactions. */ global $mfi, $ME; /* load up the information for the product */ $qid = db_query( SELECT title FROM products WHERE id = $id ); $prod = db_fetch_object($qid); /* delete this product */ $qid = db_query( DELETE FROM products WHERE id = $id ); /* delete this product from the products_categories table */ $qid = db_query( DELETE FROM products_categories WHERE product_id = $id ); include(templates/eusers_deleted.php); } function insert_product($id, $frm) { /* add a new subproduct under the parent $id. all the fields that we want are * going to in the variable $frm */ global $mfi, $ME; $on_special = checked($frm[on_special]); /* add the product into the products
Re: [PHP] SELECT MULTIPLE...
Sorry People: I really forget that: Line 110: VALUES ('$receptor[1]', '$mfi-email', '$frm[priority]', '$frm[title]', '$frm[description]', now(), '$on_special') which makes part of: if (!isset ($receptor[])) { $receptor[] = {0,0,0,0,0,0}; } else { } for ($i=0;$i6;$i++) { $qid = db_query( INSERT INTO products (receptor, recipient, priority, title, description, date_added, on_special) VALUES ('$receptor[1]', '$mfi-email', '$frm[priority]', '$frm[title]', '$frm[description]', now(), '$on_special') ); } Line 120: for ($i = 0; $i count($frm[categories]); $i++) { which makes part of: $product_id = db_insert_id(); /* add this product under the specified categories */ for ($i = 0; $i count($frm[categories]); $i++) { $qid = db_query( INSERT INTO products_categories (category_id, product_id) VALUES ('{$frm[categories][$i]}', '$product_id') ); } An this two parts, build a function: function insert_product($id, $frm) { /* add a new subproduct under the parent $id. all the fields that we want are * going to in the variable $frm */ global $mfi, $ME; $on_special = checked($frm[on_special]); /* add the product into the products table */ if (!isset ($receptor[])) { $receptor[] = {0,0,0,0,0,0}; } else { } for ($i=0;$i6;$i++) { $qid = db_query( INSERT INTO products (receptor, recipient, priority, title, description, date_added, on_special) VALUES ('$receptor[1]', '$mfi-email', '$frm[priority]', '$frm[title]', '$frm[description]', now(), '$on_special') ); } //mail('$frm[receptor]','$frm[title]','$frm[description]','$frm[recipient]') ; /* get the product id that was just created */ $product_id = db_insert_id(); /* add this product under the specified categories */ for ($i = 0; $i count($frm[categories]); $i++) { $qid = db_query( INSERT INTO products_categories (category_id, product_id) VALUES ('{$frm[categories][$i]}', '$product_id') ); } } Really sorry... again Jason Wong [EMAIL PROTECTED] wrote in message news:20021802.38606.php-general;gremlins.com.hk... On Monday 11 November 2002 17:51, Bsantos PHP wrote: Hello: I'm building an internal messaging system for small biz companies and I can't really go longer Problem is, I use some fields to make the message form and one of them must be a select multiple form element wich refers to messaging persons. This is my form: [snip] After this, the page should reload on submit, but I keep getting the warning: Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: 1 in c:/apache/htdocs/sites/mail/admin/eusers.php on line 110 Warning: Undefined index: categories in c:/apache/htdocs/sites/mail/admin/eusers.php on line 120 Which is line 110 and line 120? I'm certainly not going to count the lines in your code to see which lines they refer to. If you want people to help you, you should make it easier for them to do so by indicating which lines are being referred to as 110 120. All but the last, I think they appear because then page reloaded can't see any more the array of people (select form). Well, try using print_r() on all your important variables at strategic places in your code to see that they contain what you expect them to contain. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Utility is when you have one telephone, luxury is when you have two, opulence is when you have three -- and paradise is when you have none. -- Doug Larson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refresh
meta http-equiv=refresh content=X, http://www.Y.EXT; Being: X - number of seconds Y - domain EXT -type of domain (.net, .pt, .com, .org, etc...) In PHP you use it also, or you may go to same location as an header (double check where to do it...): header(Location: http://www.where_I_am_right_noe.something/this/that/etc;); Cheers, bsantos Shaun [EMAIL PROTECTED] wrote in message news:2002112327.79700.qmail;pb1.pair.com... hi, How do you refresh a page in php? If i cannot wat is the code or meta(i think) to do so? Thanks Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] for??????
Hi people: Can anybody help me with this? : I've got a query in a table: $result = mysql_query(SELECT username, email FROM users); which should bring about 300 lines (each for an user). Now, I've created a funtion which controls how many fields (cols) may be seen by user. Some like this: function select_query ($fields, $table) { $result = (SELECT $fileds FROM $table); } Well, I hould like to control how many fields my query will use. For example: if I call select_query('id,username,email', 'users'); I want to know that there was selected 3 cols. so I can later do some like this: for ($j=0;$j$number_of_selected_cols_minus_one;$j++) { echotd$list[$j]/td; ... and that's it. By the way!! Is this late statement correct?!?! Thanks a lot to anyone that can help me, cheers, bsantos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION for language settings?!
Hi there! This is some kind my experience: Here's the picture. I've made a simple PHP based Website. Now I hould like to expand it to spanish language. All of the text that appears on the website in divided by categories, each one of them set as a variable. All this stuff is in a file (contents.php). For example: TEXT TO BE DISPLAYED AS HEADLINE 1: ...is in file contents.php as... $title1 = Headline 1; OK, I'm trying to set $_SESSION['lang'] as contents_ing.php or contents.es.php, depending of which language user wants to choose. PROBLEM is that when I call $_SESSION['lang'] = contents_es.php, it will only be true for the current page. Next pages will use this: if (!isset($_SESSION['lang'])) { $_SESSION['lang'] = contents.php; } from startup.php that is the file charged with the index.php page of the website (default page). Can anyone tell me what's wrong? Tanks, bsantos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION for language settings?!
Not realy understanding this: then, somewhere on the page, add language links $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']. ($_SERVER['QUERY_STRING'] ? 'newlang=sp' : '?newlang=sp') $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']. ($_SERVER['QUERY_STRING'] ? 'newlang=en' : '?newlang=en') Cheers, bsantos Marek Kilimajer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try something like this: if($_GET['newlang']) { switch($_GET['newlang']){ case 'spanish': $_SESSION['lang'] = contents_sp.php; break; case 'english': $_SESSION['lang'] = contents_en.php; break; } elseif (!isset($_SESSION['lang'])) { $_SESSION['lang'] = contents.php; } then, somewhere on the page, add language links $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']. ($_SERVER['QUERY_STRING'] ? 'newlang=sp' : '?newlang=sp') $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']. ($_SERVER['QUERY_STRING'] ? 'newlang=en' : '?newlang=en') Bsantos PHP wrote: Hi there! This is some kind my experience: Here's the picture. I've made a simple PHP based Website. Now I hould like to expand it to spanish language. All of the text that appears on the website in divided by categories, each one of them set as a variable. All this stuff is in a file (contents.php). For example: TEXT TO BE DISPLAYED AS HEADLINE 1: ...is in file contents.php as... $title1 = Headline 1; OK, I'm trying to set $_SESSION['lang'] as contents_ing.php or contents.es.php, depending of which language user wants to choose. PROBLEM is that when I call $_SESSION['lang'] = contents_es.php, it will only be true for the current page. Next pages will use this: if (!isset($_SESSION['lang'])) { $_SESSION['lang'] = contents.php; } from startup.php that is the file charged with the index.php page of the website (default page). Can anyone tell me what's wrong? Tanks, bsantos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute...
Hi people: Can anyone tell me if I can execute windows calculator trought a PHP script on a web page to allow customers to check final prices?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cookie
Why don't you keep you mind ahead and use session auth bsantos Meltem Demirkus [EMAIL PROTECTED] wrote in message 001701c26532$ba7c8c90$5583@hiborya">news:001701c26532$ba7c8c90$5583@hiborya... hi, can anybody help me with cookies..I read the manual of php but it came complicated..Any basic tutorial or other something helps alot..I am trying to make a cookie to kkep the user id in it... thanks meltem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php