Re: RE: [PHP-DB] Random
Try: $result = mysql_db_query ($DBName,select * from Contacts order by rand() LIMIT 0,5 ); As your first example had the '0' and then the '5' after the LIMIT clause, the second didn't have th any '0'. Cheers. Russ On Fri, 31 Aug 2001 20:59:16 +0100 Seb Frost [EMAIL PROTECTED] wrote: I know it's documented as rand() but you might want to try random() just in case... I'm sure I read that somewhere - seb -Original Message- From: John Hurleston [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 19:18 To: [EMAIL PROTECTED] Subject: [PHP-DB] Random I would like to get the first 5 random entries out of my mysql database, what would be the correct SELECT option? I adjusted this line $result = mysql_db_query ($DBName,select * from Contacts LIMIT 0,5 ); which works correctly. :) $result = mysql_db_query ($DBName,select * from Contacts order by rand() LIMIT 5 ); Doesn't work at all. :( Can anyone through any light on this subject. Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] newbie having problem
Hi all, I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm gettin g the following error when I search for somthing. Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 Here's my relevant code: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? TABLE STUFF HERE ?php if ($row=mysql_fetch_array($result)) { # this is line 32 do { print (TRTD); print $row['ID']; print (TD); print $row['Type']; print (TD); print $row['Con']; print (TD); print $row['Operator']; print (/TD/TR); } while ($row=mysql_fetch_array($result)); } else {print (Sorry, no aircraft matching your criteria were found.);} ? = Any suggestions as to where I'm going wrong? Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
SV: [PHP-DB] newbie having problem
Check if mysql_query returns false. If it does (and im pretty sure it do), use mysql_error to check whats wrong... (Another way is to echo the query and paste it into the mysql command line client..) $result = mysql_query(...); if( $result == FALSE ) { echo mysql_error(); } I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm gettin g the following error when I search for somthing. Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 Here's my relevant code: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? TABLE STUFF HERE ?php if ($row=mysql_fetch_array($result)) { # this is line 32 do { print (TRTD); print $row['ID']; print (TD); print $row['Type']; print (TD); print $row['Con']; print (TD); print $row['Operator']; print (/TD/TR); } while ($row=mysql_fetch_array($result)); } else {print (Sorry, no aircraft matching your criteria were found.);} ? = Any suggestions as to where I'm going wrong? Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
I did this directly into MySQL on the LinuxPPC box: mysql select * from biz where - ID LIKE '%AXD%' AND - Type LIKE '%' AND - Con LIKE '%' - ORDER BY ID; and this is the response: ++-+-+--+-+---+ | ID | Type| Con | Operator | History | Notes | ++-+-+--+-+---+ |DC | Piper Aztec | 27-4169 | | G-AXDC | |DL | Piper Twin Comanche | 30-1856 | | G-AXDL | |DM | BAE HS 125/400B | 25194 | | G-AXDM | ++-+-+--+-+---+ In these records, what is actually in the ID field is also being displayed in 'History'. Not sure if this clarifies things? George - Original Message - From: Torgil Zechel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 03, 2001 11:38 AM Subject: SV: [PHP-DB] newbie having problem Check if mysql_query returns false. If it does (and im pretty sure it do), use mysql_error to check whats wrong... (Another way is to echo the query and paste it into the mysql command line client..) $result = mysql_query(...); if( $result == FALSE ) { echo mysql_error(); } I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm gettin g the following error when I search for somthing. Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 Here's my relevant code: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? TABLE STUFF HERE ?php if ($row=mysql_fetch_array($result)) { # this is line 32 do { print (TRTD); print $row['ID']; print (TD); print $row['Type']; print (TD); print $row['Con']; print (TD); print $row['Operator']; print (/TD/TR); } while ($row=mysql_fetch_array($result)); } else {print (Sorry, no aircraft matching your criteria were found.);} ? = Any suggestions as to where I'm going wrong? Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Search Results - Next 10 records
Hi Dennis! You can add the parameter LIMIT to your SQL query. Syntax: LIMIT $start_record,$record_count Example: $query_string = select * from $table where keywords like '%$keyword%' limit 5,3; This will return 3 records started with the 5. found record. The startrecord has to increase on next page. Store the current startrecord in the form and send it to the next page. bye Marcus Dennis [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Trying to figure out how to limit search results to say 10 records and produce a button to show the next 10. Do you use PHP to do the logic, or should I make another table column for a temporary count? This is what I'm up to so far... Thanks in advance function show_all($table, $keyword=0)// initialize to zero { global $start_record; if ( !isset( $start_record ) ) $start_record = 0; $query_string = select * from $table where keywords like '%$keyword%'; $query_string = select * from $table where keywords like '%$keyword%' limit $start_record,10; $entire_table = mysql_query($query_string); $count = 0; print(TABLE BORDER=1 width=700\n); while ($cols_rows = mysql_fetch_array($entire_table)) { $count++; if ($count 4){ print(tr); print(td bgcolor=azure); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['url']); print(P/td); } if ($count 3){ print(tr); print(td bgcolor=silver); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['url']); print(/td); $count++; } } print (FORM METHOD='POST' ACTION='search1.php'); print(INPUT TYPE='text' NAME='start_record' VALUE='$start_record+10'); print (INPUT TYPE='submit' VALUE='Next'/FORM); print $count; print(/TABLE\n); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Searching sql database using php
Hi Devon! Take a look in the PHP documentation in the function reference for mysql function. There you'll find a set of function for connecting to the database and doing SQL - Querys over the database. If you are not famular with SQL (SELECT - Statements) you have to learn :) bye Marcus Devon [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a database of only about 25 fields written in MYSQL for our internal client database, I need to be able to search each off these fields using php, can some one help or point me in the correct direction? Doug Semig [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Yes. If you have a specific question, please post it and I'm sure folks will be willing to try to help you out. Doug At 12:50 PM 9/3/01 +1000, Devon wrote: As per topic anyone know how to do it? Cheers --Doug's Signature File ~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~ --1.888.445.4763---8am to 8pm every day---http://www.glis.net-- The views and opinions expressed in this email are my own and may not be those of my employer. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: How can you hide database login passwd in your script?
Hi Michael! You can put all passwords and loging into one settings file. This file will included by all scripts using this datas. this include file you can put in an seperate directory on the webserver. this directory you can protect by the webserver. with apache with .htaccess files with IIS in the admin area. so your passwords are protected if php crashes. If php crashes and your webserver is running, the webserver is transfering the source of php files. bye Marcus Michael [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How can you hide database login passwd in your script? I hate having to have scripts with passwords in it that can be viewed by others. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Dropping tables in MySQL
Hi Ali! - export the database into a dump file. - strip the table from the dump. - drop the database - import the new dump bye Marcus Ali Nayeri [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi guys I had a question. How do you drop a table in a database in MySQL that has spaces in it's name. I created some tables in M$ Access and then exported them using MyODBC to MySQL. One of the tables had whitespaces in the name. Now MySQL is all screwed up. I want to drop the table but nothing works. I tried , '', `', [] but nothing works. Any solutions? Thanks Ali _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: Search Results - Next 10 records
hi ...and to be able to know the exact number of pages do $result = mysql_query(select count(*)); $nb_pages = $result/$nb_records_per_page; et voila! add this to marcus's suggestion and you have a full paging script, if you want some inspiration check out http://phpclasses.upperdesign.com i believe they have a class that does exactly that; regards At 14:02 03/09/01, Marcus Tobias wrote: Hi Dennis! You can add the parameter LIMIT to your SQL query. Syntax: LIMIT $start_record,$record_count Example: $query_string = select * from $table where keywords like '%$keyword%' limit 5,3; This will return 3 records started with the 5. found record. The startrecord has to increase on next page. Store the current startrecord in the form and send it to the next page. bye Marcus Dennis [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Trying to figure out how to limit search results to say 10 records and produce a button to show the next 10. Do you use PHP to do the logic, or should I make another table column for a temporary count? This is what I'm up to so far... Thanks in advance function show_all($table, $keyword=0)// initialize to zero { global $start_record; if ( !isset( $start_record ) ) $start_record = 0; $query_string = select * from $table where keywords like '%$keyword%'; $query_string = select * from $table where keywords like '%$keyword%' limit $start_record,10; $entire_table = mysql_query($query_string); $count = 0; print(TABLE BORDER=1 width=700\n); while ($cols_rows = mysql_fetch_array($entire_table)) { $count++; if ($count 4){ print(tr); print(td bgcolor=azure); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['url']); print(P/td); } if ($count 3){ print(tr); print(td bgcolor=silver); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['url']); print(/td); $count++; } } print (FORM METHOD='POST' ACTION='search1.php'); print(INPUT TYPE='text' NAME='start_record' VALUE='$start_record+10'); print (INPUT TYPE='submit' VALUE='Next'/FORM); print $count; print(/TABLE\n); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Search Results - Next 10 records
Thanks very much Marcus. It worked like a charm. Dennis On Mon, 3 Sep 2001 14:02:07 +0200, [EMAIL PROTECTED] (Marcus Tobias) wrote: Hi Dennis! You can add the parameter LIMIT to your SQL query. Syntax: LIMIT $start_record,$record_count Example: $query_string = select * from $table where keywords like '%$keyword%' limit 5,3; This will return 3 records started with the 5. found record. The startrecord has to increase on next page. Store the current startrecord in the form and send it to the next page. bye Marcus Dennis [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Trying to figure out how to limit search results to say 10 records and produce a button to show the next 10. Do you use PHP to do the logic, or should I make another table column for a temporary count? This is what I'm up to so far... Thanks in advance function show_all($table, $keyword=0)// initialize to zero { global $start_record; if ( !isset( $start_record ) ) $start_record = 0; $query_string = select * from $table where keywords like '%$keyword%'; $query_string = select * from $table where keywords like '%$keyword%' limit $start_record,10; $entire_table = mysql_query($query_string); $count = 0; print(TABLE BORDER=1 width=700\n); while ($cols_rows = mysql_fetch_array($entire_table)) { $count++; if ($count 4){ print(tr); print(td bgcolor=azure); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=azure); print(font size=2); print ($cols_rows['url']); print(P/td); } if ($count 3){ print(tr); print(td bgcolor=silver); print(font size=3); print ($cols_rows['num']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['site_name']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['keywords']); print(/tdtd bgcolor=silver); print(font size=2); print ($cols_rows['url']); print(/td); $count++; } } print (FORM METHOD='POST' ACTION='search1.php'); print(INPUT TYPE='text' NAME='start_record' VALUE='$start_record+10'); print (INPUT TYPE='submit' VALUE='Next'/FORM); print $count; print(/TABLE\n); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Use the User Input Critia as part of Query! (Mysql)
- Original Message - From: Jack [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 03, 2001 10:35 PM Subject: [PHP-DB] Use the User Input Critia as part of Query! (Mysql) Dear all I had a form which ask user to input the Staff Number to be as part of the query, but when i execute it, it seems not working at all here is what i wrote in php The user input box is : $StaffNum $query=select name,department,Leave_From,Leave_To,Leave_Total,Reason from leaverequest where Staff_Number=?print($StaffNum);? and authorized is null; But said there is error on this line, which is what i expected!! So could anyone pls tell me how i can get the varaible into part of the Query of Mysql? Try something like: $query=select name,department,Leave_From,Leave_To,Leave_Total,Reason from leaverequest where Staff_Number='$StaffNum' and authorized is null; hth -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
- Original Message - From: George Pitcher [EMAIL PROTECTED] To: Torgil Zechel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 03, 2001 11:19 PM Subject: Re: [PHP-DB] newbie having problem if( $result == FALSE ) { echo mysql_error(); } Yes - progress - its telling me that no database was selected. My code again: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? You haven't specified a password when connecting to the server -- does it require one? Have you tried the code as per manual: $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die (Could not connect); print (Connected successfully); mysql_select_db (my_database) or die (Could not select database); to ensure that you *are* able to connect to the server and also *select* the database? hth -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Use the User Input Critia as part of Query! (Mysql)
Dear all I had a form which ask user to input the Staff Number to be as part of the query, but when i execute it, it seems not working at all here is what i wrote in php The user input box is : $StaffNum $query=select name,department,Leave_From,Leave_To,Leave_Total,Reason from leaverequest where Staff_Number=?print($StaffNum);? and authorized is null; But said there is error on this line, which is what i expected!! So could anyone pls tell me how i can get the varaible into part of the Query of Mysql? Thx jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Use the User Input Critia as part of Query! (Mysql)
Jason Wong [EMAIL PROTECTED] wrote in message 021701c13489$245b1f40$[EMAIL PROTECTED]">news:021701c13489$245b1f40$[EMAIL PROTECTED]... - Original Message - From: Jack [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 03, 2001 10:35 PM Subject: [PHP-DB] Use the User Input Critia as part of Query! (Mysql) $query=select name,department,Leave_From,Leave_To, Leave_Total,Reason from leaverequest where Staff_Number=?print($StaffNum);? and authorized is null; Try something like: $query=select name,department,Leave_From,Leave_To, Leave_Total,Reason from leaverequest where Staff_Number ='$StaffNum' and authorized is null; Also, for security, you would be wise to cast $StaffNum to int before using it: $StaffNum = (int) $StaffNum; $query = SELECT .name,department,Leave_From,Leave_To, .Leave_Total,Reason .FROM leaverequest .WHERE Staff_Number=$StaffNum .AND authorized IS NULL; HTH -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] $3000 Per Hour or $1 Million in 26 weeks? ? How Is This Possible??
---How To Make It *BIG* on the Net...QUICKLY...with NO Money! This is NEW and INCREDIBLY EXCITING!! Join Free, WORLD-WIDE! (Zero investment!) No hassles, no selling, no pressure. Like NOTHING you have ever seen on the net today! No limits... You can join for FREE and MAKE MONEY!! We will Help YOU! Once your earnings START, they NEVER STOP! Check out this EXCITING OPPORTUNITY. Start immediately. === I'll email you free details. === Just send a blank e-mail to: [EMAIL PROTECTED]--and type JoinFree in subject line. (DO NOT HIT REPLY or It will be automatically purged or bounced.) Hope you don't miss this one. = (DO NOT HIT REPLY or It will be automatically purged or bounced.) -- -- *(REMOVAL INSTRUCTIONS BELOW)** -- - If you wish to be removed from future mailings, please send an email to: [EMAIL PROTECTED] with the subject Remove and you will automatically be blocked from any future mailings. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Warning: Page has Expired
I have the same troubles. I believe that the only solution is to use GET rather than POST as your FORM METHOD. There may be another way, but this may work fine, as long as you are not working with passwords/sensitive info. olinux --- Mad Nas [EMAIL PROTECTED] wrote: Hi All I'm using PHP 4 and MySQL in W2K . When i submit a form and call a php file, i get this message : __ Warning: Page has Expired __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] newbie needs to format time field
This may be a dumb question but here goes: I have a mySQL database that I am using PHP to interface with. I have fields in the database that are DATE and TIME types. Can I format these values so that the user sees September 15, 2001 or 2:00 PM instead of 2001-09-15 and 14:00:00 when I show the values on the web page? If so, can anyone suggest a reference which will help me do this? I didn't find anything in the mySQL or PHP manuals, but maybe I was looking in the wrong places! Thanks in advance from a relatively new PHP user! Eric J Schwinder eric.AT.bergencomputing.DOT.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Searching database tables
$searchCategory=Company;[insert html code for drop down box instead of this line] $searchKey=IBM; $result = mysql_query(SELECT * from $table WHERE ($searchCategory='$searchKey')); or something like that anyway - seb -Original Message- From: Devon [mailto:[EMAIL PROTECTED]] Sent: 04 September 2001 02:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] Searching database tables I have a database in mysql that only has one table, that table has approx 25 fields . I need to be able to search for data under each of these fields. Field examples: Company, TechContact, AdminContact, Mobile etc etc I need I guess a pull down menu that would select a field (c above) then be able to search under each field, as in search for company name, or mobile number etc etc. As of yet I cant get my search working ... does any one have any sample code or any suggestion? Any help would be amazing . if you have an answer post on here or write to me at work [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] unable to get more than one value to display in the array
Hi all, I am hoping someone can help me from my hair pulling. I am using a class called graphite.php (which I have attached) to generate a graph, It pulls the last seven days of hits to a web site from the db and graphs these as; Hits (y-axis) vs Day (x-axis) as a line graph. Unfortunately I am only able to graph the last element in the array. :( Can anyone explain why ? Thanks. Chrisotpher. Code is below... ?php // Graph to display the Last Seven Days Hits... //-- include(graphite.php); //-- // set the db table variable //-- $dbsql = stats; $db = mysql_connect(localhost,test,test); mysql_select_db(logs, $db); //-- // SELECT statement to retrieve the count of site visitors //-- $sql = SELECT count(http_x_forwarded_for) as cnt from $dbsql; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $overall = $row[cnt]; } //-- // Daily Averages queries //-- echo Last Seven Daily Averages:BR; $sql = SELECT count(*) as cnt, DAYNAME(recieved) as dnr, TO_DAYS(recieved) as tdr FROM $dbsql WHERE recieved = DATE_SUB( CURRENT_DATE, INTERVAL 6 day ) GROUP BY dnr,tdr ORDER BY tdr; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { echo $row[dnr] $row[cnt]BR; $day = $row[dnr]; $count = $row[cnt]; } //-- $test = new graphite_line(); $test-filename = mygif.gif; $test-width = 400; $test-height = 300; $test-y_axis_label = Hits; $test-y_lables = xrange(0, 20, 1); $test-x_axis_label = Days of the Week; $test-data = array($count); $test-data_lables = array($day); $test-init(); $test-prep(); $test-plot(20); $test-data = array(); $test-graph_color = ImageColorAllocate($test-image,0,255,0); $test-prep(); $test-plot(20); $test-close(); echo img src=\mygif.gif\; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
SV: [PHP-DB] newbie needs to format time field
Checkout: http://www.mysql.com/doc/D/a/Date_and_time_functions.html the function DATE_FORMAT(date,format) does what you want... -Ursprungligt meddelande- Från: Eric J Schwinder [mailto:[EMAIL PROTECTED]] Skickat: den 3 september 2001 21:39 Till: [EMAIL PROTECTED] Ämne: [PHP-DB] newbie needs to format time field This may be a dumb question but here goes: I have a mySQL database that I am using PHP to interface with. I have fields in the database that are DATE and TIME types. Can I format these values so that the user sees September 15, 2001 or 2:00 PM instead of 2001-09-15 and 14:00:00 when I show the values on the web page? If so, can anyone suggest a reference which will help me do this? I didn't find anything in the mySQL or PHP manuals, but maybe I was looking in the wrong places! Thanks in advance from a relatively new PHP user! Eric J Schwinder eric.AT.bergencomputing.DOT.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Warning: Page has Expired
look in php.ini (or whatever the Linux equivalent is) for session.cache_limiter and set it to session.cache_limiter = nocache HTH 8^D Dave -Original Message- From: olinux o [mailto:[EMAIL PROTECTED]] Sent: 03 September 2001 19:34 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Warning: Page has Expired I have the same troubles. I believe that the only solution is to use GET rather than POST as your FORM METHOD. There may be another way, but this may work fine, as long as you are not working with passwords/sensitive info. olinux --- Mad Nas [EMAIL PROTECTED] wrote: Hi All I'm using PHP 4 and MySQL in W2K . When i submit a form and call a php file, i get this message : __ Warning: Page has Expired __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]