Re: [PHP-DB] Selecting Null columns

2004-04-21 Thread Uzi Klein
Maybe it is not null but has empty content? the first statement is correct try >> SELECT * FROM questions WHERE (answer IS NOT NULL OR answer<>''); or maybe >> SELECT * FROM questions WHERE LENGTH(answer)>0; - Original Message - From: "Pambos Nicolaou" <[EMAIL PROTECTED]> To: <[EMA

[PHP-DB] Selecting Null columns

2004-04-21 Thread Pambos Nicolaou
Hi everyone I am a new user of this mail list and I hope that it will be helpful. I am trying to show the content of a MySQL table(raw) where the content of a column is NOT NULL. I used the commands below but the result shows the content of the whole table for the first case and nothing in the

Re: [PHP-DB] Inserting data into a table

2004-04-21 Thread Uzi Klein
Use UPDATE statement UPDATE tbl SET date_field=NOW() where index=your_index or UPDATE tbl SET date_field='2004-04-22' where index=your_index - Original Message - From: "charalambos nicolaou" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 22, 2004 3:35 AM Subject: [P

[PHP-DB] Inserting data into a table

2004-04-21 Thread charalambos nicolaou
Hi everyone, How can I insert a value in to a field of a MySQL table which is already NULL but the others in the same row are not. Also I would like to know if there is a way of inserting in to a DATE filed the date of the browser. Thanks in advance. Charalambos ___

Re: [PHP-DB] Re: mysql foreign keys

2004-04-21 Thread Uzi Klein
> Hi. > > Any body got an idea how to use hte foreign keys in mysql innodb tables > and how whould the change affect the performance of the server? > > lets say i have Items table, Clients table, and Sales table > the Sales table always stores ClientID and ItemID > but not every client/item is ther

[PHP-DB] Re: mysql foreign key syntax / tutorial

2004-04-21 Thread Torsten Roehr
"Uzi Klein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi. > > Any body got an idea how to use hte foreign keys in mysql innodb tables > and how whould the change affect the performance of the server? > > lets say i have Items table, Clients table, and Sales table > the Sales tab

[PHP-DB] mysql foreign key syntax / tutorial

2004-04-21 Thread Uzi Klein
Hi. Any body got an idea how to use hte foreign keys in mysql innodb tables and how whould the change affect the performance of the server? lets say i have Items table, Clients table, and Sales table the Sales table always stores ClientID and ItemID but not every client/item is there a sale can b

[PHP-DB] Re: Mysql Foreign Keys

2004-04-21 Thread Torsten Roehr
"Uzi Klein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does anybody know of a good tutorial of using foreign keys in MySQL InnoDB > tables? Take a look here: http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html Should contain everything you need to know about

Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Still doesn't work the way I want it. My boss is taking a look at it, she knows SQL really well, I was trying to do this without her assistance, but its just harder then I was expecting. thanks for the help tho On Wed, 21 Apr 2004, Daniel Clark wrote: > How about > > SELECT distinct badge.id

Re: [PHP-DB] logic problem

2004-04-21 Thread Daniel Clark
How about SELECT distinct badge.id, convert( varchar,eventime,110) as date Shows all the badge numbers IN on that date. If the badge number is not there, they didn't check in at ALL that day. > This seems too easy to not be able to do it with SQL. There must be > something we're missing in th

Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Re-read my original email, I'm using mssql and not mysql. I'm sort of close to having it working with the sql statement i posted earlier and using PHP to figure out if the date has changed or not and to count the cardnum if the date hasn't changed. I'm getting a number that is different then

Re: [PHP-DB] logic problem

2004-04-21 Thread Brent Baisley
This seems too easy to not be able to do it with SQL. There must be something we're missing in the query. Try this: select distinct badge.id,convert( varchar,eventime,110) as date,count(*) from events, badge where events.cardnum = badge.id and devid = '1' and convert( varchar, events.eventime, 11

Re: [PHP-DB] URL Problem

2004-04-21 Thread C Daniel Chase
Lambert, Patrick wrote: So it sounds like you need to examine the headers of the response (which sounds like it is a redirect)? Try PEAR's HTTP_Request (http://pear.php.net/package/HTTP_Request). This time in PHP using the above: Array ( [response_code] => 302 [response] => HTTP/1.1 302 Fo

Re: [PHP-DB] URL Problem

2004-04-21 Thread C Daniel Chase
Lambert, Patrick wrote: So it sounds like you need to examine the headers of the response (which sounds like it is a redirect)? Try PEAR's HTTP_Request (http://pear.php.net/package/HTTP_Request). More specifically, you need a HEAD request: http://pear.php.net/manual/en/package.http.http.head.php Fo

Re: [PHP-DB] Drop-down box in php

2004-04-21 Thread John W. Holmes
From: andy amol >I am using the following code, but it is not populating my script. If you can help I would be grateful. > I am using mysql as database. > $sql = "SELECT course_id FROM course"; > $sql_result = mysql_query($sql) > or die("Couldn't execute query."); > while ($row = mysql_fetc

Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Yeah I basically had that with my previous SQL statement, I was grouping by event.cardnum instead of counting the cardnums by date. I think what I'm trying to do is beyond the scope of SQL and I'll have to write some PHP to take the SQL statement results and feed them into an array and count t

RE: [PHP-DB] Multiple work mySql database search.

2004-04-21 Thread Uzi Klein
Or even better : Try this : $string = "Hello World"; $TableName = "Table"; $FieldName = "Field"; $Field = "CONCAT_WS('', ' ', TRIM($TableName.$FieldName), ' ')"; $Op = $Type=="All" ? "AND" : "OR"; $where = "WHERE ($Field LIKE '% ".(preg_replace("/[\s]+/", " %' $Op $Field LIKE '% ", $string))

RE: [PHP-DB] URL Problem

2004-04-21 Thread Lambert, Patrick
So it sounds like you need to examine the headers of the response (which sounds like it is a redirect)? Try PEAR's HTTP_Request (http://pear.php.net/package/HTTP_Request). p. > -- > From: Chris Payne > Sent: Wednesday, April 21, 2004 12:52 PM > To: [EMAIL PROTECTED] > Su

Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Yes eventtime is a timestamp field (whatever mssql's version of mysql's NOW() is) and the convert( varchar,eventime,110) converts the timestamp to a date MM-DD-. my problem is that with the count, it counts each card swipe, and i only need to count one card swipe from each patron per day.

Re: [PHP-DB] logic problem

2004-04-21 Thread Daniel Clark
AND: any count >=1 shows they came in that day. How about: SELECT convert( varchar,eventime,110) as date from events, badge, count(convert( varchar,eventime, 110)) as count WHERE events.cardnum = badge.id and devid = '1' and convert( varchar, events.eventime, 110) BETWEEN '$startdate' and '

Re: [PHP-DB] logic problem

2004-04-21 Thread Daniel Clark
How about: SELECT convert( varchar,eventime,110) as date from events, badge, count(convert( varchar,eventime, 110)) as count WHERE events.cardnum = badge.id and devid = '1' and convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate' AND type = '1' GROUP BY convert( varchar

Re: [PHP-DB] Multiple work mySql database search.

2004-04-21 Thread Uzi Klein
Try this : $string = "Hello World"; $TableName = "Table"; $FieldName = "Field"; $Field = "CONCAT_WS('', ' ', TRIM($TableName.$FieldName), ' ')"; $Op = $Type=="All" ? "AND" : "OR"; $where = "WHERE ($Field LIKE '% ".(preg_replace("/[\s]+/", " %' $Op $Field LIKE '% ", $string))." %')"; $sql = "SEL

Re: [PHP-DB] logic problem

2004-04-21 Thread Brent Baisley
I think your problem is that you are using time, when you are not interested in time, just the date. I'm assuming your eventime column is a timestamp field. Your goal is to select the badge id and the date, distinct will then eliminate multiple visits and then you can group by date to get the v

[PHP-DB] Re: URL Problem

2004-04-21 Thread Justin Patrin
Chris Payne wrote: Hi there everyone, I have a problem. Basically this is what I need to do: Request behind the scenes (PHP) an ASP Url on a different website with the value pid=1 (Where 1 is an identifying number). Then I need PHP to listen to the response from that request as A

RE: [PHP-DB] URL Problem

2004-04-21 Thread Chris Payne
Hi there, >Just to help clarify, is this what you're saying? If you were to go to the page via a web browser, and put in something like: http://www.someserver.com/somepage.asp?pid=11101 it would get changed (in the browser address bar) to something like http://www.someserver.com/somepath/someo

[PHP-DB] logic problem

2004-04-21 Thread Adam Williams
I'm using some proprietary software/hardware where when a visitor swipes their entry card, it is recorded in a mssql 2000 server. My boss wants a count of unique vistors for a range of dates. So, I need to have it give a count of unique vistors, meaning that I need to count all vists for a da

RE: [PHP-DB] URL Problem

2004-04-21 Thread Mark
--- Chris Payne <[EMAIL PROTECTED]> wrote: > Hi there, > > Thanks for the below, but I'll try to explain it a bit better. > > I don't have access to the ASP server, it's a general server setup > for > companies, to query their server you must use the > ?pid=uniquecompanynumber > as it tracks you

RE: [PHP-DB] URL Problem

2004-04-21 Thread Daniel Clark
Can also open it in read only: $fp = fopen ("/home/rasmus/file.txt", "r"); > Hi there, > > Thanks for the below, but I'll try to explain it a bit better. > > I don't have access to the ASP server, it's a general server setup for > companies, to query their server you must use the ?pid=uniquecompa

RE: [PHP-DB] URL Problem

2004-04-21 Thread Chris Payne
Hi there, Thanks for the below, but I'll try to explain it a bit better. I don't have access to the ASP server, it's a general server setup for companies, to query their server you must use the ?pid=uniquecompanynumber as it tracks your IP to make sure the correct server is connecting. Anyway, w

Re: [PHP-DB] URL Problem

2004-04-21 Thread Viorel Dragomir
Anyway first you have to translate your problem to us. In plain english. But I have spare time, so.. here is the solution for your problem, as I understood it. from php http://myserver.com/index.asp?pid=";); print_r($f); ?> In ASP you take the pid do what you want to it and then <% Resp

[PHP-DB] URL Problem

2004-04-21 Thread Chris Payne
Hi there everyone, I have a problem. Basically this is what I need to do: Request behind the scenes (PHP) an ASP Url on a different website with the value pid=1 (Where 1 is an identifying number). Then I need PHP to listen to the response from that request as ASP will then return

Re[2]: [PHP-DB] Handling missing rows on joins

2004-04-21 Thread Mikhail U. Petrov
Hi! But you can replace all information about user on for ex. 'User real name'=>'Deleted' Wednesday, April 21, 2004, 6:34:36 PM, -{ wrote: RB> The problem with this is legal issues. According to Danish law, you're not RB> permitted to save a person's details for more than a certain amount of ti

Re: [PHP-DB] Multiple work mySql database search.

2004-04-21 Thread Bruno Ferreira
Martin E. Koss wrote: I have a product database which can be searched for a keyword in up to 3 fields; using this select query: $sql_select = "SELECT * from productlist WHERE (Name LIKE '%$SearchText%') OR (Description LIKE '%$SearchText%') OR (Keywords LIKE '%$SearchText%') ORDER BY Name"; What I

Re: [PHP-DB] Multiple work mySql database search.

2004-04-21 Thread Viorel Dragomir
Split your phrase with split or explode functions. Then implode the new array as something like 'i', 'want', 'to', 'search' from 'i want to search'. Then create your whereClause for each of the result. If you want to find exactly the words than you might use the IN keyword.. like SELECT * FROM ta

[PHP-DB] Multiple work mySql database search.

2004-04-21 Thread Martin E. Koss
Hi all you experts who have help me often in the past, may I now ask what is probably so simple for someone doing PHP everyday... I have a product database which can be searched for a keyword in up to 3 fields; using this select query: $sql_select = "SELECT * from productlist WHERE (Name LIKE '

Re: [PHP-DB] Handling missing rows on joins

2004-04-21 Thread -{ Rene Brehmer }-
Was thinking of just dumping users to an "inactive" state as well upon deleting... it would solve my problem with the join issue for sure ... would also create alot of database clutter for sure ... Unused user accounts and such ... I don't like having data in the database that serves no real purpos

Re: [PHP-DB] Handling missing rows on joins

2004-04-21 Thread Doug Thompson
-{ Rene Brehmer }- wrote: Working with PHP 4.3.0 and MySQL 4.0.14 (but code MUST be compatible with 3.23.56). For my forums, I've got this 4-way join to load (and output) the posts with info on the poster: $fullthread = "SELECT postID,hf_posts.userID,name,time,post,edit,nickname,joined,location,pos

Re: [PHP-DB] Handling missing rows on joins

2004-04-21 Thread Mikhail U. Petrov
Hi! I think it'd be good to add in hf_users column status - ENUM('Active', 'Blocked', 'Deleted'), and when user will be deleted you should set this status to Deleted. Value 'Blocked' may give you a simple way to ban user :) Yes, this method of deletion take more database space, but it'd be better,

[PHP-DB] Handling missing rows on joins

2004-04-21 Thread -{ Rene Brehmer }-
Working with PHP 4.3.0 and MySQL 4.0.14 (but code MUST be compatible with 3.23.56). For my forums, I've got this 4-way join to load (and output) the posts with info on the poster: $fullthread = "SELECT postID,hf_posts.userID,name,time,post,edit,nickname,joined,location,posts,levelname