[PHP-DB] some data output formatting and grouping question...
I just have a fucking mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 ___ (hr) 0b 002 003 004 How the hell do I do that? I can't think of the goddamn' syntax! __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] help, array values echoed as Array on loop!
Ok, if I change $ID_arr[] to $ID_arr I think it gives me what I want. - Victor www.argilent.com -Original Message- From: Victor [mailto:[EMAIL PROTECTED]] Sent: Monday, September 02, 2002 3:39 PM To: 'PHP' Subject: [PHP] help, array values echoed as Array on loop! I have tried both ways to loop through an array and output the data and verify that the array is an array and I get no erros but I get this value, which should not be so. Here I'm checking if it's an array: if (!is_array($ID_arr)) { # show error if no array echo '$ID_arr is not an array.'; } here I'm counting the keys but it only outputs as 1: $key = count($ID_arr); echo $key; here are two loops that do the same thing and they both output Array: for($i = 0; $i count($ID_arr); $i++) { echo $ID_arr[$i]; } foreach($ID_arr as $ind_picture) { echo $ind_picture; } Why? If it helps, in order to get the array, the values were taken from a database and exploded from a coma delimited string. $ID_arr[] = explode(',', $pictures); # make db data into array This is the string: 15,16,17,18,19 I want each array element to contain = 15 = 16 = 17 etc... why does it echo as Array? - Victor www.argilent.com __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop!
Ok, wrong mailing list! - Victor www.argilent.com -Original Message- From: victor [mailto:[EMAIL PROTECTED]] Sent: Monday, September 02, 2002 3:46 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop! Ok, if I change $ID_arr[] to $ID_arr I think it gives me what I want. - Victor www.argilent.com -Original Message- From: Victor [mailto:[EMAIL PROTECTED]] Sent: Monday, September 02, 2002 3:39 PM To: 'PHP' Subject: [PHP] help, array values echoed as Array on loop! I have tried both ways to loop through an array and output the data and verify that the array is an array and I get no erros but I get this value, which should not be so. Here I'm checking if it's an array: if (!is_array($ID_arr)) { # show error if no array echo '$ID_arr is not an array.'; } here I'm counting the keys but it only outputs as 1: $key = count($ID_arr); echo $key; here are two loops that do the same thing and they both output Array: for($i = 0; $i count($ID_arr); $i++) { echo $ID_arr[$i]; } foreach($ID_arr as $ind_picture) { echo $ind_picture; } Why? If it helps, in order to get the array, the values were taken from a database and exploded from a coma delimited string. $ID_arr[] = explode(',', $pictures); # make db data into array This is the string: 15,16,17,18,19 I want each array element to contain = 15 = 16 = 17 etc... why does it echo as Array? - Victor www.argilent.com __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to pass multiple checkbox values thru form??
I'm working on the same problem but I need to read the code, not write it:, here are a few links and my code if you might help me in return: http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20117420.html my code: mysql_db(); # connects to mysql for($i = 0; $i sizeof($check); $i++) { # echo $i; # echo 'p'; # $data = $check[$i]; $sql = (SELECT * FROM kodak_user_pictures WHERE ID = '$check[$i]'); $result = mysql_query($sql); $row = mysql_fetch_array($result); # $row = mysql_fetch_array($db_data); $db_ID = $row[ID]; $db_picture_name = $row[picture_name]; echo $db_ID; echo 'p'; echo $db_picture_name; echo 'p'; echo $ID; echo 'p'; echo $picture_name; echo 'p'; echo $result; } so many echoes because I'm trying to figure out what works and what doesn't. - Victor www.argilent.com -Original Message- From: Smita Manohar [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 12:19 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to pass multiple checkbox values thru form?? hii i have one form in which i print records from mysql database. while displyaing those records i display one checkbox with each record. i want the user should select the checkbox corresponding to the record which s/he wants to delete. i display those records after running one query. hence each time no.of records are diff. so its difficult to hard code names for check boxes. for name attribute in input type=checkbox tag, i define one array. having same name as the key field in the table. and value for which is also set dynamically. FORM NAME = act_qmd_subj_frm METHOD = POST ACTION = confirm_delete.php while ($row = mysql_fetch_array($result)) { .. echo tr; //call function to display the contents of $row in table print_entry($row,subj_id,subj_name,subj_desc); print td valign=top align=centerinput type=checkbox name=\subj_id[]\ value=\.$row[subj_id].\ Yes, delete entry #.$row[subj_id]./td\n; ... } INPUT TYPE=submit NAME=del_but VALUE=Delete nbsp nbsp INPUT TYPE=submit NAME=modify_but VALUE=Modify nbsp nbsp INPUT TYPE=reset NAME=clear_but VALUE=Clear nbsp nbsp /FORM when i submit the form to confirm_delete.php i run one code there to print the array subj_id[] which is supposed to contain values of the checkboxes which are selected to delete or to modify. but the array subj_id[] contains no value at all. echo count($subj_id) gives 0. is there any other way to pass multiple checkbox values from the form??? i got the above trick from the book MySQL/PHP Database Applications (By, Jay Grrenspan and Brad Bulger) in one script they have passed checkbox value thru array by this way, and its working fine. can anyone PLS figure out what wrong im doing??? thnx and regds, smita. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newest entry in db
How can I use php to get the newest entry from mysql database? Ie, if I make a timestamp and then I want to retrieve the last timestamp I made how do I go about doing it? Any php or mysql documentation? - Victor www.argilent.com __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] why do i get this error please tell me?
for($i = 0; $i sizeof($check); $i++) { # start repating query # turn pictures in order delete capability off mysql_query(UPDATE kodak_user_pictures SET order=1 WHERE ID='$check[$i]') # turn off pictures or die ('Unable to turn bit off '.mysql_error()); } # end repeat You have an error in your SQL syntax near 'order=1 WHERE ID='2'' at line 2 - Victor www.argilent.com __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] why do i get this error please tell me?
Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. - Victor www.argilent.com -Original Message- From: Chris Knipe [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] why do i get this error please tell me? You have an error in your SQL syntax near 'order=1 WHERE ID='2'' at line 2 ORDER is a reserved word in MySQL. Change the query and escape order aswell 'order'='1' WHERE ID='2' Or, rename the order column to something else. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: [PHP] why do i get this error please tell me?
I meant besides the UPDATE or SELECT or any filed that those words might interfere with... - Victor www.argilent.com -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 2:18 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] RE: [PHP] why do i get this error please tell me? Ahem. Why not check out the MySQL docs for reserved words (they _are_ right there ...): http://www.mysql.com/doc/en/Reserved_words.html PHP Docs are for PHP. MySQL Docs are for MySQL. PHP != MySQL. -Original Message- From: victor [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:35 PM To: 'Chris Knipe'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] why do i get this error please tell me? Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] List
list
Re: [PHP-DB] Passing parameters to a PHP file.
Thanks Leo, i solved the problem using $HTTP_GET_VARS[]. -- == Victor Espina Caracas, Venezuela http://mitrompo.com/vespina [EMAIL PROTECTED] (Quite el 'nospam' para responder) (Remove 'nospam' to reply) Leo G. Divinagracia III [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... u quick question, does VAR1 contain a value before the call??? could be null to begin with... Victor Espina wrote: I want to call a PHP file with some parameters. I tried this sintax: HREF=MyPage.PHP?Var1=Value1 But i don't seem to be receiving any value for Var1. I tested it with: print Var1: $Var1; and the output is Var1: What i'm missing here? -- == Victor Espina Caracas, Venezuela http://mitrompo.com/vespina [EMAIL PROTECTED] (Quite el 'nospam' para responder) (Remove 'nospam' to reply) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] ODBC connection under Win32 + Apache + SQL Server
Hi, i'm new using PHP i'm trying to run some basic PHP scripts to retrieve a show data coming from a SQL Server database. The problem is that when i try to run this: $conn=odbc_connect(MQIS,sa,); PHP returns the following warning: Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I test the DSN with VFP using: SQLStringConnect(dsn=MQIS;usr=sa;pwd=;) and it works pretty fine. ¿What could be the problem here? TIA Victor -- == Victor Espina Caracas, Venezuela http://mitrompo.com/vespina [EMAIL PROTECTED] (Quite el 'nospam' para responder) (Remove 'nospam' to reply) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP-DB] OCI_DEFAULT
Hello Johannes, on 19.04.2001 you wrote: hi, OCIExecute() executes a previously parsed statement. (see OCIParse(). The optional mode allows you to specify the execution-mode (default is OCI_COMMIT_ON_SUCCESS). If you don't want statements to be committed automaticly specify OCI_DEFAULT as your mode. that's right, but had anyone of you the same problem i had ? consider the following situation: using persistent connections and specifying OCI_DEFAULT works quite okay, but subsequent calls to OCIExecute remain in the OCI_DEFAULT state, whether or not you specify OCI_COMMIT_ON_SUCCESS. this means that executes made with this call remain uncommitted. Even more, scripts that reuse the connection are not able to do normal queries with this connection. Am I doing something really nasty, or is this just a feature i don't understand ? Tested PHP versions were 4.0.3pl and 4.0.4pl1 both on FreeBSD and Debian ... Hope somebody knows about ... Victor -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Advice On Building Dynamic MySQL Queries
Hello JD, on 19.04.2001 you wrote: I am building a query from a search form. This is the code I have now: if (!empty($whereclause)) { $whereclause=urldecode($whereclause); $whereclause=stripslashes($whereclause); } extract($HTTP_POST_VARS); if (!empty($Price)) { if(empty($whereclause)) --- blah blah blah --- It Just became apparent that I am going to need to add a whole bunch more search criteria.. Does anyone have any advice/suggestions for getting rid of all those if statements? JD what about using a foreach statement and going through all the variables you need like this ? $myvars = array('Price', 'Stuff', 'Thing'); foreach ($myvars as $varname) { if (!empty($$varname)) { // do funky stuff here } } HTH Victor -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP-DB] Display data begin with A
Hi, if you're using MySQL, the simpliest method is using RLIKE SELECT stuff FROM table WHERE stuff RLIKE '^[0-9]+'; see http://www.mysql.com/doc/S/t/String_comparison_functions.html http://www.mysql.com/doc/R/e/Regexp.html for more info HTH Victor Okay it's working now.. How if I want to display all the data begin with NUMBERS. like "1,2,3,...,0" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie question
Hi Lisa, Can search engines index any HTML pages that have .php as its extension (any .php pages without a '?' or '' in the URL) ? For example: http://www.blablabla.com/blabla.php Thanks, Lisa E yes they can, but my experience is, that most search engine robots do _not_ index pages ending in .php and .php3 due to their dynamic nature (please correct me or give me a hint how to change this). We had to change the extensions to .html to avoid being not indexed by search engines. Hope this helps Victor -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]