[PHP-DB] Link for next db record
Hi all, Wondering if you could help or point me to a tut where I can use a link to get the next record in the db? Like a href='php.php'Previous record/aa href='php.php'Next record/a How do I go about doing this. Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: How to force a new browser page?
I don't know if this is what you are looking for but it will open a new browser window. You may have to play with it to get it the way you want. a href=\#\ onClick=\MyWindow=window.open('yourscript.php?id=$id','MyWindow','toolbar=n o,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,width=350,height=400'); return false;\Your Link/a HTH Jennifer Bob Parker [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm working on an intranet accounting application using php and posgresql. When I select a reord from a list for editing, I transfer the necessary variables using the 'METHOD=POST' and similarly when the update scripts are run after the edit. It makes no sense to use the back buuton to return to the original list so I would prefer to open the other pages in new windows. How please? If a web developers list is more appropriate for this question kindly recommend one. Thanks Bob Parker --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/20/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Simple search engine gone bad
Thanks all for your help. I knew it was somathing stupid and I knew it was because it was Monday. Now that it is Tues I have found the problem and it was somethin very stupid. I forgot echo /FORM; Now it work as it should. Again thanks Jennifer. Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, It's Monday, it's probably something stupid, but I have poured over this all day and cannot find the problem. This is a simple search engine based on one table. It is suppose to return the results of the search word. Instead it returns ALL records in the mysql table. If I type the letter x and there are no words in the table with an x I still get all records returned. Would someone be kind enough to show me what I have done wrong. if($search) { $query = SELECT iname, quantity, user, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' AND price 0 ORDER BY price; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $iname = $row['iname']; $q = $row['quantity']; $price = $row['price']; if($searchword = $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='usershop.php?user=$user'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thank you Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/20/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Not getting results if 0
Hi all, I am wondering how to keep something from beind displayed if a price is set to 0? I have a store where the user looks up items, but it shows all items even if the price is 0. Is there a way to prevent the items set at 0 from being displayed? Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Not getting results if 0
Wow, the only thing I can say for myself is DUH as I slap my forehead. I don't know why I didn't think of that. But thank you Natalie. Natalie Leotta [EMAIL PROTECTED] wrote in message 7546CB15C0A1D311BF0D0004AC4C4B0C024AC071@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024AC071@SSIMSEXCHNG... Are you looking it up in a database? If so you'd want to do something like where price 0. Then it wouldn't return those results. -Natalie -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Not getting results if 0 Hi all, I am wondering how to keep something from beind displayed if a price is set to 0? I have a store where the user looks up items, but it shows all items even if the price is 0. Is there a way to prevent the items set at 0 from being displayed? Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Simple search engine gone bad
Hi all, It's Monday, it's probably something stupid, but I have poured over this all day and cannot find the problem. This is a simple search engine based on one table. It is suppose to return the results of the search word. Instead it returns ALL records in the mysql table. If I type the letter x and there are no words in the table with an x I still get all records returned. Would someone be kind enough to show me what I have done wrong. if($search) { $query = SELECT iname, quantity, user, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' AND price 0 ORDER BY price; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $iname = $row['iname']; $q = $row['quantity']; $price = $row['price']; if($searchword = $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='usershop.php?user=$user'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thank you Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Can't Load Data into Mysql Using PHP
include 'phpstudy/constant.inc'; $link=mysql_pconnect(HOST,USER,PASSWD); mysql_select_db(DBNAME,$link) or die(mysql_error()); This will give you the errors if any. HTH Jennifer Jack [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Dear all I had a problem to get the php to load a csv file into mysql. I had a csv file which located at my HDD, and i had tried to Import the data from this CSV file into mysql using MYCC which is a console program for mysql, it successfully load the data into mysql table. Now i try to setup my webpage, which tried to perform same task is to load that csv file's data into mysql table, but it won't work!! don't know why!! here is my php code. ? include 'phpstudy/constant.inc'; $link=mysql_pconnect(HOST,USER,PASSWD); mysql_select_db(DBNAME,$link); print ($select); if ($select ==HKD RATE) { $importquery= LOAD DATA LOCAL INFILE 'C:/Documents and Settings/jack/Desktop/Web/test/hkd_rate.csv' into hkd_depsit1 fields terminated by ',' ; $resultimportquery=mysql_query($importquery,$link); print ($result); } ? when i run this script, it doesn't load the data into mysql! but as i said before, using the same query in MYCC, i can successfully load the data into Mysql database. Could someone pls tell me what mistake i had made? -- Thx a lot! Jack [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search Script
Thanks Maureen, I don't get the errors I was getting so that shows me you are great. Now my next problem is if an item is found how do I echo or print that to the screen. I have this as a starting point but I don't know where to go after this. if($search) { $query = SELECT uid, id, image, iname, quantity, user, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while(list($iname)=mysql_fetch_row($ret)) $user = $row['user']; if($iname == $searchword) echo $user; }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } I can't get any data to show up. Could you shed some light on this. I don't want you to wirte it just let me know if I am on the righ track. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The query should read as below, without the = after the LIKE: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY iname'; HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Search Script
Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
I am quite positive that they are not Binary what I am finding is that it has to be exactly as it is in the table. I have one item called StarrRacing Guide if I put in starr or Starr it will return nothing I have to spell it exactly like it is in the db StarrRacing Guide. here is a dump of the table maybe I have done something wrong there: uid int(10) NOT NULL default '0', id int(5) NOT NULL default '0', iname varchar(50) NOT NULL default '', image varchar(100) NOT NULL default '', quantity int(10) unsigned NOT NULL default '1', type varchar(20) NOT NULL default '', price int(6) NOT NULL default '0', user varchar(50) NOT NULL default '', I did move the while curly brace down to include the echo and that part is working great returning all records found. Thanks Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The if/else/echo should all be within the while loop. The way it is now, it should only show the last record returned, because that is the last value within the while loop. The way you have it, the rest would be done after it had looped through all of the records and it would return whatever the last values were for the $row array. According to the following link from the MySQL Manual at http://www.mysql.com/doc/S/t/String_comparison_functions.html, string comparisons using LIKE should be case insensitive as stated below: The following two statements illustrate that string comparisons are case insensitive unless one of the operands is a binary string: mysql SELECT 'abc' LIKE 'ABC'; - 1 mysql SELECT 'abc' LIKE BINARY 'ABC'; - 0 I am not sure why it is showing case sensitivity, unless as it states, one of the operands is a binary string. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Thanks all, You people are awesome. I have it working but I still have 2 bugs First it is only showing the first record it finds with the search term, not all records associated with it. Second it has to be spelled exactly right or I get 0 results. in other words if Jelly is spelled Jelly and I type jelly I get nothing but if I spell it Jelly it will return only the first record it finds what have I done wrong? if($search) { $query = SELECT uid, id, image, iname, quantity, user, type, price FROM {$config[prefix]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname; $ret = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($ret)) { $user = $row['user']; $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $q = $row['quantity']; $type = $row['type']; $price = $row['price']; } if($searchword == $iname) { echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TR; echo TD width=20%a href='remove.php?id=$idremove=yes'$user/a/TD; echo TD width=40%font size=2$iname/font/TD; echo TD width=20%font size=2CENTER$q/CENTER/font/TD; echo TD width=30%font size=2CENTER$price/CENTER/font/TD; echo /TD/TR/TABLE; } }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\searchword\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } Thanks Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: ht
[PHP-DB] Re: Search Script
Ok I am looking at the code an I'm thinking it has to be in the code because I tried it on my box at home and it did the same thing. So while looking hard at the code I came up with this: if($searchword == $iname) this is the problem if $searchword == $iname then it will echo everything I want it to. What I needed to do is have it where it isn't == to anything in otherwords a null value. So if $searchword = $iname then it will work as it is suppose to. Thanks everyone for your time, effort and help. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: FORM not inserting data
As many people have told me and I have just now got it through my thick head try either echoing the query or use $result = mysql_query($sql) or die(mysql_error()); You will find out what is being passed (or not passed) through your variables or find out what error you are getting. HTH Jennifer Neil [EMAIL PROTECTED] wrote in message 002501c1ecc2$8b1e16a0$1bc5fea9@neilmar">news:002501c1ecc2$8b1e16a0$1bc5fea9@neilmar... Help. Help Please, Please tell me what I am doing wrong here...I have a form to input data but it is not posting ithere is the code. It seems to work no errors but a query show no new additions to the table. $sql = INSERT INTO employees (first,last,address,date_of_birth,sex,age,telephone, parent_guardian_name,parent_guardian_workplace,work_telephone,emergency_info rmation_contact, list_physical_conditions_if_any,all_schools_previously_attended,examinations _passed,older_brothers,younger_brothers,older_sisters,younger_sisters, names_sisters_or_brothers_attending_school) VALUES ('$first','$last','$address','$date_of_birth',$sex','$age','$telephone','$pa rent_guardian_name','$parent_guardian_workplace', '$work_telephone','$emergency_information_contact','$list_physical_condition s_if_any','$all_schools_previously_attended','$examinations_passed','$older_ brothers','$younger_brothers','$older_sisters','$younger_sisters','$names_si sters_or_brothers_attending_school'); $result = mysql_query($sql); echo Thank you! Information entered.\n; } else{ // display form ? Neil --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Search Script
Thanks Maureen, The == was the problem. I can search with upper and lower case and only partial words. Hosting is using 3.23.45 mysql so I don't believe that was the case. Thanks again! Jennifer Maureen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here is some more information I found in the manual about case sensitivity in searches. The whole page is at http://www.mysql.com/doc/C/a/Case_sensitivity.html Here is the text that shows what might be the problem: In older MySQL versions LIKE comparisons where done on the uppercase value of each character (E == e but E é). In newer MySQL versions LIKE works just like the other comparison operators. What version of MySQL are you running? If you do not know, check to see if you can do a search for something in upper case that is in the database in lower case. If this works, then it looks like the situation above. I think previously, you were searching using all lower case for a word that was in the database with an upper case letter in it. HTH Maureen Jennifer Downey [EMAIL PROTECTED] said: Ok I am looking at the code an I'm thinking it has to be in the code because I tried it on my box at home and it did the same thing. So while looking hard at the code I came up with this: if($searchword == $iname) this is the problem if $searchword == $iname then it will echo everything I want it to. What I needed to do is have it where it isn't == to anything in otherwords a null value. So if $searchword = $iname then it will work as it is suppose to. Thanks everyone for your time, effort and help. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I have been trying to build a search script for my site that deals with only one table in my db. As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I can't seem to locate that clause in ether manual. Dan Brunner gave me this to go on: $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname LIKE = '%$shopsearch% ORDER BY iname'; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) But I can't seem to get this to work. I have never worked with LIKE before and would appreciate any help on this. Thanks Julie and Dan for your time and effort. Thanks all for your time and help Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Search tutroial
Hi all, Would someone kindly point me to a tutorial on designing a search script for mysql db. I have tried to build one but can't get anywhere with it. Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search tutroial
This is basically what I am trying to do if($search) { $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname = $shopsearch; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) $name = $row['user']; echo $name; }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\shopsearch\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } This is a dump of the table uid int(10) NOT NULL default '0', id int(5) NOT NULL default '0', iname varchar(50) NOT NULL default '', image varchar(100) NOT NULL default '', quantity int(10) unsigned NOT NULL default '1', type varchar(20) NOT NULL default '', price int(6) NOT NULL default '0', user varchar(50) NOT NULL default '', KEY uid (uid) Just a note this works throughout my site and I have no trouble with it: {$config[prefix]}_shop I'm not trying to be rude but I get sick of it when people tell me that this is the problem when it has nothing to do with the question I am asking. Thanks for your time and help Jennifer Julie Meloni [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... JD Would someone kindly point me to a tutorial on designing a search script for JD mysql db. JD I have tried to build one but can't get anywhere with it. Well, that would depend on what and how you are searching, your table structure, etc. Essentially, every SELECT query is a search. If you post more information about your table(s) structure, your search methods and the search parameters, people would probably be able to help you. - Julie -- Julie Meloni -- [EMAIL PROTECTED] -- www.thickbook.com Find Sams Teach Yourself MySQL in 24 Hours at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search tutroial
By the way SELECT uid, id, image, iname, quantity, type, user where it shows below that user isn't in the query- it is there in my editor. I just forgot to put it in before sending. Jennifer Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This is basically what I am trying to do if($search) { $query = SELECT uid, id, image, iname, quantity, type FROM {$config[prefix]}_shop WHERE iname = $shopsearch; $ret = mysql_query($query); while(list($quantity)=mysql_fetch_row($ret)) $name = $row['user']; echo $name; }else{ echo FORM METHOD=post ACTION='$PHP_SELF'; echo Search ShopsBRinput type=text name=\shopsearch\ value=\\; echo BRINPUT TYPE='submit' NAME='search' VALUE='Search'; } This is a dump of the table uid int(10) NOT NULL default '0', id int(5) NOT NULL default '0', iname varchar(50) NOT NULL default '', image varchar(100) NOT NULL default '', quantity int(10) unsigned NOT NULL default '1', type varchar(20) NOT NULL default '', price int(6) NOT NULL default '0', user varchar(50) NOT NULL default '', KEY uid (uid) Just a note this works throughout my site and I have no trouble with it: {$config[prefix]}_shop I'm not trying to be rude but I get sick of it when people tell me that this is the problem when it has nothing to do with the question I am asking. Thanks for your time and help Jennifer Julie Meloni [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... JD Would someone kindly point me to a tutorial on designing a search script for JD mysql db. JD I have tried to build one but can't get anywhere with it. Well, that would depend on what and how you are searching, your table structure, etc. Essentially, every SELECT query is a search. If you post more information about your table(s) structure, your search methods and the search parameters, people would probably be able to help you. - Julie -- Julie Meloni -- [EMAIL PROTECTED] -- www.thickbook.com Find Sams Teach Yourself MySQL in 24 Hours at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Delete from mysql table is there a way to....
Hi all, Is there a way to delete a record from a mysql table without fragmenting the db? Here is the query I am using and it does a horrible job. Fragment city. if ($quantity == 0) { $gone = mysql_query(DELETE FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$item'); } Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Delete from mysql table is there a way to....
Hi all, I'm not sure if my first post showed up so I am going to post it again and I apologize if it shows up twice. Is there a way to delete a record from a mysql table without fragmenting the db? Here is the query I am using and it does a horrible job. Fragment city. if ($quantity == 0) { $gone = mysql_query(DELETE FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$item'); } Thanks Jennifer -- The sleeper has awaken --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Closing curly brackets?
Thank you Paul, I have asked about atutorial on proper code formatting and got back a tutorial that was extremely hard to understand. While lots of people have screamed at me for my coding format no one has supplied an understandable answer. That is until this morning. The first thing you should do is properly indent your code. If you do so, you'll be sure to find the missing bracket. Basically, for each new block, tab out again. Thought that was the best tutorial I could ever get. Short and sweet and oh so easy to understand. I am using HTML_Kit as it has the same features as all the othere editors (color coding and such) but it also has a lot more. I can get plugins for anything I would ever need. Except a formatting tutorial ;) Thank for your help Jennifer Paul Burney [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 4/12/02 11:15 PM, Jennifer Downey at [EMAIL PROTECTED] appended the following bits to my mbox: I believe it has something to do with the first while statement's closing curly bracket placement but I can't seem to get it in the right place. Hi Jennifer, The first thing you should do is properly indent your code. If you do so, you'll be sure to find the missing bracket. Basically, for each new block, tab out again. It really helps to use a programmer's editor with syntax highlighting like vim or BBEdit. Here's an example using your code: === $id = $HTTP_GET_VARS[id]; $query = SELECT id, name, image, quantity, type FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $iid = $row['id']; $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $type = $row['type']; if ($iid == $id) { $display_block =CENTERimg src=$image border=0brfont size=2$nameBR$quantityBR$type/font/CENTER; echo $display_blockBRBR; if ($type == food) { //if book or weapon is present then set an option and include in the form later $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION; } else { //if any other type is present then set a blank $thisoption=;} } // end option if statement } // end id if statement /* More code after this point */ } // end while if statement. === Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Closing curly brackets?
Hi everyone, I originally posted this in general by mistake. I have a question about this code. The way it sits now it always shows the last record in the database table. In other words if the user has 6 items, like: item id 1 item id 2 item id 5 item id 6 item id 7 item id 8 it will only show the last record item id 8. I believe it has something to do with the first while statement's closing curly bracket placement but I can't seem to get it in the right place. Can someone spot the mistake and show me how to fix it. see also comments in code. $id = $HTTP_GET_VARS[id]; $query = SELECT id, name, image, quantity, type FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $iid = $row['id']; $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $type = $row['type']; if($iid == $id) { $display_block =CENTERimg src=$image border=0brfont size = 2$nameBR$quantityBR$type/font/CENTER; echo $display_blockBRBR; if($type == food) //if book or weapon is present then set an option and include in the form later {$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION; }else{ //if any other type is present then set a blank $thisoption=;} } } //check if form has been submitted if($submit){ if($sort == 'shop') { echo This item has been taken care ofBR; // We are selecting user id to insert into the users items. $db=SELECT uid FROM {$config[prefix]}_users WHERE uid={$session[uid]}; $ret = mysql_query($db); while(list($db)=mysql_fetch_row($ret)) { $user = $db; echo Your user ID is $userBR; } echo You have $quantity of this item and it's id is $iidBR; } // it seems like the first while statement's closing curly bracket should go //here but if I put it here I get a parse error. }else{ //if the form has not been submitted run the following ? FORM ACTION=?echo$PHP_SELF;? METHOD=post SELECT NAME=sort SIZE=1 ?echo $thisoption;? OPTION VALUE=shopPut in my shop/OPTION OPTION VALUE=lockerPut into my Footlocker/OPTION OPTION VALUE=discardDiscard this item/OPTION OPTION VALUE=donateDonate this item/OPTION /SELECT INPUT TYPE=submit VALUE=Submit NAME=submit /FORM ? } //if I put the first while statement's closing curly bracket here it works except it prints multiple dropdown lists on the page and only prints the first item id 1. I have tried the bracket in numerous places but I can't find the right spot. Thanks in advance Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Closing curly brackets?
No public ridicule, although it doesn't work. From what I understand $query = SELECT id, name, image, quantity, type FROM is an array so if I were to use mysql_fetch_row($ret) it is only returning 1 row. where as mysql_fetch_array($ret) is returning the whole array. However I could be wrong to. But that is the way I understand it to be. ;) But thanks for trying. Jennifer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Maybe change mysql_fetch_array($ret) to mysql_fetch_row($ret)? Not sure but I've used that before to do what appears to be similar while loops.. Wouldn't the data still get retrieved in array form with that? If I'm wrong, feel free to publicly ridicule me.. Later, Bob Weaver Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi everyone, I originally posted this in general by mistake. I have a question about this code. The way it sits now it always shows the last record in the database table. In other words if the user has 6 items, like: item id 1 item id 2 item id 5 item id 6 item id 7 item id 8 it will only show the last record item id 8. I believe it has something to do with the first while statement's closing curly bracket placement but I can't seem to get it in the right place. Can someone spot the mistake and show me how to fix it. see also comments in code. $id = $HTTP_GET_VARS[id]; $query = SELECT id, name, image, quantity, type FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $iid = $row['id']; $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $type = $row['type']; if($iid == $id) { $display_block =CENTERimg src=$image border=0brfont size = 2$nameBR$quantityBR$type/font/CENTER; echo $display_blockBRBR; if($type == food) //if book or weapon is present then set an option and include in the form later {$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION; }else{ //if any other type is present then set a blank $thisoption=;} } } //check if form has been submitted if($submit){ if($sort == 'shop') { echo This item has been taken care ofBR; // We are selecting user id to insert into the users items. $db=SELECT uid FROM {$config[prefix]}_users WHERE uid={$session[uid]}; $ret = mysql_query($db); while(list($db)=mysql_fetch_row($ret)) { $user = $db; echo Your user ID is $userBR; } echo You have $quantity of this item and it's id is $iidBR; } // it seems like the first while statement's closing curly bracket should go //here but if I put it here I get a parse error. }else{ //if the form has not been submitted run the following ? FORM ACTION=?echo$PHP_SELF;? METHOD=post SELECT NAME=sort SIZE=1 ?echo $thisoption;? OPTION VALUE=shopPut in my shop/OPTION OPTION VALUE=lockerPut into my Footlocker/OPTION OPTION VALUE=discardDiscard this item/OPTION OPTION VALUE=donateDonate this item/OPTION /SELECT INPUT TYPE=submit VALUE=Submit NAME=submit /FORM ? } //if I put the first while statement's closing curly bracket here it works except it prints multiple dropdown lists on the page and only prints the first item id 1. I have tried the bracket in numerous places but I can't find the right spot. Thanks in advance Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Multiple selects?
Hi all, You are probably getting tired of me asking questions but I have another and will try to keep them down from now on. If I have let's say five items with different id's, image's and so forth how do I display all items on one page. Do I have to use multiple selects or is there another easier way? Also what if I have 5 items that I can buy with id's 1, 2, 3, 4 and 5 and lets say that I bought items 2 and 5 but not 1, 3 and 4 how do I display 2 and 5 but let's say I don't know the id's. I used $id = $HTTP_GET_VARS[id] to buy them and have tried to use it to display them but I have to know the id's in order to make it work with multiple selects. Am I being making sense here? Kinda doesn't make sense to me and I know what I am trying to say but I don't think it worked. A good tutorial or help would be appreciated. Thanks Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Multiple selects?
Hi Bob, That would be just about what I am looking for. And I wouldn't mind seeing the code you have. Thanks Jennifer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Are you talking about something that will display a list of products like this page: http://survivalherbs.com:8080/order/index.php?command=viewCategorycategory= Herbal+Remedies These are all gathered from the database with one SELECT statement then put together in the table with a while loop.. Is that what you're talking about? If so, I have the code for it. I wrote the cart that is hosted on that page and can post some code from it if you would like.. Thanks, Bob Weaver Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, You are probably getting tired of me asking questions but I have another and will try to keep them down from now on. If I have let's say five items with different id's, image's and so forth how do I display all items on one page. Do I have to use multiple selects or is there another easier way? Also what if I have 5 items that I can buy with id's 1, 2, 3, 4 and 5 and lets say that I bought items 2 and 5 but not 1, 3 and 4 how do I display 2 and 5 but let's say I don't know the id's. I used $id = $HTTP_GET_VARS[id] to buy them and have tried to use it to display them but I have to know the id's in order to make it work with multiple selects. Am I being making sense here? Kinda doesn't make sense to me and I know what I am trying to say but I don't think it worked. A good tutorial or help would be appreciated. Thanks Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms and mysql
Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. Anyway here is what I have. This is items.php: form action='buyitem.php' method='post' ? $query = SELECT id, image, name, quantity, price FROM {$config[prefix]}_items where id = 1; $ret = mysql_query($query); $return = mysql_fetch_array($ret); echo input type='image' src='images/blueholo.gif'br; echo b$return[name]/bbr; echo Quantity $return[quantity]br; echo Cost: $return[price] SCbr; echo input type='hidden' name='ItemID' value='$id'; ? /form What I need to accomplish is that when the submit button is clicked the quantity is subtracted by 1 and then the item is placed in the users item list in mysql. This is what I have in buyitem.php but I cant seem to get it to work. $return[quantity]=(UPDATE {$config[prefix]}_items set quantity = quantity - 1 WHERE id = '$ItemID'); $result=mysql_query($db[quantity]); Would someone be kind enough to help with this? Thanks for all your help so far. And thanks in advance. Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
In any case the email or replies are not in the archives. I have searched them and came up empty. Marius Ursache [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jennifer Downey a écrit : If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. maybe... maybe not... on my NS when i press reply he tries to reply to sender, not to [EMAIL PROTECTED] ... Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] int or tinyint
Hi all, Just a simple question (I think). When should I use tinyint over int. and what is the difference between the two? Thanks Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Table structure and displaying certain thing
Hi all, I have a table called items here is a dump: CREATE TABLE items ( id int(10) NOT NULL auto_increment, name varchar(50) NOT NULL default '', item_type int(4) NOT NULL default '0', image varchar(100) NOT NULL default '', price int(10) NOT NULL default '0', quantity int(5) NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; Here is my code and I know there has to be an easier way to do this so any help would be appreciated. form action=buyitem.php method=post ?php // selects the image of the item from db $query = SELECT image FROM items where id = 1; $ret = mysql_query($query); while(list($image) = mysql_fetch_row($ret)) echo input type=image src=images/blueholo.gif name=\1\BR; //select the name of the item $query = SELECT name FROM items where id = 1; $ret = mysql_query($query); while(list($name) = mysql_fetch_row($ret)) echo B$name/B; //shows the quantity of the item $query = SELECT quantity FROM items where id = 1; $ret = mysql_query($query); while(list($quantity) = mysql_fetch_row($ret)) echo Quantity $quantityBR; //the price of the item $query = SELECT price FROM items where id = 1; $ret = mysql_query($query); while(list($price) = mysql_fetch_row($ret)) echo Cost: $price SC; ? /form What I am trying to do is make it so the user clicks on the image and is taken to buyitem.php through the form where it takes the item out of the items table and updates the user table with that item. Any ideas how I can accomplish this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL, PHPand cron
Hi all, Wondering if anyone might know how to empty a table with a php script and cron job? Would someone point me to a tutorial or help with this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unknown column 'Test' in 'field list'
Hi All! Hope I'm not bothering you nice people too much. I have a account called Test, when I click the submit button I get this error Unknown column 'Test' in 'field list' My table only has two fields id and user_name I am not trying to insert the data into the field Test but into usre_name. I had this problem once before but I can't remember how I fixed it or if I ever did. Any ideas? ?php if($action == Submit my entry){ if (!empty($name)){ $enter = insert into entry (id, user_name) values (' ',$name); mysql_query($enter) or die(mysql_error()); } exit; } $query=SELECT name FROM users WHERE uid=.$session[uid]; $ret = mysql_query($query) or die(myasql_error()); list($name) = mysql_fetch_array($ret); ? CENTERtable ALIGN=center WIDTH=80%tr tdform ACTION=?php echo($PHP_SELF);? METHOD=post ?php print tdbrUsername: input type=\text\ value=\$name\ name=\u_name\ size=30/td/tr\ntrtd; print input TYPE=\submit\ name=\action\ VALUE=\Submit my entry\BRBR; ? /form/td/tr /table/CENTER -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unknown column 'Test' in 'field list'
Never mind I forgot to put ' ' around $u_name in my insert. Jen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] If else Question
Hi all, I have a table called pets, here is a partial dump: At this time this is all I am working with. uid int(10) NOT NULL default '0', num_pet tinyint(1) NOT NULL default '1', There are three steps to adding the pet into the db Step 1 create the record, this is in create.php. And yes believe it or not this does work. $query_update = INSERT INTO pets (uid) SELECT uid FROM users WHERE uid={$session[uid]}; $result = mysql_query($query_update) or die(Unable to insert into the database); Step 2 Check to see if there is already a pet record this is in process.php. $query=SELECT num_pet FROM pets WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($num_pet)= mysql_fetch_row($ret)) // echo the number in the db, it should = 1 until submit button clicked echo $num_pet $number_pet = $num_pet; if($number_pet == 0 ) { print (Sorry you can't add another pet); }else{ this does all the updating of the record ? form action=petdata.php method=post Click to continueBR INPUT TYPE=submit VALUE=Submit NAME=submit /form ? } Step three update num_pet after submit is clicked, this is in petdata.php $db = update pets set num_pet = 0 where uid={$session[uid]}; $ret = mysql_query($db) or die(db_error()); Now here is my question, If the submit button is clicked and num_pets is updated to 0 and you try to add another record shouldn't this print- Sorry you can't add another pet? I am at a loss as to why it will keep adding records. Anyone want to take a stab at it? TIA Jen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] WHERE clause
Wondering do I have to have the WHERE clause in a select query? $b=mysql_query( SELECT * FROM my_table) -can I use something like this or do I have to put WHERE in the statement? Thanks Jennifer -- PHP Database Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP-DB] Tutorial?
Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php Thanks Jennifer Downey -- PHP Database Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP-DB] Rounding numbers
Hi again, Would someone show me how to round numbers: $bank_points= $ret; $interest = 095; $months = 12; $weeks = 52; $days=365; $query=SELECT bank_points FROM wt_users WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($bank_points)= mysql_fetch_row($ret)) $yearly_interest=$bank_points * $interest; print(BRYour yearly interest is : $yearly_interest); $daily_interest=$yearly_interest / $days; $round_daily_interest = round($daily_interest); print(BRYour daily interest is : $daily_interest); Thanks Jennifer Downey -- PHP Database Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP-DB] Rounding numbers again.
Thanks for answering my question I understand rounding now. My next question is why the script will work like this: $bank_points= $ret; $interest = .095; $months = 12; $weeks = 52; $days=365; $query=SELECT bank_points FROM wt_users WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($bank_points)= mysql_fetch_row($ret)) $yearly_interest=$bank_points * $interest; $round_yearly= round($yearly_interest); print(BRYour yearly interest is : $round_yearly Gold Pieces); $daily_interest=$round_yearly / $days; $round_daily = round($daily_interest); print(BRYour daily interest is : $round_daily Gold Pieces); $query = UPDATE wt_users set bank_points = bank_points + $round_daily WHERE uid={$session[uid]}; $result = mysql_query($query); and not like this. $bank_points = $ret; $interest = .095; $months = 12; $weeks = 52; $days=365; $yearly_interest=$bank_points * $interest; $round_yearly= round($yearly_interest); $daily_interest=$round_yearly / $days; $round_daily = round($daily_interest); $query = UPDATE wt_users set bank_points = bank_points + $round_daily; $ret = mysql_query($query); or this. $query = UPDATE wt_users set bank_points = bank_points + $round_daily; $ret = mysql_query($query); $bank_points = $ret; $interest = .095; $months = 12; $weeks = 52; $days=365; $yearly_interest=$bank_points * $interest; $round_yearly= round($yearly_interest); $daily_interest=$round_yearly / $days; $round_daily = round($daily_interest); $query = UPDATE wt_users set bank_points = bank_points + $round_daily; $ret = mysql_query($query); If I use the users session id then it works fine. With the query all I'm doing is updating ALL users bank_points right? I want to use cron to update all users at midnight. Thanks again Jennifer Downey
[PHP-DB] Join tables
Hi all, Ok first I have figured out my question on storing an image path. my question now is on joining data from two tables. wt_users has two fields (cols) called uid and pid, uid refers to the user pid refers to the users pet image_data has a field called id which refers to the image path id in image_data has the same value as id in wt_users 1 1 These two queries are what are needed to get the image to display: $pet = mysql_query(select id from wt_users where uid={$session[uid]}); $ret = mysql_query($pet); $query = select binary_data,filetype from image_data where id=$id; $result = mysql_query($query); I'm using echo img src=\petdata.php?id= this should correspond with both id's \; to display the image how do I join the two tables so that the id's match and give the correct image? And again thanks in advance for your help Regards Jennifer Downey P.S. I have looked at the mysql manual and a few tutorials. None of them helped or worked.
Re: [PHP-DB] Join tables
Ok thanks for that info, but I guess I am ignorant to what MS Access is. Please enlighten me. Thanks Jennifer Downey Marius Ursache [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; the best tool for building join queries is MS Access . make a db same as that you use in mysql and build the query with access. then copy/paste queries from there. to build queries in access is very simple . drag/drop and other visual ways. Jennifer Downey a écrit : Hi all, Ok first I have figured out my question on storing an image path. my question now is on joining data from two tables. wt_users has two fields (cols) called uid and pid, uid refers to the user pid refers to the users pet image_data has a field called id which refers to the image path id in image_data has the same value as id in wt_users 1 1 These two queries are what are needed to get the image to display: $pet = mysql_query(select id from wt_users where uid={$session[uid]}); $ret = mysql_query($pet); $query = select binary_data,filetype from image_data where id=$id; $result = @mysql_query($query); I'm using echo img src=\petdata.php?id= this should correspond with both id's \; to display the image how do I join the two tables so that the id's match and give the correct image? And again thanks in advance for your help Regards Jennifer Downey P.S. I have looked at the mysql manual and a few tutorials. None of them helped or worked. -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] I'm really stuck!
Hi all, I'm really stuck and I'm not asking anyone to re-write this just show me what is wrong, or explain why it wont work. It just seems logical that this should work. The first query will print the pet id in the browser. $query=SELECT id FROM wt_users WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($pet)= mysql_fetch_row($ret)) print(BRyour pet id is $pet); So if $pet will print the id from the wt_users (has a value of 3) and I assign $id = $pet (id also has a value of 3 in image_data) why doesn't it show the image? if($id) { $id = $pet; $query = select bin_data,filetype from image_data where id=$id; $result = mysql_query($query); $data = mysql_query($result,0,bin_data); $type = mysql_query($result,0,filetype); Header( Content-type: $type); echo $data; }; echo img src=\petdata.php?id=$id\; Thanks Jennifer Downey
[PHP-DB] Storing image path to database
Hi, Woud someone be able to help? I can't for the life of me figure out how to get this to store a image path instead of the image itself. In other words I want to make this so that the user isn't uploading an image. I want to use a radio or check box that they pick from. Any help would be appreciated. ?php if ($submit) { $data = addslashes(fread(fopen($form_data, r), filesize($form_data))); $uid={$session[uid]}; $result=MYSQL_QUERY(INSERT INTO binary_data (uid,description,bin_data,filename,filesize,filetype) . VALUES ('$uid','$form_description','$data','$form_data_name','$form_data_size','$fo rm_data_type')); $id= mysql_insert_id(); print pbYour pet has been entered/b; MYSQL_CLOSE(); } else { ? form method=post action=?php echo $PHP_SELF; ? enctype=multipart/form-data File Description:br input type=text name=form_description size=40 INPUT TYPE=hidden name=MAX_FILE_SIZE value=100 brFile to upload/store in database:br input type=file name=form_data size=40 I already have the image on the server how do I change this to store the path pinput type=submit name=submit value=submit /form a href=store.phpback/a ?php } ? this is the table CREATE TABLE binary_data ( id int(4) NOT NULL auto_increment, uid int(10) NOT NULL default '0', description varchar(50) default NULL, bin_data longblob, filename varchar(50) default NULL, filesize varchar(50) default NULL, filetype varchar(50) default NULL, PRIMARY KEY (id) ) TYPE=MyISAM; Thanks in advance Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: using sendmail w/ windows
You can use PHP to send mail. If you wish to set it up: Open the php.ini and look for: [mail function] ; For Win32 only. SMTP= this will be your smtp server; for Win32 only ; For Win32 only. sendmail_from= this will be your email address; for Win32 only ; For Unix only. You may supply arguments as well (default: 'sendmail -t -i'). ;sendmail_path=this is the path to sendmail --leave this commented out. HTH Jennifer Downey Crosswalkcentral [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... any one know how to use send mail with windows instead of linux. Will this work are their other options? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Still bangin my head
Hi all, I'm still banging my head on this. Let's say I have $1000 to withdraw from my account. I withdraw that $1000 which leaves me $0 dollars in the account. With the code below if I enter another $1000 dollars in the form and hit enter it loans me the thousand and puts my account at -$1000 dollars. What do I need to do to stop it from loaning me the thousand and keep me from having a negative balance? TABLE BORDER=0 WIDTH=25% CELLPADDING=0 CELLSPACING=0 TR TDfont size=2Withdraw/font/TD TD INPUT TYPE=text VALUE= NAME=user_withdraw/TD /TR TR TD/TD TDINPUT TYPE=submit VALUE=Make My Withdrawal NAME=withdraw/TD /TR /TABLE /FORM // used to update if a user makes a withdrawal $query = (UPDATE wt_users set bank_points = bank_points - $user_withdraw, points = points + $user_withdraw WHERE uid={$session[uid]}); $result=mysql_query($query); // select bank points for the user. $sql_result = mysql_query(SELECT bank_points FROM wt_users WHERE uid={$session[uid]}); $row = mysql_fetch_array($sql_result); // if bank points are at 0 then print no points and quit. if ($sql_result = 0) { echo you don't have that many points; exit; } else { echo Your withdraw has been made!; Thanks again in advance Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] If else trouble
Hi all, I have worked and re-worked this if else statement. I can't get it to work. It's suppose to work like this. If there are no points in the bank then echo but it always echo's you don't have enough points. It also wont keep me from withdrawing more than I have in the bank. What am I doing wrong and how do I keep the script from letting me withdraw more than I have, and keep it from echoing you don't have enough points! all the time? $sql_result = mysql_query(SELECT * FROM bank_points WHERE uid={$session[uid]}); if ($sql_result = 0) { echo you don't have enough points!; }else{ echo Your withdraw has been made!; } Thanks in advance Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Instest of add, subtract.
Hi, Instead of helping with my other question maybe you can tell me why this wont work? Is it not valid ? Can you not use strings in a query like this? $deposit=set bank_points + $user_deposit; $deposit .=set points - $user_deposit; $query = (UPDATE wt_users $deposit WHERE uid={$session[uid]} ); $result=mysql_query($query); if set like this it will update the points in the bank_points but not the points table. $db[bank_points]=(UPDATE wt_users set bank_points = bank_points + $user_deposit WHERE uid={$session[uid]} ); $result=mysql_query($db[bank_points]); Thanks in advance Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Add and Subtract
Hi All, Would someone please help me with the following code? I am trying to make this work like if I have 15 gold pieces and I deposit 5 it will subtract 5 from the gold pieces I have and deposit the 5 into my account showing that I now have 10 gold pieces I can deposit and 5 in the bank. I would really appreciate any help. Thanks in advance. Jen Downey BRBRBR FORM ACTION=bank.php METHOD=POST TITLE=bank TABLE BORDER=0 WIDTH=25% CELLPADDING=0 CELLSPACING=0 TR TDfont size=2Deposit/font/TD TD INPUT TYPE=text VALUE= NAME=user_deposit/TD /TR TR TD/TD TDINPUT TYPE=submit VALUE=Make My Deposit NAME=deposit/TD /TR /TABLE BRBRBRBRBRBR ? $query=SELECT bank_points FROM wt_users WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($points)= mysql_fetch_row($ret)) print(BRBRBRYou have $points Gold Pieces you may withdraw!); ? BRBRBR TABLE BORDER=0 WIDTH=25% CELLPADDING=0 CELLSPACING=0 TR TDfont size=2Withdraw/font/TD TD INPUT TYPE=text VALUE= NAME=user_withdraw/TD /TR TR TD/TD TDINPUT TYPE=submit VALUE=Make My Withdraw NAME=withdraw/TD /TR /TABLE /FORM ? $db[bank_points]=(UPDATE wt_users set bank_points = bank_points + $user_deposit); $result=mysql_query($db[bank_points]); $db[bank_points]=(UPDATE wt_users set bank_points = bank_points - $user_withdraw); $result=mysql_query($db[bank_points]); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Join
Thank you Beau, Appreciate that clarification. Jen Beau Lebens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... what you are referring to actually has nothing to do with PHP Jen - that's why the manual wasn't much help :) JOIN is an SQL command, so check out the manual of your RDBMS (ie. http://www.mysql.com/doc/J/O/JOIN.html for MySQL) good luck :) Beau // -Original Message- // From: Jennifer Downey [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 21 February 2002 10:47 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Join // // // Could someone point me in the right direction for joining // tables? I have // searched the php manual for it but only found info on joining arrays. // // If someone could point me to a code snip or a tutorial I would much // appreciate it. // // Thanks in advance // // Jen Downey // // // // -- // 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] Parse error
Can someone tell me why I am getting a parse error in this little snip? ? $origVar = 100; echo POriginal value is $origVar/p; $origVar += 25; echo PAdded a value, now it's $origVar/p; $origVar -= 12; echo PSubtracted a value, now it's $origVar/p; $origVar .= chickens; echo PFinal answer: $origVar/p; ? Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Parse error
You know this was a real bad stupid on my part. I saved the file in the wrong place. After moving the file to my web folder and not saving to the web folder I was using the original parse error file in the temp dir. I re-saved in the web folder and what do ya know it worked. Sorry for wasting all your time. I'll try to think better in the future. Thanks Jen Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can someone tell me why I am getting a parse error in this little snip? ? $origVar = 100; echo POriginal value is $origVar/p; $origVar += 25; echo PAdded a value, now it's $origVar/p; $origVar -= 12; echo PSubtracted a value, now it's $origVar/p; $origVar .= chickens; echo PFinal answer: $origVar/p; ? Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: A good tutorial
Thanks Joe! This is exactly what I was looking for. Little tweaking and I was off and running. Thanks again Jen Downey Lerp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Jen, here's some code I posted up in the general ng for storing in db and retrieving images from db for display on your page. It's recommended that you stay away from storing actual images in the db. If you are storing a path the code below might help you out. It select a firstname, and an image according to an id. You'll have to change the youridentityfield and youridentity values to suit your needs. # display image from db # #connect to db $connectionToDBid = odbc_connect(ceo34deesnr43ipits, joeyscode, joeyscode); // sql statement $sqlb = SELECT imagepath, firstname FROM IMAGES WHERE youridentityfield = . $youridentity; # execute the query $resultset = odbc_do($connectionToDBid, $sqlb); $image = odbc_result($resultset,1); $firstname = odbc_result($resultset,2); print brbrbrdiv align='center'; print table width='400' border=0 cellpadding=2 ; print trtd align='left' ; print font color='#ff' face='verdana'h4 . Welcome back . $firstname . /h4/font; print /td/tr; print trtd align='center' ; print img src=' . $image.' align='center' border='0'br; print /td/tr; print /table; # close the db connection here # end of display image from db # #photo upload form Here's a common form that allows you to upload a file (say an image) to the db form action='upload.php' method='post' enctype='multipart/form-data' input type='hidden' name='MAX_FILE_SIZE' value='102400' Pfont color='#ff' face='verdana' size=1Upload Photo:/fontinput type='file' name='userfile'input type='submit' value='Upload!!!'/form/p end of photo upload form ## start of upload process to db ?php # $userfile is the file being uploaded # print $userfile . BR; # print $userfile_name . BR; #use a time stamp plus the original file name to uniquely name the image before storing in db to prevent two files with the same name $timestamp = time(); $userfile_name = $timestamp.$userfile_name ; // copy the file being posted -- remember to escape backslashes!!! if(copy($userfile, /ez/codesnipits/consultant/tempimages/. $userfile_name)){ print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399' size='2'Your picture has been uploaded successfully and has been made available for online users to view./fontbrbrbr ; } else { print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399'Error encountered during resume upload process./fontbr; } $patharola = tempimages/. $userfile_name; // insert path into database here # connect to db $connectionToDBid = odbc_connect(cdefc5onwesulertt, joeyscon, joeyscon); session_register(consultantid); $consultantid = $consultantid; # create query statement -- update image field in db using path $sqlr = UPDATE CONSULTANT SET image= '$patharola' WHERE consultantid= . $consultantid; # execute the sql statement (query) on the connection made $resultset = odbc_do($connectionToDBid, $sqlr); ? end of image to db process ## Hope this helps you out :) Cheers Joe :) Jennifer Downey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... If anyone knows of one, would someone please point me towards a good tutorial on storing images in a database then fetching them out again. I would really appreciate it and thanks in advance! Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Join
Could someone point me in the right direction for joining tables? I have searched the php manual for it but only found info on joining arrays. If someone could point me to a code snip or a tutorial I would much appreciate it. Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A good tutorial
If anyone knows of one, would someone please point me towards a good tutorial on storing images in a database then fetching them out again. I would really appreciate it and thanks in advance! Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] cron job
Ok I have the cron job figured out. The only thing I would like help with is how to update all users in a table. This just updates a spacific user: $db[points]=(UPDATE wt_users set points = points + 1000 WHERE uid={$session[uid]}); $result=mysql_query($db[points]); How would I use this to update all users. Any help would be appreciated. Thanks Jen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Updating Database at a specified time
Would someone please help? I have looked everywhere and can not find how to update a database at a certain time. I am trying to get this to update at midnight instead of every time the browser refreshes. My hosting service has cron jobs but I don't understand how to set them up. Is there a way to set this code up to do what I need? ?php global $session; $db[points]=(UPDATE wt_users set points = points + 1000 WHERE uid={$session[uid]}); $result=mysql_query($db[points]); $query=SELECT points FROM wt_users WHERE uid={$session[uid]}; $ret = mysql_query($query); while(list($points)= mysql_fetch_row($ret)) print(SP: $points); ? Thanks in advance! Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP MySQL and updating
Hi again, I am having trouble with updating. How do I tell php to update the database at mid night instead of every time the browser is refreshed? I have looked for it but can't find the info. Also I thought session ID's were different between users. Is this true? Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Ok another update
Hi Everyone, I want to first thank you for helping with the last question I had. It didn't help but I finally figured it out. This one though has me stumped. I have started using a portal script thinking I might be able to see a little better how php works. It will do fine for me as far as my site will go. But here is the problem. I want to tell a user how many days they have left until a certain thing happens. The portal is phpwebthings so if anyone is familiar with it... The problem is I can't figure out how to get the username from the database here is the code I am trying to make work. ? $db[days]=(UPDATE wt_users set days = days - 1 where uid=$uid); $result=mysql_query($db[days]); $query=select name, days from wt_users where uid=$uid; $ret = mysql_query($query); while(list($name, $days) = mysql_fetch_row($ret)) print($name you have $days days to complete your questionnaire); ? I can't get it to work unless I specify a specific user. Like $query=select name, days from wt_users where uid=1; How do I pull the user from the session? Also when I do specify a user and refresh the page it updates the count down how do I get it to only update once a day. Any help would be appreciated! Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Username
Hi, It's me bothering you great helpers again! Wondering if you can help me? I know I am missing something stupid cause I am taking this pretty much straight out of the PHP 4 Bible. Here is my table dump: CREATE TABLE users ( uid int(10) unsigned NOT NULL auto_increment, name varchar(20) NOT NULL default '', password varchar(20) NOT NULL default '', class tinyint(3) unsigned NOT NULL default '0', realname varchar(40) default NULL, email varchar(50) NOT NULL default '', sex enum('Male','Female') default NULL, session varchar(15) NOT NULL default '', dateregistered datetime NOT NULL default '-00-00 00:00:00', dateactivated datetime NOT NULL default '-00-00 00:00:00', lastvisit datetime NOT NULL default '-00-00 00:00:00', logins int(10) unsigned NOT NULL default '0', points int(11) NOT NULL default '1000', PRIMARY KEY (uid), UNIQUE KEY name (name,email) ) TYPE=MyISAM; Here is the php code: ? // include the database configuration includeconfig.php; // connect to database mysql_connect($db[host],$db[user],$db[password]); mysql_select_db($db[database]) or die (sorry I couldn't connect to the database.); // if no connect then exit // exit; // if connect successful ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleUntitled/title /head body ? ? if(!IsSet($stage)) { ? Please fill out the form below to get an account. FORM METHOD=POST ACTION=te.php Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR input type=hidden name=stage value=1 INPUT TYPE=SUBMIT /form ? $query = INSERT INTO users (uid, name) VALUES(NULL, $name); $result = mysql_query($query); if($result == 0) print(There has been a problem.); else print(Your information has been recorded.); } ? /body /html All I want is to get the username into the database. As soon as test.php shows in browser, the Username, submit button and box ar e there but also it prints the There has been a problem. right off the bat. Now I know there are misprints in the book and I hope I was smart enough to catch them but maybe not. can someone please tell me what I have done wrong? Thanks for all your time. Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Username
I am not getting an error message. The te.php is connecting to the data base. Just not doing what I want it to. While that is a very good tutorial (if I was just logging in) but it has nothing to do with inserting information into the database via a form. But thanks for the tut. It will come in handy when I get to that point in my learning stage. Jen Robert Weeks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What exactly is the error message? Did you change config.php to use the name of your database and your username password? I've found the articles at devshed to be helpful in the past. This particular one has a pretty good explaination of setting up a user authentication system: http://www.devshed.com/Server_Side/PHP/TimeIsMoney/TimeIsMoney1/page1.html Robert On 2/5/02 9:50 AM, Jennifer Downey [EMAIL PROTECTED] wrote: All I want is to get the username into the database. As soon as test.php shows in browser, the Username, submit button and box ar e there but also it prints the There has been a problem. right off the bat. Now I know there are misprints in the book and I hope I was smart enough to catch them but maybe not. can someone please tell me what I have done wrong? Thanks for all your time. Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Update
Hi, I am having problems with this code. I want to update a members number of days they have been a member can anyone help? $query[days]=(UPDATE users set days_member VALUES = ('days_member' + '1')); $result=mysql_query($query[days]); Thanks in advance JD -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Update
Why? Because I am learning. It seemed like the way to do it. I didn't know all those things could happen. There is NO documentation, manual or tutorial for that matter that gives clear, in English directions on how to do something. People just assume that everyone knows techie talk. So they explain in technical terms in which 98% of us don't understand. So we have to do things by trial and error and learn by our mistakes and pray that someone who does know can explain in a way that we can understand. Regards Jennifer Downey Miles Thompson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Why? There's absolutely no point -- record the date a person became a member and calculate the number of days from that. In addition, what happens when you fail to run the update routine? Or someone runs it twice? Or it half runs, then dies because the database has gotten so large that the script times out? Who is going to keep track of when it was run? What check value scheme will you have in place to make certain none of this happens? What you are planning to do is bad practice. Please reconsider. Regards - Miles Thompson At 01:51 PM 2/4/2002 -0800, Jennifer Downey wrote: Hi, I am having problems with this code. I want to update a members number of days they have been a member can anyone help? $query[days]=(UPDATE users set days_member VALUES = ('days_member' + '1')); $result=mysql_query($query[days]); Thanks in advance JD -- 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