Re: [PHP-DB] Alter Table / ADD col_name
Many thanks. regards keith Miles Thompson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Keith, You're building it upside down! If your design relies on adding columns to store data you will quickly run out of columns. More typically when you submit data you add a row of information to a database, not another column. Database design and normalization are topics which are too big to cover in an email, but there are a number of helpful tutorials. This one is pretty decent: http://www.devshed.com/Server_Side/MySQL/Normal/Normal1/page1.html The author describes both why data has to be normalized and how that is done. An internal link points to another article which helps you determine what to include in the tables. If the above doesn't suite, Google will return a slew of hits on sql tutorial normalization. I hope this will be helpful - Miles Thompson At 02:13 PM 1/17/2002 +, Keith Webb wrote: Ok i'm new to this stuff so maybe someone can give me a quick pointer on this one. I want to add a new column / Field with the date to a database every time the submit button is clicked. PHP doesn't seem to support the ALTER TABLE command from mysql or the ADD command. Is there a way to do this? Or am I building this upside down so to speak!!! thanks keith -- 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] OCI8
On Thu, Jan 17, 2002 at 01:20:47PM -0700, Randall Barber wrote: I've been using the OCI8 extension and have a question about the Persistent Connections. While debugging the site, I will run into the following error (paraphrased): BeginSession: too many processes running etc... I have my scripts setup in the following way: ?php OCIPLogon(...); stuff ? I never do call OCILogOff(...) explicitly. I may misunderstand, but I thought when a call to a persistent connection is made, it will first look for an open session and use it. Otherwise, it creates a new one. This correct? yes. What causes this overload of sorts? Is it PHP or Apache? when using persustent connections you will at one point have as many db-connections as you have httpd processes. so to limit the no. of connections to your DB you have to set MaxClients in httpd.conf. i'mn ot to sure about the windows stuff here - does it work when using OCILogin instead of OCIPlogon? tc Win2k Apache 1.3.20 PHP 4.1.0 Thanks in advance for your help RDB -- 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] 1 query or 2 queries
I have a page that displays a book and some of its chapters (not all chapters are recorded) and I want to do a layout like this: ISN: 012345678X Book Title: A Christmas Carol Book Author: Dickens, C. Publisher:Victorian Press Year: 1934 Dickens, C Chapter One:title 1-33 Last sold for 5p per page Digitised Dickens, C Chapter Two:title34-43 Last sold for 5p per page Digitised Dickens, C Chapter Three:title 44-63 Not Cleared Not Digitised Dickens, C Chapter Six :title 92-114 Last sold for 5p per page Digitised Now, I know I could do 2 queries, 1 against the book table and the other against the chapter table. Would it be possible and if so more efficient to combine them into a single query and still be able to display in this way? MTIA George in Edinburgh (data is fictional in more ways than one) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] 1 query or 2 queries
Yes, Do a join on the two tables and only pull the book data from the first record. -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 18, 2002 1:37 PM Subject: [PHP-DB] 1 query or 2 queries I have a page that displays a book and some of its chapters (not all chapters are recorded) and I want to do a layout like this: ISN: 012345678X Book Title: A Christmas Carol Book Author: Dickens, C. Publisher:Victorian Press Year: 1934 Dickens, C Chapter One:title 1-33 Last sold for 5p per page Digitised Dickens, C Chapter Two:title34-43 Last sold for 5p per page Digitised Dickens, C Chapter Three:title 44-63 Not Cleared Not Digitised Dickens, C Chapter Six :title 92-114 Last sold for 5p per page Digitised Now, I know I could do 2 queries, 1 against the book table and the other against the chapter table. Would it be possible and if so more efficient to combine them into a single query and still be able to display in this way? MTIA George in Edinburgh (data is fictional in more ways than one) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] 1 query or 2 queries
Yes you can do that (that's what relational databases are all about). To join the two tables and fetch the data you need in a single query you would do something like this: SELECT Book.*, Chapter.* FROM Book, Chapter WHERE Book.BookTitle = Chapter.BookTitle Where BookTitle is whatever common element or key you have in both tables (this may be the title of the book, or a book ID, etc) - Patrick - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 18, 2002 8:37 AM Subject: [PHP-DB] 1 query or 2 queries I have a page that displays a book and some of its chapters (not all chapters are recorded) and I want to do a layout like this: ISN: 012345678X Book Title: A Christmas Carol Book Author: Dickens, C. Publisher:Victorian Press Year: 1934 Dickens, C Chapter One:title 1-33 Last sold for 5p per page Digitised Dickens, C Chapter Two:title34-43 Last sold for 5p per page Digitised Dickens, C Chapter Three:title 44-63 Not Cleared Not Digitised Dickens, C Chapter Six :title 92-114 Last sold for 5p per page Digitised Now, I know I could do 2 queries, 1 against the book table and the other against the chapter table. Would it be possible and if so more efficient to combine them into a single query and still be able to display in this way? MTIA George in Edinburgh (data is fictional in more ways than one) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
[PHP-DB] Resource id #2 ?
I run this query $countreq = mysql_query(SELECT COUNT(*) FROM catalogs WHERE PROCESSED IS NULL); then try to echo $countreq but end up getting Resource id #2 instead of the count total. What would cause this? Thanks for any advise! James -- 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] Quotes in db fields
Hi there.. Just wondered why some of my db fields are getting chopped wherever an occurrence of a quote () is. I used the stripslashes() function before saving them. would this be why? Do quotes need slashes in front of them when stored/being written in the db? Maybe I should use stripslashes only when I am outputting the fields to the web pages Note: I started to use stripslashes because I was getting many slashes in front of any quotes the number of slashes doubled each time the form was previewed... -- Faye Keesic Computer Programmer Analyst/Web Page Design -- 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] Recalculation ?
Hi All, I have create a page to calculate qtys and show totals. This works fine, except that I change a qty the change is not registered and calculate from the old value. I am using sessions and have try a loop of if($qty == $qty){ than calc stuff here} else{ session_unset($qty); session_register($qty); calc stuff here } And have tried other ways but to no avail. Can someone throw any light on this. As always any help is appreciated. Dave C -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How can recommend a book for SQL and DB design
I always recommend: MySQL by Paul Dubois for the MySQL side and Database Design for Mere Mortals for db design (it's better than the title might sound). Very good in fact. c -- Chris Lott http://www.chrislott.org/ -- 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] strange link problem to a database item
In my code I have the following line: printf(td align=\center\a href=\%s\ img src=\.xvpics/%s\/a/td\n, $row[name], $row[name]); When I view this web page I get I get, in- konqueror - all thumb images are fine netscape 6 - no thumb images, just a narrow verticle bar opera 6 - a rectangle with the word image in it I tried from work on an nt machine and got broken image icons. I have verified all browsers are set to show all images. When I right-click and hit show image, so I would view the thumb itself, I don't get the image, instead I get the text url to the image. I've included the full code below. Any ideas what the cause might be? -- Chip W Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. = html head titleChips Pics/title /head body table summary= border=0 align=center cellpadding=5 cellspacing=5 tr ? $pic = (int) $pic; if(! isset($pic)) { $pic = 0; } $new_pic=$pic+24; $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $num = mysql_query(select count(*) from misc) or die(mysql_error()); $sql=select * from misc limit $pic,24; $result=mysql_query($sql) or die (The query didn't work, oops); if (mysql_num_rows($result) == 0) { echo tr\ntd colspan=\6\ align=\center\\nfont size=\+2\Oops, you've reached the end of the line.\nbr\na href=\../index.html\Home/a/font; } else { while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; echo tr\ntd colspan=\6\ align=\center\\nThere are .mysql_result($num,0,0). pics in the database/td\n/tr\n; } ? /table /body /html -- 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] php/msql
Hi, I have the following code: while ($row = mysql_fetch_array($result)) { echo trtd.$row[0]./td\n; echo td.$row[1]./td\n; $formatted=sprintf($%s,$row[2]); echo td $formatted /td/trbr; } I get an error in the last line where I want to put $formatted into the last cell of a table if I // echo $formatted without the HTML tags it puts it at the top of the page. The error is : Parse error: parse error, expecting `','' or `';'' also: what does the \n mean at the end of the html tags? I am new to PHP and have no seen that before. Thanks. Mike -- 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/msql
Mike wrote: Hi, I have the following code: while ($row = mysql_fetch_array($result)) { echo trtd.$row[0]./td\n; echo td.$row[1]./td\n; $formatted=sprintf($%s,$row[2]); echo td $formatted /td/trbr; } I get an error in the last line where I want to put $formatted into the last cell of a table if I // echo $formatted without the HTML tags it puts it at the top of the page. The error is : Parse error: parse error, expecting `','' or `';'' also: what does the \n mean at the end of the html tags? I am new to PHP and have no seen that before. Thanks. Mike -- 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] strange link problem to a database item
Hello again. On 2002.01.18 18:48:36 -0600 chip wrote: In my code I have the following line: printf(td align=\center\a href=\%s\ img src=\.xvpics/%s\/a/td\n, $row[name], $row[name]); Ok. So the name field in your table holds the filename of the image and you have a thumbnail image by the same name in the .xvpics folder? What does the html source look like in your browser? If you type the url for the image into the browser address bar directly do you get the image? -Steve When I view this web page I get I get, in- konqueror - all thumb images are fine netscape 6 - no thumb images, just a narrow verticle bar opera 6 - a rectangle with the word image in it I tried from work on an nt machine and got broken image icons. I have verified all browsers are set to show all images. When I right-click and hit show image, so I would view the thumb itself, I don't get the image, instead I get the text url to the image. I've included the full code below. Any ideas what the cause might be? -- Chip W Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. = html head titleChips Pics/title /head body table summary= border=0 align=center cellpadding=5 cellspacing=5 tr ? $pic = (int) $pic; if(! isset($pic)) { $pic = 0; } $new_pic=$pic+24; $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $num = mysql_query(select count(*) from misc) or die(mysql_error()); $sql=select * from misc limit $pic,24; $result=mysql_query($sql) or die (The query didn't work, oops); if (mysql_num_rows($result) == 0) { echo tr\ntd colspan=\6\ align=\center\\nfont size=\+2\Oops, you've reached the end of the line.\nbr\na href=\../index.html\Home/a/font; } else { while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; echo tr\ntd colspan=\6\ align=\center\\nThere are .mysql_result($num,0,0). pics in the database/td\n/tr\n; } ? /table /body /html -- 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] strange link problem to a database item
On Friday 18 January 2002 08:09 pm, Steven Cayford banged out on the keys: Hello again. On 2002.01.18 18:48:36 -0600 chip wrote: In my code I have the following line: printf(td align=\center\a href=\%s\ img src=\.xvpics/%s\/a/td\n, $row[name], $row[name]); Ok. So the name field in your table holds the filename of the image and you have a thumbnail image by the same name in the .xvpics folder? What does the html source look like in your browser? If you type the url for the image into the browser address bar directly do you get the image? -Steve In Konqueror it works, but when I enter the path into netscape and opera as suggested it does not work. I even made a differant directory, called thumbs, and copied the thumb-nail images into it and got the same results. I don't understand why Konqueror will display them but the other browsers will not. I was using the .xvpics folder because it was already made by XV, so why make another? Just seemed simpler. Doesn't PHP have a way of making thumbs from the larger images dynamically? Seems like I'd seen something about this somewhere... -- chip When I view this web page I get I get, in- konqueror - all thumb images are fine netscape 6 - no thumb images, just a narrow verticle bar opera 6 - a rectangle with the word image in it I tried from work on an nt machine and got broken image icons. I have verified all browsers are set to show all images. When I right-click and hit show image, so I would view the thumb itself, I don't get the image, instead I get the text url to the image. I've included the full code below. Any ideas what the cause might be? -- Chip W Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. = html head titleChips Pics/title /head body table summary= border=0 align=center cellpadding=5 cellspacing=5 tr ? $pic = (int) $pic; if(! isset($pic)) { $pic = 0; } $new_pic=$pic+24; $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $num = mysql_query(select count(*) from misc) or die(mysql_error()); $sql=select * from misc limit $pic,24; $result=mysql_query($sql) or die (The query didn't work, oops); if (mysql_num_rows($result) == 0) { echo tr\ntd colspan=\6\ align=\center\\nfont size=\+2\Oops, you've reached the end of the line.\nbr\na href=\../index.html\Home/a/font; } else { while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; echo tr\ntd colspan=\6\ align=\center\\nThere are .mysql_result($num,0,0). pics in the database/td\n/tr\n; } ? /table /body /html -- 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] -- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- 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] Variable search help still needed - sorry :-(
Hi there, I know this is probably a REALLY simple problem, but I can't get this to work. I need to get it to cycle through each word and do a search, I used this as sent from Beau Lebens (Thank you) but I can't get it to work. It works on 1 word querie but if I enter more than 1 it says can't execute query, please help and tell me what i'm doing wrong :-) Thank you so much. Regards Chris www.planetoxygene.com - $words = explode( , $test); // create connection $connection = mysql_connect(Localhost,!!!,!!!) or die(Couldn't make a connection.); // select database $db = mysql_select_db(tas, $connection) or die(Couldn't select database.); $sql = SELECT distinct description, email, url, country, category, type, rating from search6 WHERE ; foreach ($words as $word) { $sql .= description LIKE '%word%'; } $sql .= AND category = '$category' AND country = '$country' AND type = '$type' ORDER BY description; $sql = mysql_query($sql,$connection) or die(Couldn't execute query.);
RE: [PHP-DB] strange link problem to a database item
In my code I have the following line: printf(td align=\center\a href=\%s\ img src=\.xvpics/%s\/a/td\n, $row[name], $row[name]); When I view this web page I get I get, in- konqueror - all thumb images are fine netscape 6 - no thumb images, just a narrow verticle bar Can you make this available somewhere to look at? c -- Chris Lott http://www.chrislott.org/ -- 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] Variable search help still needed - sorry :-(
On Saturday 19 January 2002 13:11, Chris Payne wrote: Hi there, I know this is probably a REALLY simple problem, but I can't get this to work. I need to get it to cycle through each word and do a search, I used this as sent from Beau Lebens (Thank you) but I can't get it to work. It works on 1 word querie but if I enter more than 1 it says can't execute query, please help and tell me what i'm doing wrong :-) Anytime you're putting a query to a db and you're not getting the results expected you should echo the query to see what you're actually sending to the db. You could also copy and paste the query into the mysql-client to see what pops out. $words = explode( , $test); // create connection $connection = mysql_connect(Localhost,!!!,!!!) or die(Couldn't make a connection.); // select database $db = mysql_select_db(tas, $connection) or die(Couldn't select database.); $sql = SELECT distinct description, email, url, country, category, type, rating from search6 WHERE ; foreach ($words as $word) { $sql .= description LIKE '%word%'; You should probably be using: $sql .= description LIKE '%word%' OR ; # note the spaces } After the foreach loop you need to remove the trailing OR . That is you need to remove the last 3 characters from $sql. $sql .= AND category = '$category' AND country = '$country' AND type = '$type' ORDER BY description; This would be a good place to: echo(The query is $sqlbr); $sql = mysql_query($sql,$connection) or die(Couldn't execute query.); hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Why must you tell me all your secrets when it's hard enough to love you knowing nothing? -- Lloyd Cole and the Commotions */ -- 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]