RE: [PHP-DB] SELECT * FROM Command
guess it is hard to answer this with so less information first show us how the table defenition is... how it is build up and then which fields you want to show to the user! then I or others can help you much more!! ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: Michelle Whelan [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: woensdag 19 maart 2003 9:06 To: [EMAIL PROTECTED] Subject: [PHP-DB] SELECT * FROM Command Hi, I have a question about how to display results. I am using PHP with a mysql database through yahoo webhosting. I've created a form (html javascript) that lets the user post data to one of the tables in my database. On a separate page, I've created a form that will do a SELECT * FROM search (by zipcode) on the database that the user posted data to. Now here's my question.. I want the query to search the db and return results for matching zip codes and display that plus the other info that was posted by the user. I have it right now so that the results displayed are simply only the zip code that matches is coming back and it displays how ever many times in matches. I hope this makes sense. Thanks in advance for any help. Michael
[PHP-DB] Re: Does Php support Flash files ?
What the fuck R U doing in my thread??/ Rajni Arya wrote: Hi, Does PHP supprots Flash files on Open BSD platform ? Thanks in advance. --Rajni -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Passing variable with previous next
Hello, I am working on a page that first collects a variable using POST, and which then uses same in the page which processed this variable. Everything works fine if I run the page with the variable already set (i.e. do not send it via POST from the page which calls the script. I have included what I think are the important parts below. Any help greatly appreciated, as this is my first time to post to this list. Thanks, Declan. (a) Page which calls the script - form.php form action=results2.php method='POST' BCounty:/Bbr select name=address_region option value=noneselect county option value=Co. CarlowCo. Carlow option value=Co. ClareCo. Clare option value=Co. CorkCo. Cork /select input type=submit name=submit value=Submit (b) Page which processes the passed variable. ?php include 'db.inc'; include 'error.inc'; // Open a connection to the DBMS if (!($connection = @ mysql_connect($hostName, $username, $password))) die(Could not connect to database); if (!mysql_select_db(processors_list2, $connection)) showerror(); $company_name = $HTTP_POST_VARS['company_name']; $limit = 5; $query_count = SELECT * FROM sheet1 WHERE address_region='$address_region'; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); $page = $_GET['page']; if(empty($page)) $page = 1; $limitvalue = $page * $limit - ($limit); $query = SELECT * FROM sheet1 WHERE address_region='$address_region' LIMIT $limitvalue, $limit; $result = mysql_query($query) or die(Error: . mysql_error()); if(mysql_num_rows($result) == 0) echo(Nothing to Display!); echo \ntable width=\100%\ align=\center\ border=\0\; while($row = mysql_fetch_array($result)) { // Print the details } echo \n/table\n; if($page != 1){ $pageprev = $page - 1; echo(a href=\$PHP_SELF?page=$pageprevaddress_region=$address_region\PREV/anb sp;); }else echo(PREVnbsp;); $numofpages = $totalrows / $limit; for($i = 1; $i = $numofpages; $i++){ if($i == $page) echo($i.nbsp;); else echo(a href=\$PHP_SELF?page=$iaddress_region=$address_region\$i/anbsp;); } if(($totalrows % $limit) != 1){ if($i == $page) echo($i.nbsp;); }else echo(a href=\$PHP_SELF?page=$iaddress_region=$address_region\$i/anbsp;); if(($totalrows - ($limit * $page)) 0){ $pagenext = $page + 1; echo(a href=\$PHP_SELF?page=$pagenextaddress_region=$address_region\NEXT/a); }else echo(nbsp; NEXT ); mysql_free_result($result); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MySQL and Cyrillic
You have to put these lines in your html-page: meta HTTP-EQUIV=Content-Type CONTENT=text/html; CHARSET=Windows-1252 Edwin Nikolay Nikolov wrote: Hello! I have problem with database, where have field with cyrillic char(1). I cant select by this field, because MySQL dont understand this chars as different. How can set default charset to win1251 or cp1251? I use MySQL on windows platform. Thank You! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Does Php support Flash files ?
Swearing Well, the word 'fuck' is a bit rude, but I don't think it is swearing. But I get the reactions that I was looking for :-) At 11:34 19-3-03, you wrote: Hi Edwin On Wednesday 19 March 2003 17:21, Edwin Boersma wrote: What the fuck R U doing in my thread??/ Rajni Arya wrote: Hi, Does PHP supprots Flash files on Open BSD platform ? Yes, it's rude to hijack threads. And if you search the archives, I often berate people for doing so. BUT there's absolutely no need and no place for swearing on a public forum such as this list. regards -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* When the going gets weird, the weird turn pro. -- Hunter S. Thompson */ Edwin Boersma *** Odos Agiou Polykarpou 84 300 Chora, NAXOS Greece T: +30/2285029088 O: +30/2285029093 M: +30/6942250095 E: [EMAIL PROTECTED] W: http://www.cyclades-info.com ICQ: 7383148 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variable with previous next
on 19/3/03 9:32 am, Achieve IT at [EMAIL PROTECTED] wrote: $company_name = $HTTP_POST_VARS['company_name']; You also need $address_region = $HTTP_POST_VARS['address_region']; Else you arent going to be able to pick up the variable or its value. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variable with previous next
Oops, I have actually defined $address_region = $HTTP_POST_VARS['address_region']; , I forgot to include in the snip in the first posting. Thanks, Declan. - Original Message - From: mike karthauser [EMAIL PROTECTED] To: Achieve IT [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 10:00 AM Subject: Re: [PHP-DB] Passing variable with previous next on 19/3/03 9:32 am, Achieve IT at [EMAIL PROTECTED] wrote: $company_name = $HTTP_POST_VARS['company_name']; You also need $address_region = $HTTP_POST_VARS['address_region']; Else you arent going to be able to pick up the variable or its value. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- 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: deleting records using a checkbox
INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y you will get an array named DELETE. check for every element in array DELETE foreach($_POST['DELETE'] as $message_id = $val) { if($val ==1) { You mean if($val == 'Y') ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SELECT * FROM Command
Mark is right, but here's something that may get you started: You need to do a query that looks something like: SELECT * FROM search WHERE zipcode=.$_POST[zip].; Where $_POST[zip] would be replaced by whatever method and variable you're using to get the search criterion into the query string. Your result set will contain all columns in your table that include the zip code your user provides. To get the output I think you're looking for, you need to iterate over that result set with a WHILE loop like this: echo table; while($row=mysql_fetch_array($result)){ echo trtd.$row[address]./tdtd.$row[zip]./td/tr; } echo /table; For each of the column values you want to show your user, you'll need to have a $row[colname] bracketed by the open and close td tags. None of this code has actually been tested, but it should be pretty close to right. It's early here and, like Mark said, you didn't provide a whole lot to go on, but hopefully this'll be enough to get you going in the right direction. HTH, Rich -Original Message- From: Snijders, Mark [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 3:09 AM To: 'Michelle Whelan'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] SELECT * FROM Command guess it is hard to answer this with so less information first show us how the table defenition is... how it is build up and then which fields you want to show to the user! then I or others can help you much more!! ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: Michelle Whelan [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: woensdag 19 maart 2003 9:06 To: [EMAIL PROTECTED] Subject: [PHP-DB] SELECT * FROM Command Hi, I have a question about how to display results. I am using PHP with a mysql database through yahoo webhosting. I've created a form (html javascript) that lets the user post data to one of the tables in my database. On a separate page, I've created a form that will do a SELECT * FROM search (by zipcode) on the database that the user posted data to. Now here's my question.. I want the query to search the db and return results for matching zip codes and display that plus the other info that was posted by the user. I have it right now so that the results displayed are simply only the zip code that matches is coming back and it displays how ever many times in matches. I hope this makes sense. Thanks in advance for any help. Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Login and link back...
I am curious about what you guys may have along the lines of best practices for forwarding from a URL to a login, and then jumping back to the original URL automatically. I have several separate applications that all need to utilize the same login mechanism. I want the user to be able to enter the URL for the application and if they are not logged in it redirects them to a login screen. I already have the sessions junk setup and understand all of that portion. I am mainly interested in how people are handling the return to a URL after successful login. I have done some research on this, and discovered the $HTTP_REFERER variable however the PHP site discourages using this. I have also thought of adding code to each page to export an origin variable to be passed to the login page such that it can be used to return the user. I thought of this method, but I am not real clear on how to manage this. Does anyone have any suggestion on implementing this, or another alternative that I have not touched on yet? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Thumbnails
Hi there gents, i looked all web for a good script to create a image thumbnail at the time I make the upload to server and DB. I mean, i have a form with some fields. One of it is the imagepath. I store here the image path so i can display the full image on a third page. Now what i want is to create a thumbnail, save it on the server and also save the path on DB so i can get it on a query on the second page before displaying the full image. Any script or tip out there? Thx Miguel
RE: [PHP-DB] Problem retrieving/updating data from InterBase
Vincent, currently I'm working with an Interbase 6.0 database and I want to insert some text (and eventually a picture) to a blob field. I've found the following php code: $bid = ibase_blob_create(); ibase_blob_add($bid, test); $comments_blob = ibase_blob_close($bid); $sql = UPDATE tblcontent SET Metadata=? WHERE id=1; ibase_query($sql,$comments_blob); ibase_commit(); When I try to retrieve this blobdata, I use the following code: $set = ibase_query(SELECT Metadata FROM tblcontent WHERE ID = 1); $row = ibase_fetch_object($set); $blob_id = ibase_blob_open($row-Metadata); $content = ibase_blob_get($blob_id); ibase_blob_close($blob_id); ibase_free_result($set); $content returns an empty string. I don't know if it goes wrong updating the data, or retrieving the data. Can anybody help me out here I've experienced flakiness using blobs with php. I did get it to work, however. When I insert my text, I do not use a blob. When I retrieved the results, I would use all capital letters for the field name, and I made use of the ibase_blob_info() function: $blob_data = ibase_blob_info( $row-METADATA ); $blob_hndl = ibase_blob_open( $row-METADATA ); $content= ibase_blob_get( $blob_hndl, $blob_data[0] )); ibase_blob_close( $blob_hndl); Hope this has some hints, Patrick May
RE: [PHP-DB] Login and link back...
Have you thought about using BASIC AUTH in Apache? That way, you don't even need to build a login page, just authenticate each page. Here's what we use: Note that some of the functions used in this script are not included, and need to be commented out or a function written for them. It's rather self-explanatory. We also create a .htaccess file with all the username/passwords in a central location. You'll need to modify tour httpd.conf file to look in that central location for all the pages. ## Function: check_auth() ## Description: Checks authentication against the mysql user info database and ##verifies the password. This function is absolutely critical. ##If it's not right, you could be letting people into the website ##unintentionally. Always make sure that login failure occurs ##unless you have a positive ID!!! ## Additionally it determines if the user has read and digitally accepted ##IEI's liability statement by calling liability_statment_check(). ## Arguments: none ## Returns: success- returns true ##failure- exits via auth_header() function check_auth() { global $conn_id,$PHP_AUTH_USER,$PHP_AUTH_PW,$PHP_AUTH_REALM,$REQUEST_URI,$sid; global $WEBUSER_TABLE,$WEBAUTH_TABLE; global $redirect; # The only way out of this function is: # 1) A recursive call to auth_header() # 2) A TRUE return to the caller # Is USER and PASS set? if( !isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW)) { if ($redirect=='y'){ log_it(LOG_DEBUG,caught redirect); auth_header($PHP_AUTH_REALM); } else { log_it(LOG_DEBUG,redirecting); Header(Location: /index.php?redirect=y); exit(); } } # Does USER have trailing whitespace? BAD MYSQL! if (ereg(' +$',$PHP_AUTH_USER)){ auth_header($PHP_AUTH_REALM); } # Is USER known to the system? $sql = SELECT * FROM $WEBUSER_TABLE WHERE web_user_id='$PHP_AUTH_USER' AND web_password='$PHP_AUTH_PW'; $row = get_row($conn_id,$sql); if($row is_array($row)) { # Yes, so... # See if they've been disabled if($row['web_access_level'] == 'D'){ ## Start the Auth over again ## auth_header($PHP_AUTH_REALM); ## include('/error_disabled.php'); Header(Location: /error_disabled.php); exit(); } # Check logged_in state $sql = SELECT logged_in FROM $WEBAUTH_TABLE WHERE web_user_id='$PHP_AUTH_USER'; $row = get_row($conn_id,$sql); if(!$row || !is_array($row)) { # First time login for USER, let him through authorize_user($PHP_AUTH_USER); return(TRUE); } else { # RETURN POINT FROM FUNCTION # USER's logged_in status is something other than 'N' which is acceptable # for access if ($row['logged_in'] != 'Y'){ update_logged_in_status($PHP_AUTH_USER,'Y'); if ($redirect!='y') auth_header($PHP_AUTH_REALM); } else { log_it(LOG_INFO,checkauth() SUCCESS: user=$PHP_AUTH_USER pass=NO-SOUP-FOR-YOU-TOO); # update_logged_in_status($PHP_AUTH_USER,'Y'); } } liability_statement_check(); return(TRUE); } else { # USER NOT KNOWN auth_header($PHP_AUTH_REALM); } } Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 10:39 AM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Login and link back... I am curious about what you guys may have along the lines of best practices for forwarding from a URL to a login, and then jumping back to the original URL automatically. I have several separate applications that all need to utilize the same login mechanism. I want the user to be able to enter the URL for the application and if they are not logged in it redirects them to a login screen. I already have the sessions junk setup and understand all of that portion. I am mainly interested in how people are handling the return to a URL after successful login. I have done some research on this, and discovered the $HTTP_REFERER variable however the PHP site discourages using this. I have also thought of adding code to each page to export an origin variable to be passed to the login page such that it can be used to return the user. I thought of this method, but I am not real clear on how to manage this. Does anyone have any suggestion on implementing this, or another alternative that I have not touched on yet? Thanks in advance. Scott Nipp Phone: (214)
RE: [PHP-DB] Login and link back...
I am curious about what you guys may have along the lines of best practices for forwarding from a URL to a login, and then jumping back to the original URL automatically. I have several separate applications that all need to utilize the same login mechanism. I want the user to be able to enter the URL for the application and if they are not logged in it redirects them to a login screen. I already have the sessions junk setup and understand all of that portion. I am mainly interested in how people are handling the return to a URL after successful login. I have done some research on this, and discovered the $HTTP_REFERER variable however the PHP site discourages using this. I have also thought of adding code to each page to export an origin variable to be passed to the login page such that it can be used to return the user. I thought of this method, but I am not real clear on how to manage this. Does anyone have any suggestion on implementing this, or another alternative that I have not touched on yet? Thanks in advance. I use a method like this. When you go to a page, an include file is going to check for a valid session. If a certain session variable does not exist (even though a session is always there), then it re-creates the current request using $_SERVER['SERVER_NAME'], $_SERVER['PHP_SELF'], and $_SERVER['QUERY_STRING'] and saves that in the session. When the login is validated, the processing script looks in the session to see if one of these URLs are set. If it is, it redirects to it using header(). To the end user, it's pretty much transparent. I will not deal with POST requests, though, but hopefully that's not a problem. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Does Php support Flash files ?
I am assuming English isn't your first language. Yes, fuck is definitely swearing, cursing, or whatever else you would like to call it. And yes, it is considered rude in our culture. :D So there. :) Matthew Moldvan. System Administrator Trilogy International, Inc. http://www.trilogyintl.com -Original Message- From: Edwin Boersma [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 4:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Does Php support Flash files ? Swearing Well, the word 'fuck' is a bit rude, but I don't think it is swearing. But I get the reactions that I was looking for :-) At 11:34 19-3-03, you wrote: Hi Edwin On Wednesday 19 March 2003 17:21, Edwin Boersma wrote: What the fuck R U doing in my thread??/ Rajni Arya wrote: Hi, Does PHP supprots Flash files on Open BSD platform ? Yes, it's rude to hijack threads. And if you search the archives, I often berate people for doing so. BUT there's absolutely no need and no place for swearing on a public forum such as this list. regards -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* When the going gets weird, the weird turn pro. -- Hunter S. Thompson */ Edwin Boersma *** Odos Agiou Polykarpou 84 300 Chora, NAXOS Greece T: +30/2285029088 O: +30/2285029093 M: +30/6942250095 E: [EMAIL PROTECTED] W: http://www.cyclades-info.com ICQ: 7383148 *** -- 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] SELECT * FROM Command *REVISED*
-Ok, this is what I have. I hope this is what you are looking for. I'm looking to format this search results page so that the results come back with the entire entry that also matches the zipcode that was searched. ex: zipcode search = 90210 results for 90210 are: contactname phone number city date posted etc. AND, somehow ( I'm thinking ordered list) to have a format for multiple results sorted by date. Is this possible? Thanks again in advance Michael html head titlewww..com/title /head body BACKGROUND=images/dirt.gif text=#FF link=#FF vlink=#00 alink=#00 BGPROPERTIES=fixed ? /* MySQL details */ $dbHost = mysql; $dbUser = ; $dbPass = ; $dbName = ; $table = havedirt; /* Attempt connection to MySQL server */ $link = @mysql_connect($dbHost, $dbUser, $dbPass); /* If connection wasnt successful... */ if (!$link) { print (bError:/b Could not connect to database.); exit; } /* Attempt to select our database */ if ([EMAIL PROTECTED]($dbName)) { print(bError:/b Could not find $dbName database.); exit; } $ZipCode = $_POST[zipcode]; /* Build SQL query to fetch all entries from the table */ $query = SELECT * FROM $table WHERE zipcode = $ZipCode; /* Execute query */ $result = mysql_query($query); /* If there was a problem with the query... */ if (!$result || @mysql_num_rows($result) 1) { print(No entries in table $table.); exit; } print(table); /* For each table entry returned... */ while($row = mysql_fetch_array($result)) { /* Add details to output variable */ print(trtd . $row['zipcode'] . /td); print(tr); } print(/table); /* Close link to MySQL */ mysql_close($link); ? /body /html
RE: [PHP-DB] SELECT * FROM Command *REVISED*
SELECT * FROM tablename WHERE zipcode='$zipcode' ORDER BY entered_date; Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: Michelle Whelan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] SELECT * FROM Command *REVISED* -Ok, this is what I have. I hope this is what you are looking for. I'm looking to format this search results page so that the results come back with the entire entry that also matches the zipcode that was searched. ex: zipcode search = 90210 results for 90210 are: contactname phone number city date posted etc. AND, somehow ( I'm thinking ordered list) to have a format for multiple results sorted by date. Is this possible? Thanks again in advance Michael html head titlewww..com/title /head body BACKGROUND=images/dirt.gif text=#FF link=#FF vlink=#00 alink=#00 BGPROPERTIES=fixed ? /* MySQL details */ $dbHost = mysql; $dbUser = ; $dbPass = ; $dbName = ; $table = havedirt; /* Attempt connection to MySQL server */ $link = @mysql_connect($dbHost, $dbUser, $dbPass); /* If connection wasnt successful... */ if (!$link) { print (bError:/b Could not connect to database.); exit; } /* Attempt to select our database */ if ([EMAIL PROTECTED]($dbName)) { print(bError:/b Could not find $dbName database.); exit; } $ZipCode = $_POST[zipcode]; /* Build SQL query to fetch all entries from the table */ $query = SELECT * FROM $table WHERE zipcode = $ZipCode; /* Execute query */ $result = mysql_query($query); /* If there was a problem with the query... */ if (!$result || @mysql_num_rows($result) 1) { print(No entries in table $table.); exit; } print(table); /* For each table entry returned... */ while($row = mysql_fetch_array($result)) { /* Add details to output variable */ print(trtd . $row['zipcode'] . /td); print(tr); } print(/table); /* Close link to MySQL */ mysql_close($link); ? /body /html
Re: [PHP-DB] SELECT * FROM Command *REVISED*
--- Michelle Whelan [EMAIL PROTECTED] wrote: -Ok, this is what I have. I hope this is what you are looking for. I'm looking to format this search results page so that the results come back with the entire entry that also matches the zipcode that was searched. ex: zipcode search = 90210 results for 90210 are: contactname phone number city date posted etc. AND, somehow ( I'm thinking ordered list) to have a format for multiple results sorted by date. Is this possible? Thanks again in advance Michael html head titlewww..com/title /head body BACKGROUND=images/dirt.gif text=#FF link=#FF vlink=#00 alink=#00 BGPROPERTIES=fixed ? /* MySQL details */ $dbHost = mysql; $dbUser = ; $dbPass = ; $dbName = ; $table = havedirt; /* Attempt connection to MySQL server */ $link = @mysql_connect($dbHost, $dbUser, $dbPass); /* If connection wasnt successful... */ if (!$link) { print (bError:/b Could not connect to database.); exit; } /* Attempt to select our database */ if ([EMAIL PROTECTED]($dbName)) { print(bError:/b Could not find $dbName database.); exit; } $ZipCode = $_POST[zipcode]; /* Build SQL query to fetch all entries from the table */ $query = SELECT * FROM $table WHERE zipcode = $ZipCode; /* Execute query */ $result = mysql_query($query); /* If there was a problem with the query... */ if (!$result || @mysql_num_rows($result) 1) { print(No entries in table $table.); exit; } print(table); print(tr); $fields = mysql_list_fields($dbName,$table,$link); $columns = mysql_num_fields($fields); for ($i = 0; $i $columns; $i++) { print (th.mysql_field_name($fields, $i)./th); } print (/trtr); foreach ($row as $key=$val) { print (td$val/td); } print (/tr); print(/table); /* Close link to MySQL */ mysql_close($link); ? /body /html = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Is the query I need even possible?
I have a table that looks like this: page_idvisitor_idtimestamp ... 13 20030101060522 58 20030101060512 26 20030101060634 73 20030101060651 35 20030101060612 -- Earliest record with this visitor id 85 20030101060738 21 5 20030101060759 15 20030101060810 75 20030101060827 -- Last record with this visitor id 510 20030101060944 16 20030101061002 ... etc What I want to select is the PAGE_ID of the EARLIEST record and the PAGE_ID of the LAST record, for each distinct visitor_id. I cannot figure out how to do this without multiple, very slow sql calls. Currently I'm getting it like this: SELECT DISTINCT(visitor_id) FROM (table) Then going through each row with: SELECT page_id FROM (table) WHERE visitor_id = '$visitor_id' ORDER BY date_time ASC LIMIT 1 to get the first and then: SELECT page_id FROM (table) WHERE visitor_id = '$visitor_id' ORDER BY date_time DESC LIMIT 1 to get the last. There must be an easier way I'm not seeing. This, on the scale of thousands of visitors, takes forever. Is there any other way to do it? TIA, Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: deleting records using a checkbox
oh yes, Sorry my mistake should be: if($val == 'Y') Foong John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y you will get an array named DELETE. check for every element in array DELETE foreach($_POST['DELETE'] as $message_id = $val) { if($val ==1) { You mean if($val == 'Y') ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is the query I need even possible?
On Wed, Mar 19, 2003 at 07:37:46PM -0500, Mike Mannakee wrote: I have a table that looks like this: page_idvisitor_idtimestamp ... 13 20030101060522 58 20030101060512 26 20030101060634 73 20030101060651 35 20030101060612 -- Earliest record with this visitor id 85 20030101060738 21 5 20030101060759 15 20030101060810 75 20030101060827 -- Last record with this visitor id 510 20030101060944 16 20030101061002 ... etc What I want to select is the PAGE_ID of the EARLIEST record and the PAGE_ID of the LAST record, for each distinct visitor_id. I cannot figure out how to do this without multiple, very slow sql calls. This is pure vi code. (Runs fine in vi; haven't tried it in MySQL.) If the combination of page_id and visitor_id is a key, then this should work. If page_id and visitor_id are not a key (unique identifier), then use the table's primary key instead. If you don't have a primary key column, consider adding an autonumber primary key and using that. The point is that the column(s) in the GROUP BY clause have to uniquely identify the row in the first table. SELECT v1.page_id, v1.visitor_id, v1.timestamp FROM visit v1, visit v2 WHERE vi.visitor_id = v2.visitor_id GROUP BY v1.page_id, v1.visitor_id HAVING Max(v1.timestamp) = Max(v2.timestamp); Substitute Min() for Max() to get the earliest visit. Bob Hall -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: deleting records using a checkbox
Since this is not valid HTML - how would you accomplish this using valid HTML? INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y i.e. Yahoo mail does checkboxes like this: input type=checkbox name=Mid value=3398_926227_29517_1491_1405_0_273578_2841_2195311700 onclick=Toggle(this) olinux John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y you will get an array named DELETE. check for every element in array DELETE foreach($_POST['DELETE'] as $message_id = $val) { if($val ==1) { You mean if($val == 'Y') ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: deleting records using a checkbox
Since this is not valid HTML - how would you accomplish this using valid HTML? INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y How is that not valid HTML? You could use: input type=checkbox name=delete[] value=?=$message_id? ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Thumbnails
What you'd be looking at there would be a custom script. Have a look at the image functions of PHP. It can be done, but I think you'll find it easiest to figure it out and write it yourself. Mike Miguel brás [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi there gents, i looked all web for a good script to create a image thumbnail at the time I make the upload to server and DB. I mean, i have a form with some fields. One of it is the imagepath. I store here the image path so i can display the full image on a third page. Now what i want is to create a thumbnail, save it on the server and also save the path on DB so i can get it on a query on the second page before displaying the full image. Any script or tip out there? Thx Miguel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Not seeing whats wrong with code
Hello, I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, and I cant firgure out whats wrong with it: ? $host = localhost; $uname = sniper; $pass = starcraft; $database = SHA; $tablename = members; $connect = mysql_connect ($host, $uname, $pass); $select = mysql_select_db ($database); $query = SELECT * from $tablename; $result = mysql_query ($query) while ($row = mysql_fetch_row($result)) { $row } ? Thanks, Mike Delorme
Re: [PHP-DB] Not seeing whats wrong with code
Mike Delorme wrote: Hello, I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, and I cant firgure out whats wrong with it: ? $host = localhost; $uname = sniper; $pass = starcraft; $database = SHA; $tablename = members; $connect = mysql_connect ($host, $uname, $pass); $select = mysql_select_db ($database); $query = SELECT * from $tablename; $result = mysql_query ($query) while ($row = mysql_fetch_row($result)) { $row You are missing a semi-colon here. And you are not printing the info. Try this instead of $row: print_r( $row );. } ? Thanks, Mike Delorme --Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Not seeing whats wrong with code
You're missing a semi-colon... I'll leave it up to you to find. :) ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Mike Delorme [mailto:[EMAIL PROTECTED] Sent: Thursday, March 20, 2003 12:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Not seeing whats wrong with code Hello, I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, and I cant firgure out whats wrong with it: ? $host = localhost; $uname = sniper; $pass = starcraft; $database = SHA; $tablename = members; $connect = mysql_connect ($host, $uname, $pass); $select = mysql_select_db ($database); $query = SELECT * from $tablename; $result = mysql_query ($query) while ($row = mysql_fetch_row($result)) { $row } ? Thanks, Mike Delorme -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Not seeing whats wrong with code
Should be: ? $host = localhost; $uname = sniper; $pass = starcraft; $database = SHA; $tablename = members; mysql_connect ($host, $uname, $pass); mysql_select_db ($database); $query = SELECT * from $tablename; $result = mysql_query ($query); while ($row = mysql_fetch_row($result)) { ...statements here... } ? MD Hello, MD I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, MD and I cant firgure out whats wrong with it: MD ? MD $host = localhost; MD $uname = sniper; MD $pass = starcraft; MD $database = SHA; MD $tablename = members; MD $connect = mysql_connect ($host, $uname, $pass); MD $select = mysql_select_db ($database); MD $query = SELECT * from $tablename; MD $result = mysql_query ($query) MD while ($row = mysql_fetch_row($result)) MD { MD $row MD } ? MD Thanks, MD Mike Delorme WBR, Max 'AMiGo' Gashkov [EMAIL PROTECTED] ]=[ http://diary.otaku.ru/amigo http://www.journals.ru/users/endymion Distributed.net participant [408228][RC5-72] __ NP: [Massimo Santucci] 2 love (first cut) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: deleting records using a checkbox
[ and ] are illegal characters. #javascript Here are a couple links. Looks like the solution is in parsing the form headers. try some google searches for 'checkbox array javascript php' Here's an interesting one: http://jscript.dk/faq/php.asp usually the only solution offered is how to work with checkbox elements w/javascript and not how to read the form submission. maybe its in php docs somewhere... i'll try some more searching later. olinux --- John W. Holmes [EMAIL PROTECTED] wrote: Since this is not valid HTML - how would you accomplish this using valid HTML? INPUT TYPE=CHECKBOX NAME=DELETE[?php echo message_id ?] VALUE=Y How is that not valid HTML? You could use: input type=checkbox name=delete[] value=?=$message_id? ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Making tree menu
Hello guys I make following query: mysql SELECT b.type, a.link AS parent_link, b.link AS child_link FROM bookmarks AS a, bookmarks AS b WHERE a.id = b.parentid order by parent_link; and here is result ++-++ | type | parent_link | child_link | ++-++ | link | MAIN FOLDER | http://www.ee/ | | folder | MAIN FOLDER | SUBFOLDER | | link | MAIN FOLDER | http://www.google.com/ | | link | SUBFOLDER | http://www.amazon.com/ | ++-++ I just can't figure out how can i produce tree style output with php MAIN FOLDER - - http://www.google.com/ - http://www.ee/ - SUBFOLDER - http://www.amazon.com/ Any help would be greatly apreciated. Have a nice day. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php