RE: [PHP-DB] resource id#2 - ????
The quick answer is that that is what it's supposed to return... that's all the result is. A nicer, longer answer is to give you some of my code so you can see one way that you actually get the data out (I use sybase_fetch_row, but you can also use db_fetch_array which returns an associated array or something - check the manual): $dataResult = sybase_query($sql); while ($array_ref = sybase_fetch_row($dataResult)) { if ($array_ref[4] == 1) { if ($array_ref[0] == $male ) { $left[$i] = $array_ref[2]; $names[$i] = $array_ref[3]; $ages[$i] = $array_ref[1]; $i++; } elseif ($array_ref[0] == $female ) { $right[$j] = $array_ref[2]; $j++; } } }//while Last note - the index of the array ref refers to something in your SQL starting with 0 (so my sql started with select sex...) -Natalie -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 1:42 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] resource id#2 - Not sure how to over come this, the result of a database query keeps giving me this: ?php /* Get Ip address, where they came from, and stamp the time */ if (getenv(HTTP_X_FORWARDED_FOR)){ $ipaddy = getenv(HTTP_X_FORWARDED_FOR); } else { $ipaddy = getenv(REMOTE_ADDR); } $referrer = $HTTP_REFERER; $date_stamp = date(Y-m-d H:i:s); /* Start session, and check registered variables */ session_start(); if (isset($HTTP_SESSION_VARS['ipaddy']) || isset($HTTP_SESSION_VARS['referrer']) || isset($HTTP_SESSION_VARS['date_stamp'])) { $main = Video clips stored in Database; /* Insert client info to database table */ require('/path/to/connection/class/con.inc'); $table_sessions = dev_sessions; $sql_insert = INSERT INTO $table_sessions (ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp'); $result = @mysql_query($sql_insert,$dbh) or die(Couldn't execute insert to database!); /* Pull video info from database table into an array */ $table_content = dev_videos; $sql_content = @mysql_query(SELECT * FROM $table_content,$dbh); while ($row = @mysql_fetch_array($record)) { $id = $row['id']; $file_name = $row['file_name']; $file_size = $row['file_size']; $file_properties = $row['file_properties']; $file_codec = $row['file_codec']; $file_author = $row['file_author']; $result = @mysql_query($sql_content,$dbh) or die(Couldn't execute query on database!); /* loop through records and print results of array into table */ $current .= trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_properties /tdtd$file_codec/tdtd$file_author/td/tr; } } else { /* Start a new session and register variables */ session_start(); session_register('ipaddy'); session_register('referrer'); session_register('date_stamp'); } ? Just to make sure everything is working correctly I have echoed every statement to the screen so I may see what's going on like so: ?php echo $main; ? table width=75% border=1 ?php echo $current; ? // my results should be here but instead I get Resource ID #2 printed wtf? /tablebr ?php echo $ipaddy; ?br ?php echo $referrer; ?br ?php echo $date_stamp; ?br ?php echo $sql_insert; ?br ?php echo $sql_content; ?br ?php echo $id; ?br ?php echo $file_name; ?br ?php echo $file_size; ?br Any help would be great! 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] resource id#2 - ????
I totally didn't even see that section of code. I am sorry I wrote back like you were an idiot! I think we know who the real idiot is today... :-) Sorry again! -Natalie -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 1:53 PM To: Jas; [EMAIL PROTECTED] Subject: Re: [PHP-DB] resource id#2 - At 11:42 -0600 6/12/02, Jas wrote: Not sure how to over come this, the result of a database query keeps giving me this: ?php /* Get Ip address, where they came from, and stamp the time */ if (getenv(HTTP_X_FORWARDED_FOR)){ $ipaddy = getenv(HTTP_X_FORWARDED_FOR); } else { $ipaddy = getenv(REMOTE_ADDR); } $referrer = $HTTP_REFERER; $date_stamp = date(Y-m-d H:i:s); /* Start session, and check registered variables */ session_start(); if (isset($HTTP_SESSION_VARS['ipaddy']) || isset($HTTP_SESSION_VARS['referrer']) || isset($HTTP_SESSION_VARS['date_stamp'])) { $main = Video clips stored in Database; /* Insert client info to database table */ require('/path/to/connection/class/con.inc'); $table_sessions = dev_sessions; $sql_insert = INSERT INTO $table_sessions (ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp'); $result = @mysql_query($sql_insert,$dbh) or die(Couldn't execute insert to database!); /* Pull video info from database table into an array */ $table_content = dev_videos; $sql_content = @mysql_query(SELECT * FROM $table_content,$dbh); while ($row = @mysql_fetch_array($record)) { $record isn't defined anywhere. Do you mean $sql_content? $id = $row['id']; $file_name = $row['file_name']; $file_size = $row['file_size']; $file_properties = $row['file_properties']; $file_codec = $row['file_codec']; $file_author = $row['file_author']; $result = @mysql_query($sql_content,$dbh) or die(Couldn't execute query on database!); /* loop through records and print results of array into table */ $current .= trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_proper ties /tdtd$file_codec/tdtd$file_author/td/tr; } } else { /* Start a new session and register variables */ session_start(); session_register('ipaddy'); session_register('referrer'); session_register('date_stamp'); } ? Just to make sure everything is working correctly I have echoed every statement to the screen so I may see what's going on like so: ?php echo $main; ? table width=75% border=1 ?php echo $current; ? // my results should be here but instead I get Resource ID #2 printed wtf? /tablebr ?php echo $ipaddy; ?br ?php echo $referrer; ?br ?php echo $date_stamp; ?br ?php echo $sql_insert; ?br ?php echo $sql_content; ?br ?php echo $id; ?br ?php echo $file_name; ?br ?php echo $file_size; ?br Any help would be great! 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
[PHP-DB] RE: [PHP] Querying for MAX
is select MAX(column name) what you are looking for? I know it works on numeric columns, I'm not sure if it works on non-numbers, you'd have to look it up in a SQL Tutorial somewhere. Good luck! -Natalie -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 2:36 PM To: 'PHP DB List'; PHP General List Subject: [PHP] Querying for MAX I'm sorry if this mensaje is posted twice. I sent it yesterdays, but then my ISP had problems with e-mail and I lost dozens of them and don't know if sent OK. Hi all, What I'm trying to do here is not inside PHP nor MySQL books I have. I need to query the DB to look the max result in a column. That is, if I have affiliate members with ID going from 1 to 10, get the query to know that the last member added was 10 so I can add member 11 without using auto_increment, because I need to insert old members too which already have ID numbers. Is that possible? Thanks in advance, Cesar Aracena mailto:[EMAIL PROTECTED] CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] timer
You could probably use: $start = time(); //run query $end = time(); and then compare start and end. I don't know how time() formats the time, but that's probably on PHP.net. -Natalie -Original Message- From: Natividad Castro [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 1:27 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] timer hi to all, how can I set up a timer that will tell me how long a query takes to run. for example, if I run the following query, I would like to know how long it takes. $query_prism = INSERT INTO prism_rec_status(prism_rec_id) select 150bk.ID from 150bk WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or PHY_ST='IA' Or PHY_ST='MN' Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or PHY_ST='GA'; $result_query = mysql_query($query_prism); Is that possible in php?? Thanks in advanced Nato -- 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] how to pull array out?
OK, then. Here's an example. I understand that this is confusing (it took me quite some time to get my first db example working correctly), but there are normally examples on PHP.net if you look up the functions that Jason referred you to. If those didn't help I don't know how much help mine will be, but at least I kind of explain it :-) It's using Sybase, but the commands should be very similar to those for other ones (I think all that changes is the first part). For mine, here's how I set up $sql: $countySql = SELECT a.Sex, a.AgeForCSR, a.Pop, b.strAgeForCSRDescription, 1 as id from tblPopCounty a, tlkpAgeForCSR b where a.StateFIPS = '$state' and a.CountyFIPS = '$county' and a.Race = '$race' and a.$sqlAge and a.AgeForCSR=b.AgeForCSR; $stateSql = SELECT a.Sex, a.AgeForCSR, a.Pop, b.strAgeForCSRDescription, 2 as id from tblPopState a, tlkpAgeForCSR b where a.StateFIPS = '$state' and a.Race='00' and a.$sqlAge and a.AgeForCSR=b.AgeForCSR; $sql = $countySql . UNION . $stateSql; so, $array_ref[0] = Sex $array_ref[1] = AgeForCSR $array_ref[2] = Pop $array_ref[3] = strAgeForCSRDescription $array_ref[4] = id ***Here's where I actually read the rows that are identified by the result and divide them up into 4 arrayes, based on gender and id*** $dataResult = sybase_query($sql); while ($array_ref = sybase_fetch_row($dataResult)) { //foreach ($a_row as $array_ref) { *** if you leave that in, you get each item, not each row*** //print $array_ref . BR; if ($array_ref[4] == 1) { if ($array_ref[0] == $male ) { $left[$i] = $array_ref[2]; $names[$i] = $array_ref[3]; $ages[$i] = $array_ref[1]; $i++; } elseif ($array_ref[0] == $female ) { $right[$j] = $array_ref[2]; $j++; } } elseif ($array_ref[4]==2) { if ($array_ref[0] == $male ) { $left2[$k] = $array_ref[2]; $names2[$k] = $array_ref[3]; $ages2[$k] = $array_ref[1]; $k++; } elseif ($array_ref[0] == $female ) { $right2[$l] = $array_ref[2]; $l++; } }//elseif id==2 // }//foreach }//while -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 1:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] how to pull array out? Mr. Wong, You are no help. As you can probably see I am NOT an experienced php developer!! Posting to this list, reading the manual, and scouring sites for tutorials is all I have to provide me with a way to maybe begin doing writting php apps. I did read your reply about feeding the results into an array however I have not been able to accomplish what I have set out to do. A GOOD EXPLANATION IS ALL WE NEED!!! You posting stuff on how we should read the manual does not suffice! People post to this newsgroup to get answers to problems they cannot figure out. I am sure you have been working with php enough to know how to accomplish anything you need, and for the rest of us we rely on examples, etc to get it done. I appriciate you taking the time to reply to mine and others posts, however if you do not have anything nice to say please keep it to yourself. I am trying to find an answer to a problem and reading your RTFM does not help. Thannks again, Jas Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Friday 31 May 2002 00:19, Jas wrote: Not sure how to do this, but I need to pull the contents of an array into editable text fields... As of yet I have not found a way to accomplish this: Good grief, I already posted the answer yesterday. Don't you read the replies? Even if you don't, spending a little time googling for mysql php tutorial would get you numerous examples. $table = auth_users; $record = @mysql_query(SELECT * FROM $table WHERE user_id = '$user_id',$dbh); [snip] echo $record; It only echoes the resource id, any help or examples would be great I repeat, mysql_query() returns a resource-id which you need to feed into mysql_fetch_array() to get the actual record. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The chief danger in life is that you may take too many precautions. -- Alfred Adler */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
RE: [PHP-DB] Resource ID#2 ????
I could be missing something, but it looks like you are using the result of the mysql_query as the actual result. It actually returns some weird identifier. To access the real info you'd have to use something like mysql_fetch_array to get it. Check out this and see if it helps: http://www.php.net/manual/en/function.mysql-query.php -Natalie -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 12:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Resource ID#2 Ok here is my problem, I set this up so a user selects a name form a select box and that name or $user_id is then passed to this page so the user can edit the contact info etc. However it does not pull the selected $user_id and place each field into my form boxes, all I get is a Resource ID #2. Not sure how I can over come this... $table = auth_users; $record = @mysql_query(SELECT * FROM $table WHERE user_id = '$user_id',$dbh); $var_form .= table width=\100%\ border=\0\ cellpadding=\7\form name=\$user_id\ method=\post\ action=\del_account.php\ trtd width=\20%\ colspan=\2\bEdit Account $user_id/b/td/tr trtd width=\20%\First Name:/tdtd width=\80%\input type=\text\ name=\$f_name\ size=\30\ maxlength=\30\ value=\$f_name\font class=\copyright\i.e. John/font/td/tr trtd width=\20%\Last Name:/tdtd width=\80%\input type=\text\ name=\$l_name\ size=\30\ maxlength=\30\ value=\$l_name\font class=\copyright\i.e. Doe/font/td/tr trtd width=\20%\Email:/tdtd width=\80%\input type=\text\ name=\$email_addy\ size=\30\ maxlength=\30\ value=\$email_addy\font class=\copyright\i.e. [EMAIL PROTECTED]/font/td/tr trtd width=\20%\User Name:/tdtd width=\80%\input type=\text\ name=\$un\ size=\30\ maxlength=\30\ value=\$un\font class=\copyright\i.e. j-doe/font/td/tr trtd width=\20%\Password:/tdtd width=\80%\input type=\password\ name=\$pw\ size=\30\ maxlength=\30\font class=\copyright\(password must be alpha-numeric, i.e. pAs5w0rd)/font/td/tr trtd width=\20%\Confirm Password:/tdtd width=\80%\input type=\password\ name=\$pw\ size=\30\ maxlength=\30\font class=\copyright\please confirm password entered/font/td/tr trtd width=\20%\nbsp;/tdtd width=\80%\input type=\submit\ name=\add\ value=\edit user\nbsp;nbsp;input type=\reset\ name=\reset\ value=\reset\/td/tr /form/table; echo $record; } else { blah blah } 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] Outlook Out Of Office
I couldn't find a way to exclude someone - even in the rules it didn't look like it had anything like that. It doesn't even look like you can skip it if you delete. You might want to try to the MS website - they have a pretty thorough FAQ and it's much better than the help that comes up with the paperclip (I didn't find it in there)! If you find anything, please let me know. I don't want to spam everyone with my Out of Office replies either :-) -Natalie -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 12:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Outlook Out Of Office i know this List isn't for this, but I'm about to go on vacation and I don't want to AutoReply everytime someone posts to this list. Does anyone know how I can set Out Of Office to skip sending a reply when the mail was sent to [EMAIL PROTECTED] ? I looked at the rules and all of the actions are the ones that I don't need. None of them are Don't send response ... I imagine this could be helpful for others as well. Ryan -- 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] Character check in string
This should get you started. http://www.php.net/manual/en/function.split.php There are other ones too, like explode. -Natalie -Original Message- From: Prodoc [mailto:[EMAIL PROTECTED]] Sent: Monday, May 20, 2002 1:00 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Character check in string Is there a php function to check if a string contains a certain kind of character and is there a function to split up a string? e.g. $data = 13_45 I want to check if variable $data contains the character _. If that's the case I want to split the variable (array or seperate variables) so I've got a variable containing 13 and one containing 45. -- 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] Not getting results if 0
Are you looking it up in a database? If so you'd want to do something like where price 0. Then it wouldn't return those results. -Natalie -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Not getting results if 0 Hi all, I am wondering how to keep something from beind displayed if a price is set to 0? I have a store where the user looks up items, but it shows all items even if the price is 0. Is there a way to prevent the items set at 0 from being displayed? Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Not getting results if 0
You're welcome. It's a Monday - no DUH necessary :-) -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:33 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Not getting results if 0 Wow, the only thing I can say for myself is DUH as I slap my forehead. I don't know why I didn't think of that. But thank you Natalie. Natalie Leotta [EMAIL PROTECTED] wrote in message 7546CB15C0A1D311BF0D0004AC4C4B0C024AC071@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024AC071@SSIMSEXCHNG... Are you looking it up in a database? If so you'd want to do something like where price 0. Then it wouldn't return those results. -Natalie -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Not getting results if 0 Hi all, I am wondering how to keep something from beind displayed if a price is set to 0? I have a store where the user looks up items, but it shows all items even if the price is 0. Is there a way to prevent the items set at 0 from being displayed? Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- 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] Best way to store/retrieve content??
Could you use PDFs? -Natalie -Original Message- From: Monty [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 2:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- 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] Best way to store/retrieve content??
In theory, if your writers are using a word processor such as Word you could try just saving as HTML and seeing if that works. I doubt they'd appreciate it if you asked them to write in FrontPage, but that would give you what you need too. If these ideas don't work you may want to browse other magazines online (if you go to fashion ones then they should have the tables you talked about). You could try magazines like Cosmo, Seventeen, etc. and see if you can get any feel for what they are developing in. I only came up with the PDFs because one site I go to uses them and we use them for some of our web publications for the NCI. Good luck! -Natalie -Original Message- From: Monty [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 2:46 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best way to store/retrieve content?? Hi Natalie, no, PDFs won't work. I need to display the content as an HTML page. From: [EMAIL PROTECTED] (Natalie Leotta) Newsgroups: php.db Date: Thu, 7 Mar 2002 14:32:57 -0500 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Could you use PDFs? -Natalie -- 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] Dynamic Drop Down Box
If they want two pages they wouldn't need JS though - just submit and use that in your second query to populate drop-down #2. I had assumed that they wanted it on the same page - which is definitely cooler :-) Good point though - I should have asked which way they wanted to do it. I suppose if you really wanted to be able to say your site used JS you could still use it to set a hidden value in the form and submit it to the next page that way. -Natalie -Original Message- From: Edward Marczak [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:27 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Dynamic Drop Down Box On 3/5/02 3:34 PM, Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] wrote: This can be done with JavaScript - I don't know if you can do it in PHP. ...unless the drop-downs are on separate pages. E.g.: page 1 just asks for make, once selected, load up page 2 with choices appropriate to the first drop down. Certainly, javascript is cooler. -- Ed Marczak [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: multiple select statements
I'd try building it piece by piece if you do have too many combinations - (I'm not promising efficiency, but I do something similar to this in one of my programs and it works). Have vars for each type of data: $firstName = ; $lastName = ; etc. Then you can set each one based on the selection boxes you have if ($firstNameComboValue select one) $firstName = $firstNameComboValue; From there you can build your SQL statement: $criteria = ; if ($firstName ) $criteria .= '$firstName'; (I can't remember if PHP needs the single quotes or not but perl does) ... for each variable (making sure you put in AND between each one). Then you can do: $sql = SELECT whatever from table WHERE $criteria; I do my db programming in perl so this is probably a horrible mix of the two, but at least it will give you an idea for somewhere you could start. You could also use booleans to determine if each one has been set, but that would probably just be an extra step that you wouldn't need unless you want to use them somewhere else too. Good luck! -Natalie -Original Message- From: Lerp [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 11:47 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: multiple select statements Hi there :) You could construct seperate queries for every possible combination of search provided you don't have a huge number of search criteria (form elements for your search) . I did this just recently for a friend finder site. In the search the user has four fields that are automatically included in the search and three more that are optional I built the sql queries based on every combination of the three optional search criterias. Since there are three optional search criterias the number of queries to be built is 8 to compensate for every combination. This is one way to do it anyway:) Hope this helps you out, Joe :) ?php # stateprovince, country, and relationship are all optional therefor 8 combinations for query -- use the other form values as well if(($country == All) ($stateprovince == All) ($relationship == All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2; } elseif(($country != All) ($stateprovince == All) ($relationship == All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' AND country ='$country' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2 . from . $country; } elseif(($country != All) ($stateprovince != All) ($relationship == All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' AND country ='$country' AND province_state ='$stateprovince' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2 . from . $stateprovince . , . $country; } elseif(($country != All) ($stateprovince != All) ($relationship != All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' AND country ='$country' AND province_state ='$stateprovince' AND relationship ='$relationship' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2 . from . $stateprovince . , . $country . looking for . $relationship . relationship.; } elseif(($country == All) ($stateprovince != All) ($relationship != All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' AND province_state ='$stateprovince' AND relationship ='$relationship' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2 . from . $stateprovince . looking for . $relationship . relationship.; } elseif(($country == All) ($stateprovince == All) ($relationship != All)){ $sql = SELECT friend_id, first_name, sex, age, city, province_state, country, relationship FROM FRIEND WHERE sex = '$sex' AND age BETWEEN '$age1' AND '$age2' AND sexuality ='$sexuality' AND relationship ='$relationship' ORDER BY signupdate DESC; $searchcriteria = $sex . . $sexuality . between the ages of . $age1 . and . $age2 . looking for . $relationship .
RE: [PHP-DB] Dynamic Drop Down Box
This can be done with JavaScript - I don't know if you can do it in PHP. I had a site where I wanted to let people compare data for two states so based on the first state that was chosen I populated the compare with the other states. If you want me to send you my code I can. It uses another file too - that one is a big JS array with all of the states in it. I also do one that populates a county box based upon a state. -Natalie -Original Message- From: Rankin, Randy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 3:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Dynamic Drop Down Box Does anyone know how I might populate a drop down box based on the users selection from a previous drop down box? For example, if I have a table called 'autos' with 2 fields, 'make' and 'model'. I select distinct 'make' and populate the first drop down box. Based on the user selection, the 2nd drop down box would be populated with the distinct 'make' for that model (ie; if the user selects Ford in the first drop down, the 2nd drop down would be populated with Explorer, Expedition, Ranger, etc.). Thanks, Randy Rankin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Display in drop-down box
Try doing a select distinct on that field and then loop through the results, adding each one to your drop-down box as you go. I don't have the exact code anymore because we stopped doing it that way, but that's the basic idea of how to go about it. I hope it helps! -Natalie -Original Message- From: Alvin Ang [SMTP:[EMAIL PROTECTED]] Sent: Friday, March 01, 2002 2:07 PM To: PHP Subject: [PHP-DB] Display in drop-down box Hi there, I was wondering if anyone would be kind enough to show me how to select a field from a table in mysql and display it in a drop-down combo box? I am trying to show my users a list of all the parts from a table so that they can edit or delete it. Thanks! Alvin -- 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
[PHP-DB] inserting a bitmap into an Image
Does anyone know how to put a bitmap into an Image? I need to have a filled circle in a graph. This shouldn't be a problem except we have an older version of GD (and our network guy is overworked so it would take a few weeks to get a newer version installed) and the graph has gridlines. If I make a circle and then fill it it will fill up to a gridline but leave the rest of the circle empty. I was hoping to get a filled circle file and use that in my Image but I can't find anything on PHP.net. I'd really appreciate any ideas you might have! Thanks! -Natalie Natalie S. Leotta Information Management Services, Inc. (301) 680-9770 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple query string
Could you make it a hidden value in a form? -Original Message- From: Renaldo De Silva [SMTP:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 3:15 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string That's the same as cookies, isn't it you have to either store the id in a cookie or at the end of the url I can't store it at the end of the url and i don't want to use cookies. Rick Emery wrote: sessions -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string isn't there any other way? Rick Emery wrote: cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- 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] How can recommend a book for SQL and DB design
I'm a recent student but I sold back my DB text in hopes I'd never have to know the stuff again (I guess that $20 wasn't worth it). The current book my old prof is using is: Introduction to Database Systems, 7th Edition by C.J. Date. but since I don't know if that's the one I used I don't know if it's any good. I do know that the class covered the normalizations and things like that. It might be a good place to start, but it seems like college textbooks are always at least twice the cost of normal books. I haven't tried the PHP O'Reilly book, so thanks for the warning! -Natalie -Original Message- From: DL Neil [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:34 PM To: Leotta, Natalie (NCI/IMS); 'Andy'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] How can recommend a book for SQL and DB design Andy (and Natalie), In fact the O'Reilly book on PHP is the exception that might well prove the rule - normally I think them v.good The reference work on MySQL is by Paul DuBois (who often stops by here - hi Paul) and published by New Riders. Unfortunately none of my favorite texts (of the moment) go into the background of db theory, eg normalisation. Perhaps one of the (recent) students on the list can help with that one... Regards, =dn - Original Message - From: Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] To: 'Andy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 15 January 2002 22:14 Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How can recommend a book for SQL and DB design
Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] any good web hosting with php and mysql support?
I use FGDesigner.com. They have proven to be quite reliable and have a wide range of plans available based on what you would need. You can check out the website. My husband and I have been hosting our site through them for a couple of years and never had any problems. I also know that they have PHP support because I was asking about it recently. I am pretty sure that they have MySQL support too - I can't be positive because I don't use MySQL. Good luck finding someone! -Natalie -Original Message- From: Gurhan Ozen [SMTP:[EMAIL PROTECTED]] Sent: Monday, January 14, 2002 1:18 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [PHP-DB] any good web hosting with php and mysql support? Hi All, I am currently looking for a reliable web host to host my personal website. I know there are millions of web hosting companies that have PHP and MYSQL support but I just can't trust any of the fully-assured and confident webhosting ads anymore. I would like to get a service from a company for which someone can vouch. I did started hosting my web site at a webhoster that promised 99.99% uptime and my site is hardly ever up and running. They don't answer my emails either. IS there anyone who have web sites hosted at webhosting service for a reasonably long time without any problems? IF yes, can you please contact me and tell me about it? This might be kind of off-topic for both lists, and i apologize to both lists, so you might want to reply to my email rather than sending it to list(s). Thank you very much. Gurhan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to insert to DB from txt??? Please help
That's why I skipped the regular expression and irregular expression and grep stuff and used explode :-) All it takes is the string and the delimiter and it feeds you back an array. I've been using it to pass parameters in the $QUERY_STRING when I don't use $HTTP_POST_VARS. You can even have strings within it that are delimited by something else. I put everything together with s and then if there's a group of things in there that I want to keep together I use @. It works well. Does this answer your question? I'm still new to PHP (I think I started in Oct. or Nov.) but that's basically all I've been doing since then. That's why I've tried to stick with the methods that make the most sense and cut down on some of my learning curve :-) Good luck! -Natalie -Original Message- From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 6:53 PM To: Leotta, Natalie (NCI/IMS) Cc: 'Kelvin'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] How to insert to DB from txt??? Please help egrep_split? But then, there's the learning curve for grep... On Fri, 4 Jan 2002, Leotta, Natalie (NCI/IMS) wrote: There are a few ways to split up text based on a delimiter. I recommend you look at split and explode on the PHP.net site and see what seems to be best for your situation. Once you go to one of them they link you to other functions that do similar things. I believe explode is faster but I can't remember for sure. -Natalie -Original Message- From: Kelvin [SMTP:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 11:44 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to insert to DB from txt??? Please help Hi everyone, I have a txt file which is contained the following: ,aaa,ccc,ddd ,aaa,ccc,ddd .etc. Now, I need to read the data from that file and than insert it into the table. insert into Table (name,pass,phone,somethingelse) Could someone help me out here, How to write the code? I know how to read from a txt file, but I don't know how to separate the data determine by , Please help, I'll be very appreciate.Thanks Kelvin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] finding records wiht non-null columns
In my database (Sybase) that won't work. You have to use not like 'NULL' or it gives an error about not using text in a where clause unless you use like. Weird, but it will work with the not like 'NULL'. -Natalie -Original Message- From: Jonathan Hilgeman [SMTP:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 11:21 AM To: 'bill' Cc: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] finding records wiht non-null columns ...WHERE some_column IS NOT NULL; - Jonathan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:19 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] finding records wiht non-null columns Is there a better query than SELECT * FROM some_database WHERE some_column I had tried WHERE some_column NULL but that didn't work. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Passing parameter in Paging
You could make hidden vars in your HTML page (in a form that submits to your PHP), alter their values in the JS, and then when you submit to the PHP it will have those. Then you can use $HTTP_POST_VARS to access the variables from inside the PHP. There might be an easier way, but I know this way works. -Natalie -Original Message- From: Mihail Bota [SMTP:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001 11:53 AM To: Bogdan Stancescu Cc: Karthikeyan; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Passing parameter in Paging Bogdan, in this respect, I have a question: can I pass the values of javascript variables to php variables? if yes, how? Mihai On Fri, 28 Dec 2001, Bogdan Stancescu wrote: I don't understand why you won't use forms with buttons and hidden controls since you know about this solution. I have two suggestions along this line: 1. You probably don't want buttons on the page -- you may use image icons instead (similar to a tape recorder's play and fast forward for next page and last page) 2. If you don't want to use images either, you may use regular links with href='javascript:document.nextPage.submit()' where nextPage would be the form name with the page forward data -- and so on. HTH Bogdan Karthikeyan wrote: Dear members, I am querying a Mysql database, which will result in 100 of records. I want to display 10 records in each page. First page it is working fine. When I navigate to second page it is not working. When I used hidden controls. Hidden controls send the details to next page only by using submit button and not by hyperlink When I used session variable. After one set of searching was over. When I trying for second search string without closing browser, changing the search string in the first search page it is still showing the old search string, unless I close the browser. Any solution for my problem Thanking you yours Karthikeyan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Passing parameter in Paging
Sure! If you need more help let me know - I can send you some code. -Natalie -Original Message- From: Leotta, Natalie (NCI/IMS) Sent: Friday, December 28, 2001 11:57 AM To: 'Mihail Bota'; Bogdan Stancescu Cc: Karthikeyan; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Passing parameter in Paging You could make hidden vars in your HTML page (in a form that submits to your PHP), alter their values in the JS, and then when you submit to the PHP it will have those. Then you can use $HTTP_POST_VARS to access the variables from inside the PHP. There might be an easier way, but I know this way works. -Natalie -Original Message- From: Mihail Bota [SMTP:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001 11:53 AM To: Bogdan Stancescu Cc: Karthikeyan; [EMAIL PROTECTED] Subject:Re: [PHP-DB] Passing parameter in Paging Bogdan, in this respect, I have a question: can I pass the values of javascript variables to php variables? if yes, how? Mihai On Fri, 28 Dec 2001, Bogdan Stancescu wrote: I don't understand why you won't use forms with buttons and hidden controls since you know about this solution. I have two suggestions along this line: 1. You probably don't want buttons on the page -- you may use image icons instead (similar to a tape recorder's play and fast forward for next page and last page) 2. If you don't want to use images either, you may use regular links with href='javascript:document.nextPage.submit()' where nextPage would be the form name with the page forward data -- and so on. HTH Bogdan Karthikeyan wrote: Dear members, I am querying a Mysql database, which will result in 100 of records. I want to display 10 records in each page. First page it is working fine. When I navigate to second page it is not working. When I used hidden controls. Hidden controls send the details to next page only by using submit button and not by hyperlink When I used session variable. After one set of searching was over. When I trying for second search string without closing browser, changing the search string in the first search page it is still showing the old search string, unless I close the browser. Any solution for my problem Thanking you yours Karthikeyan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] while...if statements???
Have you tried printing out $pet_picture to make sure that it really equals when there's no pet? -Natalie -Original Message- From: Jay Fitzgerald [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 3:09 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] while...if statements??? Does anyone know why this isn't working?? What I am trying to do is display photos from a database based on each month. This part works fine when I set it to the current month of December (today) as that is when I uploaded the photos. However, when I manually set the date to a month that has no photos in it, I want it to echo the No Animals string belowThis is only working half-way...meaning that it will display a blank page with nothing on it instead of actually echoing the No Animals string Can anyone please help?? Is there really a way to have a while...if statement CODE= ? $connection = mysql_connect($hostname, $user, $pass) or die (Unable to connect!); $query = SELECT petname, petDesc, petpicture FROM petinfo WHERE petmonth = 'Apr'; $result = mysql_db_query($database, $query, $connection) or die (Error in query: $query. . mysql_error()); while (list($pet_name, $pet_Desc, $pet_picture) = mysql_fetch_row($result)) { if ($pet_picture == ) { echo No Animals have been posted for $date at this moment. Please check back soon.; exit; } else { echo FONT FACE=\Arial, Helvetica\BPet of the month/B/FONTBR BR IMG SRC=\http://moss.bayou.com:/oppj/admin/animalcontrol/photos/$pet_pict ure\ HEIGHT=150BR BR FONT FACE=\Arial, Helvetica\ SIZE=\-1\$pet_DescBR BR To adopt $pet_name please visit the Ouachita Parish Animal Shelter.BR The adoption fee is \$50.00 which includes Spade, Neutering and 7-N-1 Shot.BR BR Sorry, we can not hold $pet_name for you (First come first serve basis)./FONT BRBR; } } ? /CODE= Thanks, Confus3d -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Use php to plot graph.
I'm working on a project right now where we call PHP from within an HTML page, send it vars using a POST method, and then use that to draw a graph. We're drawing bar graphs now but one of my coworkers did a line graph. You call the PHP as an img src tag and have PHP return a .png. We used the SAMS Teach Yourself PHP4 in 24 Hours book - it's Hour 14 where you do all sorts of stuff with images. It's not easy - you draw each line based on the endpoints and you can fill rectangles and stuff, but the end result can be pretty impressive. I'd send you my graph but it's on a development website that's password protected. If you're really interested I could save the image and download it to you. -Natalie -Original Message- From: Denny Ow [SMTP:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 11:14 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Use php to plot graph. Hi, Jus wanna to ask if it is possible to use php to plot graph using data retrieve from mysql. If yes, how should i go about? Thanks, Denny -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] What's wrong with my function? :(
I'm new to PHP but one thing I think might be happening is that maybe the changes aren't being made to a global (I'm a Java programmer) $sql so they aren't being kept. Does it actually break or is it not appending the additional string? I'd try printing out the $sql and see what you're getting - possibly at different stages of the program - like before and after you call your function. Good luck! -Natalie -Original Message- From: TorrentUK [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 3:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] What's wrong with my function? :( Please could some take a look at this code and tell me why when I take my IF statements out of the function and put in them in the same place where I call the function from they work, but as soon as I replace them with the function name they don't? Appreciate any help. torrent Here's the code... // Define the rating's filter ?php function RatingFilter () { if ($br) {$sql.= and beg_rate = '2';} if ($ir) {$sql.= and int_rate = '2';} if ($ar) {$sql.= and adv_rate = '2';} if ($sr) {$sql.= and sbd_rate = '2';} } ? if ($search) { include ('logon-inc.php'); $sql = SELECT rsrt_name, ctry_name FROM resort_tbl WHERE ctry_name='$country[0]'; RatingFilter(); --- If I put 'if' statement here instead it works for ($n=1; count($country) $n; $n++){ $sql.= or ctry_name='$country[$n]'; RatingFilter(); -- Or here } . . . . } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]