Re: [PHP-DB] Re: What's wrong with this code?
Try concencating (however you spell it) the variables...i try not to put arrays inside of strings, rather i do the following below. Oh yeah, and you have two things that say VALUES (...) ...maybe ive missed this over the years, but i thought you put the fields inside parenthesis without anything before it, then you stick the VALUES() after it, like so: $sql = INSERT INTO prod (Name, ShortDesc, LongDesc, PriceOZ, PriceLB, URLOX, URLLB, IMG) values(' . $_POST['Name'] . ',' . $_POST['ShortDesc'] . ...); If you dont like using the concencating method, you could do this as well: $sql = INSERT INTO prod (Name, ShortDesc, LongDesc, PriceOZ, PriceLB, URLOX, URLLB, IMG) values('{$_POST['Name']}','{$_POST['ShortDesc']}',.); David Balatero [EMAIL PROTECTED] - Original Message - From: Shoulder to Shoulder Farm [EMAIL PROTECTED] To: PHP Database List [EMAIL PROTECTED] Sent: Monday, September 02, 2002 7.57 AM Subject: Re: [PHP-DB] Re: What's wrong with this code? Sorry all, my mail program has been sending messages to the sender. Sorry...Taj Jean-Christian Imbeault wrote: Shoulder To Shoulder Farm wrote: mysql_query(INSERT INTO prod VALUES ( 'Name', 'ShortDesc', 'LongDesc', 'PriceOZ', 'PriceLB', 'URLOZ', 'URLLB', 'IMG') VALUES ('$_POST[Name]', '$_POST[ShortDesc]', '$_POST[LongDesc], '$POST[PriceOZ', '$_POST[PriceLB]', '$_POST[URLOZ]', '$_POST[URLLB], '$_POST[IMG]');) Maybe it's a typo but all you $_POST vars are wrong. They should be $_POST[var] not $_POST[var] as you have them. Jc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Ranking in MySQL
I have a MySQL table called images, each with a rating from 1-10. The column is a decimal(10,2). For simplicity's sake, let's say i have the following: CREATE TABLE images ( image_id int not null auto_increment, image_path varchar(255) not null, rating decimal(10,2) not null, primary key(image_id) ); What I'm looking to do is be able to pull from the database the ranked position each image is in. I.e. this image is ranked 70 out of 121 Any suggestions on a MySQL query that could do this? Thanks, David Balatero [EMAIL PROTECTED]
Re: [PHP-DB] It's just spam...
Gee thanks. I'll get back to you in about 40 years when this will be useful. Thanks! David Balatero - Original Message - From: Jonathan Hilgeman [EMAIL PROTECTED] To: PHP-DB (E-mail) [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 8:36 AM Subject: [PHP-DB] It's just spam... I thought I might advertise my own new line of products: Half-eaten Viagra. Do you have some troubles with you-know-who? Do you want me to take care of it for you? I thought not, and thats why this half-eaten Viagra will do at least half the job. If you can't handle the rest of the job, then maybe you shouldn't even be in a situation where you need Mr. Happy at all. (excluding those with medical disorders) - Jonathan --- What goes up, must come down. Ask any system administrator. -- 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] Still trying to get image from /tmp path
No no no, what you want to do is echo $row[0], not img src=$row[0]. $row[0] is the actual jpeg data, and the browser will interpret it like that since you put the header(Content-type: text/jpeg); Try echoing $row[0] only and tell me how that goes. -- David -Original Message- From: Mark Gordon [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 29, 2001 1:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Still trying to get image from /tmp path Thanks, David. That helped a little but now what I get is: img src=/tmp/phpMVWr5Z in the output. The tmp folder is up the directory tree outside of my www folder (on my web host's 'puter)- I don't have direct access to it. Heres the modified code: $sql=mysql_query(SELECT bin_data FROM binary_data WHERE id=4); $row = mysql_fetch_array($sql); header(Content-type: image/jpeg); echo img src=$row[0]; How can I use the path stored in the db to retrieve the image? = Mark [EMAIL PROTECTED] __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.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 query
Actually, I am kind of confused.. =P ...why wouldn't SELECT * FROM table WHERE (artist_id = '$id') work? -- David Balatero [EMAIL PROTECTED] -- -Original Message- From: Matt Nigh [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 22, 2001 6:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php/mysql query hi. i was wondering if the knowledgeable people on this list could help me out with a problem i'm having. what i need is this: i want a single page that with a variable taken from a database, will display a different page depending on the name of a band. http://www.site.com/bands.php?artist=thebandsname 'artist' being the column from the database and 'thebandsname' being a specific row in the 'artist' column so basically what i need is some kind of statement sorta like this: --- start --- ? if(isset($id)) { $file=$id..php; include($file); } else { echo please specify a band; } ? --- end --- but instead of including a file, i wanna include a row from a specific column, a little like select * from table where artist = 'thebandsname' so if anyone could help me with this or point me in the right direction, i'd be very appreciative. also, if you don't understand what i mean, please feel to ask and i'll try and explain a little better. thanks in advance, Matt Nigh -- 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] Wrong solution!!!!
I assume you want to do this instead..try it: ?php $itemx = 15109; $sql = SELECT quantity FROM inventory WHERE item = '$itemx'; $result = mysql_query($sql,$link); $row = mysql_fetch_array($result); // you have to fetch the result into an array to access the info in the db $num = $row[quantity]; // NOW we can compare $num ;) if ($num 1) { echo bfont color=\#FF\Out of Stock $result/font/b; } else { echo bfont color=\#FF\In Stock $result/font/b; } ? -Original Message- From: Tony [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 21, 2001 2:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Wrong solution Hello, I really do appreciate your help. But, I found out that the solution scrip that you gave me was wrong script for my purpose. I guess I didn't describe my problem right. I didn't mean to get the total number of rows to compare. Let's say I have a table name inventory and contains two columes. Here is example, iteminventory 15109 0 1511012 145907 This is a script that I tried and didn't work. $itemx = 15109; $num = mysql_query(SELECT quantity FROM inventory WHERE item = '$itemx',$link); if ($num 1) { echo bfont color=\#FF\Out of Stock $result/font/b; } else { echo bfont color=\#FF\In Stock $result/font/b; } I want my inventory quantity with known item number to compare with ($num1), but didn't work. Can you tell me how about solving this problem? 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]
RE: [PHP-DB] Probably a stupid home server question ........
Theoretically...but if you expect lots of traffic you'd better invest in a T1+, or at least a DSL line that has at least 1.5Mbit up and down. -- David Balatero -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2001 2:25 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Probably a stupid home server question Hi there everyone, I currently run a unix web server from a company in the UK, i'm getting a cable modem soonish and was wondering if I can run a server from home rather than hiring one as I am now? If so what will I need? I have Windows 2000 with php, mysql, mssql etc . and redhat linux 6.2 with the same - would it be possible to set it up from home bearing in mind my website will be the only site hosted on it? Thanks for any help, it's appreciated. Chris Payne www.planetoxygene.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] Hi there everyone,
?php session_start(); session_register(high_low); // if the var hasn't been set, then set it.. if (!isset($high_low)) { $high_low = low; } ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 5:36 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Hi there everyone, Hi there, Please could someone help me with Session Variables - I am alittle confused. How do I use them to keep information stored for the whole web visit? For example, I need a variable set to low for the entire website (Or until someone logs in and changes it to either high or low) but when I go to another page the variable is lost - please help me in simple terms :-) Thanks you everyone. Chris Payne www.planetoxygene.com [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] www.oosha.com/phpdev/
I don't think this was the best place to advertise your list, seeing as everyone on here is ALREADY on a helpful list; I don't think they need another one to clutter their inbox up with 30 more messages daily. Oh, and those link colors have to go: white on light blue doesn't work...heh David Balatero [EMAIL PROTECTED] -Original Message- From: Brett Shaw [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 15, 2001 4:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] www.oosha.com/phpdev/ Oosha.com's PhpDEV has got a mailing list if you would like to joing please see below: - To subscribe to the mailinglist, simply send a message with the word 'subscribe' in the Subject: field to the -request address of that list To: [EMAIL PROTECTED] Subject: subscribe To subscribe to the digest, simply send a message with the word 'subscribe' in the Subject: field to the following address. To: [EMAIL PROTECTED] Subject: subscribe To send email to the mailinglist, write to the following address: To: [EMAIL PROTECTED] To unsubscribe from the mailinglist, simply send a message with the word 'unsubscribe' in the Subject: field to the -request address of that list To: [EMAIL PROTECTED] Subject: unsubscribe To unsubscribe from the digest, write a email like this: To: [EMAIL PROTECTED] Subject: unsubscribe [EMAIL PROTECTED] [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] www.oosha.com/phpdev/
Sorry, I was frustrated at the moment trying to get other crap to work, and was in bitch at nearest person mode. Again, I'm sorry. -- David Balatero -Original Message- From: Brett Shaw [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 15, 2001 12:21 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] www.oosha.com/phpdev/ theres being positive David Balatero [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I don't think this was the best place to advertise your list, seeing as everyone on here is ALREADY on a helpful list; I don't think they need another one to clutter their inbox up with 30 more messages daily. Oh, and those link colors have to go: white on light blue doesn't work...heh ---- David Balatero [EMAIL PROTECTED] -Original Message- From: Brett Shaw [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 15, 2001 4:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] www.oosha.com/phpdev/ Oosha.com's PhpDEV has got a mailing list if you would like to joing please see below: - To subscribe to the mailinglist, simply send a message with the word 'subscribe' in the Subject: field to the -request address of that list To: [EMAIL PROTECTED] Subject: subscribe To subscribe to the digest, simply send a message with the word 'subscribe' in the Subject: field to the following address. To: [EMAIL PROTECTED] Subject: subscribe To send email to the mailinglist, write to the following address: To: [EMAIL PROTECTED] To unsubscribe from the mailinglist, simply send a message with the word 'unsubscribe' in the Subject: field to the -request address of that list To: [EMAIL PROTECTED] Subject: unsubscribe To unsubscribe from the digest, write a email like this: To: [EMAIL PROTECTED] Subject: unsubscribe [EMAIL PROTECTED] [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 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] Need a shopping cart
Probably cause his host is extremely ghetto and refuses to install anything non M$FT =P ...and he doesn't have full admin access to the server. -- David Balatero -Original Message- From: Tom Peck [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 6:53 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Need a shopping cart Jeff Have you tried: http://www.hotscripts.com it seems to have a huge selection of PHP scripts - i'm not sure if it has what you are after though. Why don't you have MySQL installed on your NT machine? It is a LOT quicker than any MS Access database, or flat file - especially if you are setting up a shopping cart site. Tom At 18:46 11/07/2001 -0700, you wrote: Can anyone direct me to a shopping cart package (preferrably in PHP, although PERL would possibly work) which utilizes either an MS Access database or flat files? I've found several shopping carts, but they all seem to require MySQL which I do not have access to on my server. My server is Windows NT 4 with PHP 4 and PERL 5. I sure hope someone can help. Thanks in advance. Regards, Jeff [EMAIL PROTECTED] - ICQ UIN: 736807 Training, Web Hosting and Design http://www.HookedOnThe.Net -- 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] kinda unrelated, but curious...
...where do you people pick up freelance jobs? Any input on this? - David Balatero [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] kinda unrelated, but curious...
Can you recommend job boards I won't have to pay to use? -- David -Original Message- From: Szii [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 11:27 PM To: David Balatero; [EMAIL PROTECTED] Subject: Re: [PHP-DB] kinda unrelated, but curious... Most of the time, by word of mouth. Other than that, scan the 'net, look on the job boards. If you're new to the field, put your name in a couple recruiters hands. Sure, it's not freelance, and you won't make as much, but a couple jobs and you start to become known. Once you're known, and have a portfolio, it just gets easier from there on out. Also look for part time work from home PHP jobs. You can pick up some reputation that way before quitting your REAL job. These are a real PITA to find, but they do exist. Oh, and let all your friends know that you're a PHP/web coder looking for work. It's amazing how many people know people that know people and you end up with work. 8-) -Szii - Original Message - From: David Balatero [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 02, 2001 11:27 PM Subject: [PHP-DB] kinda unrelated, but curious... ...where do you people pick up freelance jobs? Any input on this? - David Balatero [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] MySQL connection: Change on syntaxis?
$rows = mysql_num_rows($result) should work. If you want to know what's going on, try doing: ?php $rows = mysql_num_rows($result) or die(Error grabbing number of rows. MySQL said:pfont color=red . mysql_error() . /font); ? -- David Balatero -Original Message- From: Tomás García Ferrari [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 2:30 PM To: PHP List Subject: [PHP-DB] MySQL connection: Change on syntaxis? Hello, I updated php to version 4.0.5 and MySQL to version 2.32.39, had errors on lines like this: $rows = mysql_num_rows($result); and noticed that this is a solution: $rows = @mysql_num_rows($result); Is this a new use of the function mysql_num_rows? +-- --+ Tomás García Ferrari Bigital http://bigital.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] variable vaule lost
So what's the problem? I'm kind of lost here.. -- David Balatero -Original Message- From: Sharmad Naik [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:26 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] variable vaule lost pls look at the attachment -- The secret of the universe is @*í!'ñ^#+ NO CARRIER ___ _ _ _ |_|_||_||_||\/||_|| \ _|| || || \| || ||_/ -- 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] Cookie effect
I have a login script that sets a cookie on your hard drive...the only problem is, the cookie only comes into effect after I've clicked thru to another page from login.php...any ideas on this? My (abridged) code is currently: ?php header(Set-Cookie: LoggedIn=1; path=/;); header(Set-Cookie: GHSUserName=$username; path=/;); header(Set-Cookie: GHSUserID=$user_id; path=/;); ? If anyone could help me on this one, that would be great! Thanks, David Balatero [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] Displaying by post time instead of topic time...
Ok, I have a forum script Im writing with the following table structure: /// CREATE TABLE forum_topics ( topic_id int(11) NOT NULL auto_increment, topic_title varchar(100) NOT NULL, topic_poster int(11) DEFAULT '0' NOT NULL, topic_time int(14) DEFAULT '0' NOT NULL, topic_views int(10) DEFAULT '0' NOT NULL, forum_id int(10) DEFAULT '0' NOT NULL, topic_status int(10) DEFAULT '0' NOT NULL, topic_notify int(2) DEFAULT '0' NOT NULL, PRIMARY KEY (topic_id) ); CREATE TABLE forum_posts ( post_id int(11) NOT NULL auto_increment, topic_id int(11) DEFAULT '0' NOT NULL, forum_id int(11) DEFAULT '0' NOT NULL, poster_id int(11) DEFAULT '0' NOT NULL, post_text text NOT NULL, post_time int(14) DEFAULT '0' NOT NULL, poster_ip varchar(16) NOT NULL, PRIMARY KEY (post_id) ); / The posts are linked to the topics using the topic_id field in each one. As well, topic_time and post_time are both UNIX datestamps that are made with mktime(). My current sql and display code is: ?php $sql = SELECT t.*, u.user FROM forum_topics t, frontend_users u WHERE t.forum_id = '$id' AND t.topic_poster = u.id ORDER BY topic_time DESC; $result = mysql_query($sql) or die(/table/td/tr/tableError: Could not query forum database.br.$sql.brMysql said:.mysql_error().); while ($myrow = mysql_fetch_array($result)) { if ($i % 2) { echo 'tr bgcolor='.$rowcolor.' width=100%'; } else { echo 'tr bgcolor='.$altrowcolor.' width=100%'; } $i++; // the following three vars are custom functions I wrote, dont worry about them. $poster = getUserName($myrow[topic_poster]); $replies = (getTotalPosts($myrow[topic_id], topic) - 1); $lastpost = getLastPost($myrow[topic_id]); // post_time, poster_id, username as array() $date = returnDateNoTime($lastpost[post_time]); $user = $lastpost[username]; echo 'tdnbsp;/td'; echo 'td'.$font.'a href=viewtopic.php?id='.$myrow[topic_id].''.$myrow[topic_title].' /a/td'; echo 'td'.$font.$poster.'/font/td'; echo 'td'.$font.$myrow[topic_views].'/font/td'; echo td width=\100%\$fontsmall$user posted on $date/small/font/td; echo 'td'.$font.$replies.'/font/td'; echo '/tr'; } ? What Im doing right now is querying the database and pulling out the latest topics in order of topic creation. What I want to do is ORDER them by the most recent post_time in each topic. If anyone has any suggestions on how I might do that, Id be very grateful. Thanks! David Balatero [EMAIL PROTECTED]
RE: [PHP-DB] Password field!
Yes, that will work, just a) make sure that the password column in your database is 32 chars exactly [varchar(32) or something, as md5 hashes are 32 chars in length], and b) in the sql code you dont want to say WHERE user = '$md5($pass)', rather, WHERE user = 'md5($pass)', or else it will treat $md5() as a variable, instead of the md5() function. Also, I find the easiest way to auth a user, especially if you'll need to auth him/her on more than one occasion, is writing a small function to do that: ?php $md5_pass = md5($orig_pass); // this creates a 32 char string of encrypted chars function authUser($user, $pass) { $sql = SELECT id FROM user_table WHERE (user = '$user') AND (pass = '$pass'); $result = mysql_query($sql); if (!$result) { die(Error querying DB in authUser()br.mysql_error()); } return mysql_num_rows($result); } / then you call on the function to auth. If the function returns 1, then the user is authenticated, if 0, it fails. / $is_auth = authUser($submitted_user, $md5_pass); if ($is_auth == 0) { echo Sorry, bad user/pass. Hit back and try again.; } else { echo You logged in successfully!; } ? Hope this helps! -- David Balatero -Original Message- From: Paulo Henrique Lomanto [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 12:23 PM To: Pedro M. S. Oliveira; PHP db Subject: RES: [PHP-DB] Password field! -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. You can do this: Encrypt a passowrd before insert into db using $var = md5('your_password'); and insert the $var into your pass field into your db. To verify the password, get the pass entered by user and do $md5('user_pass') and do a select into your db like this: SELECT user, ip FROM your_table WHERE user = '.$user_entered.' AND pass = '.$md5('user_pass').'; if this select return a row, the user pass is valid. If not, this is not valid. And your password are encrypted! :) []´s Lomanto, Paulo H. - -Mensagem original- De: Pedro M. S. Oliveira [mailto:[EMAIL PROTECTED]] Enviada em: quarta-feira, 25 de abril de 2001 16:01 Para: PHP db Assunto: [PHP-DB] Password field! Hello all! i was wondering if any1 of you could help me with something. i have a table with 3 fields user_ip, user and pass. how can i encript the pass and then read compare it with a pass inserted on the web page? thanx *** Pedro Miguel Silva Oliveira Cell Phone: +351 96 5867227 SMS: [EMAIL PROTECTED] Email: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBOuckBZyz9Qg5WP+kEQITSQCguN65L93RIeqmynzoV8uMArXinJEAoIPQ WiDfcwq/ZJXTvDPPL6Xm3zwt =jwsZ -END PGP SIGNATURE- -- 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] Permanent Cookies
I've been having this problem as well...if anyone could clear that one up that would be great. I was just about to send out an email on that actually :) Thanks, David Balatero [EMAIL PROTECTED] - Original Message - From: Lisa Elita [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 14, 2001 5:33 AM Subject: [PHP-DB] Permanent Cookies I tried to use cookies with this PHP code: SetCookie("cookiename", "cookievalue", "Friday, 16-Jan-2037 00:00:00 GMT", "/", ".myserver.com", 0); but it seems that the cookie is only store in memory (not as file). Can someone explain it to me... Best regards, Lisa Elita -- 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 to limit a WHILE statement?
Ok, in your $sql var, put: $sql = "SELECT * FROM table LIMIT 20"; Leave the other code intact. This fetches 20 rows from MySQL. -- David Balatero -Original Message- From: Bob Stone [mailto:[EMAIL PROTECTED]] Sent: Monday, April 02, 2001 3:53 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to limit a WHILE statement? Dear PHP Helpers, What is your recommendation on limiting a while statement so that it only iterates a maximum of 20 times? Here is the code snippet: $result = mysql_query($sql, $db); while ($myrow = mysql_fetch_array($result)) { printf("Name: bfont color=\"green\" size=\"5s\"%s %s %s %s\nbr/b/font", $myrow["salutation"], $myrow["first_name"], $myrow["mid_name"], $myrow["user_name"]); Best regards, Bob Stone __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text -- 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] Auto load PHP
Maybe after the UPDATE statement, you could do: ?php header("Location: /path/to/other/script.php"); ? ...but I don't know, I don't use header() that much. -- David Balatero -Original Message- From: Jim Ray [mailto:[EMAIL PROTECTED]] Sent: Monday, April 02, 2001 6:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Auto load PHP Is there a way, once updating a table to load another PHP? After, I have the user click on the save button, the code calls a update routine. After the UPDATE is done, I want the code to call another progam. Thank you. Jim -- 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] Select Database number show it
I believe this is what you want: SELECT * FROM mydatabase LIMIT 0,5 --- David Balatero [EMAIL PROTECTED] --- -Original Message- From: Naga Sean [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 5:06 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Select Database number show it Friends, Can you tell me how to select database between 1-5 and then show it to the web. ex : 1 xx 2 xx 3 xx 4 xx 5 xx 6 xx 7 xx 8 xx 9 xx 10 xx I think it's easy, but I'm a beginner here. so I don't know how to do that. Thanks Regards, Naga _ 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] getting last entry in database table
Do this: $querykb = "SELECT e_description FROM events WHERE t_id = '$t_id' ORDER BY id desc"; where id is the unique id of each row. Then it will order it like: Entry 2 Entry 1 ---- David Balatero Martin Skjldebrand wrote: Martin Skjldebrand wrote: I have a table containing steps toward solving a problem. I want to pass the last entry to another database as a solution. How do I do this? What I've tried today is: I read a few more pages in my newbie book and decided to try it like this instead: ? if (isset($cmdAddtoKb)) { $querykb ="SELECT e_description FROM events WHERE t_id = '$t_id';"; $resultkb = mysql_query($querykb, $mysql_link); $answer = mysql_fetch_row($resultkb); foreach ($answer As $teststring) //while we are inside the array { $kb_answer = $teststring;//pass the current string to the final variable } I've got two entries in e_description: note 1 note 2 Still $kb_answer refuses to become anything other than "note 1". What I'm looking to do it to get it to be "note 2" or rather the *last* entry in the table e_description that fits the SELECT statement (there might be 1,2, 7 or 94 entries. I still want $kb_answer to be the last one). Frustrating being a newbie, Martin S. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP and MYSQL query
First, try just calling the form action like: form action="luquery.php?DB=csjoaTA=associatesSortField=company" method="POST" Turning the amp; into chars (maybe my mail prog formatted it like this? ...nevertheless..) Also, try doing: $result=mysql_query("select * from $TA where $SortField='%".$search."%' order by $SortField"); --- David Balatero www.icegaming.com [EMAIL PROTECTED] --- Jim Ray wrote: I have a simpe query that I can not seem to get to work. Here is the HTML side: td width="27%" align="center"form action="luquery.php?DB=csjoaamp;TA=associatesamp;SortField=company" method="post"input type="text" name="search"brinput type="submit"/form/td Here is the PHP side: The fields are being past, but I get 0 in the results? $result=mysql_query("select * from $TA where $SortField='$search%' order by $SortField"); Am I missing something here? Thanks for the help. Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] php and mysql file insertion!
Couldn't you also just store the image on the server, then put the path to the image (http://www.mysite.com/images/thatimg.jpg) in the database? -- David Balatero Rick Emery wrote: Yes. There's another tutorial on the site which addresses that question. rick -Original Message- From: Kevin Connolly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 1:39 PM To: Rick Emery Subject: Re: [PHP-DB] php and mysql file insertion! great thanks! Will I be able to save different file types do you know? wull it work for non-picture files? Thanks again, Kev. - Original Message - From: "Rick Emery" [EMAIL PROTECTED] To: "'Kevin Connolly'" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 7:28 PM Subject: RE: [PHP-DB] php and mysql file insertion! That link just failed me... Anyway, go to http://www.weberdev.com. Select the "Articles and Tutorials" link at the left. Go to the "PHP" link. Select the "Graphics" link. Select the article "Saving Images in MySQL". rick -Original Message- From: Rick Emery Sent: Tuesday, March 06, 2001 1:23 PM To: 'Kevin Connolly'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] php and mysql file insertion! http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1825 -Original Message- From: Kevin Connolly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 12:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php and mysql file insertion! Hi, I have a MySQL database that is updated using a PHP script. It stores a members details (name, address etc.) I also want it to store a file (a member photo to be exact). Is this possible? Any help is much appreciated! Thanks, Kevin. -- 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]