OK. Ya followed me just a little too literally. We needed you to restructure. So you're part way there. i've made some changes below.
I don't have access to PHP here at work, otherwise I'd test the changes I made below. So you'll have to test them. You'll note that I placed the while(){} loop where it should be. I also split the Name line into two different array elements. The array element names refer directly to the variables after SELECT in your SELECT query. I did the same in the Phone line. -----Original Message----- From: Jason Gerfen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 23, 2001 2:23 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: PHP and MySQL queries... Ok here is what I have done after your suggestions... if ($date == "") {$date = '%';} $result = mysql_query ("SELECT fname,lname,address,city,state,zip,phonea,phone,email,crty,crnum,crmo,cryr,w eeks,ogden,rock,logan,ipaddress,ad,total,num,date,time FROM ads WHERE date LIKE '%$date%' LIMIT 0, 30 "); $count = mysql_num_rows($results); if (mysql_num_rows($results) ) { while( $row = mysql_fetch_array($result) ) { print "<B>Name: </B>".$row['fname'].", ".$row[' lname']."<BR>\n"; print "<B>Address: </B>".$row['address']."<BR>\n"; print "<B>City: </B>".$row['city']."<BR>\n"; print "<B>State: </B>".$row['state']."<BR>\n"; print "<B>Zip: </B>".$row['zip']."<BR>\n"; print "<B>Phone: </B>".$row['phonea'].", ".$row[' phone']."<BR>\n"; print "<B>Email: </B>".$row['email']."<BR>\n"; print "<B>Credit Type: </B>".$row['crty']."<BR>\n"; print "<B>Credit Number: </B>".$row['crnum']."<BR>\n"; print "<B>Credit Date: </B>".$row['crmo']."<BR>\n"; print "<B>Weeks: </B>".$row['weeks']."<BR>\n"; print "<B>Ogden: </B>".$row['ogden']."<BR>\n"; print "<B>Logan: </B>".$row['logan']."<BR>\n"; print "<B>IP Address: </B>".$row['ipaddress']."<BR>\n"; print "<B>Ad: </B>".$row['ad']."<BR>\n"; print "<B>Total: </B>".$row['total']."<BR>\n"; print "<B>Ad Number: </B>".$row['num']."<BR>\n"; print "<B>Date: </B>".$row['date']."<BR>\n"; print "<B>Time: </B>".$row['time']."<BR>\n"; } } else { print "No rows found"; } ?> After I have uploaded it to the webserver I now get a parse error on line 201 and that is the end of the php file, so there isn't anything to change. I am still fairly new to this so any help you can provide would be great. Thanks again. Jason >From: Rick Emery <[EMAIL PROTECTED]> >To: 'Jason' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >Subject: RE: [PHP-DB] Re: PHP and MySQL queries... >Date: Tue, 23 Oct 2001 13:13:21 -0500 > >First o all, GET RID of the 19 constructs using mysql_result(). You've >already captured the row with the $row=mysql_fetch_array(). >mysql_result() cannot be mixed with mysql_fetch_arry(). > >So instead of: >echo "<B>Address: </B>"; >printf(mysql_result($result,$count,"address")); >echo "<BR>\n"; > >use: >print "<B>Address: </B>".$row['address']."<BR>\n"; > >Next, dates are stored in MySQL as YYYY-MM-DD. Use that format in your >input. > >Next, don't combine that "if(mysql_fetch_array())" with the "do while()" >Instead, use: > >if (mysql_num_rows($results) ) >{ > while( $row = mysql_fetch_array($result) ) > { > } >} >else { >print "No rows found"; >} > >Do the above. Re-submit. Tell me the results. W'ell go from there... > >rick > >-----Original Message----- >From: Jason [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, October 23, 2001 12:37 PM >To: [EMAIL PROTECTED] >Subject: [PHP-DB] Re: PHP and MySQL queries... > > >As of yet I have tried all sorts for date formating for the search field to >work. I.E. 2001-10-23, 10/23/2001, 10/%/2001, 10%, %10%, etc. The date >field in the database is stored as 10/23/2001 and yet when a user enters >the >date and clicks the search button it does not display the results. I am >almost certain that as the user clicks the submit button the php script is >parsing the search string (i.e. 10/23/2001) incorrectly. I believe it is >parsing the sting as 10&nsb;23&nsb;2001 or something to that effect. If >anyone has some more information on this please let me know. I am pretty >sure I have exhausted my resources. > >"Jason" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am having a hard time setting up a form for users to enter a date in >the > > format of 00/00/0000 (of course they would use an actual date). My form >is > > as follows... > > <form name="auth" method="post" action="search.php"> > > <p>*I.E. - Format is 04/01/2001*</p> > > <p>Search for Ads by date: > > <input type="text" name="date"> > > </p> > > <p> > > <input type="submit" name="login" > > value="Submit"> > > <input type="reset" name="reset" >value="Reset"> > > </p> > > </form> > > ================================================ > > On my search.php page I have the following MySQL connection and search > > parameters... > > <?php > > > > mysql_connect ("db_hostname", "db_username", "db_password"); > > > > mysql_select_db ("db_name"); > > > > if ($date == "") > > {$date = '%';} > > > > $result = mysql_query ("SELECT > > >fname,lname,address,city,state,zip,phonea,phone,email,crty,crnum,crmo,cryr, w > > eeks,ogden,rock,logan,ipaddress,ad,total,num,date,time > > FROM ads WHERE date LIKE '%$date%' LIMIT 0, 30 "); > > $count = -1; > > if ($row = mysql_fetch_array($result)) { > > $count ++; > > do { > > echo "<B>Name: </B>"; > > printf(mysql_result($result,$count,"fname")); > > echo " "; > > printf(mysql_result($result,$count,"lname")); > > echo "<BR>\n"; > > > > echo "<B>Address: </B>"; > > printf(mysql_result($result,$count,"address")); > > echo "<BR>\n"; > > > > echo "<B>City: </B>"; > > printf(mysql_result($result,$count,"city")); > > echo "<BR>\n"; > > > > echo "<B>State: </B>"; > > printf(mysql_result($result,$count,"state")); > > echo "<BR>\n"; > > > > echo "<B>Zip: </B>"; > > printf(mysql_result($result,$count,"zip")); > > echo "<BR>\n"; > > > > echo "<B>Phone: </B>("; > > printf(mysql_result($result,$count,"phonea")); > > echo ") "; > > printf(mysql_result($result,$count,"phone")); > > echo "<BR>\n"; > > > > echo "<B>Email: </B>"; > > printf(mysql_result($result,$count,"email")); > > echo "<BR>\n"; > > > > echo "<B>Credit Type: </B>"; > > printf(mysql_result($result,$count,"crty")); > > echo "<BR>\n"; > > > > echo "<B>Credit Number: </B>"; > > printf(mysql_result($result,$count,"crnum")); > > echo "<BR>\n"; > > > > echo "<B>Credit Card Date: </B>"; > > printf(mysql_result($result,$count,"crmo")); > > echo " "; > > printf(mysql_result($result,$count,"cryr")); > > echo "<BR>\n"; > > > > echo "<B>Weeks: </B>"; > > printf(mysql_result($result,$count,"weeks")); > > echo "<BR>\n"; > > > > echo "<B>town1: </B>"; > > printf(mysql_result($result,$count,"town1")); > > echo "<BR>\n"; > > > > echo "<B>town2: </B>"; > > printf(mysql_result($result,$count,"town2")); > > echo "<BR>\n"; > > > > echo "<B>town3: </B>"; > > printf(mysql_result($result,$count,"town3")); > > echo "<BR>\n"; > > > > echo "<B>IP Address: </B>"; > > printf(mysql_result($result,$count,"ipaddress")); > > echo "<BR>\n"; > > > > echo "<B>Ad: </B>"; > > > > $ad[$count] = (mysql_result($result,$count,"ad")); > > > > $ad[$count] = ereg_replace ("&a&", "'", $ad[$count]); > > $ad[$count] = ereg_replace ("&q&", "\"", $ad[$count]); > > $ad[$count] = ereg_replace ("&p&", "%", $ad[$count]); > > $ad[$count] = ereg_replace ("&bs&", "\\", $ad[$count]); > > > > > > echo $ad[$count]; > > echo "<BR>\n"; > > > > echo "<B>Total: </B>"; > > printf(mysql_result($result,$count,"total")); > > echo "<BR>\n"; > > > > echo "<B>Ad Number: </B>"; > > printf(mysql_result($result,$count,"num")); > > echo "<BR>\n"; > > > > echo "<B>Date: </B>"; > > printf(mysql_result($result,$count,"date")); > > echo "<BR>\n"; > > > > echo "<B>Time: </B>"; > > printf(mysql_result($result,$count,"time")); > > echo "<BR>\n"; > > > > } while($row = mysql_fetch_array($result)); > > > > } else {print "Sorry, no records were found!";} > > > > ?> > > So far I have come to the conclusion that the input from the user is > > probably where my problem is because I am assuming it is taking the "/" >in > > the date they enter and doing something I don't want it to. In any >event >if > > someone could give me a clue as to how to resolve this issue it would be > > greatly appreciated. > > > > > > > >-- >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] > > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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]