Re: [PHP-DB] Renaming all pages to .php
On Friday, June 20, 2003, at 11:55 AM, David Blomstrom wrote: Hm... it would be nice if I could use a search and replace function, but that would be tricky. If I replaced every instance of .htm"> with .php">, then that would also change links to other websites. For example... If /all/ your serving up is going to be handled by php, why not register php to handle your .htm files? -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HTML tags in auth.php script
Check out the auto_prepend configuration option here: http://www.php.net/manual/en/configuration.directives.php I believe you can do this on a per-directory basis, but haven't tried it. -Steve On Friday, January 10, 2003, at 02:56 PM, [EMAIL PROTECTED] wrote: ThX John...One other question. I have an images folder and other 25 sub-folders underneath this folder. Each of this sub-folder is a web album with it own default index.html and thumbnails pics in it. My question is : Is there an easy way of having a folder level access control to the "IMAGES" folder and not having to get into each of those 25 index.html files and including my "auth.php" script in there. As of now any one can just type my whole URL upto the sub-folder and get to see my web pics. Thanks in advance. NT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SHOW PICTURE FROM DATABASE
On Tuesday, December 31, 2002, at 02:25 AM, nikos wrote: Steve b. the "_type" is the type of the binary data. From the PHP manual read: "$userfile_type - The mime type of the file if the browser provided this information. An example would be "image/gif" Ok, but it didn't look like you saved the type information in the database, at least it wasn't in your query, so where is it coming from? I mean tacking _type on the variable doesn't magically tell you the mime type except in the case of file uploads (where the type is supplied by the browser), right? Ready to stand corrected... -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SHOW PICTURE FROM DATABASE
Some suggestions... On Monday, December 30, 2002, at 03:55 PM, Nikos Gatsis wrote: where showpict.php: $query="SELECT pict FROM pict WHERE pro_id= '$pro_id"; (You're missing an end ' there, but apparently that's not the problem) $result=mysql_db_query($database, $query, $conn) or Die (mysql_error()); list($photo)=mysql_fetch_row($result); $type = $photo_type; Where did the $photo_type variable come from? What's in it? if (!empty($photo)) { header("Content-Type: {$type}"); I believe this header should be in the form header("Content-Type: image/jpeg") or whatever image type you have. You should probably include an additional header header("Content-Length: " . strlen($photo)); echo $photo; } THANX Nikos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Insert path string into Mysql
On Monday, November 18, 2002, at 01:10 PM, Alan Kelly wrote: $path = 'c:\\demo\\' ; $query = "insert into PH_PHOTO (PHOTO_PATH) VALUES ('$path')"; $result=mysql_query($query); I would guess that the backslashes are being interpreted once by php when the variable $path is interpolated into the query string (to become c:\demo\) and again by mysql at which point it tries to insert a value for \d. You might try $path = 'c:demo' and see if that works. Or maybe leave the path alone and do the query line like this: $query = "insert into PH_PHOTO (PHOTO_PATH) VALUES ('" . $path . "')"; -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL password protection?
You could put it anywhere. Stick it in a text file somewhere, fopen() and read the file for the password. Or keep it in a php script outside of the web root if that's the issue, then just include() it when you need to. Of course any file you put it in will have to be readable by whatever user the webserver is running as. -Steve On Wednesday, November 6, 2002, at 04:16 PM, 1LT John W. Holmes wrote: I was wondering if it is possible to protect my password to the MySQL-server from being in a PHP-script. Now I can't do that, so everybody who gets to see my php-sourcecode also can see my (not protected/not encrypted) password. How can I change this? You can't, unless you want to put it in php.ini or a my.conf file... ---John Holmes... -- 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] what's wrong with this ereg?
Well, one thing is you've got mismatched parentheses. You need another another opening paren right after the "if". Also, don't you need to escape the last hyphen in your character sets? As well as the . before the third character set? -Steve On Tuesday, August 20, 2002, at 11:11 AM, [EMAIL PROTECTED] wrote: > I am trying an email verification function, like this: > > if (empty($useremail)) || !eregi("^[A-Za-z0-9\_-]+@[A-Za-z0-9\_-] > +.[A-Za-z0-9\_-]+.*", $email)) > { >$errmsg .= "The email address appears to be invalid\n"; > } > > But it will not work, on one server I get this error: > Parse error: parse error in > /home/virtual/site109/fst/var/www/html/auth_dealers/user_input2.php on > line > 70 > and on another server I get this error: > Parse error: parse error, unexpected T_BOOLEAN_OR in > /usr/local/apache/htdocs/auth_dealers/user_input2.php on line 70 > > What do I need to do to fix this? > > -- > Chip Wiegand > Computer Services > Simrad, Inc > www.simradusa.com > [EMAIL PROTECTED] > > "There is no reason anyone would want a computer in their home." > --Ken Olson, president, chairman and founder of Digital Equipment > Corporation, 1977 > (They why do I have 9? Somebody help me!) > > > -- > 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] or statement in url
How about http://www.xyz.com/foo.php?FooID[]=1&FooID[]=2 Then FooID will be an array of the values. -Steve On Thursday, July 18, 2002, at 03:20 PM, Matthew K. Gold wrote: > can I use an OR operator in a variable that is passed through a url? > > ex. how can I combine the following two lines so that I end up with > records > that have an id of either 1 or 2? > > http://www.xyz.com/foo.php?FooID=1 > > http://www.xyz.com/foo.php?FooID=2 > > (I tried the following, but it didn't work: > http://www.xyz.com/foo.php?FooID=1||FooID=2 ) > > thanks in advance for your help. > > Matt > > > -- > 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] header function
What's on line 3 of Auth_user.php ? If you have anything outside of the tags it will start the html output. Even just an empty line. -steve On Monday, July 15, 2002, at 04:09 PM, Mohammad Forouhar-Fard wrote: > > Hi, > I have a problem with function header("Location:xy.php?var=2). > I have not any text (print echo or display any text) at all before I > set a cookie > If I try to execute this function of Apache server in my Company it is > all auf OK. But if I try to run at home I have even the same error > Cannot add header information - headers already sent by (output started > at > C:\httpd\HTDOCS\Auth_user.php on line 3 > Can somebody help my I have at home this configuration: > I have Winxp OmniHTTPd/2.09 Server. > > > > > -- > 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] what the heck? (elementary question)
On Monday, June 24, 2002, at 01:52 PM, Matthew Crouch wrote: > this bit from my index page is giving me 2 headaches: > 1. it isn't passing anything into the URL > 2. the page that gets called ("name.php") sits and tries to load > forever. it looks like it's even filling up my hard drive with data (?!) > > Note: it does this (#2) even if I type in the URL with a variable and > value, like "name.php?lastname=smith" > > printf ("", > $lastname); > ?> > > > > > > > Can you do a "get" and a "post" at the same time? Tacking the lastname onto the url as in "action=\"name.php?lastname=%s\"" is using a get method, but your form is supposed to set lastname using the post method. Is there some reason you want your script to set one version of lastname and let the user type in a different version of lastname? If so try using the post method with an . -Steve > > -- > 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] Date of Birth From Form
A combination of strtotime() and date() can make this easy. date("Y-m-d", strtotime($birthday)) Or see docs and comments at http://www.php.net/manual/en/function.strtotime.php -Steve On Friday, April 19, 2002, at 01:29 PM, Brandon Paul wrote: > Hey all, > > I have a credit application form, and one of the required elements is > the > applicant's Date of Birth. I have "creditapp" table with a "birthdate" > field and it is a DATE datatype. On the form, I want to be able to have > them enter their Date of Birth as "mm/dd/" and have it go into the > database properly (-mm-dd). Is there a way to do it this way, or > am I > going about it wrong? Any help would be greatly appreciated. > > Thanks! > > Brandon > > > > -- > 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] odbc versions
Hi. I'm looking at compiling one of the odbc function sets into php on my Mac OSX machine (I eventually want to be able to talk to MAS90 on a Windows machine -- if that's feasible). I'm finding the ODBC situation a bit confusing though. Should I use iodbc or unixodbc? Any suggestions? And will a database driver for one work with the other or are they incompatible? Thanks. -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cron job and php
Where is your php binary? (try "which php") The command path under crontab is not always the same as in a login shell, so you might need to spell it out like: */10 * * * * /usr/local/bin/php /home/harpreet/crontest.php -Steve On Tuesday, April 16, 2002, at 12:17 PM, Harpreet Kaur wrote: > Thanks Lisi. The use of php in front of the path made > /home/harpreet/crontest.php run one time when run from the telnet > prompt. But it still doesnt run from the crontab. I created a > mycron.txt file with the below statement. The put crontab mysql.txt to > specify the cron. But it doesnt seem to run this way. What am i doing > wrong. Please help. > > Help is appreciated. > > Regards, > harpreet kaur > > > >> From: Lisi <[EMAIL PROTECTED]> >> To: "Harpreet Kaur" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >> Subject: Re: [PHP-DB] cron job and php >> Date: Tue, 16 Apr 2002 19:13:11 +0200 >> >> Try */1 * * * * php /home/harpreet/crontest.php >> >> or */1 * * * * php ~/crontest.php >> >> ~ means your home directory. >> >> I think this should work, every minute. >> >> -Lisi >> >> >> At 03:54 PM 4/16/02 +, Harpreet Kaur wrote: >>> Can i run a php page using a crontab job. I am trying to do so but no >>> luck. My cron job statement is : >>> * * * * * lynx /home/harpreet/crontest.php >>> >>> Actually i want to run a script every 10 minutes to do some >>> background job >>> like we do in sql server. How can i do it with mysql and php. >>> >>> Help is appreciated, >>> >>> regards, >>> Harpreet Kaur >>> >>> _ >>> Get your FREE download of MSN Explorer at >>> http://explorer.msn.com/intl.asp. >>> >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> > > > > > _ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > -- PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Arrays
Your $eventdate variable is an array, not a string so you can't just drop it into an sql query string like that. If you have separate fields in the db for year, month and day then you probably want something like: $query = "insert into ... values ( ... , '$eventdate[0]', '$eventdate[1]', '$eventdate[2]', ...)"; Otherwise, if they're all supposed to go into the same field then do something like: $eventdatestring = join("-", $eventdate); $query = "insert into ... values ( ..., '$eventdatestring', ...)"; This should insert the date in the form "eventyear-eventmonth-eventday"; -Steve On Monday, April 15, 2002, at 03:13 PM, Alex Francis wrote: > I am trying to insert event dats into a database and to make sure the > user > puts the date in the correct format. I am now trying to collect the > information from the three fields and insert it into one field. > > code as follows: $eventdate = array ("eventyear", "eventmonth", > "eventday"); > > when I insert it into the database like: $query = "INSERT INTO > $tablename4 > VALUES ('0', '$entername', '$date', '$eventdate', '$eventheading', > '$eventbody' )"; > > for the $eventdate variable the word "array" is inserted. > > Could someone please tell me where I am going wrong. > > -- > Alex Francis > Cameron Design > 35, Drumillan Hill > Greenock PA16 0XD > > Tel 01475 798106 > [EMAIL PROTECTED] > http://www.camerondesign.co.uk > > This message is sent in confidence for the addressee only. It may > contain > legally privileged information. > Unauthorised recipients are requested to preserve this confidentiality > and > to advise the sender > immediately of any error in transmission. > > > > -- > 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] Using include file
I pasted your code into a file testinclude.php (changing only the server name), then wrote another file test.php: It parses okay for me. How are you doing the include? -Steve On Friday, April 12, 2002, at 03:02 PM, Alex Francis wrote: > I get a parse error on line 2. The code is as follows: > > $server = "mysql.xcalibre.co.uk"; > $user = "user"; > $passwd = "password"; > $dbname = "rschool"; > $tablename1 = "story"; > $tablename2 = "guestbook"; > $tablename3 = "drawing"; > $tablename4="notices"; > $link = mysql_connect ($server, $user, $passwd); > ?> > > As I said, when I paste the code into each file I don't have a problem. > -- > Alex Francis > Cameron Design > 35, Drumillan Hill > Greenock PA16 0XD > > Tel 01475 798106 > [EMAIL PROTECTED] > http://www.camerondesign.co.uk > > This message is sent in confidence for the addressee only. It may > contain > legally privileged information. > Unauthorised recipients are requested to preserve this confidentiality > and > to advise the sender > immediately of any error in transmission. > Steve Cayford <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Just a guess: Are you doing the include from a function? If so, make >> sure you explicitly mark your global vars. Otherwise, what's the error >> message? >> >> -Steve >> >> On Friday, April 12, 2002, at 12:28 PM, Alex Francis wrote: >> >>> I have one site which I am having problems connecting to my database. >>> If I >>> create my connections in an "include" config file I get an error on >>> the >>> server connection. When I cut and paste the code exactly as it is into >>> each >>> file I have no problems. I have a local server set up in my office >>> which I >>> use to test my databases and scripts and have a slightly different >>> config >>> file on that one. The include file works fine. >>> >>> I have various other sites using "include" config files and have had >>> no >>> problems, but this one is a pain, I have to change each file when I >>> move it >>> mrom my test server to my hosting server. >>> >>> Any help would be appreciated. >>> >>> -- >>> Alex Francis >>> Cameron Design >>> 35, Drumillan Hill >>> Greenock PA16 0XD >>> >>> Tel 01475 798106 >>> [EMAIL PROTECTED] >>> http://www.camerondesign.co.uk >>> >>> This message is sent in confidence for the addressee only. It may >>> contain >>> legally privileged information. >>> Unauthorised recipients are requested to preserve this confidentiality >>> and >>> to advise the sender >>> immediately of any error in transmission. >>> >>> >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using include file
Just a guess: Are you doing the include from a function? If so, make sure you explicitly mark your global vars. Otherwise, what's the error message? -Steve On Friday, April 12, 2002, at 12:28 PM, Alex Francis wrote: > I have one site which I am having problems connecting to my database. > If I > create my connections in an "include" config file I get an error on the > server connection. When I cut and paste the code exactly as it is into > each > file I have no problems. I have a local server set up in my office > which I > use to test my databases and scripts and have a slightly different > config > file on that one. The include file works fine. > > I have various other sites using "include" config files and have had no > problems, but this one is a pain, I have to change each file when I > move it > mrom my test server to my hosting server. > > Any help would be appreciated. > > -- > Alex Francis > Cameron Design > 35, Drumillan Hill > Greenock PA16 0XD > > Tel 01475 798106 > [EMAIL PROTECTED] > http://www.camerondesign.co.uk > > This message is sent in confidence for the addressee only. It may > contain > legally privileged information. > Unauthorised recipients are requested to preserve this confidentiality > and > to advise the sender > immediately of any error in transmission. > > > > -- > 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] HTML tables in PHP
You probably want something more like this (see modified code below). Note that if you get a lot of records, your html table will keep expanding out to the right. You might want to break it up with rows ... or not, as you like. There are quite a few places that have intros to php subjects. Check out the list at http://www.php.net/links.php -Steve "; while($row = mysql_fetch_array($ret)){ // note: indenting your code in loops makes it much easier to see what's going on :) $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $display_block ="$name$quantity"; // show each record in its own cell here echo "$display_block"; } // finish up the table outside the loop echo ""; ?> On Wednesday, April 10, 2002, at 01:17 PM, Jennifer Downey wrote: > Hi everyone! > > Is there a good tutorial on how to write html tables in PHP? > > In my last post "Not displaying all records" I have the items displayig > all > the contents of the table but they are in descending order. > like this > item 1 > item 2 > > Here is the code I am using > > $query = "SELECT id, name, image, quantity FROM > {$config["prefix"]}_my_items > WHERE uid={$session["uid"]} ORDER BY id"; > $ret = mysql_query($query); > while($row = mysql_fetch_array($ret)){ > $image = $row['image']; > $name = $row['name']; > $quantity = $row['quantity']; > > $display_block =" src=$image>$name$quantity"; > echo "$display_block"; > echo""; > } > > > I have already tried this > > $display_block =" src=$image>$name$quantity"; > echo > "$display_block$display_block"; > echo""; > > But it displays 2 sets of all items still in descending order beside > each > other: > > item 1 item 1 > item 2 item 2 > > What I wnat is to display them > > item 1 item 2 item 3 > > Is there a way to do this? > > Thanks > Jennifer > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/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] Images on MySQL
I keep hearing this from people (not to store images in mysql), but I would like to hear a bit more about why. Mysql has blob fields, so it seems perfectly reasonable to use them, doesn't it? I'm storing some images in a database and what's attractive to me about it is that I can put the images anywhere I like. I guess I could mount an image directory over NFS, but it seems easier and more consistent to use sql. Any thoughts on this? -Steve On Friday, March 29, 2002, at 05:43 AM, Jason Wong wrote: > On Thursday 28 March 2002 19:35, Clever wrote: >> Hi, >> I'm designing a site and I have to store a lot of images. >> Which is the best for speed? >> 1) Store all images on a MySQL table? >> 2) Save them on disk like normal files and only have pointers to them >> on >> the database? > > 2) > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > The only difference in the game of love over the last few thousand years > is that they've changed trumps from clubs to diamonds. > -- The Indianapolis Star > */ > > -- > 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] elseif statement syntax
You probably have error reporting turned off in your php.ini file or you may be directing errors into your log file, try checking there. Why are you tacking "or die(mysql_error())" on the end of each of your query assignments? You're just assigning a string to a variable so there's nothing to fail, or at least no mysql errors. -Steve On Wednesday, March 20, 2002, at 10:41 AM, Andrea Caldwell wrote: > Hi All, I'm pretty new at this, so go easy on me please ;-) > > What is wrong w/ this syntax? If the search results are 0, it just > displays > a blank screen instead of echoing the error message if numresults ==0 > or the > mysql_error message. If data is found, everything is fine. Thanks in > advance for your help! > > if($searchterm){ > $query = "select directory.realname, directory.phone, directory.ext, > directory.phone2, directory.email, directory.location from directory > where > realname like '%".$searchterm."%'" or die (mysql_error()); > } > elseif($location){ > $query = "select directory.realname, directory.phone, directory.ext, > directory.phone2, directory.email, directory.location from directory > where > location like '%".$location."%'" or die (mysql_error()); > } > else{ > $query = "select directory.realname, directory.phone, directory.ext, > directory.phone2, directory.email, directory.location from directory > where > location like '%".$searchloc."%'" or die (mysql_error()); > } > > $result = mysql_query($query) or die (mysql_error()); > $num_results = mysql_num_rows($result)or die (mysql_error());; > > if($num_results==0){ > echo "Sorry, nothing matched your search request. Please go back and > try > again."; > } > > else { > echo "Number of Entries Found: > ".$num_results.""; > } > > > > -- > 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] A weird images database/web page problem
Hello again. On Thursday, January 17, 2002, at 01:06 AM, chip wrote: > On Wednesday 16 January 2002 08:57 pm, Steven Cayford banged out on the > keys: >> On 2002.01.16 19:59:37 -0600 chip wrote: >>> Let's tackle the first one first - >> OK. >>> On Tuesday 15 January 2002 10:20 pm, Steven Cayford banged out on the >>> keys: On 2002.01.15 23:30:25 -0600 chip wrote: > won't work) > $new_pic=$pic+12; Is $pic already set by the HTTP_GET_VARS here? >>> I don't know. How do I set this? I was reading the online manual about >>> http_get_vars and it didn't help, and doesn't have any examples. >> I was assuming that the $pic variable was set by the HTTP get request >> since your link below is in the form: >> . >> When the target script starts after being called like that the value >> in the >> global variable $HTTP_GET_VARS['pic'] will hold whatever $new_pic was >> set >> to in the reference. Assuming you have register_globals on, > > Yes it is on. > >> then the global >> variable $pic will also be set to the same value. > > Makes sense > >> Otherwise $pic will be uninitialized and should evaluate to 0. > > So, I guess I have to set the variable to 0 first when the first page is > loaded, then add 24 (or 12 or whatever) to for the link to the next > page. So, > with that in mind I added this > $pic=0; > before > $new_pic=$pic+12; > but that just caused it to reload the same images each time next was > pushed. > So, now that I appear to be a total dummy, and the manual doesn't > provide any > examples, and the two books I have don't seem to be able to help also, > would > you mind helping me a bit more? I'm I going about this next page stuff > all > wrong, is there a better way to do it? > -- > Sorry, I think I got you off track. In this case you *do* want to set $pic from the GET vars. I guess how I would do this would be something like this: if(! isset($pic)) { $pic = 0; } This way, if $pic has been set by the GET vars, then the value will be retained, otherwise it will be explicitly set to whatever default value you want--in this case 0. This is probably anal of me, but I just don't like using uninitialized variables. Also keep in mind that $pic can be set to any value via the URL. So if someone types into their browser: "http://...your_site.../index.php?pic=hello"; then when your script runs $pic will hold the string "hello" instead of a number. Then if you stick the value straight into your sql statement without verifying it you could get all sorts of weird problems. If the site is just for your own local use, then don't worry about it, but if its going to be available to the wider world at some point then you may want to explicitly force $pic to be an integer "$pic = (int) $pic;" or something like that. In any case, this is all aside from the problem that you were running into. I think if you change your sql statement below from "select * from ab limit $new_pic,12" to "select * from ab limit $pic,12" you'll find you can get the first page of images. -Steve > (nothing new below here, just history) > $conn=mysql_connect("localhost", "chip","carvin") or die ("Could >>> >>> not >>> > get > the databse"); > mysql_select_db("images", $conn) or die ("Could not select the > database"); > $sql="select * from ab limit $new_pic,12"; Assuming that $pic is 0, then $new_pic is 12, so you're selecting with LIMIT 12, 12. You probably want to use $pic here, right? > $result=mysql_query($sql); > while ($row=mysql_fetch_array($result)) >{ >printf(" src=\"../thumbs/%s\">\n", $row["name"], $row["name"]); >$i++; >if($i %6==0) >{ >echo "\n"; >} Note that if the select statement gives you other than 6 or 12 images (which it probably will on the last page), that will never get echoed. >} > echo "\n\n href=\"../index.html\">Home \n href=\"index.php?pic=$new_pic\">Next\n\n\n"; > ?> To find out if $new_pic pointed to a valid image you would probably >>> >>> need >>> to do a "select count(*) from ab" to get the total number of records. >>> >>> If >>> $new_pic is less than the count, then show the link. > -- > Chip W > > > -- > 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] question
On Wednesday, December 12, 2001, at 09:03 AM, Robert Weeks wrote: > Hi, > > I'm a little stumped here, maybe I haven't had enough coffee yet... > > Anyway, I have a lot of SQL queries that return one row if there is a > match > and instead of having to write out something like this: > > $firstname = $row["firstname"]; > $lastname = $row["lastname"]; > $midinitial = $row["midinitial"]; > $preferredname = $row["preferredname"]; > $address1 = $row["address1"]; > $address2 = $row["address2"]; > $city = $row["city"]; > $state = $row["state"]; > $zip = $row["zip"]; > > I thought I'd loop through the result and and get the info out like > this: > > $nrows = mysql_num_rows($result); > $nfields = mysql_num_fields($result); > $rowarray = mysql_fetch_row($result); > > for ($i=0; $i<$nfields; $i++){ > $fname = mysql_fieldname($result,$i); > $val = $rowarray[$i]; > $fname = $val; Do you want $$fname = $val here? Taking the string in $fname as the name of a variable to which you are assigning $val. > } > > and then later in the page reference the values using > > Problem is this isn't working. If I echo the varibles to the page they > will > print out but they wont show up in the tags. > > I tried setting the varibles to global and that still doesn't seem to > work. > I know I'm missing something really simple and basic here. If someone > could > give me a push in the right direction I'd appreciate it. > > Thanks, > > Robert > > > -- > 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] losing first row of an array
On Friday, November 2, 2001, at 01:09 PM, Seany wrote: > having this code running PHP4.0b2 > > $result = mysql_query("SELECT clubac.id AS clubacid, clubac.club_id, > clubac.ac_year, clubac.ac_type, club.id > FROM clubac, club WHERE club.id = '$club_id' AND clubac.club_id = > club.id"); > > $row = mysql_fetch_array($result); Here you've fetched the first row... > > if ($row = mysql_fetch_array($result)) { ...and here you've overwritten it with the second row. You probably just want: if ($row) { ... > > do { > echo "$row[club_id]"; > echo "$row[id]"; > echo "$row[ac_year]"; > echo "$row[ac_type]"; > > } while($row = mysql_fetch_array($result)); > > } else .blablabla > > is there a fundamental miss on my part why the is printing the first or > not > even recognising it > if call direct in mysql with the above query it's fine with the results > even > if there is 1 row > > duh??? > > Seany > > > > -- > 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] Learning PHP Sessions
This is really off-topic for this list, but... From my understanding of sessions, you really don't want session_start() in an if{} block. Every time you hit this script, it will have no memory of any session variables until you call session_start(). -Steve On Tuesday, October 30, 2001, at 02:30 PM, Matthew Tedder wrote: > /* > Hi, > > I'm new to PHP and am having trouble understanding how to use PHP > sessions. My book tells in near the beginning how to start them and > register > session variables, but I can't figure out how to destroy a session or > later > read those session variables. I'm also trying to do this across > frames, but > can't even get it to work within a single page. > > Here's what I've learned so far and what my problems are: > */ > > /* To start a session */ > session_start(); > > /* To register a session variable */ > session_register("myvar"); > $myvar = "some value"; > > /* > PROBLEM #1: From the above commands, I get a $PHPSESSID that seems to > be > globally available for use, but I cannot seem to read my values back > out of > the registered session variable from anywhere... I tried: > */ > > print "$myvar\n"; /* and absolutely nothing is printed */ > > /* To destroy a session */ > session_destroy(); > > /* > PROBLEM #2: This says there is no session to destroy. It's rather > strange > because I can still print the $PHPSESSID value.. > > I've attached my code... > > */ > ?> > -- > 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] Help! ¡Ayuda!
> > > Source code- CÛdigo fuente: > > $based="articulo.dbf"; > if (($descriptor=dbase_open ($based, 0))==0){ >printf ("Error al abrir la base de datos"); > }else{ >printf ("Base de datos abierta"); >$num_registros=dbase_numrecords($descriptor); >$num_campos=dbase_numfields($descriptor); >for ($i=1;$i<=$num_registros;$i++){ > $registro= dbase_get_record ($descriptor, $i); > for ($j=0;$j<$num_campos;$j++){ > printf ("Fila %d,Campo %d vale %S", $i, $j, $registro[$j]); Try using a lower-case '%s' here -^ I don't think the uppercase %S means anything to printf. > } >} >dbase_close($descriptor); >printf ("Base de datos cerrada"); > } > ?> > Don't know much about dbase, but the rest looks okay. -Steve -- 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] date
Check out the date functions in php, they're very nice. mktime(), date(), strftime(), and setlocale() -Steve On Friday, October 26, 2001, at 08:47 AM, Rick Emery wrote: > Assume the following table: > create mytable ( > mydate date ); > > Assume the following inserts: > INSERT INTO mytable VALUES( "2003-02-20"); > INSERT INTO mytable VALUES( "2004-12-25"); > INSERT INTO mytable VALUES( "1999-01-01"); > > The following will order this table, assuming precedence of > year->month->day, and print in Euro format: > SELECT DATE_FORMAT(mydate,"%d/%m/%Y") FROM mytable ORDER BY mydate; > > The following will order this table, assuming precedence of > day->month->year, and print in Euro format: > SELECT DATE_FORMAT(mydate,"%d/%m/%Y") AS edate FROM mytable ORDER BY > edate; > > With basic PHP, you can format the Euro date input into the script into > the > -MM-DD requied for insertion into the database. > > -Original Message- > From: ax [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 26, 2001 6:11 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] date > > > how would i enter european format date into mysql (dd/mm/) ... and > how > would i make the query sort by date if i am using this format ?? > > ax > > > > -- > 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] PROBLEM ACCESSING DBASE WITH PHP
You only need to post your question once, and you really shouldn't cross-post to multiple lists...please, I just got six copies of your question. Did you compile php with the --enable-dbase configure flag? You can check with phpinfo() for what's enabled and also what configuration flags were used. -Steve On Thursday, October 25, 2001, at 12:31 PM, Sebas wrote: > I need to open a dbase file, so I use the "dbase_open" function and > then I > compile it but it tells me > > Fatal error: Call to undefined function: dbase_open() > > it seems like this function does not exists!.Does anybody could help me? > Thanks > [EMAIL PROTECTED] > > > --- > Necesito abrir una base de datos dbase, por lo que uso la funciÛn > "dbase_open" y al compilar, me sale el error: > > Fatal error: Call to undefined function: dbase_open() > > Parece como si la funciÛn no existiera. øøPuede alguien ayudarme?? °°Es > muy > urgente!!Gracias > > [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] PHP and MySQL queries...
Oop. I guess I missed the point of that question. Still, the MySQL manual says a DATE takes 3 bytes, DATETIME 8 bytes, and TIMESTAMP 4 bytes. That seems fairly efficient. Using an INT for a date might actually take up more space. -Steve On Thursday, October 25, 2001, at 09:34 AM, Steve Cayford wrote: > Yep, MySQL has DATE, DATETIME, and TIMESTAMP field types. You can order > by them and everything. > > -Steve > > On Thursday, October 25, 2001, at 09:18 AM, Tim Foster wrote: > >> I'm new to this list, to PHP and to MySQL (been doing VBScript on ASP >> for several years, >> tho). >> >> I'm curious... >> >> If you're going to store it as an integer, why not store "10/24/2001" >> as MMDD >> (20011024). This gives you the added benefit of being able to have the >> db sort your >> fields. This even works if you want to include the time with your date >> (provided all dates >> in the field consistently contain the same *amount* of info). For >> example, noon on >> Christmas will always be lower than noon of the following New Year >> ..as it should be: >> >> /MM/DD 20011225< 20020101 >> /MM/DD HH:MM 200112251200< 200201011200 >> /MM/DD HH:MM:SS 2001122512 < 2002010112 >> >> I'm betting there's no easy way to sort it if you store it as MM/DD/YY >> >> MM/DD/ 10242001 < 12252001 (good) >> ..but NOT less than the following New Year's >> MM/DD/ 10242001 > 01012002 (bad) >> >> Granted, you might take up a bit more space in the DB, which would >> have a tiny impact on >> performance(??), but an extra $100 on the hard drive would effectively >> eliminate any >> reasonable space considerations and (IMHO) reduce the amount of >> programming/debugging to >> more than justify the overhead. >> >> FWIW, M$ likes to store their dates as two integers: one to hold the >> date portion, the >> other to hold the hours:minutes:seconds portion. >> >> If there's something about PHP/MySQL that makes this point moot, >> please let me know. >> >> TIM >> -He who always plows a straight furrow is in a rut. >> >> >>> -Original Message- >>> From: Mike Frazer [mailto:[EMAIL PROTECTED]] >>> Sent: Wednesday, October 24, 2001 7:54 AM >>> To: [EMAIL PROTECTED]; [EMAIL PROTECTED] >>> Subject: Re: [PHP-DB] PHP and MySQL queries... >>> >>> >>> Agreed. This is especially useful when you need to conserve every >>> byte you >>> can; a timestamp of "10/24/2001" or something similar is going to >>> take 10 >>> bytes as a string and an indeterminate number of bytes for an actual >>> timestamp because of system variations, whereas an integer value of >>> 10242001 >>> will take you 2-4 bytes depending on the type of int you declare. >>> Not a lot >>> of space, but assume for a second you have 30 fields in your database >>> and 5 >>> million rows...suddenly those 6-8 bytes have multiplied on this one >>> field >>> alone. Space and speed are important in DBs :) >>> >>> Mike Frazer >> >> >> -- >> 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: php-list- >> [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] PHP and MySQL queries...
Yep, MySQL has DATE, DATETIME, and TIMESTAMP field types. You can order by them and everything. -Steve On Thursday, October 25, 2001, at 09:18 AM, Tim Foster wrote: > I'm new to this list, to PHP and to MySQL (been doing VBScript on ASP > for several years, > tho). > > I'm curious... > > If you're going to store it as an integer, why not store "10/24/2001" > as MMDD > (20011024). This gives you the added benefit of being able to have the > db sort your > fields. This even works if you want to include the time with your date > (provided all dates > in the field consistently contain the same *amount* of info). For > example, noon on > Christmas will always be lower than noon of the following New Year ..as > it should be: > > /MM/DD20011225< 20020101 > /MM/DD HH:MM 200112251200< 200201011200 > /MM/DD HH:MM:SS 2001122512 < 2002010112 > > I'm betting there's no easy way to sort it if you store it as MM/DD/YY > > MM/DD/10242001 < 12252001 (good) > ..but NOT less than the following New Year's > MM/DD/10242001 > 01012002 (bad) > > Granted, you might take up a bit more space in the DB, which would have > a tiny impact on > performance(??), but an extra $100 on the hard drive would effectively > eliminate any > reasonable space considerations and (IMHO) reduce the amount of > programming/debugging to > more than justify the overhead. > > FWIW, M$ likes to store their dates as two integers: one to hold the > date portion, the > other to hold the hours:minutes:seconds portion. > > If there's something about PHP/MySQL that makes this point moot, please > let me know. > > TIM > -He who always plows a straight furrow is in a rut. > > >> -Original Message- >> From: Mike Frazer [mailto:[EMAIL PROTECTED]] >> Sent: Wednesday, October 24, 2001 7:54 AM >> To: [EMAIL PROTECTED]; [EMAIL PROTECTED] >> Subject: Re: [PHP-DB] PHP and MySQL queries... >> >> >> Agreed. This is especially useful when you need to conserve every >> byte you >> can; a timestamp of "10/24/2001" or something similar is going to take >> 10 >> bytes as a string and an indeterminate number of bytes for an actual >> timestamp because of system variations, whereas an integer value of >> 10242001 >> will take you 2-4 bytes depending on the type of int you declare. Not >> a lot >> of space, but assume for a second you have 30 fields in your database >> and 5 >> million rows...suddenly those 6-8 bytes have multiplied on this one >> field >> alone. Space and speed are important in DBs :) >> >> Mike Frazer > > > -- > 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] MySQL Query Weirdness
When you use mysql_fetch_array you're actually retrieving an array with two copies of the value you're looking for. One is indexed by the column number and one indexed by the column name. So it looks like you're looping through them both and printing each out. You might want mysql_fetch_assoc (to use just the column name) or mysql_fetch_row (to use just the column number) -Steve On Thursday, September 20, 2001, at 05:02 PM, Chris S. wrote: > > > Hello, > > I'm new at this php/mysql stuff, so go easy on my guys. > > I've got my query script up and working, but the problem is I'm getting > the > same column printed twice on the html output. Here is the output: > > Connected successfully > Chris Chris > Mark Mark > Mike Mike > Dee Dee > etc... > > Here is my .php script: > > $link = mysql_connect("localhost", "dbuser","dbpassword") > or die ("Could not connect"); > print ("Connected successfully"); > mysql_select_db ("dapscores") or die ("Could not select database"); > > $query = "SELECT first_name FROM overall_results"; > $result = mysql_query ($query) or die ("Query failed"); > > // printing HTML result > > print "\n"; > while ($line = mysql_fetch_array($result)) { > print "\t\n"; > while(list($col_name, $col_value) = each($line)) { > print "\t\t$col_value\n"; > } > print "\t\n"; > } > > print "\n"; > > > > mysql_close($link); > ?> > > > Here is my database layout: > > mysql> describe overall_results; > +---+-+--+-+-+---+ > | Field | Type| Null | Key | Default | Extra | > +---+-+--+-+-+---+ > | Match_Date| date| YES | | NULL| | > | Place | varchar(10) | YES | | NULL| | > | Last_Name | varchar(20) | YES | | NULL| | > | First_Name| varchar(20) | YES | | NULL| | > | USPSA | varchar(10) | YES | | NULL| | > | Class | char(3) | YES | | NULL| | > | Division | varchar(20) | YES | | NULL| | > | PF| varchar(7) | YES | | NULL| | > | Lady | char(3) | YES | | NULL| | > | Mil | varchar(4) | YES | | NULL| | > | Law | varchar(4) | YES | | NULL| | > | F0r | char(3) | YES | | NULL| | > | Age | varchar(20) | YES | | NULL| | > | Match_Pts | float | YES | | NULL| | > | Match_percent | float | YES | | NULL| | > +---+-+--+-+-+---+ > > If I run the query from mysql>, it works fine, just the HTML output > shows > the double column thing. Is this a database problem? I've tried > different > variations of my script and I get the same output each time. > > Thanks > > -- > Chris S. > [EMAIL PROTECTED] > PGP 0xDA39672B > > > -- > 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] Query construction
Usually what I do when I'm having this type of problem is put the whole sql statement into a string variable then print the variable out just before running the query so you know exactly what's being sent to mysql. Then I log into mysql from the command line and enter the query manually to see what sort of response or error message I get. -Steve On Wednesday, September 19, 2001, at 09:01 AM, Russ Michell wrote: > Hi there: > > Further to a previous submission (which can be ignored), I'd like the > following query to 'search' a > table field of different team names (stored as a single string), but it > does't seem to work! > > "SELECT * FROM $table_users WHERE usrName='$username' AND > usrPswd=password('$password') AND affil_team RLIKE '$team+'"; > (I've also tried: RLIKE '$team?' ) > > This should match the string found in the variable: '$team' with the > some of contents (string) > found in 'affil_team'. > > For example my test has been, trying to find 'footballSat', so $team = > 'footballSat'. 'footballSat' > exists as part of the string in the 'affil_team' field but the above > query refuses to find > 'footballSat'!! (No error is received though) > > I'm using MySQL 3.22.32 + php4.0.3pl1 > > Cheers > Russ > > #---# > > "Believe nothing - consider everything" > > Russ Michell > Anglia Polytechnic University Webteam > Room 1C 'The Eastings' East Road, Cambridge > > e: [EMAIL PROTECTED] > w: www.apu.ac.uk/webteam > t: +44 (0)1223 363271 x 2331 > > www.theruss.com > > #---# > > > -- > 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] Table Search ... HELP
All the info you want should be in $result after the query. But to get it out of $result you need to access one row at a time with mysql_fetch_array($result), which returns a numerically keyed array (if I remember correctly), or mysql_fetch_assoc($result), which returns a string keyed array or hash. So, like this (more or less)... if ($TechContact == ""){ $TechContact = '%'; } $result = mysql_query ("SELECT * FROM enet WHERE TechContact LIKE '$TechContact%'"); // this part added... while($row = mysql_fetch_assoc($result)){ print $row["TechContact"]; print $row["SomeOtherColumnName"]; print $row["YetAnotherColumnName"]; print "\n"; } On 2001.09.06 19:41:55 -0500 Devon wrote: > Below is an example of my code which searches a table and prints the > result, > the problem is that it only displays the TechContact where I want it to > display all the fields that associated with it in that row off the colum > eg. > Mobile, AdminContact etc etc Any suggestions? > > if ($TechContact == "") > {$TechContact = '%';} > $result = mysql_query ("SELECT * FROM enet > WHERE TechContact LIKE '$TechContact%'"); > print $row["TechContact"]; > > > > > > -- > 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] Forms Question
On Wednesday, September 5, 2001, at 04:50 PM, Jeff Grossman wrote: > Hello, > Here is the code I have: > > while ($row=mysql_fetch_array($result)) { >$store=$row["store"]; >$jobdesc=$row["jobdesc"]; > echo ""; > echo "Store: > > Signal Hill > Reseda > Orange > West Covina > Riverside > Norwalk > Fountain Valley > Pasadena > Redondo Beach > San Bernardino > Kearny Mesa > San Marcos > Chino > Corporate Office > "; > echo " VALUE=\"$jobdesc\">"; > echo " Changes\">"; > } > > > Is want I am trying to do possible? I want the value which is stored in > $store to automatically fill in on the drop down list. But, for some > reason it is defaulting to the first option, and not using the value > that is in the database. > > Can I use a drop down menu, or should I just go to radio buttons? > > Thanks, > Jeff If I understand your question... In order to have your value preset in the drop down list you need indicate that with blahblah What I've been using for this is a hash like this: while ($row=mysql_fetch_array($result)) { $selected = array(); $selected[$row["store"]] = "selected"; $store=$row["store"]; $jobdesc=$row["jobdesc"]; echo ""; echo "Store:"; echo "" echo " Signal Hill"; echo " Reseda"; ...etc, etc., etc. something along those lines, anyway. So, if $row["store"] == "Signal Hill", then $selected["Signal Hill"] will be set to "selected", while $selected["Reseda"] and all the others will be blank. This is a very keen thing about php. -Steve -- 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]