Re: [PHP-DB] strange link problem to a database item
On Friday 18 January 2002 09:39 pm, Chris Lott banged out on the keys: 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? Okay, try this: a href=http://66.114.152.128/p/public_html/; The following files are available for you to look at - index.html.txt index.tk.txt index.pickups.txt Just enter those file names after the above url to view the source code. (of course you all already know that). -- Chip 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]
Re: [PHP-DB] strange link problem to a database item
On Saturday 19 January 2002 16:06, chip wrote: On Friday 18 January 2002 09:39 pm, Chris Lott banged out on the keys: 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? Okay, try this: a href=http://66.114.152.128/p/public_html/; The following files are available for you to look at - index.html.txt index.tk.txt index.pickups.txt Just enter those file names after the above url to view the source code. (of course you all already know that). Interesting problem. It seems that your thumbnails are in an invalid format. Using Opera right-clicking on picture and selecting Image Properties reveals that the purported image dimensions are 0 x 0 pixels and Bits per pixel is also 0. Saving the thumbnail and loading into IrfanView gives an invalid header error. I think you'll have to look at re-doing your thumbnails. hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I'd love to go out with you, but the man on television told me to say tuned. */ -- 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] Breaking up an array
I am trying to break this array up so that I can display each one of these varibles independantly. What PHP function will allow me to to this?? Or what other way can I achieve this?? Thx Troy +--+---+-+-+-+ | username | Total | average | minimum | maximum | +--+---+-+-+-+ | eric |52 | 52 | 52 | 52 | | troy | 11436 | 84.7111 | 10 | 99 | | wade |38 | 38 | 38 | 38 | +--+---+-+-+-+ SELECT username, SUM(statusDuration) as 'Total', - avg(statusDuration) as 'average', - min(statusDuration) as 'minimum', - max(statusDuration) as 'maximum' from workerLogs group by username; Array ( [0] = eric [1] = eric [2] = 52 [3] = 52 [4] = 52 [5] = 52 [6] = 52 [7] = 52 [8] = 52 [9] = 52 ) Array ( [0] = troy [1] = troy [2] = 35651 [3] = 35651 [4] = 176.4900990099 [5] = 176.4900990099 [6] = 10 [7] = 10 [8] = 99 [9] = 99 ) Array ( [0] = wade [1] = wade [2] = 38 [3] = 38 [4] = 38 [5] = 38 [6] = 38 [7] = 38 [8] = 38 [9] = 38 ) -- 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 Mysql on Win32 platform
Hey. I have apache, php and mysql installed on Win32 platform. Everything works great but when I try to connect to mysql database with PHP, I get the following error: Warning: Access denied for user: 'ODBC@localhost' (Using password: YES) in c:\dev\msgv2\index.php on line 15. The line 15 contains the mysql_connect. It is using the user 'root' with password. The user exists in mysql's User table. Do I need to grant ODBC access to mysql and if I do, how do I do it? Thanks in advance. // Joni -- 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
Hi Mike 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. Welcome to our little band! Tuxedo Junction does that mean that there is a dress code on the Internet in Canada? The echo command outputs one or more strings: http://www.php.net/manual/en/function.echo.php. If you have more than one string, they must be separated with commas. Alternatively you could join the three strings together using the concatenation operator: http://www.php.net/manual/en/language.operators.string.php The \n question (newline character) is answered/illustrated in the first link above (and many other places - try throwing it into the manual's search facility). You sound as if you're just starting out. There are many PHP/MySQL tutorials on the web. Start at the host sites and check out links, otherwise chuck a few of the key words at Google. Regards, =dn -- 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] distinct - how to do
I have the following query: $query = SELECT * FROM xp_topics, xp_stories WHERE xp_topics.topicid = xp_stories.topicid AND xp_topics.artistname='Faith Hill' ORDER BY topictext DESC LIMIT 0,20; It returns the lot but a lot of doubles. I want to put a DISTINCT call the query, but if I put it after the select ( select distinct * from...) it returns nothing. How do you do a DISTINCT?
[PHP-DB] MySQL database
Hi, Could anybody explain to me how I should make a table with usernames and passwords. I want to make a site, where users can sign up and enter some values, which is stored in a different table. How do I grant the necessary acces to the tables, so users can enter values into them? Please help, Morten -- 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] distinct - how to do
At 2:28 +1300 1/20/02, Barry Rumsey wrote: I have the following query: $query = SELECT * FROM xp_topics, xp_stories WHERE xp_topics.topicid = xp_stories.topicid AND xp_topics.artistname='Faith Hill' ORDER BY topictext DESC LIMIT 0,20; It returns the lot but a lot of doubles. I want to put a DISTINCT call the query, but if I put it after the select ( select distinct * from...) it returns nothing. How do you do a DISTINCT? That's how you do it (add DISTINCT after the SELECT keyword). You must be doing something else wrong. -- 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 2002.01.18 23:00:16 -0600 chip wrote: 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 Strange. It sounds like the images themselves are in a format that only konquerer understands. Are they jpegs, gifs, pngs? Do they have the right file extensions? I don't know what else to recommend. PHP does have image manipulation functions if it was compiled with gd support. See the manual at http://www.php.net/manual/en/ref.image.php. Alternatively you can call the ImageMagick programs from your script. -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] -- 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]
Re: [PHP-DB] Variable search help still needed - sorry :-(
Hi there, I made some of the changes you said below, and when I check the query I get this: The query is SELECT distinct description, email, url, country, category, type, rating from search6 WHERE description LIKE '%word%'AND category = 'Automotive' AND country = 'Austria' AND type = 'Car Rental' ORDER BY description so to me it doesn't appear to be putting the array item in there, or am I wrong? I am confused, thanks for your help. Regards Chris 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] -- 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] distinct - how to do
Barry, Change -- xp_topics.topicid = xp_stories.topicid to--- xp_stories.topicid = xp_topics.topicid and see what your results are. Your primary selection is on xp_topics. Then add DISTINCT following your SELECT. That should do the trick - Miles At 02:28 AM 1/20/2002 +1300, Barry Rumsey wrote: I have the following query: $query = SELECT * FROM xp_topics, xp_stories WHERE xp_topics.topicid = xp_stories.topicid AND xp_topics.artistname='Faith Hill' ORDER BY topictext DESC LIMIT 0,20; It returns the lot but a lot of doubles. I want to put a DISTINCT call the query, but if I put it after the select ( select distinct * from...) it returns nothing. How do you do a DISTINCT? -- 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 database
Morten, What's your level of knowledge of both databases and PHP? Please have a look at the Introductory Tutorial (Link at the top left of www.php.net). At the end of that tutorial, which is admittedly rudimentary, there are links to more advanced ones, including ones specifically for user authentication. Regards - Miles Thompson At 06:08 PM 1/19/2002 +0100, Morten Nielsen wrote: Hi, Could anybody explain to me how I should make a table with usernames and passwords. I want to make a site, where users can sign up and enter some values, which is stored in a different table. How do I grant the necessary acces to the tables, so users can enter values into them? Please help, Morten -- 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 database
As Brian Clark just pointed out on php-general, in response to another issue ... http://www.faqts.com/knowledge_base/index.phtml/fid/51/ Some very specific refernces. You'll find what you need there. Miles At 06:08 PM 1/19/2002 +0100, Morten Nielsen wrote: Hi, Could anybody explain to me how I should make a table with usernames and passwords. I want to make a site, where users can sign up and enter some values, which is stored in a different table. How do I grant the necessary acces to the tables, so users can enter values into them? Please help, Morten -- 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] Variable search help still needed - sorry :-(
On Sat, 19 Jan 2002, Chris Payne wrote: Hi there, I made some of the changes you said below, and when I check the query I get this: The query is SELECT distinct description, email, url, country, category, type, rating from search6 WHERE description LIKE '%word%'AND category = 'Automotive' AND country = 'Austria' AND type = 'Car Rental' ORDER BY description so to me it doesn't appear to be putting the array item in there, or am I wrong? I am confused, thanks for your help. You should probably be using: $sql .= description LIKE '%word%' OR ; # note the spaces Missed this error the first time round. It should be: $sql .= description LIKE '%$word%' OR ; # note the $!! hth -- Jason Wong -- 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] Password help plz
hi guys, i'm new to php/mysql :), so plz bare with me a bit. i'm trying to figure out how to retrieve password un crypted to browser. // $result = mysql_query(SELECT * FROM auth WHERE username='$valid_user',$db); $myrow = mysql_fetch_array($result); ? form method=post action=?php echo $PHP_SELF? input type=hidden name=id value=?php echo $myrow[id]? Username:input type=Text name=username value=?php echo $myrow[username]?br Userpass:input type=Text name=userpass value=?php echo $myrow[userpass]?br Usermail:input type=Text name=usermail value=?php echo $myrow[usermail]?br Userpriv:input type=Text name=userpriv value=?php echo $myrow[userpriv]?br input type=Submit name=update value=Update information/form // i've tried this and no result... Userpass:input type=Text name=userpass value=?php echo $myrow[userpass(password('userpass'))]?br could someone plz help me out with this...tx Shelly _ Send and receive Hotmail on your mobile device: http://mobile.msn.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-DB] load data infile problem
I have a called file cats.txt which count data that were solitary of a DB Access. I need to export these data for a table 'cats' inside of a DB done in MySql. In MySql I can execute this procedure in the following way: Load data local infile gatos.txt into table gatos fields terminated by ',' enclosed by '' (Id, Nome, Raça); I need to know how I can accomplish this same operation but using PHP Thank you Paulo -- 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] Password help plz
Shelly, Retrieve a decrypted password for display? Can't do it, MySQL's password() function is one way. Check this page of the MySQL docs: http://www.mysql.com/doc/M/i/Miscellaneous_functions.html You can display the password as encrypted by that function. PHP doesn't have a password() function, that's a MySQL function, so your line ?php echo $myrow[userpass(password('userpass'))]? won't work. This isn't an altogether bad thing. There is a long-held belief that once passwords are set no one should be able to retrieve them, only reset them. This does make it very difficult to use the users table for mailing passwords to users. g If you want to encrypt /decrypt passwords, have a look at the des_encrypt() and des_decrypt() functions on the above-referenced page. If you want still more information on passwords there is a tutorial/article on line at www.zend.com Regards - Miles Thompson At 04:13 PM 1/19/2002 -0500, Shelly Wilds wrote: hi guys, i'm new to php/mysql :), so plz bare with me a bit. i'm trying to figure out how to retrieve password un crypted to browser. // $result = mysql_query(SELECT * FROM auth WHERE username='$valid_user',$db); $myrow = mysql_fetch_array($result); ? form method=post action=?php echo $PHP_SELF? input type=hidden name=id value=?php echo $myrow[id]? Username:input type=Text name=username value=?php echo $myrow[username]?br Userpass:input type=Text name=userpass value=?php echo $myrow[userpass]?br Usermail:input type=Text name=usermail value=?php echo $myrow[usermail]?br Userpriv:input type=Text name=userpriv value=?php echo $myrow[userpriv]?br input type=Submit name=update value=Update information/form // i've tried this and no result... Userpass:input type=Text name=userpass value=?php echo $myrow[userpass(password('userpass'))]?br could someone plz help me out with this...tx Shelly _ Send and receive Hotmail on your mobile device: http://mobile.msn.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] load data infile problem
You running Windows or *nix? File permissions will play a part in this, but use PHP's exec() function to execute MySQL's load data infile. The manual has a number of well annotated examples. The big problem may be that you'll be executing the command as whatever user the web server is running as. But before you start reinventing the wheel, search for MySQL import csv PHP, or something similar, and check out the script sites referred to in the links part of the manual. This isn't a new problem and has been addressed before. HTH - Miles Thompson At 09:13 PM 1/19/2002 +, rop30999 wrote: I have a called file cats.txt which count data that were solitary of a DB Access. I need to export these data for a table 'cats' inside of a DB done in MySql. In MySql I can execute this procedure in the following way: Load data local infile gatos.txt into table gatos fields terminated by ',' enclosed by '' (Id, Nome, Raça); I need to know how I can accomplish this same operation but using PHP Thank you Paulo -- 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]