[PHP-DB] Database Sorting by date
Here is the problem I want to be able to view all or search through the currency lists in the database by the month. Any help would be great!!! Here is the code TABLE FORM name=currency METHOD=POST ACTION=testtest.php TR HEIGHT=20TD COLSPAN=2FONT SIZE=+0 FACE=VERDANA BR TRTD ALIGN=LEFT BSelect a CCSD:/BBRselect name=month onChange=document.currency.submit() option value=NULLSELECT option value=NULLVIEW ALL option value=2002-03March 2002 option value=2002-04April 2002 option value=2002-05May 2002 option value=2002-06June 2002 option value=2002-07July 2002 option value=2002-08August 2002 option value=2002-09September 2002 option value=2002-10October 2002 option value=2002-11November 2002 option value=2002-12December 2002 /TD/tr /table ? include '..\drop.php'; $DBName = currency; $table = currency; $db = mysql_connect($DBhost,$DBuser,$DBpass) or die(Problem connecting); mysql_select_db($DBName) or die(Problem selecting database); if ($month == NULL){ $query = SELECT * FROM $table; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } else { $query = SELECT * FROM $table where DATE = preg_match(Y-m,'$month')) ORDER BY DATE; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } ? ? echo TABLE BORDER=\1\\n; echo TR bgcolor=\#709fff\TDcenterbDATE/b/center/TDTDcenterbEURO /b/center/TDTDcenterbEURO RECONVERSION/b/center/TDTDcenterbKM/b/center/TDTDcenter bKM RECONVERSION/b/center/TDTDcenterbHUF/b/center/TDTDcente rbKUNA/b/center/TD/TR\n; for($i = 0; $i $numofrows; $i++) { $row = mysql_fetch_array($result); //get a row from our result set if($i % 2) { //this means if there is a remainder echo TR bgcolor=\#d3d3d3\\n; } else { //if there isn't a remainder we will do the else echo TR bgcolor=\#f0f0f0\\n; } echo TD.$row['DATE']./TDTD.$row['EURO']./TDTD.$row['EURORECON']. /TDTD.$row['KM']./TDTD.$row['KMRECON']./TDTD.$row['HUF']. /TDTD.$row['KUNA']./TD\n; echo /TR\n; } //now let's close the table and be done with it echo /TABLE\n; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Date Question
Steve is right you can do it that way, but I would put in the area where you insert the information into the database. Either way is correct. but I find this way easier and you don't take up any area on your from. (preferences) mysql_select_db($DBName) or die(Unable to select database $DBName); $logtime = date(Y-m-j G:i:s); $sqlquery = INSERT INTO $table VALUES('$id','$logtime','$logccsd','$logevent','$logaction','$loginit'); From the PHP site: a.. a - am or pm b.. A - AM or PM c.. B - Swatch Internet time d.. d - day of the month, 2 digits with leading zeros; i.e. 01 to 31 e.. D - day of the week, textual, 3 letters; i.e. Fri f.. F - month, textual, long; i.e. January g.. g - hour, 12-hour format without leading zeros; i.e. 1 to 12 h.. G - hour, 24-hour format without leading zeros; i.e. 0 to 23 i.. h - hour, 12-hour format; i.e. 01 to 12 j.. H - hour, 24-hour format; i.e. 00 to 23 k.. i - minutes; i.e. 00 to 59 l.. I (capital i) - 1 if Daylight Savings Time, 0 otherwise. m.. j - day of the month without leading zeros; i.e. 1 to 31 n.. l (lowercase 'L') - day of the week, textual, long; i.e. Friday o.. L - boolean for whether it is a leap year; i.e. 0 or 1 p.. m - month; i.e. 01 to 12 q.. M - month, textual, 3 letters; i.e. Jan r.. n - month without leading zeros; i.e. 1 to 12 s.. O - Difference to Greenwich time in hours; i.e. +0200 t.. r - RFC 822 formatted date; i.e. Thu, 21 Dec 2000 16:01:07 +0200 (added in PHP 4.0.4) u.. s - seconds; i.e. 00 to 59 v.. S - English ordinal suffix for the day of the month, 2 characters; i.e. th, nd w.. t - number of days in the given month; i.e. 28 to 31 x.. T - Timezone setting of this machine; i.e. MDT y.. U - seconds since the epoch z.. w - day of the week, numeric, i.e. 0 (Sunday) to 6 (Saturday) aa.. W - ISO-8601 week number of year, weeks starting on monday (added in PHP 4.1.0) (Saturday) ab.. Y - year, 4 digits; i.e. 1999 ac.. y - year, 2 digits; i.e. 99 ad.. z - day of the year; i.e. 0 to 365 ae.. Z - timezone offset in seconds (i.e. -43200 to 43200). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Updating Forms Values
on 4/4/02 8:35 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] appended the following bits to my mbox: home.php?name=Barry Zimmerman This once you have eddited a page becomes: home.php?name=Barry You'll need to url encode the variable: echo 'home.php?name=' , urlencode($username); HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Submitting Dynamic Form
I use the PHP manual and the on-line resources/tutorials, such as PHP.net I have lots of time to read these things, because...well...I have no life GRIN I just kind of stumble on these things. -Original Message- From: Chris MacKenzie [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 12:51 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Submitting Dynamic Form Ah, I just knew there must be an easy way of doing it. Thanks Rick ! Is there a good reference on stuff like this with some examples ? Am I pushing the friendship ? :-) Rick Emery wrote: $HTTP_POST_VARS or $_POST is an associative array that holds the keys and values for all inputs/selects in form from the submitted page. Use array_keys() to determine the names of all your list boxes to examine each key and its value. Or you can use the list($key,$val) = each($HTTP_POST_VARS) construct to extract each key and value. So then you just walk through the array and process each entry. -Original Message- From: Chris MacKenzie [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 8:47 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Submitting Dynamic Form Hi Rick, Here's a code snippet (less error checking). Basically there could be as many as twnety questions listed with their associated listboxes of possible answers. Also be aware that ms-sql identity type is similar to mysqls autoincrement type except that once a record is deleted, that identity value is never used again. My problem is that since the question_id field is never guaranteed to be sequential and seeing that I have named the answer listboxes with the question_id field, what is a good way to extract the values from the form and perform an update query ? How can I do this if I don't know what the question_id values will be ? -- CUT $sql= SELECT * FROM tbl_exam_questions ORDER BY question_id;; $result=mssql_query($sql,$conn1); $numrows = mssql_num_rows($result); print 'form method=POST action=submit_exam_answers.php name=F1'; ## List All Questions and load the possible answers into list box. for($cnt = 0; $cnt $numrows; $cnt++){ $row = mssql_fetch_array($result); print 'p'.$row[question_text].'/p'; print 'My Answer is: select size=1 name='.$row[question_id].'option selected value=0- SELECT ONE -/option'; ## Now fetch the possible answers and load it into the list box. $pa_sql = SELECT * FROM tbl_exam_answers WHERE question_id = .$row[question_id].;; $pa_result = mssql_query($pa_sql,$conn1); $pa_numrows = mssql_num_rows($pa_result); for($pa_cnt = 0; $pa_cnt $pa_numrows; $pa_cnt++) { $pa_row = mssql_fetch_array($pa_result); print 'option value='.$pa_row[id].''.$pa_row[p_answers].'/option'; } print '/selectbrhrbr'; ## Finished Loading Possible Answers into list box. } print 'pinput type=submit value=Save Answer name=Submitinput type=reset value=Reset Form name=Reset/p/form'; -- CUT Oh, and before I forget tbl_exam_questions.correct_answer holds the relevent id entry from tbl_exam_answers what happened when you extracted the form field names from the DB? Hi All, I'm pretty new to the whole php thing and I'm currently making an multiple choice exam type of thing with php/mssql. The two tables concerned are called tbl_exam_questions and tbl_exam_questions which are defined like so. [tbl_exam_questions] ( [question_id] [int] IDENTITY (1, 1) NOT NULL , [question_text] [varchar] (355) NOT NULL , [correct_answer] [int] NOT NULL ) ON [PRIMARY] [tbl_exam_answers] ( [id] [int] IDENTITY (1, 1) NOT NULL , [question_id] [int] NOT NULL , [p_answers] [varchar] (255) NOT NULL ) ON [PRIMARY] What I'm trying to do is to pull all the questions out and display them with the possible answer in a html form and dropbox. I'm displaying the entire exam on one page, with one submit button on the bottom so that the student can review the answers before finally submitting them. The problem I have is that the form field names are dynamic in that they are set up the value held in tbl_exam_answers.question_id and with ms-sql the identity type is not guarenteed to be incremental, so how can I reference them to send a query back to the DB to mark the student ? Have I painted myself into a corner ? :-/ -- Rgds, Chris MacKenzie Windows: Where do you want to go today ? Mac OS: Where do you want to be tomorrow ? Linux: Are you coming or what ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to link a MYSQL table to a dbase file
How can I extract data for a mysql-table from a dbase file? This is the situation: 1) we have a dbase-file with data 2) the dbase-file is put on the server 3) we have a mysql-table that needs to get his data out of this dbase-file. How can I link this mysql-table to this file! !!note: --- I don't mean how I can put the data of the dbase-file into the table, but the table should be linked to the dbase file to get its data! Background: --- we want to upload a file with data from our own local database each night to our internet-mysql-database. In MS-access such a file is called a 'external table.' If this isn't possible and we don't have the ability to use the php-dbase-functions (because of our provider), is there another solution to get the data from the dbase-file automatically in the mysql-database? Can you help me!! Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database Sorting by date
Ron, What problem are you having? I'm looking at your code, and it's so clean, I could eat off of it. My only suggestion would be that $month will NEVER == NULL. If you are testing for NULL, the test is: if ($month == NULL ) Second, $month will be assigned a value, so it will never be NULL either. BTW, what is in drop.inc? -Original Message- From: Ron Allen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Database Sorting by date Here is the problem I want to be able to view all or search through the currency lists in the database by the month. Any help would be great!!! Here is the code TABLE FORM name=currency METHOD=POST ACTION=testtest.php TR HEIGHT=20TD COLSPAN=2FONT SIZE=+0 FACE=VERDANA BR TRTD ALIGN=LEFT BSelect a CCSD:/BBRselect name=month onChange=document.currency.submit() option value=NULLSELECT option value=NULLVIEW ALL option value=2002-03March 2002 option value=2002-04April 2002 option value=2002-05May 2002 option value=2002-06June 2002 option value=2002-07July 2002 option value=2002-08August 2002 option value=2002-09September 2002 option value=2002-10October 2002 option value=2002-11November 2002 option value=2002-12December 2002 /TD/tr /table ? include '..\drop.php'; $DBName = currency; $table = currency; $db = mysql_connect($DBhost,$DBuser,$DBpass) or die(Problem connecting); mysql_select_db($DBName) or die(Problem selecting database); if ($month == NULL){ $query = SELECT * FROM $table; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } else { $query = SELECT * FROM $table where DATE = preg_match(Y-m,'$month')) ORDER BY DATE; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } ? ? echo TABLE BORDER=\1\\n; echo TR bgcolor=\#709fff\TDcenterbDATE/b/center/TDTDcenterbEURO /b/center/TDTDcenterbEURO RECONVERSION/b/center/TDTDcenterbKM/b/center/TDTDcenter bKM RECONVERSION/b/center/TDTDcenterbHUF/b/center/TDTDcente rbKUNA/b/center/TD/TR\n; for($i = 0; $i $numofrows; $i++) { $row = mysql_fetch_array($result); //get a row from our result set if($i % 2) { //this means if there is a remainder echo TR bgcolor=\#d3d3d3\\n; } else { //if there isn't a remainder we will do the else echo TR bgcolor=\#f0f0f0\\n; } echo TD.$row['DATE']./TDTD.$row['EURO']./TDTD.$row['EURORECON']. /TDTD.$row['KM']./TDTD.$row['KMRECON']./TDTD.$row['HUF']. /TDTD.$row['KUNA']./TD\n; echo /TR\n; } //now let's close the table and be done with it echo /TABLE\n; ? -- 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
RE: [PHP-DB] How to link a MYSQL table to a dbase file
Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a comma-separated-value table? Then suck up the csv into the mysql databasde. -Original Message- From: Marij Bellen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:37 AM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: [PHP-DB] How to link a MYSQL table to a dbase file How can I extract data for a mysql-table from a dbase file? This is the situation: 1) we have a dbase-file with data 2) the dbase-file is put on the server 3) we have a mysql-table that needs to get his data out of this dbase-file. How can I link this mysql-table to this file! !!note: --- I don't mean how I can put the data of the dbase-file into the table, but the table should be linked to the dbase file to get its data! Background: --- we want to upload a file with data from our own local database each night to our internet-mysql-database. In MS-access such a file is called a 'external table.' If this isn't possible and we don't have the ability to use the php-dbase-functions (because of our provider), is there another solution to get the data from the dbase-file automatically in the mysql-database? Can you help me!! Thanks. -- 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
Re: [PHP-DB] How to link a MYSQL table to a dbase file
I run my site on a linux webserver. I don't really know what a cron is? I can also get a csv file. I also have a function to translate the dbase-file to sql. Is a cron a tool or whatever to automatically load data into the database? == Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a comma-separated-value table? Then suck up the csv into the mysql databasde. = How can I extract data for a mysql-table from a dbase file? This is the situation: 1) we have a dbase-file with data 2) the dbase-file is put on the server 3) we have a mysql-table that needs to get his data out of this dbase-file. How can I link this mysql-table to this file! !!note: --- I don't mean how I can put the data of the dbase-file into the table, but the table should be linked to the dbase file to get its data! Background: --- we want to upload a file with data from our own local database each night to our internet-mysql-database. In MS-access such a file is called a 'external table.' If this isn't possible and we don't have the ability to use the php-dbase-functions (because of our provider), is there another solution to get the data from the dbase-file automatically in the mysql-database? Can you help me!! Thanks. -- 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
FW: [PHP-DB] PHP Certificate
Can anyone help or point me to a good tutorial for using forms to update data in a table? -- 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] Re: [PHP-DB] Updating Forms Values
Hi there again. I have tried using the urlencode method but for some reason it is still doing the same thing and stripping the rest of the name. I will try to explain more how this works. I have a site where you login using a name and passord. These values are stored using cookies and we have the cookie script on each page before the headers to check to see if the user is allowed at the page there are trying to access. This is working fine until we come to editing or adding records. What happens is the name is tagged onto the standard url links on each page. So therefore knowing what records to show according to which user is logged into the system. Now I have tried using the urlencode but for some reason it just does not seem to work. Basically when the user of the system adds or edits a new record, once they click submit and are taken to the next page which either updates or adds the new entry, the links which takes them back to the start of the system loses the end of there name as there is a a space between there first and second name. I have pasted the code which updates the record in the database, together with some of the other code on the page. The cookie is at the top and if you look at the link to go back to the index it contains a urlencode there. I hope someone can help as I am pulling my hair on this one. Many thanks Barry * ? if ($name == $name) { $msg = PWelcome to secret page A, authorized user!/p; } else { header(Location: http://*/administration/error.php;); exit; } ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML HEAD TITLEedited/TITLE META NAME=GENERATOR CONTENT=Freeway 3.1 STYLE TYPE=text/css !-- style6 { margin-top: 0px; } style3 { font-size: 10px; } -- /STYLE /HEAD BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 BGCOLOR=#ffCENTER TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693 TR VALIGN=TOP TD COLSPAN=3/TD TD HEIGHT=8/TD /TR TR VALIGN=TOP TD ROWSPAN=3 TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=312 TR VALIGN=TOP TD ROWSPAN=2IMG SRC=../../Resources/ip20tm.gif BORDER=0 WIDTH=90 HEIGHT=39 ALT=/TD TD COLSPAN=2/TD TD HEIGHT=22/TD /TR TR VALIGN=TOP TD/TD TDIMG SRC=../../Resources/admintitle.gif BORDER=0 WIDTH=209 HEIGHT=17 ALT=/TD TD HEIGHT=17/TD /TR TR TD WIDTH=90IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=90 HEIGHT=1 ALT=/TD TD WIDTH=12IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=12 HEIGHT=1 ALT=/TD TD WIDTH=209IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=209 HEIGHT=1 ALT=/TD TD WIDTH=1 HEIGHT=1IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=1 HEIGHT=1 ALT=/TD /TR /TABLE /TD TD COLSPAN=2/TD TD HEIGHT=26/TD /TR TR VALIGN=TOP TD/TD TD P CLASS=style6 ALIGN=RIGHTFONT FACE=Verdana, Arial SIZE=2SPAN CLASS=style3| /SPAN/FONTA HREF=../index.php?name=? echo urlencode($name); ?FONT FACE=Verdana, Arial SIZE=2SPAN CLASS=style3back to my clients/SPAN/FONT/AFONT FACE=Verdana, Arial SIZE=2SPAN CLASS=style3 | /SPAN/FONTA HREF=../../index.php TARGET=_selfFONT FACE=Verdana, Arial SIZE=2SPAN CLASS=style3log out/SPAN/FONT/AFONT FACE=Verdana, Arial SIZE=2SPAN CLASS=style3 |/SPAN/FONT/P/TD TD HEIGHT=13/TD /TR TR VALIGN=TOP TD COLSPAN=2/TD TD HEIGHT=1/TD /TR TR TD WIDTH=312IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=312 HEIGHT=1 ALT=/TD TD WIDTH=8IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=8 HEIGHT=1 ALT=/TD TD WIDTH=371IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=371 HEIGHT=1 ALT=/TD TD WIDTH=2 HEIGHT=1IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=2 HEIGHT=1 ALT=/TD /TR /TABLE TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693 TR VALIGN=TOP TD/TD TD HEIGHT=6/TD /TR TR VALIGN=TOP TD?php // create connection $connection = mysql_connect(*,*,*) or die(Couldn't make connection.); // select database $db = mysql_select_db(*, $connection) or die(Couldn't select database.); ? ? if ($REQUEST_METHOD==POST) { # setup SQL statement $SQL = UPDATE case_study SET; $SQL = $SQL . clientname = '$clientname', ; $SQL = $SQL . activity = '$activity', ; $SQL = $SQL . title = '$title', ; $SQL = $SQL . brief = '$brief', ; $SQL = $SQL . solution = '$solution', ; $SQL = $SQL . result = '$result' ; $SQL = $SQL . WHERE id = '$id' ; #execute SQL statement $result = mysql_db_query( inpress,$SQL,$connection ); # check for error if (!$result) { echo(ERROR: . mysql_error() . \n$SQL\n);} echo (P ALIGN=CENTERFONT FACE=\Verdana\SPAN
[PHP-DB] Editing/Updating Data with Forms
Can anyone help me with editing/updating data in a table with using a form? Josh Evans ACS Helpdesk [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database Sorting by date
Ron, This would indicate that $table was not set. Or that the table indicated in $table does not exist. Print out $query; is it as you expected? Enter the SELECT at the mysql command prompt: what is the result? -Original Message- From: Allen, Ronald L CIV [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:41 AM To: Rick Emery Subject: RE: [PHP-DB] Database Sorting by date The query fails when I try to look at a month it says Query Failed Ronald L. Allen (MCSE NT, MCP, CCNA) SR. LAN/WAN Administrator SFOR - Hungary, Croatia [EMAIL PROTECTED] [EMAIL PROTECTED] +36-82-50 ext. 22580 DSN: 760-2000 -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 16:43 To: 'Ron Allen'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Database Sorting by date Ron, What problem are you having? I'm looking at your code, and it's so clean, I could eat off of it. My only suggestion would be that $month will NEVER == NULL. If you are testing for NULL, the test is: if ($month == NULL ) Second, $month will be assigned a value, so it will never be NULL either. BTW, what is in drop.inc? -Original Message- From: Ron Allen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Database Sorting by date Here is the problem I want to be able to view all or search through the currency lists in the database by the month. Any help would be great!!! Here is the code TABLE FORM name=currency METHOD=POST ACTION=testtest.php TR HEIGHT=20TD COLSPAN=2FONT SIZE=+0 FACE=VERDANA BR TRTD ALIGN=LEFT BSelect a CCSD:/BBRselect name=month onChange=document.currency.submit() option value=NULLSELECT option value=NULLVIEW ALL option value=2002-03March 2002 option value=2002-04April 2002 option value=2002-05May 2002 option value=2002-06June 2002 option value=2002-07July 2002 option value=2002-08August 2002 option value=2002-09September 2002 option value=2002-10October 2002 option value=2002-11November 2002 option value=2002-12December 2002 /TD/tr /table ? include '..\drop.php'; $DBName = currency; $table = currency; $db = mysql_connect($DBhost,$DBuser,$DBpass) or die(Problem connecting); mysql_select_db($DBName) or die(Problem selecting database); if ($month == NULL){ $query = SELECT * FROM $table; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } else { $query = SELECT * FROM $table where DATE = preg_match(Y-m,'$month')) ORDER BY DATE; $result = mysql_query($query) or die (Query failed); //let's get the number of rows in our result so we can use it in a for loop $numofrows = mysql_num_rows($result); } ? ? echo TABLE BORDER=\1\\n; echo TR bgcolor=\#709fff\TDcenterbDATE/b/center/TDTDcenterbEURO /b/center/TDTDcenterbEURO RECONVERSION/b/center/TDTDcenterbKM/b/center/TDTDcenter bKM RECONVERSION/b/center/TDTDcenterbHUF/b/center/TDTDcente rbKUNA/b/center/TD/TR\n; for($i = 0; $i $numofrows; $i++) { $row = mysql_fetch_array($result); //get a row from our result set if($i % 2) { //this means if there is a remainder echo TR bgcolor=\#d3d3d3\\n; } else { //if there isn't a remainder we will do the else echo TR bgcolor=\#f0f0f0\\n; } echo TD.$row['DATE']./TDTD.$row['EURO']./TDTD.$row['EURORECON']. /TDTD.$row['KM']./TDTD.$row['KMRECON']./TDTD.$row['HUF']. /TDTD.$row['KUNA']./TD\n; echo /TR\n; } //now let's close the table and be done with it echo /TABLE\n; ? -- 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] HTTP authentication script failure display
I have adapted a HTTP authentication script from Leon Atkinson's Core PHP book. I've done something that stopped the failure message from displaying. The password request works and valid users are sent to the correct page. But instead of getting This directory requires a user name and password when a failure occurs, I get a blank screeen. I've compared the code in the book with mine but I can't see what I've done. Any help would be appreciated. John Hughes ? session_start(); /* ** Check password */ if($PHP_AUTH_USER != '') { require (**/connect_***.***'); $sql = SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND password = password('$PHP_AUTH_PW') ; $result = mysql_query($sql,$connection) or die (Can't execute query.); $num = mysql_numrows($result); if ($num != 0) { $valid=yes; $user=$username; session_register('valid'); session_register('user'); header(Location:letters.php); exit; } #end if } ELSE { //SEND headers to request username and password header(WWW-Authenticate: Basic realm='The Letters Realm'); header(HTTP/1.0 401 Unauthorized); //show failure text print(This directory requires a user name and password.br\n); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Editing/Updating Data with Forms
Josh, Your question is too vague to answer. Do you know mysql? Do you know PHP or PERL? If not, learn these, then ask. If so, create code, then ask -Original Message- From: Evans, Josh [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 9:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Editing/Updating Data with Forms Can anyone help me with editing/updating data in a table with using a form? Josh Evans ACS Helpdesk [EMAIL PROTECTED] -- 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
Re: [PHP-DB] Editing/Updating Data with Forms
Sounds like you're more in need of a consultant than a mailing list.. Bob - Original Message - From: Evans, Josh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 04, 2002 8:30 AM Subject: [PHP-DB] Editing/Updating Data with Forms Can anyone help me with editing/updating data in a table with using a form? Josh Evans ACS Helpdesk [EMAIL PROTECTED] -- 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
RE: [PHP-DB] How to link a MYSQL table to a dbase file
cron is an application/utility on ALL unix servers. It is used to execute ANY unix command or script at specified dates, times, etc. type the following to learn more: man cron man ctrontab your cron job would execute the command to translate the dbase file to sql. Then execute mysql to read in the sql file -Original Message- From: Marij Bellen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:57 AM To: Php-Db@Lists. Php.Net (E-mail) Subject: Re: [PHP-DB] How to link a MYSQL table to a dbase file I run my site on a linux webserver. I don't really know what a cron is? I can also get a csv file. I also have a function to translate the dbase-file to sql. Is a cron a tool or whatever to automatically load data into the database? == Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a comma-separated-value table? Then suck up the csv into the mysql databasde. = How can I extract data for a mysql-table from a dbase file? This is the situation: 1) we have a dbase-file with data 2) the dbase-file is put on the server 3) we have a mysql-table that needs to get his data out of this dbase-file. How can I link this mysql-table to this file! !!note: --- I don't mean how I can put the data of the dbase-file into the table, but the table should be linked to the dbase file to get its data! Background: --- we want to upload a file with data from our own local database each night to our internet-mysql-database. In MS-access such a file is called a 'external table.' If this isn't possible and we don't have the ability to use the php-dbase-functions (because of our provider), is there another solution to get the data from the dbase-file automatically in the mysql-database? Can you help me!! Thanks. -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to link a MYSQL table to a dbase file
Hi Marij, Cron is a tool in UNIX/LINUX server used to execute commands/programs automatically in a fixed period basis. You can always read unix man pages to learn more , just type man cron and man crontab. You may also want to see this link: http://www.faqts.com/knowledge_base/view.phtml/aid/1005/fid/436 Gurhan Ozen MCI WorldCom Quality Assurance Team [EMAIL PROTECTED] ph: 703-449-4754 Vnet: 228-4754 AIM: Greywolf1923 -Original Message- From: Marij Bellen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 9:57 AM To: Php-Db@Lists. Php.Net (E-mail) Subject: Re: [PHP-DB] How to link a MYSQL table to a dbase file I run my site on a linux webserver. I don't really know what a cron is? I can also get a csv file. I also have a function to translate the dbase-file to sql. Is a cron a tool or whatever to automatically load data into the database? == Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a comma-separated-value table? Then suck up the csv into the mysql databasde. = How can I extract data for a mysql-table from a dbase file? This is the situation: 1) we have a dbase-file with data 2) the dbase-file is put on the server 3) we have a mysql-table that needs to get his data out of this dbase-file. How can I link this mysql-table to this file! !!note: --- I don't mean how I can put the data of the dbase-file into the table, but the table should be linked to the dbase file to get its data! Background: --- we want to upload a file with data from our own local database each night to our internet-mysql-database. In MS-access such a file is called a 'external table.' If this isn't possible and we don't have the ability to use the php-dbase-functions (because of our provider), is there another solution to get the data from the dbase-file automatically in the mysql-database? Can you help me!! Thanks. -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New to PHP Need Help
JT $Location_Info = mysql_fetch_row($result); JT echo p$Location_Info; After you fetch the row, you have to extract the elements from the array that makes up the row. For more than one row in your result, you have to call mysql_fetch_row() again. From http://www.php.net/manual/en/function.mysql-fetch-row.php : mysql_fetch_row -- Get a result row as an enumerated array Examples of using this function follow on the manual page. I would venture to guess that what you really want to use would be mysql_fetch_array(), which also produces an array of results, but _all_ of the rows, not just the first one (and thus does not require additional calls to the function). From http://www.php.net/manual/en/function.mysql-fetch-array.php : mysql_fetch_array -- Fetch a result row as an associative array, a numeric array, or both. With examples also on the manual page. - 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] New to PHP Need Help
Jason, If you don't have one, I would also recommend a good book that combines PHP and MYSQL interaction. I would strongly suggest the one I cut my PHP teeth on: PHP Essentials by Julie Meloni -Original Message- From: Julie Meloni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 10:18 AM To: Jason Tobias Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] New to PHP Need Help JT $Location_Info = mysql_fetch_row($result); JT echo p$Location_Info; After you fetch the row, you have to extract the elements from the array that makes up the row. For more than one row in your result, you have to call mysql_fetch_row() again. From http://www.php.net/manual/en/function.mysql-fetch-row.php : mysql_fetch_row -- Get a result row as an enumerated array Examples of using this function follow on the manual page. I would venture to guess that what you really want to use would be mysql_fetch_array(), which also produces an array of results, but _all_ of the rows, not just the first one (and thus does not require additional calls to the function). From http://www.php.net/manual/en/function.mysql-fetch-array.php : mysql_fetch_array -- Fetch a result row as an associative array, a numeric array, or both. With examples also on the manual page. - 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 -- 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] Please help count ?
Hi All I have a variable returned by my application. For clarity it is a post code so result could be EX3 T56 or BG56 G67 or CA2 123 But I only need the first bit of the postcode to continue my search. How do I set my var to only include the first bit of the postcode. It is returned in the format shown, so my question might be how I read only the first bit before the space. I fully appreciate any kind of help with this and as always thank you in advance for any help. Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com
[PHP-DB] No logro tomar los datos de un formulario
Hola. Estoy tratando de generar una respuesta a un formulario pero no logro que el PHP tome los datos que bienen. trabajo con apache para win 1.2, PHP 4, Dreamweaver 4 y MySQL 3.1 he aqui los códigos de los archivos en cuestion: el formulario: - HTML BODY FORM ACTION=mis_datos.php METHOD=post input type=hidden name=edad value=55 pTu nombre input type=text name=nombre size=30 value=jose/p pTu sistema favorito select size=1 name=sistema option selected value=LinuxLinux/option option value=UnixUnix/option option value=MacintoshMacintosh/option option value=WindowsWindows/option /select/p p¿Te gusta el futbol ? input type=checkbox name=futbol value=ON/p p¿Cual es tu sexo?/p blockquote pHombreinput type=radio value=hombre checked name=sexo/p pMujer input type=radio name=sexo value=mujer/p /blockquote pAficiones/p ptextarea rows=5 name=aficiones cols=28/textarea/p pinput type=submit value=Enviar datos name=enviar input type=reset value=Restablecer name=B2/p /FORM /BODY HTML -- el PHP: --- html body ? if ($enviar) { echo Hola b . $nombre . /b que tal estásBR\n; echo Eres . $sexo . BR\n; echo Tienes . $edad . BR\n; echo Tu sistema favorito es . $sistema . BR\n; if ($futbol) { echo Te gusta el futbol BR\n; } else { echo NO te gusta el futbol BR\n; } if ($aficiones != ) { echo Tus aficiones son: BR\n; echo nl2br($aficiones); } else { echo NO tienes aficiones BR\n; } } echo a href='formulario.htm'VOLVER AL FORMULARIO/a ? /body /html -- Puede alguien ayudarme? Sergio -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Please help count ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 you can do this... $myvar = ecplode(' ', $postcode); $firsthalf = $myvar[0]; But not everyone puts the space in there S On Thursday 04 April 2002 5:29 pm, Dave Carrera wrote: Hi All I have a variable returned by my application. For clarity it is a post code so result could be EX3 T56 or BG56 G67 or CA2 123 But I only need the first bit of the postcode to continue my search. How do I set my var to only include the first bit of the postcode. It is returned in the format shown, so my question might be how I read only the first bit before the space. I fully appreciate any kind of help with this and as always thank you in advance for any help. Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com - -- Shane -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8rH/75DXg6dCMBrQRAlEUAJ9R/jfY0Ufdj5yCSiTRw7qB81B3TwCeJELP GW03u2HKvFXy9fDEEdV1lfg= =xALC -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Please help count ?
$post = ereg_replace((.*) ,\\1, $old_post); If you want to search mysql for this that is something else -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 10:29 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Please help count ? Hi All I have a variable returned by my application. For clarity it is a post code so result could be EX3 T56 or BG56 G67 or CA2 123 But I only need the first bit of the postcode to continue my search. How do I set my var to only include the first bit of the postcode. It is returned in the format shown, so my question might be how I read only the first bit before the space. I fully appreciate any kind of help with this and as always thank you in advance for any help. Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Please help count ?
Dave, Try: $postcode_parts = explode( , $postcode); The first part of the postcode will be available in $postcode_parts[0]. - Chris -Original Message- From: Dave Carrera [SMTP:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Please help count ? Hi All I have a variable returned by my application. For clarity it is a post code so result could be EX3 T56 or BG56 G67 or CA2 123 But I only need the first bit of the postcode to continue my search. How do I set my var to only include the first bit of the postcode. It is returned in the format shown, so my question might be how I read only the first bit before the space. I fully appreciate any kind of help with this and as always thank you in advance for any help. Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] grouping by category
Hi Big Al, You're just running full-steam ahead into these mailing lists. :) Anyhow, as olinux pointed out, you can get everything you want in one query, but I would choose a different query (no need to GROUP BY category), and then use a multi-dimensional array to organize the data. Here's my version of your code: ? // Connect to DB // Query $Query = SELECT url, author, name, category, num FROM hwureviews ORDER BY num DESC; $Result = mysql_query($Query); // Do error-checking for 0 results somewhere in here // Add reviews to a multi-dimensional array - START while($Row = mysql_fetch_assoc($Result)) { // Get pieces needed to set up array $ReviewNum = $Row[num]; $Category = $Row[category]; // Add record info to array foreach($Row as $ColumnName = $Value) { // Store all fields except for num and category, because // we already have those. if(($ColumnName != num) ($ColumnName != category)) { $Reviews[$Category][$ReviewNum][$ColumnName] = $Value; } } } // Add reviews to a multi-dimensional array - END /* Now you should have an array that looks like: $Reviews[Video Cards][1][author] = Chuck Jones; $Reviews[Video Cards][1][url] = http://www.chuckjones.com;; $Reviews[Video Cards][1][some_other_col_name] = col_value; $Reviews[Video Cards][6][author] = Bill Smith; $Reviews[Video Cards][6][url] = http://www.billsmith.com;; $Reviews[Video Cards][6][some_other_col_name] = col_value; $Reviews[Memory][3][author] = Joe Bob; $Reviews[Memory][3][url] = http://www.joebob.net;; $Reviews[Memory][3][some_other_col_name] = col_value; */ // Go through array foreach($Reviews as $CategoryName = $SingleReview) { // Print out the category name print b . $CategoryName . /bbr; // List all the reviews foreach($SingleReview as $ReviewNum = $ReviewDetails) { print - . $ReviewDetails[name] . (Written by: . $ReviewDetails[author] . )br; } } ? Now, that should give you a real basic listing looking like: bCategory 1/b - Review Name (Written by: Author)br - Review Name (Written by: Author)br bCategory 2/b - Review Name (Written by: Author)br - Review Name (Written by: Author)br There are some nice perks about the above code. If you added, for instance, a field called rating to the database, and you wanted to display the value in the listings, all you would need to do is to add rating to your beginning SELECT statement. At that point, it would instantly be available in the bottom $ReviewDetails array as $ReviewDetails[rating]. The multi-dimensional arrays are a little hard to grasp at first, but they can make things a lot easier to read/understand, which is what I strive for in my coding (over speed). You never know who will one day read your code... - Jonathan -Original Message- From: Alex Behrens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 6:16 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] grouping by category Hey Guys, I'm trying to get my script to group all my reviews by category now but now it just displays them all in a row a bunch of times and doesn't group them how I want it to group them. I want it too look like this: Processor Reviews - Review - Review Motherboard Reviews - Review -Review Heres my syntax, and the page is online here (http://www.hardware-unlimited.com/hardware2.php) so you can see how it is executed now: ?php $db = mysql_connect( db32.pair.com, net3dual_2, ***); mysql_select_db( net3dual_reviews,$db); file://select cateogries $r = mysql_query(SELECT category FROM hwureviews ORDER BY num DESC); while($a=mysql_fetch_array($r)) { $category = $a[category]; file://select reviews for the current category $select_reviews = select url, author, name from hwureviews where category='.$a[category].'; $reviews = mysql_query($select_reviews); while($rev=mysql_fetch_array($reviews)) { $name = $rev[name]; $author = $rev[author]; $url = $rev[url]; $email = $rev[email]; file://print out review info echo $category Reviews:br; echo - a href=\$url\$name/a (Written by: a href=\mailto:$email\;$author/a) - [a href='$url' onMouseOver='if (window.event || document.layers) show(\$name\,event)' onMouseOut='hide(\$name\)'Description/a]brbr; } // end review while } // end category while ? What do I need to do? Thanks! -Alex Big Al Behrens E-mail: [EMAIL PROTECTED] Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: [EMAIL PROTECTED] -- 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
RE: [PHP-DB] Editing/Updating Data with Forms
Just look at your basic PHP tutorials like Devshed's PHP 101: http://www.devshed.com/Server_Side/PHP/PHP101 - Jonathan -Original Message- From: Evans, Josh [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 7:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Editing/Updating Data with Forms Can anyone help me with editing/updating data in a table with using a form? Josh Evans ACS Helpdesk [EMAIL PROTECTED] -- 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] HTTP authentication
Earlier I posted a question about why the failure message in my HTTP authentication script wasn't working. I figured out the answer. There was no place to go if the user entered a username or password that wasn't in the database. Below is the corrected code. John Hughes ? session_start(); /* ** Check password */ if($PHP_AUTH_USER != '') #If variable has content check user database { require (***directory path ouside Web root***/connect DB***); $sql = SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND password = password('$PHP_AUTH_PW') ; #end SQL $result = mysql_query($sql,$connection) or die (Can't execute query.); $num = mysql_numrows($result); if ($num != 0) { $valid=yes; $user=$username; session_register('valid'); session_register('user'); header(Location:letters.php); exit; } ELSE { #TRY AGAIN header(WWW-Authenticate: Basic realm='The Letters Realm'); header(HTTP/1.0 401 Unauthorized); //show failure text if user presses cancel print(This directory requires a user name and password.br\n); } #END IF ON SQL CHECK DB RESULT } ELSE { //SEND headers to request username and password header(WWW-Authenticate: Basic realm='The Letters Realm'); header(HTTP/1.0 401 Unauthorized); //show failure text if user presses cancel print(This directory requires a user name and password.br\n); } ? __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] New to PHP Need Help
change: $Location_Info = mysql_fetch_row($result); to: $row = mysql_fetch_array($result); $Location_Info = $row['fieldname']; replace fieldname with the real name of your database field -Original Message- From: Jason Tobias [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 9:29 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] New to PHP Need Help I am trying to define variables through an anchor tag to retrive data from MySQL, When the script runs it displays Array. I am running WIN2K and IIS 5 echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); $table = locations; $location = ($_REQUEST[location]); $query = Select * from $table where Location_ID = $location; $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); echo p$Location_Info; ? -- PHP General 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] Re: [PHP] New to PHP Need Help
Firstly, cross-posting like this is a huge no-no, please don't do that again. When the script runs it displays Array. Printing arrays directly will do that. Logically speaking, how do you expect PHP to know what value to get here? You are SELECTing many. I am running WIN2K and IIS 5 I'm sorry ;) echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); If you start running into problems, please consider mysql_error() $table = locations; $location = ($_REQUEST[location]); No need for the () here. $query = Select * from $table where Location_ID = $location; Notice how you're selecting many columns here, not just one. $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); Looking in the manual, the entry for mysql_fetch_row tells us: mysql_fetch_row -- Get a result row as an enumerated array array mysql_fetch_row ( resource result) So it returns an array. If you prefer the _row format then continue to use it, for example using list(): list($id, $name, $email) = mysql_fetch_row($result); Or just: $row = mysql_fetch_row($result); print $row[0]; // This is an enumerated array (numerical) print $row[1]; Or use a function like mysql_fetch_assoc instead: $row = mysql_fetch_assoc($result); print $row['id']; // with id being a column name // selected via the query print $row['name']; And lastly, if you're not going to use all the data, don't SELECT * of it. Good start, keep it going :) Regards, Philip Olson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] New to PHP Need Help
I am trying to define variables through an anchor tag to retrive data from MySQL, When the script runs it displays Array. I am running WIN2K and IIS 5 echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); $table = locations; $location = ($_REQUEST[location]); $query = Select * from $table where Location_ID = $location; $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); echo p$Location_Info; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to question...
Ok here is what I would like to accomplish, I am sure someone has done something like this but I need an example to go from since I am still not able to write php from scratch... I need to write a function to count the contents of a directory, like the file names and place them into an array so I can use a select box to select the file path in which I would like to save to database, like I said I don't want someone to do it for me, I just need a resource such as a tutorial or example to run with. Thanks a ton, Jas -- 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
[PHP-DB] Time diference
Hi, I need to build a piece of code do calculate the total working time of a employee. I have the tables: # # Table structure for table 'card_ticks' # CREATE TABLE card_ticks ( cod bigint(20) unsigned NOT NULL auto_increment, tick datetime , employee int(10) unsigned NOT NULL DEFAULT '0' , PRIMARY KEY (Cod) ); # # Table structure for table 'employes' # CREATE TABLE employes ( cod int(3) unsigned NOT NULL auto_increment, nameme char(30) NOT NULL DEFAULT '' , pass char(50) NOT NULL DEFAULT '' , PRIMARY KEY (cod) ); The table card_ticks is feeded by a system connected to a serial port where each time the employee pass a card into a machine a record is inserted on the table. Generally, a employee has 4 card_tick's by day, for example 1,2002-04-02 23:51:48,3 2,2002-04-02 23:52:00,7 3,2002-04-02 23:52:09,5 4,2002-04-02 23:52:14,3 5,2002-04-02 23:52:23,8 6,2002-04-02 23:52:32,1 7,2002-04-02 23:52:40,3 8,2002-04-03 00:04:39,3 9,2002-04-03 00:08:45,3 10,2002-04-03 00:11:23,3 11,2002-04-03 00:20:26,3 I have to write the code to do something like this Calculate the total working time in a month for employee 3. Any sugestions? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mail function help
For some reason the mail command will not work on all systems mybe I am using it wrong can some one provide some feedback on this. here is a code snip. $msg = \tFirst Name: $custfname\n \tLast Name: $custlname\n \tEmail Address: $custemail\n \tCategory: $dservice\n \tDescription: $custpdes\n; $recipient = $custcatergory; $subject = $adminsubsupport; $mailheaders = From: $adminfrmsupport \n; $mailheaders .= Reply-To: $email\n\n; mail($recipient, $subject, $msg, $mailheaders); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
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 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] viewing records
On Friday 05 April 2002 03:35, Natividad Castro wrote: Hi to all, I created an application that uses authentication. When the user enters the username and password, if it is valid, he will have access to the first record, which I'm displaying in a form. My question is: can another user view the same record at the same time? TONGUE IN CHEEK You mean by looking over the first user's shoulder? Probably, unless the first user completely blocked the monitor. /TONGUE IN CHEEK if the answer is yes, is there any way to prevent this? Isn't this what your authentication scheme is supposed to prevent? The reason I'm asking is because some information will be copied and pasted to a mainframe computer from the form. Any idea? In general, if your authentication scheme is working as it should then other users should not be able to access your data without authentication. Obvious really. Without knowing what your authentication scheme is we can't really comment on how secure it is. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I'd love to go out with you, but the last time I went out, I never came back. */ -- 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
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_/ -- 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
Re: [PHP-DB] Forms and mysql
if you have full access to internet (no proxy or something) try to search on news servers (alt.php or oher php related newsgroups) news server: news2.euro.net or other... Jennifer Downey a écrit : 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 -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
On Friday 05 April 2002 13:42, Jennifer Downey wrote: 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. Email posts, many people don't know/don't differentiate/don't care about the difference. Obviously you're not one of them :) I guess since I am a woman everyone feels they need to send private email instead of replying with a post. How enviable. 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. You don't say what the problem is. I'm assuming your form works correctly. 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'); Your use of variable names is most confusing. $return[quantity] was holding a quantity when in your form, now it's being assigned a query ?? $result=mysql_query($db[quantity]); Is $db[quantity] meant to be $return[quantity] ? Or vice-versa? Or is it a typo? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Why must you tell me all your secrets when it's hard enough to love you knowing nothing? -- Lloyd Cole and the Commotions */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Databse Access Problem...
A little background information: Running PHP on Apache server bundled with Oracle Portal on Redhat Linux 7.1. Trying to access the Oracle database from the web using PHP and when I write the connect statement, I get this error: Fatal error: Call to undefined function: ocilogon() in /home/students/uss/public_html/index.php on line 6 Here is my code: HTML HEAD /HEAD BODY ?php $dbconnection = OCILogon(username, password, databasename); $sql = SELECT GURMAIL_PIDM FROM GURMAIL_GENERAL; $parsedsql = OCIParse($dbconnection, $sql) or die(Unable to Parse); OCIExecute($parsedsql) or die(Unable to execute); ? /BODY /HTML Can anyone help?? Is my code wrong? Is the PHP server missing something? Pusta -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Databse Access Problem...
Pusta, Sounds like Oracle support hasn't been compiled into PHP. Wayne Pusta wrote: A little background information: Running PHP on Apache server bundled with Oracle Portal on Redhat Linux 7.1. Trying to access the Oracle database from the web using PHP and when I write the connect statement, I get this error: Fatal error: Call to undefined function: ocilogon() in /home/students/uss/public_html/index.php on line 6 Here is my code: HTML HEAD /HEAD BODY ?php $dbconnection = OCILogon(username, password, databasename); $sql = SELECT GURMAIL_PIDM FROM GURMAIL_GENERAL; $parsedsql = OCIParse($dbconnection, $sql) or die(Unable to Parse); OCIExecute($parsedsql) or die(Unable to execute); ? /BODY /HTML Can anyone help?? Is my code wrong? Is the PHP server missing something? Pusta -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Databse Access Problem...
do a file called phpinfo.php ? phpinfo(); ? see what version of php are you using, then check in manual if your version is old enough for ocilogon Pusta a écrit : A little background information: Running PHP on Apache server bundled with Oracle Portal on Redhat Linux 7.1. Trying to access the Oracle database from the web using PHP and when I write the connect statement, I get this error: Fatal error: Call to undefined function: ocilogon() in /home/students/uss/public_html/index.php on line 6 Here is my code: HTML HEAD /HEAD BODY ?php $dbconnection = OCILogon(username, password, databasename); $sql = SELECT GURMAIL_PIDM FROM GURMAIL_GENERAL; $parsedsql = OCIParse($dbconnection, $sql) or die(Unable to Parse); OCIExecute($parsedsql) or die(Unable to execute); ? /BODY /HTML Can anyone help?? Is my code wrong? Is the PHP server missing something? Pusta -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ '/ ,. \` /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] saving details problem (big)
Hi all I am making use of AFD postcode lookup application. What it dose is ask for your postcode and returns your address. You may have seen this around the web.. Well my problem is that I have added 3 extra fields Name, email, phone number And I need to save this info. I have tried sessions and cookies but have just noticed That the form action is a cgi file on the afd server. Thus this is stopping me Saving info. Any ideas on how I can save the info. I am in a back to the wall situation so any pointer and guidance is Most appreciated. P.S Had it work all fine and dandy when I added the extra info after postcode lookup but customer insisted he wants it this way round. Customers... (cant live with them, cant live without them...) Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com
RE: [PHP-DB] saving details problem (big)
Dave, would it be possible (not ideal, but might work) to do something like this; - user fills out form - user clicks submit - submit fires off 2 events, one submits to AFD server, the other opens a new window, behind the current, submits certain values (the 3 new ones) and saves them into the database. this window then automatically closes iteself once finished - whatever happens at AFD then comes back to your next page where you pull out the last values again and continue working with them is that feasible for you? HTH Beau // -Original Message- // From: Dave Carrera [mailto:[EMAIL PROTECTED]] // Sent: Friday, 5 April 2002 3:11 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] saving details problem (big) // // // Hi all // // I am making use of AFD postcode lookup application. // // // // What it dose is ask for your postcode and returns your address. // // You may have seen this around the web.. // // // // Well my problem is that I have added 3 extra fields // // // // Name, email, phone number // // // // And I need to save this info. // // // // I have tried sessions and cookies but have just noticed // // That the form action is a cgi file on the afd server. Thus this is // stopping me // // Saving info. // // // // Any ideas on how I can save the info. // // // // I am in a back to the wall situation so any pointer and guidance is // // Most appreciated. // // // // P.S Had it work all fine and dandy when I added the extra info after // postcode lookup but customer insisted he wants it this way round. // Customers... // // (cant live with them, cant live without them...) // // // // Dave Carrera // // Php Developer // // http://davecarrera.freelancers.net // // http://www.davecarrera.com // // // // // // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php