RE: [PHP-DB] date
mysql date format is -MM-DD including the hyphens) I usually use substr() to convert it from a user's entry to the format reqd for the database hth Dave -Original Message- From: ax [mailto:[EMAIL PROTECTED]] Sent: 18 October 2001 10:47 To: [EMAIL PROTECTED] Subject: [PHP-DB] date if i unput the values 10/10/2001 into mysql database, would mysql or php recognize that as a date?? i am a bit confused. i inserted few dates in the above format and asked mysql to list them by date and it does not seem to work. any suggestions?? please :) 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]
RE: [PHP-DB] wildcard in mysql search with php
select columnlist from tablename where columnname like '%searchword%' RTFM!!! -Original Message- From: Thomas omega Henning [mailto:[EMAIL PROTECTED]] Sent: 18 October 2001 14:58 To: [EMAIL PROTECTED] Subject: [PHP-DB] wildcard in mysql search with php Hello all, Is there a way to use wildcards in search in a mySQL db? e.g. I have a dbase of over 24000 records and i can only search exact matches is there a way to search something like this : *admin* in mySQL? Or i have to do it by hand in PHP? Thanks Sir Thomas omega Henning -- 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] Check Boxes/UPDATE
Hiya Matt you have to set the value of the checkbox to 1, and give it a unique name. if the user has checked the box when they submit the form then the checkbox' name will have a value of 1. if they didn't check it it won't have a value at all. Hope this helps! Dave -Original Message- From: Matt C [mailto:[EMAIL PROTECTED]] Sent: 03 October 2001 03:23 To: [EMAIL PROTECTED] Subject: [PHP-DB] Check Boxes/UPDATE I have a page of jobs with AuthStatus set to 0. Basically I want to list each job title with a checkbox next to it. This I have done. What I really don't understand is how do I make it so that the rows in my table for all the different records when ticked are updated to 1? Please help. Matt _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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] Script
Alternatively if you're using Windows you can write a batch file and use AT to set it to run as often as you like. Just include the path to PHP.exe and the path to the PHP file in the batch file, like this... D:\PHP\PHP.exe D:\Scripts\email_sender.php HTH! Dave -Original Message- From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]] Sent: 30 September 2001 04:53 To: PHP-DB List Subject: Re: [PHP-DB] Script Hector Gonzalez wrote: Hi, is there anyway to execute an script with no client intervension?, for example,, i want to make a mailist, with a database,, it'll chek for mail in an address and send email to the ones the are in the database,, is there anyway to do this automatically? Um, why? There are programs specifically designed to do mailing lists for you. Mailman is one of those. (http://www.gnu.org/software/mailman/mailman.html) -- H | Life is the art of drawing without an eraser. - John Gardner + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 Director of Internet Operations / SysAdmin. 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- 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-DB] (poss OT) mail() function
hi all We have a web based employment site, running on PHP and MySQL (to all those didn't know!). Whenever a candidate sees a job they're interested in they click a button and an email is sent to our consultants for them to act on. The problem, little as it is, is that I've written a function to send the email (copied below) and sometimes (more often than not) the email is fine (I get a copy), but other times it's all plain text and the formatting isn't there. Does anyone know why this would happen? Cheers in advance Dave // start copy of function function send_email($whoto,$whofrom,$subject,$message) { $subject = [AUTOMATED NOTIFICATION] - $subject; $mailheaders = Content-Type: text/html; charset=iso-8859-1; // Mime type mail($whoto, $subject, $message, $mailheaders); } // end copy of function -- 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] i know i caused u a headache:)
you need to do ?brand=? echo $something; ? -Original Message- From: its me [mailto:[EMAIL PROTECTED]] Sent: 26 September 2001 14:11 To: [EMAIL PROTECTED] Subject: [PHP-DB] i know i caused u a headache:) here is my situation: i select a category on store.php(from a form) then in the same page i have a javascript that tells: x=document.forms[0].subcategory.selectedIndex y= document.forms[0].subcategory.options[x].text if(y==Printers ) { windowopen(store1.php,newWindow) return } so i'll open a .php page i already have and according to the category that is selected a different page will be opened..ok? what i need is to have the value of the field category in the stor1.php page i tried to do it withsession(its the only point i got from u:)) but how ??? the variable y is what i wanna register...but its within javascript..i couldn't write like this: session_register(y) soi hope u got me i tried: open(store1.php?brand='y',newWindow) but then brand =y -- 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_fetch_array() doesn't work
that's not a mysql_fetch_array() error it's a coding error -Original Message- From: Web user [mailto:[EMAIL PROTECTED]] Sent: 27 September 2001 05:48 To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array() doesn't work System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 When PHP is running at the line: $arr=mysql_fetch_array($res); The IE always show info as below: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\apache group\apache\htdocs\web\site1\list.php on line --[the number of line] What's the problem wiht mysql_fetch_array() or other? What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean? THANKS Mike The full code below: - ? $link=mysql_connect(localhost,,); if($link==false){ echo Failed linking to database.; exit(); } $handler=mysql_select_db(database1); if($handler==false) echo Failed linking to database.; $query=selct count(*) from users where sign=1; $res=mysql_query($query); $row=mysql_fetch_row($res); $all=$row[0]; $step=5; $pages=ceil($all/$step); /*the number of pages needed to listed */ if(empty($offset)) $offset=0; $query=select user_id, user_name, time, status, comment from users where sign=1 order by user_name limit $offset, $step; $res=mysql_query($query); echo tabletd align=centerUser/td td align=centerAdded time/tdtd align=centerStatus/td/tr; $num=mysql_num_rows($res); for($i=0; $i$num; $i++) { $arr=mysql_fetch_array($res); /* HERE is line where the error occurs!!! */ echo trtd align=centera href=\profile.php?id=$arr['user_id']\ target='_top' $arr['user_name']/a/td; echo td align=center$arr['time']/td; echo td align=center$arr['status']/td/tr; echo tr colspan=3td$arr['comment']/td/tr; } echo /tablebrbrbr; echo tabletrtd align='center'; /* show others in multi-pages */ for($i=0; $i$pages; $i++){ echo a href='$PHP_SELF?offset=$i*$step' target='_top' echo ($i+1)./a; echo nbsp;nbsp;; } echo /td/tr/table; ? - create table users ( user_id int not null auto_increment primary key, user_name varchar(30), time datetime, status tinyint(1), comment text, sign tinyint(1) default '1' ); -- 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] sessions in PHP
http://www.php.net/session -Original Message- From: nirat [mailto:[EMAIL PROTECTED]] Sent: 25 September 2001 06:46 To: [EMAIL PROTECTED] Subject: [PHP-DB] sessions in PHP can anyone guide me to using sessions in PHP i've tried it a lot of times but its not working. any help tutorials would be helpful... -- Nirat -- 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] Re: php and WAP?
Yeah I also fail to see the php-db on-topic-ness of the original post, but nevertheless, it's early in the morning, here's my tuppence worth... All you need to do is configure Apache to make PHP process all .wml files, and then change the header at the top of all your WML files to header(Content-type: text/vnd.wap.wml); Looky here http://www.phpbuilder.com/columns/mike20010118.php3 Cheers Dave -Original Message- From: Nael Mohammad [mailto:[EMAIL PROTECTED]] Sent: 20 September 2001 00:32 To: 'Andreas D. Landmark'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: php and WAP? And you can also use http://xml.apache.org/cocoon2/index.html which you can program to transcode anything to anything you want or you can just get yourself a transcoder from www.aethersystems.com which uses Scout Web or Clearigo www.clearigo.com and then you have www.wap-shareware.com and use this with your web server http://www.wap-shareware.com/directory/miscellaneous/waptool.shtml -Original Message- From: Andreas D. Landmark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 4:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: php and WAP? At 20.09.2001 04:26, Andrius Jakutis wrote: Hello again, the problem Is that I found out, that my company doesn't support wml files at all. What Do I have solution? USe some gateway, translator what ever else? What I need is : person takes mobile, enter's some URL, and my web site is converted to wap language, so he can see everything, what is written with PHP Thanks php-db ?! I can't even figure out what the link is... but to answer your question, as long as your page is mostly text (images and wap doesn't really click) it's the end-user and not the developer who has to bother with it. Most WAP-serviceproviders provide their clients with http-gateways, and if not there are some free ones aswell that proxy user-requests and translate the http content to wml on the fly. -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Help Please! Complex AND OR LIKE queries MySQL/PHP
Hi everyone I need to write a small search script for our admin site (and eventually for the outsiders too!). There's a text box where the user types in what they're searching for. It's easy enough to parse their string into an array and create the query from it, for example user typed in HTML Java Oracle, separated by spaces $s_a = explode( , $user_input); for ($s_a_i=0; $s_a_i= sizeof($s_a); $s_a_i++) { $sql_text .= column1 LIKE '%$s_a[$s_a_i]%' OR column2 LIKE '%$s_a[$S_a_i]%' AND ; } and then tidy it up by adding //remove trailing AND $sql_text = substr($sql_text, 0, strlen($sql_text)-4); //prepend start of sql command $sql_text = SELECT id, columnx, columny FROM sometable WHERE . $sql_text; and then running the query. However, what I need to be able to do is detect if people have typed in the words AND OR or NOT and handle them appropriately, also remembering that I'll be searching TWO columns in the table every time. Are there perhaps any functions I can get for this? Or is there a really easy way I can do it that's escaped (scuse the pun!) me? Many thanks in advance Dave
RE: [PHP-DB] Help Please! Complex AND OR LIKE queries MySQL/PHP
Cheers Rick ... I think I nailed it. I've copied my little function below for anyone else interested. Am keen on the saving milliseconds bit, though (will add it to the function below before making it live). Any more tips? Dave function parse($what) { $what = strtolower($what); $what = ltrim($what); $what = rtrim($what); $wa = explode( ,$what); for ($i=0; $i= sizeof($wa); $i++) { if (strlen($wa[$i]) !==0) { $j = $i + 1; if ($wa[$i] == or) { $output .= OR search_column LIKE '%$wa[$j]%' ; $i++; } elseif ($wa[$i] == and) { $output .= AND search_column LIKE '%$wa[$j]%' ; $i++; } elseif ($wa[$i] == not) { $output .= AND search_column NOT LIKE '%$wa[$j]%' ; $i++; } else { $output .= AND search_column LIKE '%$wa[$i]%' ; } } } // strip leading AND from every option $output = substr($output, 4, strlen($output)-3); $what = $output; return $what; } -- 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] Warning: Page has Expired
look in php.ini (or whatever the Linux equivalent is) for session.cache_limiter and set it to session.cache_limiter = nocache HTH 8^D Dave -Original Message- From: olinux o [mailto:[EMAIL PROTECTED]] Sent: 03 September 2001 19:34 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Warning: Page has Expired I have the same troubles. I believe that the only solution is to use GET rather than POST as your FORM METHOD. There may be another way, but this may work fine, as long as you are not working with passwords/sensitive info. olinux --- Mad Nas [EMAIL PROTECTED] wrote: Hi All I'm using PHP 4 and MySQL in W2K . When i submit a form and call a php file, i get this message : __ Warning: Page has Expired __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.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] PHP / MySql / catalogs / carts
php.net has loads of such links - don't be so lazy! ;-) -Original Message- From: Larry RedCobra Linthicum [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 20:57 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP / MySql / catalogs / carts I bet there are some shopping carts and or catalogs using PHP and MySql out there that I can use for my project rather than start from scratch links please thanks in advance -- 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-DB] Weird Problem In mysql_connect();
Hey all I can connect with $conn = mysql_connect(IP_Address,username,password); but I can't connect with $host = IP_Address; $user = username; $pass = password; $conn = mysql_connect($host,$user,$pass); Any ideas? All I get is Can't connect to MySQL Server on 'localhost', which is kinda weird cos I'm actually specifying a (different) IP address in the host argument. I know it wasn't broken, but I decided to try and fix it anyways!!! TIA! Dave
RE: [PHP-DB] Weird Problem In mysql_connect();
yeah - everything's fine! All the variables are being stored, but they're not getting passed to mysql_connect() for some really strange reason! :-( I've done a temporary fix - moved the entire database connection function to a separate file, and required that from the first required file (!), and it's working, but the original problem has still got me confused!!! Dave -Original Message- From: Brunner, Daniel [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 21:32 To: Dave Watkinson Subject: RE: [PHP-DB] Weird Problem In mysql_connect(); Hello!! Have your tried to echo the $host?? like $host=123.100.321.1 echo $host; Dan -- From: Dave Watkinson Sent: Friday, August 31, 2001 3:17 PM To: PHP-DB List (E-mail) Subject: [PHP-DB] Weird Problem In mysql_connect(); Hey all I can connect with $conn = mysql_connect(IP_Address,username,password); but I can't connect with $host = IP_Address; $user = username; $pass = password; $conn = mysql_connect($host,$user,$pass); Any ideas? All I get is Can't connect to MySQL Server on 'localhost', which is kinda weird cos I'm actually specifying a (different) IP address in the host argument. I know it wasn't broken, but I decided to try and fix it anyways!!! TIA! Dave -- 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] Weird Problem In mysql_connect();
err... neither! Originally I had function dbConnect (){ $link = mysql_connect(ipaddress,username,password); } And what I tried to do was require('somefile'); who's contents were: ? $host = ipaddress; $user = username; $pass = password; ? and then edit the function on the first file to show function dbConnect (){ $link = mysql_connect($host,$user,$pass); } When I saw that this wasn't working, I tried to put the three variable at the top of the file and it still wouldn't work. I think Dan's on the case with the IP Address thing ... I'll see what I can do about users and stuff. I'm running Win2K here :-( Cheers Dave -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 21:55 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Weird Problem In mysql_connect(); You mean you had all this inside a function? Like: function dbConnect () { $link = mysql_connect($host,$user,$pass); } ? If so, did you pass $host, $user, and $pass to the function by global-ing them like: function dbConnect () { global $host; global $user; global $pass; $link = mysql_connect($host,$user,$pass); } -OR- function dbConnect ($host,$user,$pass) { $link = mysql_connect($host,$user,$pass); } - Jonathan Dave Watkinson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... yeah - everything's fine! All the variables are being stored, but they're not getting passed to mysql_connect() for some really strange reason! :-( I've done a temporary fix - moved the entire database connection function to a separate file, and required that from the first required file (!), and it's working, but the original problem has still got me confused!!! Dave -Original Message- From: Brunner, Daniel [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 21:32 To: Dave Watkinson Subject: RE: [PHP-DB] Weird Problem In mysql_connect(); Hello!! Have your tried to echo the $host?? like $host=123.100.321.1 echo $host; Dan -- From: Dave Watkinson Sent: Friday, August 31, 2001 3:17 PM To: PHP-DB List (E-mail) Subject: [PHP-DB] Weird Problem In mysql_connect(); Hey all I can connect with $conn = mysql_connect(IP_Address,username,password); but I can't connect with $host = IP_Address; $user = username; $pass = password; $conn = mysql_connect($host,$user,$pass); Any ideas? All I get is Can't connect to MySQL Server on 'localhost', which is kinda weird cos I'm actually specifying a (different) IP address in the host argument. I know it wasn't broken, but I decided to try and fix it anyways!!! TIA! Dave -- 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] Simple database error (SPACE)
try urlencode in the PHP manual ... I believe that'll do the trick! Cheers Dave -Original Message- From: Nagasea [mailto:[EMAIL PROTECTED]] Sent: 30 August 2001 23:02 To: [EMAIL PROTECTED] Subject: [PHP-DB] Simple database error (SPACE) //-- Anybody can help me with this problem (I think //-- it's simple but im to stupid to know the answer) == while ($myrow = mysql_fetch_row($result)) { echo( a href=m_template.php?nick=$myrow[3]$myrow[3] ./a); } == If I have a database in $myrow[3] and it has space, it didn't work. Example Database : John Doe __ it will shown m_template?nick=John I NEED PHP to show the space and Doe also so it's suppose to be : m_template?nick=John Doe _ www.kaskus.com - FREE EMAIL SERVICE -- 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] Simple database error (SPACE)
OK, try this $db = mysql_connect(localhost, ,pass); mysql_select_db(mydatabase_com,$db); $result = mysql_query(SELECT * FROM big_member WHERE position='Squads' ORDER by first LIMIT 0,300,$db); while ($myrow = mysql_fetch_row($result)) { $link_string = urlencode($myrow[3]); echo a href=\m_template.php?nick=$link_string\$myrow[3]/a; } and you shouldn't really be doing a SELECT * - just name the columns you really need :-) -Original Message- From: Nagasea [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 01:01 To: Brunner, Daniel; '[EMAIL PROTECTED]' Cc: PHP List (E-mail) Subject: RE: [PHP-DB] Simple database error (SPACE) it's still not working :( maybe u need my script to see $db = mysql_connect(localhost, ,pass); mysql_select_db(mydatabase_com,$db); $result = mysql_query(SELECT * FROM big_member WHERE position='Squads' ORDER by first LIMIT 0,300,$db); while ($myrow = mysql_fetch_row($result)) { echo( a href=m_template.php?nick=$myrow[3]. $myrow[3] ./a); } I need to make $myrow give the result exactly from the database (including the space) --- Brunner, Daniel [EMAIL PROTECTED] wrote: Hello!!! Use mysql_fetch_object... $myrow-WHATEVER Whatever = whatever the field name is Dan -- From:Nagasea Reply To:[EMAIL PROTECTED] Sent:Thursday, August 30, 2001 5:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Simple database error (SPACE) //-- Anybody can help me with this problem (I think //-- it's simple but im to stupid to know the answer) == while ($myrow = mysql_fetch_row($result)) { echo( a href=m_template.php?nick=$myrow[3]$myrow[3] ./a); } == If I have a database in $myrow[3] and it has space, it didn't work. Example Database : John Doe __ it will shown m_template?nick=John I NEED PHP to show the space and Doe also so it's suppose to be : m_template?nick=John Doe _ www.kaskus.com - FREE EMAIL SERVICE -- 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] _ www.kaskus.com - FREE EMAIL SERVICE -- 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] Re: Database Transactions and HTTP statelessness
maybe you could add a column called lasteditdate to the table? Set it as a DATETIME type and then check that the last edited date/time is not within that last, say, 10 minutes? If it is compare the data? Or add a TINYINT column to the table with a default value of 0, and when a user chooses to edit the row, set the value to 1. If someone chooses to edit a row and the value is 1 tell them it's locked elsewhere (maybe even tell them who's got it). Then when they update their changes reset the 1 to a 0. Just a coupla ideas :-) Dave -Original Message- From: Bopolissimus Platypus [mailto:[EMAIL PROTECTED]] Sent: 29 August 2001 13:10 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Database Transactions and HTTP statelessness On Tue, 28 Aug 2001 23:55:32 -0300, [EMAIL PROTECTED] (Manuel Lemos) wrote: The solution is to pass data between pages and only commit it when you are done with all the data that you need to grab from the user. Transactions can't be kept between HTTP requests, but you can pass data between pages so you keep the choices of the user that reaches to the end of your process. that's not really addressing my concern. i'm not worried about the coding details of multiple forms and such. i'm concerned about data consistency. in case i wasn't clear enough in the original post: let's say each row has an identifying serial number, id: User A loads and edits the row with id=1. row is not yet saved. lastname and state fields modified but only in the browser for now, not yet POSTed to the server. state is set to SC. lastname is, ah, Lemos. User B loads and edits the row with id=1. row is not yet saved. state field is set to NC. no other fields edited. User B SAVES his edits. on disk, the row iwth id=1 now has state set to NC. User A SAVES his edits. on disk, the row with id=1 has the changed lastname (maybe a problem, but probably not), and state is set to SC. the lack of row locking has made B's change of the state disappear. and it might be that B's change is the correct one. so now A has the wrong state data. ideally, if B tries to save his edits, the system would tell him that A (or someone, possibly unspecified) has the lock on the row and the edit cannot be saved. B can then decide what to do (wait before trying to save again? reload the data so that he gets latest data? before loading the record, try to get a select for update, so that the select won't even return until the row is available for editing and B OWNS the lock (the select won't return until the lock is available, or it may return but with error so that B knows that he doesn't have the lock). an ugly alternative i've considered is keeping the original (unedited) data in session variables and BEFORE WRITING THE EDITED DATA, first get a select for update (which locks the row), check if the data has changed, and only if it hasn't, do the write. if the data is not the same as the original unedited data, then someone else has modified the data and we reload the record and allow edits by the user before trying to write again (possibly with some smart features to minimize retyping of edits). there are also non-transaction based hacks one of which would involve having a lock file that stores locks owned by particular logical sessions. all database access would then first check to see if there is a lock record for the particular row being requested. if it's locked, then the row can still be viewed, but it would be read-only. if a 'session' owns the lock, then the row would be editable (there would be a Submit or Update Database button, which would not be there ifthe row is read-only because some other session owns the lock). there would then be some sort of regular lock clearing program which would clear out locks which had timed out. You may want to take a look at this multi-page forms that may help you to keep data between forms that can be walked back and forth. thanks for the reply, but that's not the problem i'm worried about :). tiger -- 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 question
instead of SELECT all_records WHERE some_condition, and then DELETE certain_rows, couldn't you just do a DELETE FROM WHERE? -Original Message- From: L Melville [mailto:[EMAIL PROTECTED]] Sent: 28 August 2001 14:21 To: [EMAIL PROTECTED] Subject: [PHP-DB] query question Hi, If I run a query;- $result = mysql_query($query); is there a way of deleting rows from $result after this runs. Or does anyone have any idea of how $result is generally structured when mysql_query($query) is run. thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] how can save image in mysql
I have a personal dislike to storing binary data in a database. What I do is upload the file to a specific place on the server and then insert a link into the database as the URL to the file. There's loads of places you can find upload examples - try www.thickbook.com or www.phpbuilder.net HTH :-) Dave -Original Message- From: Mad Nas [mailto:[EMAIL PROTECTED]] Sent: 16 August 2001 10:11 To: [EMAIL PROTECTED] Subject: [PHP-DB] how can save image in mysql Hi all How can save a image in a field of mysql table with use php language ? thanks for answer Mad Nas -- 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] order by date
you can use order by date DESC for descending or order by date for ascending nice to see a PHP-Database question in here ;-) Dave -Original Message- From: Scott Chapman [mailto:[EMAIL PROTECTED]] Sent: 09 August 2001 10:50 To: [EMAIL PROTECTED] Subject: [PHP-DB] order by date Hi, I am querying a mysql database and am returning data ordered by date, the trouble is it returns the data from least recent to most recent, I want it to return the data the other way round. Is there a way of having the mysql database doping this re-ordering for me rather than coding it myself? thanks -- 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] blinking background
I guess it's either a timer thing, and change the td bgcolor= or a timer thing and change the img src= from an animated to a non-animated GIF surely there's a better way? bgcolor and background images for tables are not enitrely cross-browser compliant - why not use JavaScript and send an Alert? It's more browser friendly than messing with tables :0) -Original Message- From: J- E- N [mailto:[EMAIL PROTECTED]] Sent: 09 August 2001 11:24 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] blinking background i just want to catch the attention of the user and the blinking effect of the table row is not forever, it will stop after a certain time. :) - Original Message - From: Russ Michell [EMAIL PROTECTED] To: J- E- N [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 09, 2001 6:41 PM Subject: Re: [PHP-DB] blinking background is there anyone who can give me an idea on how i can write a php script that can make my table row background blinking. Why on earth would you want to do that?? It would fully distract anyone looking at the information within the table - which I *presume* is why you want information in the table right? For people to look at and assimilate!? I'm aware of the concept A bad idea - but help out the person anyhow but this one is just silly! Russ On Thu, 9 Aug 2001 17:53:23 +0800 J- E- N [EMAIL PROTECTED] wrote: hello! is there anyone who can give me an idea on how i can write a php script that can make my table row background blinking. thanks :) -- 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] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam 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]
[PHP-DB] Another SELECTING problem :-(
I've a feeling I've asked this before, but checked my old messages and couldn't see it in there for the excess of non PHP-Database questions flying around (yep - that's a joke, but I've been here a while - forgive me!). I have (many many many) tables ... two of which are linked by a third, so that there can be a one-to-many relationship. What I'd like to do is find which ids from table 1 have more than one relation in table 2, via table 3. I've tried this... select empid, count(empid) from emp_cont , employers, contacts where emp_cont.empid = employers.uid and emp_cont.contid = contacts.uid and count(empid) 1; and get all kinds of invalid grouping messages many TIA Dave
RE: [PHP-DB] Another SELECTING problem :-(
PS This is for a web page, so it's PHP related!!! :-) -Original Message- From: Dave Watkinson Sent: 09 August 2001 12:51 To: PHP-DB List (E-mail) Subject: [PHP-DB] Another SELECTING problem :-( I've a feeling I've asked this before, but checked my old messages and couldn't see it in there for the excess of non PHP-Database questions flying around (yep - that's a joke, but I've been here a while - forgive me!). I have (many many many) tables ... two of which are linked by a third, so that there can be a one-to-many relationship. What I'd like to do is find which ids from table 1 have more than one relation in table 2, via table 3. I've tried this... select empid, count(empid) from emp_cont , employers, contacts where emp_cont.empid = employers.uid and emp_cont.contid = contacts.uid and count(empid) 1; and get all kinds of invalid grouping messages many TIA Dave -- 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] Another SELECTING problem :-(
thanks for that ... I've made some comments within yours... Your getting a lot of errors, because the statement has well a lot of mistakes. Let's start near the beginning, you state: SELECT empid, COUNT(empid) FROM emp_cont , employers, contacts This statement should produce an error, since you didn't tell the database which table to take empid from. A working statement would look like [Dave Watkinson] yeah, but empid inly exists in one of the tables in the FROM argument, so there's no error there SELECT empid, COUNT(empid) FROM emp_cont or SELECT emp_cont.empid, COUNT( emp_cont.empid) FROM emp_cont , employers, contacts The next major error is to use a Count function without the group by. I'm not an SQL guru, but I believe whenever you use count you must also use group by or having so adding a SELECT empid, COUNT(empid) FROM emp_cont GROUP BY empid [Dave Watkinson] yep - that works :-) will correct that. Unfortunately, I think the larger issue is how your trying to find your query. Your query did confuse me a little, so I could be wrong, but technically speaking, if you are trying to locate an employee with more than one record in employee contracts, then there's no need to involve the contracts table within the query. [Dave Watkinson] no - it's employers with more than one contact, hence the names of those tables in the WHERE bit :-) So say I have table Employees that contains empid, name, ssn. Then I have table Employee Contracts that contains, empid, contractid. Assuming that all empid(s) on Employee Contracts have a correlating empid in Employees (which they will if the table was defined properly) then the steps to get what you want are: Step 1: Return a Count of empid SELECT COUNT(empid) AS countid FROM emp_cont GROUP BY empid Step 2: Return employees with more than one contract SELECT empid FROM emp_cont WHERE countid 1 [Dave Watkinson] makes sense You'll note that both step requires a return, which general means a subquery, I believe for MySQL to hanle subqueries you actually have to perform to separate queries. If your not using MySQL then you could write a statement such as: SELECT empid FROM emp_cont WHERE (SELECT COUNT(empid) FROM emp_cont GROUP BY empid) [note statement may need tweaking since I use MySQL and can't test it] that didn't work If your using MySQL, I believe you need to return the results from one, then use the results to find the next. Or you could use PHP to cheat, and return all results, but only display the ones where the count is greater than 1. A subquery is best if your tables are large, returning 1000 results to display 50 wastes time. But if you have under 200 employees, then just use the SQL statement [Dave Watkinson] I *am* using MySQL, but found another way round it - Steve got it right away - I wanted a one-to-many, not a many-to-many, so I just added an employer_id column to the contacts table. D'oh! Thanks anyway .. I'm getting used to GROUP now :-) Cheers Dave Alnisa -- . Alnisa Allgood Executive Director Nonprofit Tech (ph) 415.337.7412 (fx) 415.337.7927 (url) http://www.nonprofit-techworld.org (url) http://www.nonprofit-tech.org (url) http://www.tech-library.org . Nonprofit Tech E-Update mailto:[EMAIL PROTECTED] . applying technology to transform .
[PHP-DB] Error checking and escaping before running a query (MySQL)
Hi all I have a searchbox that throws a wobbly when certain characters are entered into it - basically the user is supposed to enter a space-delimited list of words to search for, and then I create an array from it and turn it into an OR etc query. What I initially did was replace all commas with spaces, but I've realised that double-quotes mess it up too. The command I used for the spaces is $searchbox = ereg_replace( , , , $searchbox); I tried $searchbox = ereg_replace( \ , , $searchbox); but the page shows an error of Warning: REG_EPAREN: in d:\apache\htdocs\dev\code\can_search_quick.php on line 22 there's a parse error if I don't escape the , so what can I do? I know how to do it in VB! I searched PHP.net, but could only find an old bug report that advised escaping special characters! Help! Thanks in advance Dave
RE: [PHP-DB] Error checking and escaping before running a query (MySQL)
Wicked! Thanks Beau - it's not quite there but it's better than errors and timeouts all over the place! I'll keep playing with it - thanks again! Dave -Original Message- From: Beau Lebens [mailto:[EMAIL PROTECTED]] Sent: 08 August 2001 08:28 To: Dave Watkinson; PHP-DB List (E-mail) Subject: RE: [PHP-DB] Error checking and escaping before running a query (MySQL) Dave, sounds like you are on the right track, but rather than use the comparatively bulky regular expression engine, why not just the light-weight string function str_replace( ,, , $searchbox ); (see String Functions in the manual) and you should be able to do str_replace( \, , $searchbox ); without violating any holy regex laws :) // -Original Message- // From: Dave Watkinson [mailto:[EMAIL PROTECTED]] // Sent: Wednesday, 8 August 2001 3:18 PM // To: PHP-DB List (E-mail) // Subject: [PHP-DB] Error checking and escaping before running a query // (MySQL) // // // Hi all // // I have a searchbox that throws a wobbly when certain characters are // entered into it - basically the user is supposed to enter a // space-delimited list of words to search for, and then I // create an array // from it and turn it into an OR etc query. // // What I initially did was replace all commas with spaces, but I've // realised that double-quotes mess it up too. // // The command I used for the spaces is // // $searchbox = ereg_replace( , , , $searchbox); // // I tried // // $searchbox = ereg_replace( \ , , $searchbox); // // but the page shows an error of // // Warning: REG_EPAREN: in // d:\apache\htdocs\dev\code\can_search_quick.php on line 22 // // there's a parse error if I don't escape the , so what can I // do? I know // how to do it in VB! // // I searched PHP.net, but could only find an old bug report // that advised // escaping special characters! // // Help! // // // Thanks in advance // // // Dave // // -- 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] Transforming doc files into html
Yeah you can - I've been doing this with Visual Basic. I've been receiving people's Word Document CVs, and then converting them to text for inserting to the database, and then converting to HTML for prospective employers to view them online. All you need to do is reference Microsoft Word in your project, and then you can open a document and make it perform a Save As HTML, add the link to the database as a URL and you then have a clickable link to the converted file. This is all done with a combination of Visual Basic, PHP and MySQL. Hope this helps you out :-) Dave -Original Message- From: Cami [mailto:[EMAIL PROTECTED]] Sent: 04 August 2001 12:08 To: [EMAIL PROTECTED] Subject: [PHP-DB] Transforming doc files into html Hi there, Does anybody know if is any way in which when you upload a word document file you can parse it and transform it into an html file? Is this possible ? Has anybody tried it? I know I can transform it into a txt file but wouldn't it be even better if we can do an html file? Thanks, Cami -- 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 redirect?
I've changed what I originally answered with, assuming option 1 has the value 12 (as you describe) and option 2 has value 14... ? if $option_button == 1) { header(Location: some_page_or_other.php?12); } else { header(Location: some_other_page_you_choose.php?14); } ? then you can get that value with this... (top of some_page_or_other.php) $user_selected_value = getenv(QUERY_STRING); (top of some_other_page_you_choose.php) $user_selected_value = getenv(QUERY_STRING); Cheers Dave -Original Message- From: CrossWalkCentral.Net (Webmaster) [mailto:[EMAIL PROTECTED]] Sent: 03 August 2001 02:38 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP redirect? I got it to work Thanks to Dave Watkinson however I do have another question. If I redirect to another page will I be able to pass the variable from the form to it as well? here i my layout. From passes 6 variables to my php redirect if they sletect option 2 the the value is 12 redirecting to annother php file where i will need that value of 12. Dave Watkinson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ? if $option_button == 1) { header(Location: some_page_or_other.php); } else { header(Location: some_other_page_you_choose.php); } ? that's all you need - make sure the form on the previous page has two radiobuttons, each with the same name of option_button and each has a value - one is 1 and the other is 2. HTH :-) Dave -Original Message- From: Webmaster [mailto:[EMAIL PROTECTED]] Sent: 02 August 2001 04:45 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP redirect? I have a form and based off of this form if my user selects option a then I want them to be redirected to another page. If they select option B then I want to continue with my php scrips as it does now. Does any one have any ideas on how I can accomplish this? -- 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] Trouble with PHP/MYSQL/APACHE
looks like your include path and/or file don't exist. Double check that colon before /usr - surely that's incorrect? The undefined function is probably because the include file can't be found. Dave -Original Message- From: Al Moote [mailto:[EMAIL PROTECTED]] Sent: 02 August 2001 20:06 To: PHP Mailing List Subject: [PHP-DB] Trouble with PHP/MYSQL/APACHE I apologize in advance if my question seems tedious. I am trying to use PHPNuke (http://www.phpnuke.com) but after I install as per the instructions, I get an error when trying to access http://mydomain.com/admin.php that reads: *** Warning: Failed opening 'themes/NukeNews/theme.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/header.php on line 42 Fatal error: Call to undefined function: themeheader() in /var/www/html/header.php on line 53 *** This is a specialized issue, but I hope that other PHPNuke admins are out there. Regards, Alan Moote SysAdmin -- 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] UPDATE Not Updating
Isn't PHP/MySQL case sensitive? Are all the column names the correct case? You could also try changing your die bit to or die (mysql_error()); that will echo the MySQL error message. HTH! Dave -Original Message- From: Steve Fitzgerald [mailto:[EMAIL PROTECTED]] Sent: 01 August 2001 22:25 To: [EMAIL PROTECTED] Subject: [PHP-DB] UPDATE Not Updating I belive this UPDATE should work, but it isn't. I get no errors. I have also tried using FieldName= '$Fieldname', but that does not seem to work either. $table_name = contacts; $update_contact_sql = UPDATE $table_name SET FirstName =\$FirstName\, LastName = \$LastName\, Title = \$Title\, WorkPhone = \$WorkPhone\, HomePhone = \$HomePhone\, Mobile = \$Mobile\, EmailName = \$EmailName\, Birthday = \$Birthday\ WHERE ContactID = \$ContactID\ ; $result = @mysql_query($update_contact_sql, $connection) or die (Couldn't execute query.); -- 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] Limit Select Field Characters?
$fulldate = date(dmy); echo $fulldate; -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 01 August 2001 23:34 To: PHP-DB Subject: [PHP-DB] Limit Select Field Characters? I have a timestamp field that looks like this 0109011754 but I only want to compare 010801 when doing a SELECT. Is there a way I can do this? Thanks. Jeff Oien -- 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 redirect?
? if $option_button == 1) { header(Location: some_page_or_other.php); } else { header(Location: some_other_page_you_choose.php); } ? that's all you need - make sure the form on the previous page has two radiobuttons, each with the same name of option_button and each has a value - one is 1 and the other is 2. HTH :-) Dave -Original Message- From: Webmaster [mailto:[EMAIL PROTECTED]] Sent: 02 August 2001 04:45 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP redirect? I have a form and based off of this form if my user selects option a then I want them to be redirected to another page. If they select option B then I want to continue with my php scrips as it does now. Does any one have any ideas on how I can accomplish this? -- 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] replace string - case insensitive
go to http://www.php.net/eregi_replace hth Dave -Original Message- From: J- E- N [mailto:[EMAIL PROTECTED]] Sent: 28 July 2001 15:41 To: [EMAIL PROTECTED] Subject: [PHP-DB] replace string - case insensitive hello str_replace is case sensitive, what function should i use for case insensitive. thanks very much. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Finding NoMatches in MySQL
Hi all During the process of importing a lot of Oracle data into MySQL, I have two tables that are giving me a bit of a headache. One is a list of jobs and the other is a list of employers. There's now a unique id for each table, and the job table also has a column called id1, which *should* correspond to employers.uid. With me so far? Well, the problem is that there were loads of duplications in the employers table, and after deleting the duplicates some of the jobs.id1 records now point to non-existing records. How do I do a query that does something like this... select jobs.uid from jobs where jobs.id1 not in employers.uid ??? many thanks in advance! Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Retrieving Rows - Can I Change The Order?
Hi all I think this should be a nice easy one... I get a select * query, then I start checking what values are in certain columns for a given row. Usually I do something like if ($row[3] == 1) { // do something } else { // do something else } OK - nice and easy. Now then, I have changed a column in the table, and the only way I found to change a data type is to delete the offending column and then add it again. When I do the select now the new column, which was at $row[3] is now always $row[39]. I don't mind this, because I know where it is, but is there any way I can make it appear at $row[3] again? I'm sure you can imagine when there are quite a few pages using this code it's easier to reorder the columns in the select than to change all my if() codes! By the way, I know I can be explicit by SELECTing each column by name, but I'ds rather use a SELECT * fror this partucular instance. Any ideas? Or am I just being lazy (it's been a long night after all!)? TIA Dave -- 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] Re: simple database question
Oops sorry I keep assuming this is a MySQL/PHP list! D'oh! Dave -Original Message- From: Brian Weisenthal [mailto:[EMAIL PROTECTED]] Sent: 26 July 2001 15:08 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: simple database question oh, using ms sql Brian Weisenthal [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ok this should be an easy one, i am just blanking on it here. i want to link two tables together, a user table and address table. i create the user entry first, then create the address entry. after creating the address entry how do i get the auto_id that was entered in to enter it into the user table? there is no unique field in the address table. any ideas? -- 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] Now, I have new problem!!
Hi Tony Don't know if you got any feedback on this, but I would crate a form on the HTML page with an input type (say a dropdown list) with the name of, for example, itemnumber. The code could be something like this... form method=post action=inventory.php select name=itemnumber option value=9845Item description/option option value=9846Item description/option option value=9847Item description/option etc /select /form then in inventory.php you can retrieve the value of the variable $itemnumber to see which item was selected. Hope this helps! Dave -Original Message- From: Tony [mailto:[EMAIL PROTECTED]] Sent: 22 July 2001 03:13 To: [EMAIL PROTECTED] Subject: [PHP-DB] Now, I have new problem!! My server has a cgi-local bin, where all of my cgi scripts have to be stored in there. When I input the script into my regular html pages, it doesn't work. This is the script that I am using and saved as inventory.php, ?php $link = mysql_connect(,x,x) or die (Could not connect); if (! @mysql_select_db(x) ) echo( PUnable to locate the inventory . database at this time./P ); exit();} $itemx = 9846; $sql = SELECT quantity FROM inventory WHERE item = '$itemx'; $result = mysql_query($sql,$link); $row = mysql_fetch_array($result); $num = $row[quantity]; if ($num 1) { echo bfont color=\#FF\Out of Stock/font/b; } else { echo bfont color=\#FF\In Stock/font/b; } mysql_close($link); ? How can I connect from my html page with known value of $itemx = to this scrip(inventory.php), and get result back on to my html page with words In Stock or Out of Stock? Can anybody help me please? Thanks for your time again. Tony -- 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]