[PHP-DB] session problem on Netscape Vs IE, Help please!
Hi All, In my application i'm using sessions... I'm using PHP4.0.6 + Apache on linux redhat. when I upgrade PHP into PHP 4.1.1 I've got problem on the NETSCAPE that session is broken (unrecognized). but on the IE ..All running well... Any body know How to solve this problem??? Help me.. please! :))
RE: [PHP-DB] Passing contents of array on as variables...
rather than all the hidden fields and stuff you guys are trying to do - why not just build the array variable you want, then save it into a session, on the next page, access the session variable and wallah - there's your array, still in tact and just as you left it (ie. containing all the info you want, not the word "Array") HTH beua // -Original Message- // From: jas [mailto:[EMAIL PROTECTED]] // Sent: Monday, 25 February 2002 5:50 PM // To: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] Passing contents of array on as variables... // // // Bjorn, // I just wanted to thank you for giving me alot of insight // into what I was // trying to accomplish however, due to time restraints I have // decided to do it // a different way by pulling the entries into a select box // that a customer can // use to delete the different items. Once again, thanks a ton // Jas // // "Jas" <[EMAIL PROTECTED]> wrote in message // [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // > Ok, I think I understand what you are talking about. So // now I know what I // > need to accomplish, and would you happen to know of a good // place to learn // > about something like this? For some reason this function // keeps seeming to // > elude me and if you know of a good tutorial on how to // accomplish this I // > would appreciate it. Thanks again, // > Jas // > <[EMAIL PROTECTED]> wrote in message // > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // > > One problem I see is that you are sending all of the // values for all of // > your // > > fields (except the id field) from the first page to the // second page, not // > just // > > the ones that are checked, so even if it was working // properly, you would // > get // > > a list of all items in the table, not just the checked // items. You need // to // > > send the array of id's (since this is the name for the // checkbox) from // the // > > first page to the second one (again in the checkbox form // element, you // did // > not // > > put a value on it). // > > // > > What your first page is currently doing is pulling all of the // information // > out // > > of the database. Then as soon as you pull each item out, you are // putting // > it // > > into an hidden form element array, ie. $car_type[], // $car_model[], etc. // > > regardless of whether the checkbox is checked or not to // pass to the next // > > page. You do not know if the checkbox is checked or not // until the next // > page // > > when it looks at the values in the id array. On the // second page, you // need // > to // > > look at the id array and then (through a database call) // pull the row // from // > the // > > table for each id in the array. // > > // > > HTH // > > // > > MB // > > // > > jas <[EMAIL PROTECTED]> said: // > > // > > > $i=0; // > > > while // > > > // ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$c // ar_vin[$i]) // > { // > > > $i ++; // > > > } // > > > Is what I added and this is what is being output to // the screen at this // > > > point... // > > > =0; while () { ++; } // > > > now i am still too new to php to understand why it is // not putting the // > > > contents of the array into my hidden fields like it // does on my first // > page (i // > > > can see them when I view source). // > > > <[EMAIL PROTECTED]> wrote in message // > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // > > > > When you call your $car_type in the second page, you // need to set a // > > > variable // > > > > starting at 0 and call it as $car_type[0] and loop // through all of // the // > > > values // > > > > in the array. // > > > > // > > > > ie. // > > > > // > > > > $i=0; // > > > > while ($car_type[$i]) { // > > > > // > > > > I have added more code below that should help. // > > > > // > > > > MB // > > > > // > > > > // > > > > jas <[EMAIL PROTECTED]> said: // > > > > // > > > > > Yeah, tried that and it still isnt passing the // contents of the // array // > as // > > > a // > > > > > varible to the confirmation page for deletion. I // am at a loss on // > this // > > > one. // > > > > > <[EMAIL PROTECTED]> wrote in message // > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // > > > > > > You didn't add the value part of the hidden element, ie. // > > > > > > // > > > > > > value=\"$myrow[car_type]\"> // > > > > > > // > > > > > > You were naming the field as an array with no value. // > > > > > > // > > > > > > if you want to pass this as an array of values, // you would need // to // > use: // > > > > > > // > > > > > > value=\"$myrow[car_type]\"> // > > > > > > // > > > > > > Give that a try and see if it works. // > > > > > > // > > > > > > HTH // > > > > > > // > > > > > > MB // > > > > > > // > > > > > > // > > > > > > jas <[EMAIL PROTECTED]> said: // > > > > > > // > > > > > > > As of right now if you run the php script and // view source on // the // > > > page // > > > > > you // > > > > > > > can see that it does p
RE: [PHP-DB] Delete selected files
your checkboxes should pass a value (probably just the filename) and you could perhaps name them all "filenames[]" or something, using the array trick in PHP, so that on the page you submit to, $filenames will be an array containing everything that was checked. you can then loop thru the array and unlink() each filename in there. HTH beau // -Original Message- // From: Nautilis [mailto:[EMAIL PROTECTED]] // Sent: Monday, 25 February 2002 10:43 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Delete selected files // // // Hi everybody, // // I show a list of files that I upload to the user's folder // using the next // code: // // $path= "../clients/$user"; // $dir = opendir ($root); // while ($archivo = readdir ($dir)) //{ // $size = filesize("$path/$filename"); // $size = ($size/1024); // $size = intval($size * 100 ) / 100; // if ($filename!= "." && $filename!="..") // { // echo "$filename$size Kb"; // } // } // // I want to add a checkbox in every file i get in the user's folder. My // question is: // // Is there any way to use some kind of function to delete // selected files? I am // not sure if i can use javascript to evaluate which is // checked and how. And // after that evaluation, how to call a unlink ($filename) to // delete the files. // // Any help would be greatly appreciated. // // Nau // // // // -- // 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: PHP advice
You should enclose any string that you searching on within a ' and ' Your SQL query should look something like; $query = "SELECT * FROM auth WHERE password = '". $password ."'"; Cheers "Greg Lobring" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I dont understand why this is causing me so much trouble, hopefully someone > can help. I have a simple PHP script that takes the user id and password > from a form on a page...here is the php used after submitting the form: > > @ $db = mysql_pconnect("localhost", "blah", "blah"); > if (!$db) > { > echo "Error: Could not connect to database."; > exit; > } > mysql_select_db("blahblah"); > $query = "select * from auth where password = ".$password.""; > $result = mysql_query($query); > $num_results = mysql_num_rows($result); > echo "Number of Rows: ".$num_results.""; > mysql_close($db); > ?> > > It connects fine, and when the query returns NO (0) rows, it appears > correct. However, when the query returns a record, I get the following > error: > > > Warning: Supplied argument is not a valid MySQL result resource in picks.php > on line 16 > > Where line 16 is the the line that says $num_results = > mysql_num_rows($result); > > > Does anyone have any advice? > > Appreciated in advance.. > > Greg > > > > _ > Chat with friends online, try MSN Messenger: http://messenger.msn.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
[PHP-DB] using sendmail w/ windows
any one know how to use send mail with windows instead of linux. Will this work are their other options? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with file uploads
Hi, I'm using PHP4+Apache+Win2000 Professional. I'm having problem with file uploads. I wrote a simple test program and it works fine, but when i try to use it on my application, windows says something like "php generated an error and a log file is beeing created". When i look at the log file in Apache, it says: "[Sun Feb 24 18:41:35 2002] [error] [client 127.0.0.1] Premature end of script headers: /apache/php/php.exe". Im my application i'm using sessions... Is there any conflict with file uploads? I dont think so Help me.. please! :)) __ Quer ter seu próprio endereço na Internet? Garanta já o seu e ainda ganhe cinco e-mails personalizados. DomíniosBOL - http://dominios.bol.com.br -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing contents of array on as variables...
Awesome... Thanks alot Natalie! I actually decided to pull the contents of the table into a select list as my option to delete the items, out of frustration. In any event I would love to take a look at your code to see a different approach to accomplishing my original problem. Thanks again everyone. Jas "Natalie Leotta" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jas, > > I've run into the same kind of problem with the site I'm doing for work. > > My first solution was to use the query string to pass contents of an array > (array[0]&array[1]...) but I got to the point where I was passing too much > information and it wouldn't work. Now I use hidden data in my form and I > dynamically name the fields in a loop. Then in the next page I use the > get_post_vars and use substring so I can say if the first part of the var > name is my array name then I get the position from the next part of the var > name (array0, array1...) and use that position to put it in the new array. > > I definitely wouldn't assume it's the cleanest way to do it, but I didn't > want to use sessions (if they'd even work) and the query string had some > problems with confidential data anyway (the users can see it and we aren't > supposed to display data in certain situations). > > If you'd like to go with this method and want some pointers let me know and > I'll send you some of my code. > > Good luck! > > -Natalie > > > -Original Message- > > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] > > Sent: Monday, February 25, 2002 1:01 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] Passing contents of array on as variables... > > > > Let's see what your code looks like now and where it is returning the > > word "array". That might help determine where the problem lies now. > > > > MB > > > > jas <[EMAIL PROTECTED]> said: > > > > > Ok to this point I have been able to query a database table, display the > > > results in tables and within a form. As of yet I have been able to > > insert > > > the contents of the db query into an array for further processing. > > However, > > > when I try to pass the contents of that array on to another page to > > delete > > > selected records from the db it only displays the word "array". Not > > quite > > > sure where I need to go from here... Any insight would be a great help. > > > Thanks in advance, > > > Jas > > > > > > > > > > > > -- > > > 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
Re: [PHP-DB] Passing contents of array on as variables...
Bjorn, I just wanted to thank you for giving me alot of insight into what I was trying to accomplish however, due to time restraints I have decided to do it a different way by pulling the entries into a select box that a customer can use to delete the different items. Once again, thanks a ton Jas "Jas" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok, I think I understand what you are talking about. So now I know what I > need to accomplish, and would you happen to know of a good place to learn > about something like this? For some reason this function keeps seeming to > elude me and if you know of a good tutorial on how to accomplish this I > would appreciate it. Thanks again, > Jas > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > One problem I see is that you are sending all of the values for all of > your > > fields (except the id field) from the first page to the second page, not > just > > the ones that are checked, so even if it was working properly, you would > get > > a list of all items in the table, not just the checked items. You need to > > send the array of id's (since this is the name for the checkbox) from the > > first page to the second one (again in the checkbox form element, you did > not > > put a value on it). > > > > What your first page is currently doing is pulling all of the information > out > > of the database. Then as soon as you pull each item out, you are putting > it > > into an hidden form element array, ie. $car_type[], $car_model[], etc. > > regardless of whether the checkbox is checked or not to pass to the next > > page. You do not know if the checkbox is checked or not until the next > page > > when it looks at the values in the id array. On the second page, you need > to > > look at the id array and then (through a database call) pull the row from > the > > table for each id in the array. > > > > HTH > > > > MB > > > > jas <[EMAIL PROTECTED]> said: > > > > > $i=0; > > > while > > > ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$car_vin[$i]) > { > > > $i ++; > > > } > > > Is what I added and this is what is being output to the screen at this > > > point... > > > =0; while () { ++; } > > > now i am still too new to php to understand why it is not putting the > > > contents of the array into my hidden fields like it does on my first > page (i > > > can see them when I view source). > > > <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > When you call your $car_type in the second page, you need to set a > > > variable > > > > starting at 0 and call it as $car_type[0] and loop through all of the > > > values > > > > in the array. > > > > > > > > ie. > > > > > > > > $i=0; > > > > while ($car_type[$i]) { > > > > > > > > I have added more code below that should help. > > > > > > > > MB > > > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > Yeah, tried that and it still isnt passing the contents of the array > as > > > a > > > > > varible to the confirmation page for deletion. I am at a loss on > this > > > one. > > > > > <[EMAIL PROTECTED]> wrote in message > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > You didn't add the value part of the hidden element, ie. > > > > > > > > > > > > value=\"$myrow[car_type]\"> > > > > > > > > > > > > You were naming the field as an array with no value. > > > > > > > > > > > > if you want to pass this as an array of values, you would need to > use: > > > > > > > > > > > > value=\"$myrow[car_type]\"> > > > > > > > > > > > > Give that a try and see if it works. > > > > > > > > > > > > HTH > > > > > > > > > > > > MB > > > > > > > > > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > > > > > As of right now if you run the php script and view source on the > > > page > > > > > you > > > > > > > can see that it does place the content of db table into array... > ex. > > > > > > > Current Inventory > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Type Of Car: > Ford > > > > > > type="checkbox" name="id[1]">remove > > > > > > > but on the following page (after selecting items to delete) it > just > > > > > displays > > > > > > > the word array for each field (i.e. car_type etc.) > > > > > > > > > > > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > > > Oops... yeah its a monday. > > > > > > > > Bjorn, I reverted back to my original code because I was > getting > > > > > > > confused... > > > > > > > > Here is page one... > > > > > > > > > > > > > > > // Database connection paramaters > > > > > > > > require '../path/to/db.php'; > > > > > > > > // SQL statement to get current inventory > > > > > > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or > die("Could > > > not > > > > > > > > execute query, please try again later");
Re: [PHP-DB] Passing contents of array on as variables...
Ok, I think I understand what you are talking about. So now I know what I need to accomplish, and would you happen to know of a good place to learn about something like this? For some reason this function keeps seeming to elude me and if you know of a good tutorial on how to accomplish this I would appreciate it. Thanks again, Jas <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > One problem I see is that you are sending all of the values for all of your > fields (except the id field) from the first page to the second page, not just > the ones that are checked, so even if it was working properly, you would get > a list of all items in the table, not just the checked items. You need to > send the array of id's (since this is the name for the checkbox) from the > first page to the second one (again in the checkbox form element, you did not > put a value on it). > > What your first page is currently doing is pulling all of the information out > of the database. Then as soon as you pull each item out, you are putting it > into an hidden form element array, ie. $car_type[], $car_model[], etc. > regardless of whether the checkbox is checked or not to pass to the next > page. You do not know if the checkbox is checked or not until the next page > when it looks at the values in the id array. On the second page, you need to > look at the id array and then (through a database call) pull the row from the > table for each id in the array. > > HTH > > MB > > jas <[EMAIL PROTECTED]> said: > > > $i=0; > > while > > ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$car_vin[$i]) { > > $i ++; > > } > > Is what I added and this is what is being output to the screen at this > > point... > > =0; while () { ++; } > > now i am still too new to php to understand why it is not putting the > > contents of the array into my hidden fields like it does on my first page (i > > can see them when I view source). > > <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > When you call your $car_type in the second page, you need to set a > > variable > > > starting at 0 and call it as $car_type[0] and loop through all of the > > values > > > in the array. > > > > > > ie. > > > > > > $i=0; > > > while ($car_type[$i]) { > > > > > > I have added more code below that should help. > > > > > > MB > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > Yeah, tried that and it still isnt passing the contents of the array as > > a > > > > varible to the confirmation page for deletion. I am at a loss on this > > one. > > > > <[EMAIL PROTECTED]> wrote in message > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > You didn't add the value part of the hidden element, ie. > > > > > > > > > > > > > > > > > > > > You were naming the field as an array with no value. > > > > > > > > > > if you want to pass this as an array of values, you would need to use: > > > > > > > > > > > > > > > > > > > > Give that a try and see if it works. > > > > > > > > > > HTH > > > > > > > > > > MB > > > > > > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > > > As of right now if you run the php script and view source on the > > page > > > > you > > > > > > can see that it does place the content of db table into array... ex. > > > > > > Current Inventory > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Type Of Car: Ford > > > > > type="checkbox" name="id[1]">remove > > > > > > but on the following page (after selecting items to delete) it just > > > > displays > > > > > > the word array for each field (i.e. car_type etc.) > > > > > > > > > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > > Oops... yeah its a monday. > > > > > > > Bjorn, I reverted back to my original code because I was getting > > > > > > confused... > > > > > > > Here is page one... > > > > > > > > > > > > > // Database connection paramaters > > > > > > > require '../path/to/db.php'; > > > > > > > // SQL statement to get current inventory > > > > > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could > > not > > > > > > > execute query, please try again later"); > > > > > > > // Creating table to make data look pretty > > > > > > > echo " > width=\"100%\"> > > > > > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > > > > > Current > > > > > > > Inventory"; > > > > > > > // Start to count number of records in selected table and loop > > until > > > > done > > > > > > > $count = -1; > > > > > > > while ($myrow = mysql_fetch_array($result)) { > > > > > > > $count ++; > > > > > > > // Begin placing them into an hidden fields and then array > > > > > > > echo " > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > // Place items on separate cells in html table > > > > > > > Type Of Car: "; > > > > > > > printf(mysql_resu
Re: [PHP-DB] Passing contents of array on as variables...
One problem I see is that you are sending all of the values for all of your fields (except the id field) from the first page to the second page, not just the ones that are checked, so even if it was working properly, you would get a list of all items in the table, not just the checked items. You need to send the array of id's (since this is the name for the checkbox) from the first page to the second one (again in the checkbox form element, you did not put a value on it). What your first page is currently doing is pulling all of the information out of the database. Then as soon as you pull each item out, you are putting it into an hidden form element array, ie. $car_type[], $car_model[], etc. regardless of whether the checkbox is checked or not to pass to the next page. You do not know if the checkbox is checked or not until the next page when it looks at the values in the id array. On the second page, you need to look at the id array and then (through a database call) pull the row from the table for each id in the array. HTH MB jas <[EMAIL PROTECTED]> said: > $i=0; > while > ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$car_vin[$i]) { > $i ++; > } > Is what I added and this is what is being output to the screen at this > point... > =0; while () { ++; } > now i am still too new to php to understand why it is not putting the > contents of the array into my hidden fields like it does on my first page (i > can see them when I view source). > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > When you call your $car_type in the second page, you need to set a > variable > > starting at 0 and call it as $car_type[0] and loop through all of the > values > > in the array. > > > > ie. > > > > $i=0; > > while ($car_type[$i]) { > > > > I have added more code below that should help. > > > > MB > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > Yeah, tried that and it still isnt passing the contents of the array as > a > > > varible to the confirmation page for deletion. I am at a loss on this > one. > > > <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > You didn't add the value part of the hidden element, ie. > > > > > > > > > > > > > > > > You were naming the field as an array with no value. > > > > > > > > if you want to pass this as an array of values, you would need to use: > > > > > > > > > > > > > > > > Give that a try and see if it works. > > > > > > > > HTH > > > > > > > > MB > > > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > As of right now if you run the php script and view source on the > page > > > you > > > > > can see that it does place the content of db table into array... ex. > > > > > Current Inventory > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Type Of Car: Ford > > > > type="checkbox" name="id[1]">remove > > > > > but on the following page (after selecting items to delete) it just > > > displays > > > > > the word array for each field (i.e. car_type etc.) > > > > > > > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > Oops... yeah its a monday. > > > > > > Bjorn, I reverted back to my original code because I was getting > > > > > confused... > > > > > > Here is page one... > > > > > > > > > > > // Database connection paramaters > > > > > > require '../path/to/db.php'; > > > > > > // SQL statement to get current inventory > > > > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could > not > > > > > > execute query, please try again later"); > > > > > > // Creating table to make data look pretty > > > > > > echo " width=\"100%\"> > > > > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > > > > Current > > > > > > Inventory"; > > > > > > // Start to count number of records in selected table and loop > until > > > done > > > > > > $count = -1; > > > > > > while ($myrow = mysql_fetch_array($result)) { > > > > > > $count ++; > > > > > > // Begin placing them into an hidden fields and then array > > > > > > echo " > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > // Place items on separate cells in html table > > > > > > Type Of Car: "; > > > > > > printf(mysql_result($result,$count,"car_type")); > > > > > > // Create checkbox so user can delete items if needed > > > > > > echo " > > > > > name=\"id[".$myrow[id]."]\">remove\n"; > > > > > > echo "Model Of Car: "; > > > > > > printf(mysql_result($result,$count,"car_model")); > > > > > > echo "\n"; > > > > > > echo "Year Of Car: "; > > > > > > printf(mysql_result($result,$count,"car_year")); > > > > > > echo "\n"; > > > > > > echo "Price Of Car: $"; > > > > > > printf(mysql_result($result,$count,"car_price")); > > > > > > echo "\n"; > > > > > > echo "VIN Of Car: "; > > > > > > printf(mysql_result($result,$count,"car_vin")); > > > > > > echo " > > color=\"33\">
Re: [PHP-DB] Passing contents of array on as variables...
$i=0; while ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$car_vin[$i]) { $i ++; } Is what I added and this is what is being output to the screen at this point... =0; while () { ++; } now i am still too new to php to understand why it is not putting the contents of the array into my hidden fields like it does on my first page (i can see them when I view source). <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > When you call your $car_type in the second page, you need to set a variable > starting at 0 and call it as $car_type[0] and loop through all of the values > in the array. > > ie. > > $i=0; > while ($car_type[$i]) { > > I have added more code below that should help. > > MB > > > jas <[EMAIL PROTECTED]> said: > > > Yeah, tried that and it still isnt passing the contents of the array as a > > varible to the confirmation page for deletion. I am at a loss on this one. > > <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > You didn't add the value part of the hidden element, ie. > > > > > > > > > > > > You were naming the field as an array with no value. > > > > > > if you want to pass this as an array of values, you would need to use: > > > > > > > > > > > > Give that a try and see if it works. > > > > > > HTH > > > > > > MB > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > As of right now if you run the php script and view source on the page > > you > > > > can see that it does place the content of db table into array... ex. > > > > Current Inventory > > > > > > > > > > > > > > > > > > > > > > > > Type Of Car: Ford > > > type="checkbox" name="id[1]">remove > > > > but on the following page (after selecting items to delete) it just > > displays > > > > the word array for each field (i.e. car_type etc.) > > > > > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > Oops... yeah its a monday. > > > > > Bjorn, I reverted back to my original code because I was getting > > > > confused... > > > > > Here is page one... > > > > > > > > > // Database connection paramaters > > > > > require '../path/to/db.php'; > > > > > // SQL statement to get current inventory > > > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > > > > execute query, please try again later"); > > > > > // Creating table to make data look pretty > > > > > echo " > > > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > > > Current > > > > > Inventory"; > > > > > // Start to count number of records in selected table and loop until > > done > > > > > $count = -1; > > > > > while ($myrow = mysql_fetch_array($result)) { > > > > > $count ++; > > > > > // Begin placing them into an hidden fields and then array > > > > > echo " > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > // Place items on separate cells in html table > > > > > Type Of Car: "; > > > > > printf(mysql_result($result,$count,"car_type")); > > > > > // Create checkbox so user can delete items if needed > > > > > echo " > > > > name=\"id[".$myrow[id]."]\">remove\n"; > > > > > echo "Model Of Car: "; > > > > > printf(mysql_result($result,$count,"car_model")); > > > > > echo "\n"; > > > > > echo "Year Of Car: "; > > > > > printf(mysql_result($result,$count,"car_year")); > > > > > echo "\n"; > > > > > echo "Price Of Car: $"; > > > > > printf(mysql_result($result,$count,"car_price")); > > > > > echo "\n"; > > > > > echo "VIN Of Car: "; > > > > > printf(mysql_result($result,$count,"car_vin")); > > > > > echo " > color=\"33\">\n"; > > > > > } > > > > > // End loop and print the infamous delete button > > > > > echo " > > > > value=\"delete\">"; > > > > > ?> > > > > > Here is page two... > > > > > > > > > print(" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Confirm > > Record > > > > > Deletion > > > > > > > Here is where above loop code would go and $car_type, $car_model, etc. would > be called as $car_type[$i], $car_model[$i], etc. > > > > > > > > > > > > Type Of Car: > > > > > $car_type // here is where it prints the word "array" > > instead of > > > > > type of car > > > > > > > > > > > > > > > Model Of Car: > > > > > $car_model > > > > > > > > > > > > > > > Year Of Car: > > > > > $car_year > > > > > > > > > > > > > > > Price Of Car: > > > > > $car_price > > > > > > > > > > > > > > > VIN Of Car: > > > > > $car_vin > > > > > > > increment $i and > end loop > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "); > > > > > ?> > > > > > > > > > > <[EMAIL PROTECTED]> wrote in message > > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > Let's see what your code looks like now and where it is returning > > the > > > > > > word "array". That might help determine where the pro
Re: [PHP-DB] Passing contents of array on as variables...
When you call your $car_type in the second page, you need to set a variable starting at 0 and call it as $car_type[0] and loop through all of the values in the array. ie. $i=0; while ($car_type[$i]) { I have added more code below that should help. MB jas <[EMAIL PROTECTED]> said: > Yeah, tried that and it still isnt passing the contents of the array as a > varible to the confirmation page for deletion. I am at a loss on this one. > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > You didn't add the value part of the hidden element, ie. > > > > > > > > You were naming the field as an array with no value. > > > > if you want to pass this as an array of values, you would need to use: > > > > > > > > Give that a try and see if it works. > > > > HTH > > > > MB > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > As of right now if you run the php script and view source on the page > you > > > can see that it does place the content of db table into array... ex. > > > Current Inventory > > > > > > > > > > > > > > > > > > Type Of Car: Ford > > type="checkbox" name="id[1]">remove > > > but on the following page (after selecting items to delete) it just > displays > > > the word array for each field (i.e. car_type etc.) > > > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > Oops... yeah its a monday. > > > > Bjorn, I reverted back to my original code because I was getting > > > confused... > > > > Here is page one... > > > > > > > // Database connection paramaters > > > > require '../path/to/db.php'; > > > > // SQL statement to get current inventory > > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > > > execute query, please try again later"); > > > > // Creating table to make data look pretty > > > > echo " > > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > > Current > > > > Inventory"; > > > > // Start to count number of records in selected table and loop until > done > > > > $count = -1; > > > > while ($myrow = mysql_fetch_array($result)) { > > > > $count ++; > > > > // Begin placing them into an hidden fields and then array > > > > echo " > > > > > > > > > > > > > > > > > > > > > > > > // Place items on separate cells in html table > > > > Type Of Car: "; > > > > printf(mysql_result($result,$count,"car_type")); > > > > // Create checkbox so user can delete items if needed > > > > echo " > > > name=\"id[".$myrow[id]."]\">remove\n"; > > > > echo "Model Of Car: "; > > > > printf(mysql_result($result,$count,"car_model")); > > > > echo "\n"; > > > > echo "Year Of Car: "; > > > > printf(mysql_result($result,$count,"car_year")); > > > > echo "\n"; > > > > echo "Price Of Car: $"; > > > > printf(mysql_result($result,$count,"car_price")); > > > > echo "\n"; > > > > echo "VIN Of Car: "; > > > > printf(mysql_result($result,$count,"car_vin")); > > > > echo " color=\"33\">\n"; > > > > } > > > > // End loop and print the infamous delete button > > > > echo " > > > value=\"delete\">"; > > > > ?> > > > > Here is page two... > > > > > > > print(" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Confirm > Record > > > > Deletion > > > > Here is where above loop code would go and $car_type, $car_model, etc. would be called as $car_type[$i], $car_model[$i], etc. > > > > > > > > Type Of Car: > > > > $car_type // here is where it prints the word "array" > instead of > > > > type of car > > > > > > > > > > > > Model Of Car: > > > > $car_model > > > > > > > > > > > > Year Of Car: > > > > $car_year > > > > > > > > > > > > Price Of Car: > > > > $car_price > > > > > > > > > > > > VIN Of Car: > > > > $car_vin > > > > increment $i and end loop > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "); > > > > ?> > > > > > > > > <[EMAIL PROTECTED]> wrote in message > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > Let's see what your code looks like now and where it is returning > the > > > > > word "array". That might help determine where the problem lies now. > > > > > > > > > > MB > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > > > Ok to this point I have been able to query a database table, > display > > > the > > > > > > results in tables and within a form. As of yet I have been able > to > > > > insert > > > > > > the contents of the db query into an array for further processing. > > > > However, > > > > > > when I try to pass the contents of that array on to another page > to > > > > delete > > > > > > selected records from the db it only displays the word "array". > Not > > > > quite > > > > > > sure where I need to go from here... Any insight would be a great > > > help. > > > > > > Thanks in advance, > > > > > > Jas > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > PHP Dat
Re: [PHP-DB] Passing contents of array on as variables...
Yeah, tried that and it still isnt passing the contents of the array as a varible to the confirmation page for deletion. I am at a loss on this one. <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You didn't add the value part of the hidden element, ie. > > > > You were naming the field as an array with no value. > > if you want to pass this as an array of values, you would need to use: > > > > Give that a try and see if it works. > > HTH > > MB > > > jas <[EMAIL PROTECTED]> said: > > > As of right now if you run the php script and view source on the page you > > can see that it does place the content of db table into array... ex. > > Current Inventory > > > > > > > > > > > > Type Of Car: Ford > type="checkbox" name="id[1]">remove > > but on the following page (after selecting items to delete) it just displays > > the word array for each field (i.e. car_type etc.) > > > > "Jas" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Oops... yeah its a monday. > > > Bjorn, I reverted back to my original code because I was getting > > confused... > > > Here is page one... > > > > > // Database connection paramaters > > > require '../path/to/db.php'; > > > // SQL statement to get current inventory > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > > execute query, please try again later"); > > > // Creating table to make data look pretty > > > echo " > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > Current > > > Inventory"; > > > // Start to count number of records in selected table and loop until done > > > $count = -1; > > > while ($myrow = mysql_fetch_array($result)) { > > > $count ++; > > > // Begin placing them into an hidden fields and then array > > > echo " > > > > > > > > > > > > > > > > > > // Place items on separate cells in html table > > > Type Of Car: "; > > > printf(mysql_result($result,$count,"car_type")); > > > // Create checkbox so user can delete items if needed > > > echo " > > name=\"id[".$myrow[id]."]\">remove\n"; > > > echo "Model Of Car: "; > > > printf(mysql_result($result,$count,"car_model")); > > > echo "\n"; > > > echo "Year Of Car: "; > > > printf(mysql_result($result,$count,"car_year")); > > > echo "\n"; > > > echo "Price Of Car: $"; > > > printf(mysql_result($result,$count,"car_price")); > > > echo "\n"; > > > echo "VIN Of Car: "; > > > printf(mysql_result($result,$count,"car_vin")); > > > echo "\n"; > > > } > > > // End loop and print the infamous delete button > > > echo " > > value=\"delete\">"; > > > ?> > > > Here is page two... > > > > > print(" > > > > > > > > > > > > > > > > > > > > > > > > > > > Confirm Record > > > Deletion > > > > > > > > > Type Of Car: > > > $car_type // here is where it prints the word "array" instead of > > > type of car > > > > > > > > > Model Of Car: > > > $car_model > > > > > > > > > Year Of Car: > > > $car_year > > > > > > > > > Price Of Car: > > > $car_price > > > > > > > > > VIN Of Car: > > > $car_vin > > > > > > > > > > > > > > > > > > > > > > > > > > > "); > > > ?> > > > > > > <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > Let's see what your code looks like now and where it is returning the > > > > word "array". That might help determine where the problem lies now. > > > > > > > > MB > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > > > Ok to this point I have been able to query a database table, display > > the > > > > > results in tables and within a form. As of yet I have been able to > > > insert > > > > > the contents of the db query into an array for further processing. > > > However, > > > > > when I try to pass the contents of that array on to another page to > > > delete > > > > > selected records from the db it only displays the word "array". Not > > > quite > > > > > sure where I need to go from here... Any insight would be a great > > help. > > > > > Thanks in advance, > > > > > Jas > > > > > > > > > > > > > > > > > > > > -- > > > > > 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
Re: [PHP-DB] Passing contents of array on as variables...
You didn't add the value part of the hidden element, ie. You were naming the field as an array with no value. if you want to pass this as an array of values, you would need to use: Give that a try and see if it works. HTH MB jas <[EMAIL PROTECTED]> said: > As of right now if you run the php script and view source on the page you > can see that it does place the content of db table into array... ex. > Current Inventory > > > > > > Type Of Car: Ford type="checkbox" name="id[1]">remove > but on the following page (after selecting items to delete) it just displays > the word array for each field (i.e. car_type etc.) > > "Jas" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Oops... yeah its a monday. > > Bjorn, I reverted back to my original code because I was getting > confused... > > Here is page one... > > > // Database connection paramaters > > require '../path/to/db.php'; > > // SQL statement to get current inventory > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > execute query, please try again later"); > > // Creating table to make data look pretty > > echo " > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > Current > > Inventory"; > > // Start to count number of records in selected table and loop until done > > $count = -1; > > while ($myrow = mysql_fetch_array($result)) { > > $count ++; > > // Begin placing them into an hidden fields and then array > > echo " > > > > > > > > > > > > // Place items on separate cells in html table > > Type Of Car: "; > > printf(mysql_result($result,$count,"car_type")); > > // Create checkbox so user can delete items if needed > > echo " > name=\"id[".$myrow[id]."]\">remove\n"; > > echo "Model Of Car: "; > > printf(mysql_result($result,$count,"car_model")); > > echo "\n"; > > echo "Year Of Car: "; > > printf(mysql_result($result,$count,"car_year")); > > echo "\n"; > > echo "Price Of Car: $"; > > printf(mysql_result($result,$count,"car_price")); > > echo "\n"; > > echo "VIN Of Car: "; > > printf(mysql_result($result,$count,"car_vin")); > > echo "\n"; > > } > > // End loop and print the infamous delete button > > echo " > value=\"delete\">"; > > ?> > > Here is page two... > > > print(" > > > > > > > > > > > > > > > > > > Confirm Record > > Deletion > > > > > > Type Of Car: > > $car_type // here is where it prints the word "array" instead of > > type of car > > > > > > Model Of Car: > > $car_model > > > > > > Year Of Car: > > $car_year > > > > > > Price Of Car: > > $car_price > > > > > > VIN Of Car: > > $car_vin > > > > > > > > > > > > > > > > > > "); > > ?> > > > > <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Let's see what your code looks like now and where it is returning the > > > word "array". That might help determine where the problem lies now. > > > > > > MB > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > > > Ok to this point I have been able to query a database table, display > the > > > > results in tables and within a form. As of yet I have been able to > > insert > > > > the contents of the db query into an array for further processing. > > However, > > > > when I try to pass the contents of that array on to another page to > > delete > > > > selected records from the db it only displays the word "array". Not > > quite > > > > sure where I need to go from here... Any insight would be a great > help. > > > > Thanks in advance, > > > > Jas > > > > > > > > > > > > > > > > -- > > > > 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
Re: [PHP-DB] Passing contents of array on as variables...
As of right now if you run the php script and view source on the page you can see that it does place the content of db table into array... ex. Current Inventory Type Of Car: Fordremove but on the following page (after selecting items to delete) it just displays the word array for each field (i.e. car_type etc.) "Jas" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Oops... yeah its a monday. > Bjorn, I reverted back to my original code because I was getting confused... > Here is page one... > // Database connection paramaters > require '../path/to/db.php'; > // SQL statement to get current inventory > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > // Creating table to make data look pretty > echo " name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > Current > Inventory"; > // Start to count number of records in selected table and loop until done > $count = -1; > while ($myrow = mysql_fetch_array($result)) { > $count ++; > // Begin placing them into an hidden fields and then array > echo " > > > > > > // Place items on separate cells in html table > Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > // Create checkbox so user can delete items if needed > echo " name=\"id[".$myrow[id]."]\">remove\n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > // End loop and print the infamous delete button > echo " value=\"delete\">"; > ?> > Here is page two... > print(" > > > > > > > > > Confirm Record > Deletion > > > Type Of Car: > $car_type // here is where it prints the word "array" instead of > type of car > > > Model Of Car: > $car_model > > > Year Of Car: > $car_year > > > Price Of Car: > $car_price > > > VIN Of Car: > $car_vin > > > > > > > > > "); > ?> > > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Let's see what your code looks like now and where it is returning the > > word "array". That might help determine where the problem lies now. > > > > MB > > > > jas <[EMAIL PROTECTED]> said: > > > > > Ok to this point I have been able to query a database table, display the > > > results in tables and within a form. As of yet I have been able to > insert > > > the contents of the db query into an array for further processing. > However, > > > when I try to pass the contents of that array on to another page to > delete > > > selected records from the db it only displays the word "array". Not > quite > > > sure where I need to go from here... Any insight would be a great help. > > > Thanks in advance, > > > Jas > > > > > > > > > > > > -- > > > 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] Passing contents of array on as variables...
Jas, I've run into the same kind of problem with the site I'm doing for work. My first solution was to use the query string to pass contents of an array (array[0]&array[1]...) but I got to the point where I was passing too much information and it wouldn't work. Now I use hidden data in my form and I dynamically name the fields in a loop. Then in the next page I use the get_post_vars and use substring so I can say if the first part of the var name is my array name then I get the position from the next part of the var name (array0, array1...) and use that position to put it in the new array. I definitely wouldn't assume it's the cleanest way to do it, but I didn't want to use sessions (if they'd even work) and the query string had some problems with confidential data anyway (the users can see it and we aren't supposed to display data in certain situations). If you'd like to go with this method and want some pointers let me know and I'll send you some of my code. Good luck! -Natalie > -Original Message- > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] > Sent: Monday, February 25, 2002 1:01 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Passing contents of array on as variables... > > Let's see what your code looks like now and where it is returning the > word "array". That might help determine where the problem lies now. > > MB > > jas <[EMAIL PROTECTED]> said: > > > Ok to this point I have been able to query a database table, display the > > results in tables and within a form. As of yet I have been able to > insert > > the contents of the db query into an array for further processing. > However, > > when I try to pass the contents of that array on to another page to > delete > > selected records from the db it only displays the word "array". Not > quite > > sure where I need to go from here... Any insight would be a great help. > > Thanks in advance, > > Jas > > > > > > > > -- > > 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
Re: [PHP-DB] Passing contents of array on as variables...
Oops... yeah its a monday. Bjorn, I reverted back to my original code because I was getting confused... Here is page one... Current Inventory"; // Start to count number of records in selected table and loop until done $count = -1; while ($myrow = mysql_fetch_array($result)) { $count ++; // Begin placing them into an hidden fields and then array echo " // Place items on separate cells in html table Type Of Car: "; printf(mysql_result($result,$count,"car_type")); // Create checkbox so user can delete items if needed echo "remove\n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } // End loop and print the infamous delete button echo ""; ?> Here is page two... Confirm Record Deletion Type Of Car: $car_type // here is where it prints the word "array" instead of type of car Model Of Car: $car_model Year Of Car: $car_year Price Of Car: $car_price VIN Of Car: $car_vin "); ?> <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Let's see what your code looks like now and where it is returning the > word "array". That might help determine where the problem lies now. > > MB > > jas <[EMAIL PROTECTED]> said: > > > Ok to this point I have been able to query a database table, display the > > results in tables and within a form. As of yet I have been able to insert > > the contents of the db query into an array for further processing. However, > > when I try to pass the contents of that array on to another page to delete > > selected records from the db it only displays the word "array". Not quite > > sure where I need to go from here... Any insight would be a great help. > > Thanks in advance, > > Jas > > > > > > > > -- > > 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] Passing contents of array on as variables...
Let's see what your code looks like now and where it is returning the word "array". That might help determine where the problem lies now. MB jas <[EMAIL PROTECTED]> said: > Ok to this point I have been able to query a database table, display the > results in tables and within a form. As of yet I have been able to insert > the contents of the db query into an array for further processing. However, > when I try to pass the contents of that array on to another page to delete > selected records from the db it only displays the word "array". Not quite > sure where I need to go from here... Any insight would be a great help. > Thanks in advance, > Jas > > > > -- > 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] Passing contents of array on as variables...
Ok to this point I have been able to query a database table, display the results in tables and within a form. As of yet I have been able to insert the contents of the db query into an array for further processing. However, when I try to pass the contents of that array on to another page to delete selected records from the db it only displays the word "array". Not quite sure where I need to go from here... Any insight would be a great help. Thanks in advance, Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL query help - limit and group by
Hi there. I would like to return the 2 most recent events from my table, for each author (Author_ID). Here's my table structure (simplified). tblEvents ID Title Create_Date Author_ID Is there a way to do this with a query instead of getting every record, sorted by Author_ID, displaying the first two events, and skipping through until the Author_ID changes, then displaying the first 2 events for that Author_ID, etc. I know I could use a GROUP BY clause, but can I limit the number of records returned in each group, sorted by date? -- Faye -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: "The" Debacle
Interesting question... Libraries traditionally use "Distillers, The" but really this is a hold over from the card catalogues where if they didn't do it that way the "T" section would be over half of the catalogue. Also it's easier for people to notice that the library puts the "the" second but looking for "The Distillers" and not finding any "The..." than it is to notice the opposite but searching for "Distillers ..." and not finding any. But think beyond the card catalog... This is 2002 not 1802. How about a column title which is accurate (whatever is on the official album - er... CD or MP3 ID tag). But then have a second table with a word index. TitleIndex - id int, type int, word varchar(80) Where id is the id of whatever used that word, type tells you what that was (in your case an artist name, album name or anything else you intend to track) and word is the lowercase (to make it case insensitive) word you're indexing. So if we have "The Distillers - Sing Sing Death House" and "The Grateful Dead - Terrapin Station" and "The Bobs - Cover Songs of ..." Your table might look like: id type word 1 1 the 1 1 distillers 232 sing 232 sing 232 death 232 house 3 1 the 3 1 grateful 3 1 dead 122 terrapin 122 station 2 1 the 2 1 bobs 152 cover 152 songs 152 of 152 ... Isn't this more of a pain in the ass? Well yes but not that much and consider the huge benefits it can offer. You search on this table by breaking off of the words your end user submits into single words and do a group by sorting by count(*) desc -- you'll get relevance and if I searched for "Sing Sing Dead House" or "The Dead" -- which would fail under your design here we would find something (true "The Dead Kennedys" would rate as high as "The Grateful Dead" but they would both be there). If you add a third type for song titles you're really cooking now. Queries can be restricted by type and re-run if the first finds nothing. Good Luck, Frank On 2/24/02 10:19 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > From: "Jonathan Underfoot" <[EMAIL PROTECTED]> > Date: Sun, 24 Feb 2002 13:35:43 -0500 > To: "[PHP-DB]" <[EMAIL PROTECTED]> > Subject: "The" Debacle > > I'm putting together a table with bands, and I have a slight problem. Well it > not really a problem as much as I'd like some input from more seasoned > professionals. Certain band names begin with "The" but when listing them it > would be of great advantge to me to remove the "the." Has anyone else faced > this dilemma? I was thinking that when inputting and editing band names that > I could just scripot a new column with the comma in place. I suppose librarys > have this difficulty as well. So what is it? > > Column 1 - "The Distillers" > Column 2 - "Distillers, The" > > Or a bit of PHP programming every time I list them (seems more difficult.) > > Either way, does anyone have the propper PHP function I should use? > > Thanks much... > > -Jonathan > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem in programming PHP with WML
on 2/25/02 11:32 AM, ªüYam at [EMAIL PROTECTED] appended the following bits to my mbox: > I don't know why??That comes out a Err Msg about "Unsupported type: > text/html" . I've never done any WML scripting, but the error message offers a big clue. PHP by default sends a Content-type header of text/html. Evidently, WAP enabled devices don't like that. Try something like this: Header('Content-type: text/vnd.wap.wml'); Not sure about that content type, but it was what I found on a simple google search. HTH. Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem in programming PHP with WML
I'm doing a project involving in WAP & WEB applications which complementary with Mysql database. However, when i try to compile the wml page, it goes error. The page is about combining the scripts of wml and php so as to access the database and returning the result to the client-sided. I don't know why??That comes out a Err Msg about "Unsupported type: text/html" . Is there anyone can help me please?? thx a lot -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP advice
Hi there :) What happens when you change this line ($query = "select * from auth where password = ".$password.""; ) to this: (no periods) $query = "select * from auth where password = '$password'"; Cheers, Joe :) "Greg Lobring" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I dont understand why this is causing me so much trouble, hopefully someone > can help. I have a simple PHP script that takes the user id and password > from a form on a page...here is the php used after submitting the form: > > @ $db = mysql_pconnect("localhost", "blah", "blah"); > if (!$db) > { > echo "Error: Could not connect to database."; > exit; > } > mysql_select_db("blahblah"); > $query = "select * from auth where password = ".$password.""; > $result = mysql_query($query); > $num_results = mysql_num_rows($result); > echo "Number of Rows: ".$num_results.""; > mysql_close($db); > ?> > > It connects fine, and when the query returns NO (0) rows, it appears > correct. However, when the query returns a record, I get the following > error: > > > Warning: Supplied argument is not a valid MySQL result resource in picks.php > on line 16 > > Where line 16 is the the line that says $num_results = > mysql_num_rows($result); > > > Does anyone have any advice? > > Appreciated in advance.. > > Greg > > > > _ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Array HELL!!!!
Try putting the hidden element statement down inside the while loop in he second page, but change it to "" and add $id=$row['id']; before it. I will show below where it should go. HTH MB jas <[EMAIL PROTECTED]> said: > I have made the changes you suggested which if you ask me have been the most > informative answers I have recieved thus far. I did run into a slight snag > on line 21 which is this on my confirmation page " NAME=\"id[]\" VALUE=\"$id[]\">" and the parse error is as follows... > Parse error: parse error, expecting `STRING' or `NUM_STRING' or `'$'' in > /php/rem_conf_t.php3 on line 21 > Wouldn't I need to adjust the value=\"$id[]\" to something like > value=\".$id[].\" because we passed an array not a string? Not sure. Thanks > again. You are sincerely helping me understand this whole php bit. =) > Jas > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Ok, you have almost got it. I have made little remarks further down in > your > > code which should just about do it for you. > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > I don't know what it is but I am having a hell of a time trying to get > some > > > results of a query setup into an array or variable (too much of a newbie > to > > > know which) that can be passed to a confirmation page before deleting > the > > > record from a table. I have given up working on this but for those of > you > > > that want to finish it here is the code and the table structure... > > > > > > [Table Structure] > > > id int(30) DEFAULT '0' NOT NULL auto_increment, > > >car_type varchar(30), > > >car_model varchar(30), > > >car_year varchar(15), > > >car_price varchar(15), > > >car_vin varchar(25), > > >dlr_num varchar(25), > > >PRIMARY KEY (id) > > > > > > [Page 1 - Queries DB table for records] > > > > > require '../path/to/db.php'; > > > $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > > execute query, please try again later"); > > > echo " > > name=\"rem_inv\" method=\"post\" action=\"rem_conf.php3\"> > > > Current > > > Inventory"; > > > $count = -1; > > > > $count should start at 0 and then increment at the bottom of the while > loop > > > > > while ($myrow = mysql_fetch_array($result)) { > > > $id = $row["id"]; > > > > $row should be $myrow since that is what it is called above (or change > $myrow > > above to $row) > > > > > > > $car_type = $row["car_type"]; > > > $car_model = $row["car_model"]; > > > $car_year = $row["car_year"]; > > > $car_price = $row["car_price"]; > > > $car_vin = $row["car_vin"]; > > > $count ++; > > > > $count ++; should be moved to the bottom of the loop just before it is > closed > > > > > echo "Type Of Car: "; > > > printf(mysql_result($result,$count,"car_type")); > > > > mysql_result is not needed here, you have defined the variable $car_type > to > > be this here as well as the rows below, so replace mysql_result($result, > > $count, "car_type") with just $car_type > > > > > echo " > > value=\"".$myrow[id]."\">remove\n"; > > > > replace $myrow[id] with $id since it is already defined above > > when id[] is passed to page 2, it will contain an array of the id numbers > > that got checked > > > > > > > echo "Model Of Car: "; > > > printf(mysql_result($result,$count,"car_model")); > > > > same as above, replace mysql_result($result,$count,"car_model") with > > $car_model > > > > > echo "\n"; > > > echo "Year Of Car: "; > > > printf(mysql_result($result,$count,"car_year")); > > > > same as above replace with $car_year > > > > > echo "\n"; > > > echo "Price Of Car: $"; > > > printf(mysql_result($result,$count,"car_price")); > > > > same as above replace with $care_price > > > > > echo "\n"; > > > echo "VIN Of Car: "; > > > printf(mysql_result($result,$count,"car_vin")); > > > > same as above replace with $car_vin > > > > > echo " color=\"33\">\n"; > > > > $count ++; should go here > > > > > } > > > echo " > > value=\"delete\">"; > > > ?> > > > > > > [Page 2 - Takes records and confirms which ones to be deleted] > > > > > print(" > > > > > > > > > > send id[] array passed from previous page to the next page: > > > > > > If you are planning on deleting multiple items at a time, you won't need > the > > following hidden elements at all, just make a database call at this point > > using the id[] array passed to this page from the first page. The only > value > > it needs for the 3rd page is the id value since that is what it uses to > > determine what to delete. > > > > Here is an example of the database call to make: > > > > $i=0; > > while ($id[$i]) { > > $result = @mysql_query("SELECT * FROM cur_inv where id=$id[$i]",$dbh) or > die > > ("Could not execute query, please try again later"); > > $row=mysql_fetch_array($result); Add here: $id=$row['id']; > > $car_type=$row['car_type']; > > $car_model=$row['car_model']; > > $car_year=$row['car_year']; > > $car_price=$row['car_price']; > > $car_vin=$row[
[PHP-DB] Delete selected files
Hi everybody, I show a list of files that I upload to the user's folder using the next code: $path= "../clients/$user"; $dir = opendir ($root); while ($archivo = readdir ($dir)) { $size = filesize("$path/$filename"); $size = ($size/1024); $size = intval($size * 100 ) / 100; if ($filename!= "." && $filename!="..") { echo "$filename$size Kb"; } } I want to add a checkbox in every file i get in the user's folder. My question is: Is there any way to use some kind of function to delete selected files? I am not sure if i can use javascript to evaluate which is checked and how. And after that evaluation, how to call a unlink ($filename) to delete the files. Any help would be greatly appreciated. Nau -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-db@lists.php.net
The problem was solved. The programmer used htmlspecialchars() in one of his functions. So the function was the problem. No problemas with phpMyAdmin - too clever. Andrey - Original Message - From: "Jonathan Underfoot" <[EMAIL PROTECTED]> To: "[PHP-DB]" <[EMAIL PROTECTED]> Sent: Monday, February 25, 2002 3:37 PM Subject: Re: [PHP-DB] Problem with symbol & > In my experience PHPMyAdmin DOES NOT change anything. It never changes & > for me, and it dosen't addslashes(), which makes it a complete pain in the > ass to use, but better than changing things without your knowledge I > suppose. Maybe I'm using an old version? > > -Jonathan > - Original Message - > From: "Marco Coletta" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 25, 2002 3:42 AM > Subject: Re: [PHP-DB] Problem with symbol & > > > > It's not phpMyadmin that changed & to & but the PHP script. > > Than because I could not find with the PHP script the record I looked in > > with phpMyadmin. > > > > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > > 010801c1bdd7$576e9dd0$0b01a8c0@ANDreY">news:010801c1bdd7$576e9dd0$0b01a8c0@ANDreY... > > > phpMyAdmin has changed & to & and then put it in the DB. > > > So it is better not to use phpMyAdmin or any toher web based tool for > > tasks which includes & entering. Not sure for <,> > > > > > > Regards, > > > Andrey Hristov > > > - Original Message - > > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, February 25, 2002 10:32 AM > > > Subject: Re: [PHP-DB] Problem with symbol & > > > > > > > > > > I edit with phpMyAdmin and Mascon, but if I look at the recodr with > > Mysql > > > > client I have the same result : > > > > in the record I find & instead of & > > > > > > > > > > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > > > > 00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY">news:00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY... > > > > > The problem is that you probably use phpMyAdmin for editing data. > > > > > > > > > > Regards, > > > > > Andrey Hristov > > > > > - Original Message - > > > > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > > > > To: <[EMAIL PROTECTED]> > > > > > Sent: Monday, February 25, 2002 10:08 AM > > > > > Subject: [PHP-DB] Problem with symbol & > > > > > > > > > > > > > > > > I have a problem with symbol &. > > > > > > > > > > > > In PHP script I have a variable with a string assigned containing > > the > > > > > > symbol '&' : > > > > > > > > > > > > $myvariable = 'Smith & Sons'; > > > > > > when I insert the variable in the database : > > > > > > > > > > > > $query="insert into mytable (mycolumn) values > > > > > > (myvalue1='$myvariable');"; > > > > > > > > > > > > $result=mysql_query($query); > > > > > > > > > > > > if I edit directly the column in Mysql the symbol '&' has been > > > > > > translated to '&'. > > > > > > > > > > > > The real problem is that if I do a query with where looking for > the > > > > content > > > > > > of record where myvalue='Smith & Sons' > > > > > > in this case the symbol & is not translated and so the query has > no > > > > success. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > 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
php-db@lists.php.net
In my experience PHPMyAdmin DOES NOT change anything. It never changes & for me, and it dosen't addslashes(), which makes it a complete pain in the ass to use, but better than changing things without your knowledge I suppose. Maybe I'm using an old version? -Jonathan - Original Message - From: "Marco Coletta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 25, 2002 3:42 AM Subject: Re: [PHP-DB] Problem with symbol & > It's not phpMyadmin that changed & to & but the PHP script. > Than because I could not find with the PHP script the record I looked in > with phpMyadmin. > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > 010801c1bdd7$576e9dd0$0b01a8c0@ANDreY">news:010801c1bdd7$576e9dd0$0b01a8c0@ANDreY... > > phpMyAdmin has changed & to & and then put it in the DB. > > So it is better not to use phpMyAdmin or any toher web based tool for > tasks which includes & entering. Not sure for <,> > > > > Regards, > > Andrey Hristov > > - Original Message - > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, February 25, 2002 10:32 AM > > Subject: Re: [PHP-DB] Problem with symbol & > > > > > > > I edit with phpMyAdmin and Mascon, but if I look at the recodr with > Mysql > > > client I have the same result : > > > in the record I find & instead of & > > > > > > > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > > > 00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY">news:00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY... > > > > The problem is that you probably use phpMyAdmin for editing data. > > > > > > > > Regards, > > > > Andrey Hristov > > > > - Original Message - > > > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Monday, February 25, 2002 10:08 AM > > > > Subject: [PHP-DB] Problem with symbol & > > > > > > > > > > > > > I have a problem with symbol &. > > > > > > > > > > In PHP script I have a variable with a string assigned containing > the > > > > > symbol '&' : > > > > > > > > > > $myvariable = 'Smith & Sons'; > > > > > when I insert the variable in the database : > > > > > > > > > > $query="insert into mytable (mycolumn) values > > > > > (myvalue1='$myvariable');"; > > > > > > > > > > $result=mysql_query($query); > > > > > > > > > > if I edit directly the column in Mysql the symbol '&' has been > > > > > translated to '&'. > > > > > > > > > > The real problem is that if I do a query with where looking for the > > > content > > > > > of record where myvalue='Smith & Sons' > > > > > in this case the symbol & is not translated and so the query has no > > > success. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > 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
Re: [PHP-DB] Displaying data as while recieving form mysql server
Try to put all your Content to list of Array,.. So u can show the user what they have inputed,.. May it Help [EMAIL PROTECTED] www.indiga.org ---Original Message--- From: Roel Mulder Date: Saturday, February 23, 2002 07:00:50 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Displaying data as while recieving form mysql server Hi Lee, You can't. A has to be closed before a browser can render it and present it to you. So, the webserver may well be trowing echo("".$row[$i]."\n"); to the browser, the browser will wait for the . You might try cutting the one big table into smaller tables, each complete table will be visible as it is completed. Or find an alternative and don't use tables. This also argues that it is not wise to put an entire (much content) page into a table: ... content, much content ... as it simply takes ages before anything seems to happen in your browser. M.vr.gr. Roel Mulder At 16:17 22-02-2002 -0600, you wrote: >Hello. > >After I run my mysql query and get the results, then I do a look to put >the data into table rows that go to a webbrowser. >How can i set it up so that the user see's the table rows as their writen, >not after the script is all done. > >Lee >[EMAIL PROTECTED] > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php Mulder Technisch Advies Postbus 69 NL-2740 AB WADDINXVEEN tel. 0182-640184 fax. 0182-640185 http://www.mta.nl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] PHP IDE
On Sam, Feb 23, 2002 at 12:54:21 -0500, Aron Pilhofer wrote: > After spending two frustrating hours tracking down a bug yesterday - only to > discover it was a misplaced quote mark. I've had it. > > I am looking for suggestions out there for a good IDE for PHP development, > preferably one that doesn't cost an arm and a leg. I tried PHP4EE studio, > but it is buggy as hell and kept crashing on me. You might try phpmole-IDE available at http://www.akbkhome.com/. Though it won't make you happy yet if you are a windows user. For some more tips look at http://www.k-fish.de/krabutzig/emacsphp.html. Regards, Karsten -- Why do we have to hide from the police, daddy? Because we use emacs, son. They use vi. - mailto:[EMAIL PROTECTED] w³: http://www.k-fish.de/ gpg: http://www.k-fish.de/mykeys.gpg -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] evaluate file type
On Monday 25 February 2002 17:22, Nautilis wrote: > Hi everybody > > I am wondering if there is any way to evaluate which kind of file i have on > my server. > > Explanation: > > I have a website where i upload some files for my registered users. I > upload every file to a certain folder. Every user has his own folder so i > upload some files to some users and some other to other users. I create a > list with readdir so i can show a list of files that user can download. > > What I am trying to do is to evaluate the extension of that file so i can > show an icon, at least for certain types, for example PDF, GIF, JPG. ZIP > and WORD documents, and a general icon for the rest of file extensions. > > Anybody can point me into the right direction for evaluate this? If you're using Linux there is a command called 'file' which does a good job identifying what type a particular file is. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Give me chastity and continence, but not just now. -- St. Augustine */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] "The" Debacle
Hi, I have a similar system.. only problem is a band called "The The" :) we manually entered and corrected the artists http://www.musicexperts.com/ steve At 11:16 PM + 24/2/02, Peter Lovatt wrote: >When you add the data > >//does it begin with 'The '? >$name_start = substr($band_name, 0, 2) > >if ($name_start=="The") > { > //remove the word 'The' and following space from the beginning of the >string > str_replace('The ', '', $band_name) ; > > //add ', The 'to the end of the name > $band_name=$band_name.', The'; > } > >You might want something more sophisticated if The with a capital is found >in the middle of names, but hope this is a start > > >Peter >--- >Excellence in internet and open source software >--- >Sunmaia >www.sunmaia.net >[EMAIL PROTECTED] >tel. 0121-242-1473 >--- > >> -Original Message- >> From: Jonathan Underfoot [mailto:[EMAIL PROTECTED]] >> Sent: 24 February 2002 18:36 >> To: [PHP-DB] >> Subject: [PHP-DB] "The" Debacle >> >> >> I'm putting together a table with bands, and I have a slight >> problem. Well it not really a problem as much as I'd like some >> input from more seasoned professionals. Certain band names begin >> with "The" but when listing them it would be of great advantge to >> me to remove the "the." Has anyone else faced this dilemma? I >> was thinking that when inputting and editing band names that I >> could just scripot a new column with the comma in place. I >> suppose librarys have this difficulty as well. So what is it? >> >> Column 1 - "The Distillers" >> Column 2 - "Distillers, The" >> >> Or a bit of PHP programming every time I list them (seems more difficult.) >> >> Either way, does anyone have the propper PHP function I should use? >> >> Thanks much... >> >> -Jonathan >> >> > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- - "Minds are like parachutes, they work best when open" Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] evaluate file type
> I create a > list with readdir so i can show a list of files that user can download. you already have the filename? Op maandag 25 februari 2002 10:22, schreef Nautilis: > Hi everybody > > I am wondering if there is any way to evaluate which kind of file i have on > my server. > > Explanation: > > I have a website where i upload some files for my registered users. I > upload every file to a certain folder. Every user has his own folder so i > upload some files to some users and some other to other users. I create a > list with readdir so i can show a list of files that user can download. > > What I am trying to do is to evaluate the extension of that file so i can > show an icon, at least for certain types, for example PDF, GIF, JPG. ZIP > and WORD documents, and a general icon for the rest of file extensions. > > Anybody can point me into the right direction for evaluate this? > > Thx alot in advance to anybody reading this post. > > Nautilis -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] evaluate file type
Hi everybody I am wondering if there is any way to evaluate which kind of file i have on my server. Explanation: I have a website where i upload some files for my registered users. I upload every file to a certain folder. Every user has his own folder so i upload some files to some users and some other to other users. I create a list with readdir so i can show a list of files that user can download. What I am trying to do is to evaluate the extension of that file so i can show an icon, at least for certain types, for example PDF, GIF, JPG. ZIP and WORD documents, and a general icon for the rest of file extensions. Anybody can point me into the right direction for evaluate this? Thx alot in advance to anybody reading this post. Nautilis -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Still bangin my head
you would need to do a select and find out how much is in the "account" first, then do a check on the equation to see if the result is going to come out negative - if it is, then either don't allow it, or give them an option to clear the account or whatever, otherwise just go ahead and do the withdrawl. alternatively on the withdrawl screen, you could tell them how much is in the account and only allow them to enter a value up to that amount (javascript) which would kind of pre-empt their stupidity :) HTH beau // -Original Message- // From: Jennifer Downey [mailto:[EMAIL PROTECTED]] // Sent: Monday, 25 February 2002 5:00 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Still bangin my head // // // Hi all, // // I'm still banging my head on this. // // Let's say I have $1000 to withdraw from my account. I // withdraw that $1000 // which leaves me $0 dollars in the account. // With the code below if I enter another $1000 dollars in the // form and hit // enter it loans me the thousand and puts my account at -$1000 dollars. // What do I need to do to stop it from loaning me the thousand // and keep me // from having a negative balance? // // // // // Withdraw // // // // // // // // // // // used to update if a user makes a withdrawal // $query = ("UPDATE wt_users set bank_points = bank_points - // $user_withdraw, // points = points + $user_withdraw WHERE uid={$session["uid"]}"); // $result=mysql_query("$query"); // // // select bank points for the user. // $sql_result = mysql_query("SELECT bank_points FROM wt_users WHERE // uid={$session["uid"]}"); // $row = mysql_fetch_array($sql_result); // // if bank points are at 0 then print no points and quit. // if ($sql_result <= "0") { // echo "you don't have that many points"; // exit; // } else { //echo "Your withdraw has been made!"; // // Thanks again in advance // // Jennifer Downey // // // // -- // 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] Still bangin my head
if you follow your code you see that you do 0 - 1000 and it's logic to be -1000. Jennifer Downey a écrit : > Hi all, > > I'm still banging my head on this. > > Let's say I have $1000 to withdraw from my account. I withdraw that $1000 > which leaves me $0 dollars in the account. > With the code below if I enter another $1000 dollars in the form and hit > enter it loans me the thousand and puts my account at -$1000 dollars. > What do I need to do to stop it from loaning me the thousand and keep me > from having a negative balance? > > > > Withdraw > > > > > > > > > > // used to update if a user makes a withdrawal > $query = ("UPDATE wt_users set bank_points = bank_points - $user_withdraw, > points = points + $user_withdraw WHERE uid={$session["uid"]}"); > $result=mysql_query("$query"); > > // select bank points for the user. > $sql_result = mysql_query("SELECT bank_points FROM wt_users WHERE > uid={$session["uid"]}"); > $row = mysql_fetch_array($sql_result); > // if bank points are at 0 then print no points and quit. > if ($sql_result <= "0") { > echo "you don't have that many points"; > exit; > } else { >echo "Your withdraw has been made!"; > > Thanks again in advance > > Jennifer Downey > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ "@'/ ,. \`@" /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Still bangin my head
Hi all, I'm still banging my head on this. Let's say I have $1000 to withdraw from my account. I withdraw that $1000 which leaves me $0 dollars in the account. With the code below if I enter another $1000 dollars in the form and hit enter it loans me the thousand and puts my account at -$1000 dollars. What do I need to do to stop it from loaning me the thousand and keep me from having a negative balance? Withdraw // used to update if a user makes a withdrawal $query = ("UPDATE wt_users set bank_points = bank_points - $user_withdraw, points = points + $user_withdraw WHERE uid={$session["uid"]}"); $result=mysql_query("$query"); // select bank points for the user. $sql_result = mysql_query("SELECT bank_points FROM wt_users WHERE uid={$session["uid"]}"); $row = mysql_fetch_array($sql_result); // if bank points are at 0 then print no points and quit. if ($sql_result <= "0") { echo "you don't have that many points"; exit; } else { echo "Your withdraw has been made!"; Thanks again in advance Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-db@lists.php.net
It's not phpMyadmin that changed & to & but the PHP script. Than because I could not find with the PHP script the record I looked in with phpMyadmin. "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio 010801c1bdd7$576e9dd0$0b01a8c0@ANDreY">news:010801c1bdd7$576e9dd0$0b01a8c0@ANDreY... > phpMyAdmin has changed & to & and then put it in the DB. > So it is better not to use phpMyAdmin or any toher web based tool for tasks which includes & entering. Not sure for <,> > > Regards, > Andrey Hristov > - Original Message - > From: "Marco Coletta" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 25, 2002 10:32 AM > Subject: Re: [PHP-DB] Problem with symbol & > > > > I edit with phpMyAdmin and Mascon, but if I look at the recodr with Mysql > > client I have the same result : > > in the record I find & instead of & > > > > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > > 00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY">news:00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY... > > > The problem is that you probably use phpMyAdmin for editing data. > > > > > > Regards, > > > Andrey Hristov > > > - Original Message - > > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, February 25, 2002 10:08 AM > > > Subject: [PHP-DB] Problem with symbol & > > > > > > > > > > I have a problem with symbol &. > > > > > > > > In PHP script I have a variable with a string assigned containing the > > > > symbol '&' : > > > > > > > > $myvariable = 'Smith & Sons'; > > > > when I insert the variable in the database : > > > > > > > > $query="insert into mytable (mycolumn) values > > > > (myvalue1='$myvariable');"; > > > > > > > > $result=mysql_query($query); > > > > > > > > if I edit directly the column in Mysql the symbol '&' has been > > > > translated to '&'. > > > > > > > > The real problem is that if I do a query with where looking for the > > content > > > > of record where myvalue='Smith & Sons' > > > > in this case the symbol & is not translated and so the query has no > > success. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > -- > > > > 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-db@lists.php.net
phpMyAdmin has changed & to & and then put it in the DB. So it is better not to use phpMyAdmin or any toher web based tool for tasks which includes & entering. Not sure for <,> Regards, Andrey Hristov - Original Message - From: "Marco Coletta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 25, 2002 10:32 AM Subject: Re: [PHP-DB] Problem with symbol & > I edit with phpMyAdmin and Mascon, but if I look at the recodr with Mysql > client I have the same result : > in the record I find & instead of & > > > "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio > 00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY">news:00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY... > > The problem is that you probably use phpMyAdmin for editing data. > > > > Regards, > > Andrey Hristov > > - Original Message - > > From: "Marco Coletta" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, February 25, 2002 10:08 AM > > Subject: [PHP-DB] Problem with symbol & > > > > > > > I have a problem with symbol &. > > > > > > In PHP script I have a variable with a string assigned containing the > > > symbol '&' : > > > > > > $myvariable = 'Smith & Sons'; > > > when I insert the variable in the database : > > > > > > $query="insert into mytable (mycolumn) values > > > (myvalue1='$myvariable');"; > > > > > > $result=mysql_query($query); > > > > > > if I edit directly the column in Mysql the symbol '&' has been > > > translated to '&'. > > > > > > The real problem is that if I do a query with where looking for the > content > > > of record where myvalue='Smith & Sons' > > > in this case the symbol & is not translated and so the query has no > success. > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > -- > > > 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
RE: [PHP-DB] "The" Debacle
To make sure that other names are not interfered with, I would refine what you're doing. ie. "Theater Nuts" would become "ater Nuts, The" obviously this is not acceptable... so you would do something like this... //does it begin with 'The '? $name_start = substr($band_name, 0, 3) if ($name_start=="The ") { //remove the word 'The' and following space from the beginning of the string $band_name = str_replace('The ', '', $band_name) ; // add ', The ' to the end of the name $band_name .= ", The"; } > When you add the data > > //does it begin with 'The '? > $name_start = substr($band_name, 0, 2) > > if ($name_start=="The") > { > //remove the word 'The' and following space from the beginning of the > string > str_replace('The ', '', $band_name) ; > > //add ', The 'to the end of the name > $band_name=$band_name.', The'; > } > > You might want something more sophisticated if The with a capital is > found > in the middle of names, but hope this is a start > > > Peter
php-db@lists.php.net
I edit with phpMyAdmin and Mascon, but if I look at the recodr with Mysql client I have the same result : in the record I find & instead of & "Andrey Hristov" <[EMAIL PROTECTED]> ha scritto nel messaggio 00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY">news:00f401c1bdd4$7d3bec00$0b01a8c0@ANDreY... > The problem is that you probably use phpMyAdmin for editing data. > > Regards, > Andrey Hristov > - Original Message - > From: "Marco Coletta" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 25, 2002 10:08 AM > Subject: [PHP-DB] Problem with symbol & > > > > I have a problem with symbol &. > > > > In PHP script I have a variable with a string assigned containing the > > symbol '&' : > > > > $myvariable = 'Smith & Sons'; > > when I insert the variable in the database : > > > > $query="insert into mytable (mycolumn) values > > (myvalue1='$myvariable');"; > > > > $result=mysql_query($query); > > > > if I edit directly the column in Mysql the symbol '&' has been > > translated to '&'. > > > > The real problem is that if I do a query with where looking for the content > > of record where myvalue='Smith & Sons' > > in this case the symbol & is not translated and so the query has no success. > > > > > > > > > > > > > > > > -- > > > > > > > > > > -- > > 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