Re: [PHP-DB] INSERT into 2 different tables??
Just wana ask is it possible to have only one form and when i submit, it should INSERT data into 2 diff tables?? Hope u get my idea... It is possible. You just need to do 2 single inserts to one to each table. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: php mail() question
What does this do? Well I added PRE and /PRE for a testing purpose. It returns in the textarea PRE/PRE ... So it's skipping the HtmlSpecialChars code. Why? Change this: echo textarea name='headers' cols='250' rows='5'PRE,HtmlSpecialChars($headers[$line]),/PRE/textarea'; For echo textarea name='headers' cols='250' rows='5'PRE.HtmlSpecialChars($headers[$line])./PRE/textarea'; Which should display. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/DB speed
On 56K the page would probably either 1) timeout on the way you have it currently or 2) only display part of the page/form and not read the whole page correctly. I dunno give us the URL, I am sure someone is on dialup to give it a wurl. Try the url with web analyzer http://www.websiteoptimization.com/services/analyze/ This is by far the most useful dev tool I have found recently. Saves touching dial ups for testing.. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PhpmyAdmin from external computers
However, when i connect to that computer from my windows computer and go to the phpmyadmin url it wont let me do anything. Ive set all the priveleges to allow full access in every way, but it still wont let me access it What error do you get? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PhpmyAdmin from external computers
I goto http://serverIP/phpmyadmin/index.php - and it logs me inautomatically as localhost, i can see the database lists on the side panel etc. I click on a database or create a new database and the login screen comes up. I try entering the root password and username, but it just comes up with : #1045 - Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) and ive tried with a blank password as well. I have the auth_type in config.inc.php (PhpMyAdmin) set to 'config' and the username and password for mysql is in their respective places. Logging in as root with no password remotely is not good. Try making another user logged in locally with user and password, then try that from remote. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] faster imagecreatefromjpeg
on 17/10/03 3:57 pm, Georgescu Vlad at [EMAIL PROTECTED] wrote: i need to replace the using of imagecreatefromjpeg($jpgpath) with something more faster PS: the image to load has: 198 MB (208,603,887 bytes) Why not resize the image using photoshop first? Any app resizing 200Mb images are going to take ages. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] UPDATE part of a column
on 23/9/03 1:03 pm, Shaun at [EMAIL PROTECTED] wrote: 1. How can I clean the table, so for example changing: Ashfield Business CentreBR The Idlewells PrecinctBR Sutton-in-AshfieldBR to: Ashfield Business Centre, The Idlewells Precinct, Sutton-in-Ashfield, 2, Is there a way to make sure the data is 'clean' before entering into the table? Do something like this: $pagetext=ereg_replace( BR, ,$pagetext); To strip the BRs -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $PHP_SELF does not work with all browsers
on 15/9/03 1:46 pm, Alain Barthélemy at [EMAIL PROTECTED] wrote: http://localhost/~webpage/?chosenLettre=65 /// where is $PHP_SELF Try using $_SERVER['PHP_SELF'] -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Populating an array from mysql db
I have a course booking system that allows the client to add courses and then specify how long they run for. The admin system I have built allows the client to add up to 30 dates for each instance of the course and these are adding to a database row in the form date1, date2, date3, daten etc. What I am trying to achieve now is to extract this data into an array so I can count how many dates have been added and to display the dates. If the course runs for eg. 2 days - values of date1 and date2 would be populated as date1=2003-09-01, date2=2003-09-02 - all other dates would be default to -00-00 and I wish to ignore these. I'm trying to work out how to set up a loop to extract positive dates from my db so I end up with $bookdate[0] = '2003-09-01'; $bookdate[1] = '2003-09-02'; etc Can anyone provide me with some help in this extraction? Thanks in advance. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Populating an array from mysql db
on 28/8/03 1:09 pm, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: I'd worry about the empty dates after. and use something like. $qry = select date1, date2 from table; $result = mysql_query($qry) or die(mysql_error()); while ($rs = mysql_fetch_row($result)) { //this array could be built a number of ways, one is $bookdate[] = array($rs[0],$rs[1]); } if i've not misunderstood, that should work Thanks for this - I ended up rehashing my query to this: ? $result = mysql_query(SELECT * FROM dates WHERE bookcode = '$bookcode' ORDER BY date1,$db); // loop to populate array $myrow = mysql_fetch_array($result); $i = 1; while ($i = '30') { if ($myrow['date'.$i] '-00-00') { $bookdate[]=$myrow['date'.$i]; } $i++; /* the printed value would be $i before the increment (post-increment) */ } //end loop $result2 = count ($bookdate); if ($result2 == 0) { echo pThis course booking runs for 0 days/pp; } else if ($result2 == 1) { echo pThis course booking runs for b1/b day on the following date:/Pp; } else { echo pThis course booking runs for b$result2/b days on the following dates: /pp; } function print_dates ($bookdate) {foreach ($bookdate as $display_date) { $date = $display_date; $dv[0] = substr($date, 8, 2); $dv[1] = substr($date, 5, 2); $dv[2] = substr($date, 0, 4); $display_date = implode (-,$dv) ; print(span class=\divider\$display_date/spanbr); } } print_dates($bookdate); ? Which does what I need. The tricky bit was the //loop cheers -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Populating an array from mysql db
on 28/8/03 5:00 pm, CPT John W. Holmes at [EMAIL PROTECTED] wrote: Thanks for this - I ended up rehashing my query to this: ? $result = mysql_query(SELECT * FROM dates WHERE bookcode = '$bookcode' ORDER BY date1,$db); // loop to populate array $myrow = mysql_fetch_array($result); $i = 1; while ($i = '30') { if ($myrow['date'.$i] '-00-00') You're making PHP do some extra work here. You're testing to see if one string is greater than another... how can strings be greater than or less than? Why don't you just check for $myrow['date'.$i] != '-00-00' ?? Thanks. I'll make your change. Ta. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] a bandwitch question
on 5/8/03 12:20 pm, JeRRy at [EMAIL PROTECTED] wrote: So top frame loads: http://localhost/blah.php And the bottom frame loads: http://www.getpaid2reademails.com/ (example) Now does the localhost generate the bandwitch for that visit from the bottom frame aswell or only the top frame? They are separate. Localhost knows nothing about the bottom frame as it is only loaded by the frameset when it is client side. It behaves the same way as if you had 2 browser windows open pulling in the two URLs. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] osCommerce - which merchant service/payment gateway?
on 17/7/03 3:07 pm, Becoming Digital at [EMAIL PROTECTED] wrote: I'm sorry for going slightly off-topic, but I'm sure many of you have experience with this issue. Every shopping cart *does* use a database, after all, and I'm sure someone else will find this useful, too. Thanks a lot. http://www.protx.com/ provide a gateway for oscommerce. Its in the contributions section. Easy to install and the cheapest gateway we;ve seen. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Accessing MySql using Flash while using PHP as themiddleware
on 25/6/03 4:15 pm, Ron Allen at [EMAIL PROTECTED] wrote: Does anybody have an idea how-to use Flash and PHP to access a MySql database. I know how to use PHP and mysql with no problem to pull info, but with Flash I am struggling. Look on flashkit.com -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ideas for Affiliate Program.....
on 24/6/03 4:59 pm, Kieu D. Trang at [EMAIL PROTECTED] wrote: Have anyone ever done anything similar and have other suggestions? I am working on it, but is still looking for better ways of doing it... thanks in advance.. You want to look on sourceforge for a project called php affiliate. I think that should save you some time ;-) -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Selecting unique values from a db
Being thick today: How do I select unique values from a table? Eg I have a image upload script that writes the name of the file to a db when it uploads. As we may need to upload the image several times, my db is full up with several rows with same titles.. Eg: img db id | title | short-title | - 1 | pie.jpg | pie | 2 | pie.jpg | pie | 3 | pie2.jpg| pie2| _ How do I get results as SELECT * FROM img WHERE ?? ORDER BY title Results - 1 | pie.jpg | pie | 3 | pie2.jpg| pie2| _ Many thanks/ mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Selecting unique values from a db
on 18/6/03 12:20 pm, John W. Holmes at [EMAIL PROTECTED] wrote: Not really a PHP question... This is a php db list though. SELECT DISTINCT title FROM ... Thanks for this. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] hiding db password
on 12/6/03 3:31 pm, Sallee, Helen at [EMAIL PROTECTED] wrote: ?php putenv(TWO_TASK=ORCL2); putenv(ORACLE_HOME=/u01/home/oracle/product/9.2.0); $conn = OCILogon(USER1,USER1PASS); $query = OCIParse($conn,select * from state); OCIExecute($query); ? Thank you Use an include file buried below your site root with $user=USER1; $pass=USER1PASS; Then you should be able to do: Include/path/to/pass.inc.php; snip $conn = OCILogon($user,$pass); Which is more secure. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] hiding db password
on 12/6/03 3:48 pm, CPT John W. Holmes at [EMAIL PROTECTED] wrote: From a web server perspective, though, this is safer because if the web server ever broke and started serving PHP pages as plain text (been there, done that), then at least no one can get to your include file through your web server. That is what I meant by more secure. Putting files below webroot prevents webusers from getting at them. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Posting the results of a query to an email
Hi, I have been building up a store which now has catalogue and persistant shopping cart which I now want to submit the results (the order) to an email for processing. I have a mysql db called 'cart' that holds: Cart_id, cookie_id, item_id, and quantity. I have a 'products' table which contains: item_id, item_code, item_title, item_price etc. I want to select item_code, qty from cart where cookie_id = $_COOKIE[cartId] //the above select needs work And then email these to the client which I would do using php's mail function. I'm currently trying to work out how to extract the contents of the cart, convert the item_id to its item_code from products and then dump the results to an email.. Can anyone provide me with some help in where to start. thanks -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Posting the results of a query to an email
on 11/6/03 4:09 pm, mike karthauser at [EMAIL PROTECTED] wrote: I want to select item_code, qty from cart where cookie_id = $_COOKIE[cartId] //the above select needs work And then email these to the client which I would do using php's mail function. Partially answering my own question: $result = mysql_query(select ITEM_CODE, ITEM_TITLE from cart inner join products on cart.item_id = products.ITEM_ID where cart.cookie_id = ' . GetCartId() . ' order by products.ITEM_TITLE asc, $db); This then gives me a result set. What would be the best way to extract the results to an emailable format, given that there could be one or many items in the cart table? Thanks -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Including Details in MySQL longer than 255 characters
on 20/3/03 6:11 pm, Adam Venturella at [EMAIL PROTECTED] wrote: Anyway if someone could point me in the right direction I would be very appreciative. Change your column type to TEXT rather than varchar(255) -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variable with previous next
on 19/3/03 9:32 am, Achieve IT at [EMAIL PROTECTED] wrote: $company_name = $HTTP_POST_VARS['company_name']; You also need $address_region = $HTTP_POST_VARS['address_region']; Else you arent going to be able to pick up the variable or its value. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Does Php support Flash files ?
on 18/3/03 8:44 am, rajni arya at [EMAIL PROTECTED] wrote: Does PHP supprots Flash files on Open BSD platform ? Is that flash as in macromedia? What do you want PHP to do to the files? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Does Php support Flash files ?
on 18/3/03 11:19 am, rajni arya at [EMAIL PROTECTED] wrote: Actually i want to use animated gif file but php doesn't support gif files so, i thought of replacing it with flash file. yes, fash is as in macromedia with extenstion of .swf. For what though? Are you wanting to create it on the fly or are you looking to link to it in the PHP? You can link flash to php and import variables using action script. I am unsure what you are trying to achieve as your questions are a little vague. Plus this is a database list. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't Understand
on 12/3/03 12:01 pm, Snijders, Mark at [EMAIL PROTECTED] wrote: on www.marksnijders.com and www.nederlandmobiel.nl i use those scripts (php and the GD functions ) for automatically changing the file size... Yeah but GD's server side... Unless they have something installed on their client machine then you're going to have to do it server side. Your script will upload and then resize. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to page results?
We've been working on a news section for our site which allows us to find news stories - dump them in a mysql db, list the summaries in a page and then link to a full version of the story. The bit i'm having trouble with is how to list the results so we can set up multi pages of content and link them via a simple Previous | 1 2 3 4 5 | Next type of scenario. I got a query thus $result2=mysql_num_rows($result); to count our results. Does anyone have any pointers on what to do next? Cheers mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SESSIONS
on 26/2/03 12:58 pm, MaN at [EMAIL PROTECTED] wrote: And also use $_POST[SUBMIT] or set register_globals On Just use $_POST[SUBMIT] register_globals was turned off for security reasons. You are compromising the security of your system if you turn it back on. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] preventing page from resubmitting when refreshing page
I have a page that has a form on the first part that posts to itself and dumps the contents of the form into a database. All this is well and good - I'm using if ($_POST['submit']) { } to detect the submission and everything is doing as it should. Thing is if you refresh the page that displays the results it then posts to the database again. I've tried some error trapping but in the same way the page hold the post variables it just redoes what it has done rather than re running the script. Is there something i can do on browser refresh to prevent this or prevent my mysql database from duplicating the records? any help would be appreciated. cheers mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] keyword search a mysql database.
on 18/12/02 5:47 pm, Adam Voigt at [EMAIL PROTECTED] wrote: $searchstring = $_POST[searchfor]; $searchstring = str_replace( ,%,$searchstring); mssql_query(SELECT id FROM table WHERE field LIKE '$searchstring';); I've modified my query to $result = mysql_query(SELECT coursecode, title FROM courses WHERE title LIKE '$tsearch' ORDER BY title,$db); Where $tsearch is my search string. I'm not getting any results from this though What i am trying to achieve is to look in title and produce a result if the string appears. so searching for 'Training Course will find results like Training Course 1 Training Course 2 Training Course n, etc. Is LIKE the best way to do this or should i be using wildcards? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] keyword search a mysql database.
I'm looking for tips and tricks in how to approach building a keyword search over an number of fields in a courses database. I know how i can search for one word at a time, but i am not sure on how i would approach searching via a defined string. Anyone got any good pointers for doing this/ or some tutorial that i can read though? Thanks.. BTW kettles on if anyone wants a brew.. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] CMS error
I have a field in a news CMS that could contain Infact most of the time it does in the form of URL's etc. Getting the data initially into the database is no problem - Infact MySQL shows has no toruble with it. The problem i am getting is when i edit the data - basically loading into a form - textarea. The data displays everything after the first appears but in a small textarea. I have looked at addslashes() which insnt apropriate in this instance as the text area has no problem with the slashes. Is there an equivalent for or am i worth substituting them for a character when i load them into my edit field. I can imagine this is a common probem in CMS - any suggestions on a quick fix..? cheers mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CMS error
on 16/12/02 5:15 pm, mike karthauser at [EMAIL PROTECTED] wrote: I have a field in a news CMS that could contain Infact most of the time it does in the form of URL's etc. Getting the data initially into the database is no problem - Infact MySQL shows has no toruble with it. The problem i am getting is when i edit the data - basically loading into a form - textarea. The data displays everything after the first appears but in a small textarea. I have looked at addslashes() which insnt apropriate in this instance as the text area has no problem with the slashes. Is there an equivalent for or am i worth substituting them for a character when i load them into my edit field. then you find the answer. HTMLSpecialChars(). very handy. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] limiting field extraction to 40 characters
If i try the below in my query i get no results. Ideally i would like to do this (not valid sql) ? $result = mysql_query(SELECT * FROM courses,$db); printf(select name=\coursecode\\n); while ($myrow = mysql_fetch_array($result)) { $l=$myrow['coursecode']; ?option value=?=$l;??=($_POST['coursecode']==$l)?' selected=selected':;??=$myrow['left(title,40)'];?/option? } printf(/select\n); ? on 11/12/02 5:26 pm, Peter Beckman at [EMAIL PROTECTED] wrote: LEFT(str,len) Returns the leftmost len characters from the string str: mysql SELECT LEFT('foobarbar', 5); - 'fooba' This function is multi-byte safe. select left(coursecode,40) from courses On Wed, 11 Dec 2002, mike karthauser wrote: I am using ? $result = mysql_query(SELECT * FROM courses,$db); printf(select name=\coursecode\\n); while ($myrow = mysql_fetch_array($result)) { $l=$myrow['coursecode']; ?option value=?=$l;??=($_POST['coursecode']==$l)?' selected=selected':;??=$myrow['title'];?/option? } printf(/select\n); ? to generate a html optionselect. Unfortunately a few of my course titles are really long and this effects the rendering of the optionselect making it ultra wide. Is there a way i can print only the first 40 characters of the title - even though the full title lives in the db still (it is used throughout the site)? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] limiting field extraction to 40 characters
I am using ? $result = mysql_query(SELECT * FROM courses,$db); printf(select name=\coursecode\\n); while ($myrow = mysql_fetch_array($result)) { $l=$myrow['coursecode']; ?option value=?=$l;??=($_POST['coursecode']==$l)?' selected=selected':;??=$myrow['title'];?/option? } printf(/select\n); ? to generate a html optionselect. Unfortunately a few of my course titles are really long and this effects the rendering of the optionselect making it ultra wide. Is there a way i can print only the first 40 characters of the title - even though the full title lives in the db still (it is used throughout the site)? cheers -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Enlarging tables
We have been entering data into a mysql table and it has got to id=127 and then stopped us from entering anymore data. When i built the table i must have specified the size wrong. Can anyone recommend how to fix this? regards mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Enlarging tables
on 9/12/02 2:50 pm, Aaron Wolski at [EMAIL PROTECTED] wrote: What's your table structure looks like? ++--+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-++ | id | tinyint(4) | | PRI | NULL| auto_increment | | bookcode | varchar(20) | YES | | NULL|| | coursecode | varchar(10) | YES | | NULL|| | date | date | YES | | NULL|| | title | varchar(255) | YES | | NULL|| ++--+--+-+-++ -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Enlarging tables
on 9/12/02 2:58 pm, Hutchins, Richard at [EMAIL PROTECTED] wrote: Premature clickage... Or you could use a mediumint or int. Just check the mysql manual and select the int type that suits the size of your db best. Ta. Thats working now. Thanks from a 3 week old newbie. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] reversing a date stamp
I'm using the below code as the basis for a client updateable news section.. I have variable called date which is set in the db as TIMESTAMP(6). When I print it i get the date in the reverse order YYMMDD. What would be the best way to display it in reverse based on my code below? Thanks.. snip $result = mysql_query(SELECT * FROM news,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf(strong%s/strongbr\n, $myrow[title]); printf(%s a href=\%s?id=%s\ class=\mailto\more /a [%s]p\n, $myrow[summary], $_SERVER['PHP_SELF'], $myrow[id], $myrow[date]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo pSorry, no records were found!; } /snip -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] option selected
I'm using the contents of a table to print an option list in another form to allow me to cross reference the tables in my data. ? $result = mysql_query(SELECT * FROM category,$db); printf(select name=\catcode\\n); while ($myrow = mysql_fetch_array($result)) { printf(option value=\%s\%s/option\n, $myrow[catcode], $myrow[title]); } printf(/select\n); ? Once i have selected from the drop box the variable is submitted back to my table and saved. When re-edit the data - the record already has a value for catcode which i want to reflect within the drop box - in html it would be the addition of selected=selected within the option. Are there any recommended methods of doing this? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] inserting html into mysql tables
hi, is there anything special i need to know in regards to creating a table to hold html data? I am building a CMS for a site using php and mysql. The various tables hold course information that the client wants to edit. I imagine it will be a case of dropping the cleaned html source from dreamweaver into a form box and posting it to the table. What would a good varchar(?) be for say 5K of data? cheers mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] using php4 to connect to mysql (newbie question)
hi, I'm new to php and mysql and are trying to find some tutorials that i can work through so i can get my head round connecting php4 to mysql. I have been looking in all the usual places but keep finding php3 examples and also examples using globals on.. The one i have been looking at is http://www.devarticles.com/art/1/23 All fine until it starts using globals... My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd 4.7 stable. Can anyone recommend any good tutorials for my query? thanks mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] substituting for $id with globals off (newbie)
Hi, thanks for earlier replies regarding php resources. I am currently hitting a brick wall on the script below due to my lack of understanding of php coupled with my lack of knowledge about globals. I replaced $id with $_GET['id'] in line 5 which now allows the user to reach the script to evaluate when presented with testpage.php?id=n. It now falls over when it tries to run the query part : WHERE id=$id I tried to submit this instance with $_GET['id'] in the query which also fails. In the $_GET['id'] where is the value for id now stored? Can anyone see where i have gone wrong? thanks --- my source: ?PHP $db = mysql_connect(localhost, root); mysql_select_db(bsdb1,$db); // display individual record if ($_GET['id']) { $result = mysql_query(SELECT * FROM address WHERE id=$id,$db); $myrow = mysql_fetch_array($result); printf(Name: %s\nbr, $myrow[name]); printf(Address: %s\nbr, $myrow[address]); printf(Home Number: %s\nbr, $myrow[hnum]); printf(Work Number: %s\nbr, $myrow[wnum]); } else { // show employee list $result = mysql_query(SELECT * FROM address,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf(a href=\%s?id=%s\%s/abr\n, $_SERVER['PHP_SELF'], $myrow[id], $myrow[name]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo Sorry, no records were found!; } } ? -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php