Ask a Question related to PHP Development, Design and Development.
-
DjDrakk #1
Re: Message for 0 Records Found
if ($data = mysql_fetch_array($result)) {
echo "<table>\n"
do {
echo "<tr>";
echo "<td>".$data['dataset1']."</td>\n";
echo "<td>".$data['dataset2']."</td>\n"; /* Add more datasets if
needed */
echo "</tr>\n";
} while ($data = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "No Records Found\n";
};
--
Your GP or your HP!
Warren Butt
"entoone" <entoone@pacbell.net> wrote in message
news:8izXa.705$cV.58022018@newssvr21.news.prodigy. com...the> This code works so far to return values if there are records that matchtitle> query, but how can I have a message displayed to the user, should there be
> no records found? Thanks in advance.
>
> <?
> include("searchbyst.php");
> ?>
>
> <?php
>
> /* This script gets results from db, and then formats a table with> headers and rows of data */
>
> /* Returns name, phone and record id number and sorts by name -
> searchable for name and phone
>
> /* Connecting, selecting database */
>
> $link = mysql_connect("localhost", "lister", "2332400")
>
> or die("Could not connect");
>
> mysql_select_db("nlisting") or die("Could not select database");
>
>
> /* Performing SQL query */
>
> $query = "SELECT * FROM contacts23 where state='$searchstate' order by
> hcounty";
>
> $result = mysql_query($query) or die("Query failed");
>
>
>
> /* Printing results in HTML */
>
> print "<center>\n";
>
> print "<table border=1 cellpadding=2 cellspacing=5>\n";
>
> print "\t<tr bgcolor=#000000>\n";
>
> {
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >First</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >Last</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >County</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahomahref='show.php?searchid=$line[id]'>More> size=2 >State</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >Phone</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >Mobile</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >Fax</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#ffffff face=Tahoma
> size=2 >Profile</td>\n";
>
> }
>
> print "\t</tr>\n";
>
> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
>
>
> print "\t<tr>\n";
>
> {
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[first] </td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[last]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[hcounty]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[state]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[phone]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[mobile]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 >$line[fax]</td>\n";
>
> print "\t\t<td><bgcolor=#000000><font color=#000000 font
> color=#000000 face=Tahoma size=2 ><A> Info</td>\n";
>
>
>
>
>
> }
>
> print "\t</tr>\n";
>
> }
>
> print "</table>\n";
>
>
>
> /* Free resultset */
>
> mysql_free_result($result);
>
>
>
> /* Closing connection */
>
> mysql_close($link);
> ?>
>
> <p> </p>
>
> <div align="center">
>
> <center>
>
> <p></p>
>
> </center>
>
> </div>
>
>
DjDrakk Guest
-
CF: change File not found message
We have a server with Cold Fusion MX 7, IIS6 and Windows 2003 Web Edition. One of our clients was running their Cold Fusion based ecommerce... -
No records found for MySQL Table
Hello, We have a MySQL table that we had been using PHP to query, but now we want to query the table using CF 5.0 on a windows 2000 server. The... -
Found Records
is there a function that allows you to distinguish between found and omitted records? For example, a certain field = 0 for omitted, 1 for in the... -
[PHP] Form variables lost when duplicate records are found !
--- Pushpinder Singh Garcha <pgarcha@adelphia.net> wrote: Of course. However, I don't understand what you need help with. There are many... -
[PHP] Form variables lost when duplicate records are found!
then the forms variables are stored and NOT LOST ?? Have you looked into sessions? http://www.php.net/manual/en/ref.session.php -
entoone #2
Re: Message for 0 Records Found
I got it.. durr.. I'm tired.. is there a way to center the response? I know
I'm asking alot, but just having a little trouble in a few areas. Thansk
again MeerKat!
"MeerKat" <liquidlaughter2000@blueyonder.co.uk> wrote in message
news:xwzXa.41$Hm4.15@news-binary.blueyonder.co.uk...the> entoone wrote:> > This code works so far to return values if there are records that matchbe> > query, but how can I have a message displayed to the user, should thereby> [snip]> > no records found? Thanks in advance.> >
> > $query = "SELECT * FROM contacts23 where state='$searchstate' order> if (mysql_num_rows($result) > 0) {> > hcounty";
> >
> > $result = mysql_query($query) or die("Query failed");
> >
> // print your table;
> } else {
> print "Sorry, no results";
> }
>
>
> --
> MeerKat
>
entoone Guest
-
MeerKat #3
Re: Message for 0 Records Found
entoone wrote:
....> I got it.. durr.. I'm tired.. is there a way to center the response? I know
print "<center>Sorry, no results</center>";
....
(obviously stylesheets would be better but given you've used <center>
before then what the heck... :) )
--> I'm asking alot, but just having a little trouble in a few areas. Thansk
> again MeerKat!
>
> "MeerKat" <liquidlaughter2000@blueyonder.co.uk> wrote in message
> news:xwzXa.41$Hm4.15@news-binary.blueyonder.co.uk...
>>>>entoone wrote:
>>>>>This code works so far to return values if there are records that match
> the
>>>>>query, but how can I have a message displayed to the user, should there
> be
>>>>>>>no records found? Thanks in advance.
>>[snip]
>>>>> $query = "SELECT * FROM contacts23 where state='$searchstate' order
> by
>>>>>>>hcounty";
>>>
>>> $result = mysql_query($query) or die("Query failed");
>>>
>>if (mysql_num_rows($result) > 0) {
>>// print your table;
>>} else {
>>print "Sorry, no results";
>>}
>>
>>
>>--
>>MeerKat
>>
>
>
MeerKat
MeerKat Guest



Reply With Quote

