[PHP-DB] select inside a while loop

2003-11-27 Thread Mike Baerwolf
Hello, I have two mysql tables songs and artists. They look like this: CREATE TABLE `artists` ( `artist_id` int(10) unsigned NOT NULL auto_increment, `artist_name` varchar(100) default NULL, `artist_img` varchar(50) default NULL, PRIMARY KEY (`artist_id`), UNIQUE KEY `artist_name`

[PHP-DB] mysql field comparison to multiple variables

2003-10-24 Thread Mike Baerwolf
Hello, I trying to put together a sql statement that will pull records based on a date field. I can't figure out how to compare the date field to multiple php variables. Something like this, WHERE date_field != $date_1 OR $date_2 OR $date_3 etc. etc. Thanks for the help. Mike -- PHP

[PHP-DB] md5() and mysql

2003-08-29 Thread Mike Baerwolf
Hello, I'm looking at using md5() and mysql for user auth to some of the data in a table. I found the following on the php md5 manual page, $query = INSERT INTO user VALUES ('DummyUser',md5('DummyPassword')); $password = md5($password); $query = SELECT * FROM user WHERE username='DummyUser'

[PHP-DB] Multiple checkboxes

2003-08-14 Thread Mike Baerwolf
Hello, I'm trying to get the values from a form post with multiple checkboxes checked . Here is what I have, if ($row = mysql_fetch_array($result)); do { input type=checkbox name=class_id[] value=$row[class_id] $row[name] }while ($row = mysql_fetch_array($result));

[PHP-DB] Insert/Update help needed

2003-07-17 Thread Mike Baerwolf
Hello all, I've been able to get the below to work pretty much. The only problem I have is when there is an apostrophe in the data of one of the fields like (You're the One). When this occurs nothing gets updated or inserted(tried both). I've done other things from forms inserting/updating

[PHP-DB] Date Ranges

2001-05-02 Thread Mike Baerwolf
Hi, I'm working on a event calendar and some events span more than one day. I would like to store a date range like 2001-02-05 thru 2001-07-05 so when I do a query for the current day the event would appear for all the days in the range. I hoping someone can point me to some documentation or

[PHP-DB] substring_index Part 2

2001-04-12 Thread Mike Baerwolf
Thanks for the help on the earlier ?. Now that I have the select statement working I can't get any results displayed. $result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM news",$db) or die ("Invalid Query"); if ($myrow = mysql_fetch_array($result)) { do {

[PHP-DB] select substring_index

2001-04-11 Thread Mike Baerwolf
I have a simple news manager and I would like to display the first two sentences of a news story. I got this select statement from the mysql mailing list: SELECT substring_index( body, ". ", 2) FROM news; This works great from the mysql client but when I try it using php with this: $result

[PHP-DB] retrieving images

2001-03-31 Thread Mike Baerwolf
Hello, I'm trying to retrieve and output all the binary images in my images table. This is what I have, $result = mysql_query("SELECT * FROM images",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { $filetype =

[PHP-DB] news manager

2001-03-29 Thread Mike Baerwolf
Hello, I'm working on a news manager and would like to display records for today,yesterday,last week, last month and so on. This is what I have so far, $result = mysql_query("SELECT * FROM news WHERE timestamp=010325",$db); if ($myrow = mysql_fetch_array($result)) { Is there a way to do

[PHP-DB] PrintF

2001-03-27 Thread Mike Baerwolf
Hello, I'm new to PHP and mySQL. I'm trying to find more info on printf. Specifically setting table properties, like height,width,background. Hoping someone can point me in the right direction. Thanks for the Help, Mike