ValdouaD
-
Posts
22 -
Joined
-
Last visited
Never
Posts posted by ValdouaD
-
-
Hello, I want to place my resutls area inside a table in my page design but when I do it causes the page design to be all distorted. Is it NOT possible to display the below code inside a nested table on a page?
$connect = mysql_connect("XXXX", "XXXX", "XXXX"); $db = mysql_select_db("XXXX", $connect); $sql = "SELECT * FROM STOREDATA WHERE State = '".$_POST['state']."' OR ZIP_Code = '".$_POST['zipCode']."'"; $result = mysql_query($sql); $rows = mysql_num_rows($result); if($rows > 0) { echo "<p><center></p> <table border=\"1\"> <th align=\"center\newstyle\">Name</th> <th align=\"center\">City</th> <th align=\"center\">State</th> <th align=\"center\">Sales Phone</th>"; while($row=mysql_fetch_array($result)) { echo "<tr><center> <td align=\"center\" class=\"newstyle\">".$row['Name']."</td> <td align=\"center\" class=\"newstyle\">".$row['City']."</td> <td align=\"center\" class=\"newstyle\">".$row['State']."</td> <td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td> </tr>"; } } else { echo "No results found"; } mysql_close($connect); ;
-
Hey, thanks for all of your help. There seems to be more going on then meets the eye. I may have to go and do a complete redo on this one to get everything to flow right.
-
Ok, I do not have my CSS on a separate sheet, its all in the head section.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; --> ; background-color: #efe9e3; .table-data { } .PHP-area { z-index: 56000; } </style> <script src="950/SpryMenuBar.js" type="text/javascript"></script> <link href="950/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <link href="950/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" /> </style> <style type="text/css"> <!-- .style1 { font-family: Arial, Helvetica, sans-serif; padding-left: 15px; padding-right: 15px; } .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> </head> <body> <table width="950" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="950/950-hdr-nodrop.png" width="950" height="89" alt="header" /></td> </tr> </table> <table width="950" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="1021" height="25" bgcolor="A91E01"><ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="http://www.schylling.com" title="Schylling Toys" target="_top">Home</a> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?" title="Catalog" target="_top">Catalog</a></li> <li><a class="MenuBarItemSubmenu" href="#">Customer Service</a> <ul> <li><a href="http://www.schylling.com/om.html" title="Our Mission" target="_top">Our Mission</a> </li> <li><a href="http://www.schylling.com/pp.html" title="Privacy Policy" target="_top">Privacy Policy</a></li> <li><a href="http://www.schylling.com/safety.html" title="Safety Information" target="_top">Safety Information</a> </li> <li><a href="http://www.schylling.com/directions.html" title="Directions" target="_top">Toy & Game Directions</a></li> </ul> </li> <li><a href="http://www.shopatron.com/home/index/329.0" title="Store" target="_top">Shop Online</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=SRCH&Store_Code=SD" title="Search" target="_top">Search Our Site</a></li> </ul> </td> </tr> </table> <table width="950" height="490" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="47" bgcolor="efe9e3"><div align="center"><img src="950/top-block2.png" width="161" height="47" /></div> <td width="775" rowspan="2" valign="top" bgcolor="#FFFFFF"><p class="style1"><img src="direct-assets/Sl-tag.jpg" alt="" width="745" height="59" /> </p> <p class="style1"><span class="style5"><strong>Please use the form below to locate a retailer near you.</strong></span></p> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="371" valign="top" class="PHP-area"><?php if(!isset($_POST['submit'])){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p>Search by Zip:</font></b> <input type="text" name="zipCode" size="20"> (example: 01922) </p> <p>Search by State: </b></font> <input type="text" name="state" size="20"> (example: NY for New York) </font></b></span> <input type="submit" name="submit" value="Go"> </p> </form> <?php } else { // Page two, search and display $connect = mysql_connect("localhost", "XXXX", "XXXX"); $db = mysql_select_db("XXXX", $connect); $sql = "SELECT * FROM STOREDATA WHERE State = '".$_POST['state']."' OR ZIP_Code = '".$_POST['zipCode']."'"; $result = mysql_query($sql); $rows = mysql_num_rows($result); if($rows > 0) { echo "<p><center></p> <table border=\"1\"> <th align=\"center\newstyle\">Name</th> <th align=\"center\">City</th> <th align=\"center\">State</th> <th align=\"center\">Sales Phone</th>"; while($row=mysql_fetch_array($result)) { echo "<tr><center> <td align=\"center\" class=\"newstyle\">".$row['Name']."</td> <td align=\"center\" class=\"newstyle\">".$row['City']."</td> <td align=\"center\" class=\"newstyle\">".$row['State']."</td> <td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td> </tr>"; } } else { echo "No results found"; } mysql_close($connect); ; } ?></td> </tr> </table> <p class="style1"> </p> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> </tr> </table> <p class="style1"> </p> <p class="style1"> </p> <p class="style1"> </p></td> </tr> <tr> <td width="175" height="443" valign="top" class=""> <ul id="MenuBar2" class="MenuBarVertical"> <li><a class="MenuBarItemSubmenu" href="#">Schylling Originals</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SO-ABC" target="_top">ABC Collection </a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SO-PP">Peter Pirate </a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SO-SM">Sock Monkey </a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AF">Action Figures </a></li> <li><a class="MenuBarItemSubmenu" href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AP">Animals & Plush </a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AP-PM">Puppets & More </a> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AP-RD">Rubber Ducks </a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AP-TT">Thumb Toys </a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=AC">Arts & Crafts </a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB" class="MenuBarItemSubmenu">Character / Brands</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-AB">Angeline ballerina</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-CG">Curious George</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-OL">Olivia</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-TF">Thomas & Friends</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-UD">Uglydoll</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-WO">Wizard of Oz</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=CB-ZZ">Zhu Zhu Pets</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=DA" class="MenuBarItemSubmenu">Dolls & Accessories</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=DA-D">Dolls</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=DA-FL">Flatsy</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=DA-FF">Flower Fairies</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=GAM" class="MenuBarItemSubmenu">Games</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=GAM-CG">Classic Games</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=GAM-WB">Panda's Pick (Bamboo)</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=GAM-WB">Wood</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP" class="MenuBarItemSubmenu">Infant & Preschool</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP-ABC">ABC's Collection</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP-AM">Ambi</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP-BP">Block & Puzzles</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP-EA">Eco Angels</a> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=IP-JB">Jack In the Box</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JM" class="MenuBarItemSubmenu">Jokes & Magic</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JM-FAN">Fantasma Magic</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JM-JO">Jokes</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JF" class="MenuBarItemSubmenu">Just For Fun</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JF-NO">Novelty</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=JF-WU">Wind-Ups</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=LAV">Lavalite</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=MM">Money Matters</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=MT">Musical</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT" class="MenuBarItemSubmenu">Outdoor Play</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-BS">Beach & Sand</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-GARD">Gardening</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-KF">Kites & Flying toys</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-PT">Play Tents</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-PB">Playground Balls</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=OT-RA">Ride Ons & Accessories</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=RP" class="MenuBarItemSubmenu">Role Play</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=RP-CS">Cook Sets</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=RP-DU">Dress Up</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=RP-JA">Jewelry & Accessories</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=RP-TS">Tea Sets</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SC" class="MenuBarItemSubmenu">Science & Building</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SC-DP">Deskpets</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SC-ER">Erector</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=SC-SM">Sea Monkeys</a></li> </ul> </li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=TTCS" title="Tin Toys">Tin Toys</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=VEH" class="MenuBarItemSubmenu">Vehicles</a> <ul> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=VEH-DAR">Darda Cars & Tracks</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=VEH-DC">Die Cast</a></li> <li><a href="http://www.schylling.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=SD&Category_Code=VEH-TCS">Tin / Collector Series</a></li> </ul> </ul> </td> </tr> </table> <table width="950" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="950" height="61"><img src="950/footer-rnd.png" width="950" height="50" /></td> </tr> </table> <p> </p> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </body> </html>
-
Ok, I found some mistakes when I copied the code in there... so now I have it in and it works, but once you get the results it ruins the page layout... is it a Z-Index issue now?
-
Siric,
Ok, now this just got totally strange. i copied and pasted your code into the area of where i wanted this to show up and now when I test it out I get a blank page. I skipped fixing teh CSS for now I can always change that later. When I go and view its source it stops at line 5! This is extremely odd!
-
Ok, here is the link to the page that has the query on it: http://www.schylling.com/sf.php
-
Ok, so how do I wrap this all up into the page. For some reason when I add the results info it make my whole page design fall apart. I can post the example page here if that would help.
-
Hello, I havent changed this code since 2006 I believe so I am a little rusty at making changes to it. But what i would like to do is have my query on the page with my results listed on the same page instead of having ir broken down into 2 different pages.
Here is my form:
<form name="search" action="spage2.php" method="post"> <p align="left" style="margin-top: -1; margin-bottom: -1"> <span class="style2"><b><font size="2">Search by Zip:</font></b><font size="2"> </font> <input type="text" name="zipCode" size="20"> <b><font size="2">(example: 01922) </font></b></span></p> <p align="left" style="margin-top: -1; margin-bottom: -1"> <span style="font-family: Arial, Helvetica, sans-serif"><br> <font size="2"><b>Search by State: </b></font> <input type="text" name="state" size="20"> <input type="submit" size="20"> <b> <font size="2">(example: NY for New York) </font></b></span> </form>
And here is my the code from the results page:
// Page two, search and display $connect = mysql_connect("localhost", "XXXX", "XXXX"); $db = mysql_select_db("database_name", $connect); $sql = "SELECT * FROM STOREDATA WHERE State = '".$_POST['state']."' OR ZIP_Code = '".$_POST['zipCode']."'"; $result = mysql_query($sql); $rows = mysql_num_rows($result); if($rows > 0) { echo "<p><center></p> <table border=\"1\"> <th align=\"center\newstyle\">Name</th> <th align=\"center\">City</th> <th align=\"center\">State</th> <th align=\"center\">Sales Phone</th>"; while($row=mysql_fetch_array($result)) { echo "<tr><center> <td align=\"center\" class=\"newstyle\">".$row['Name']."</td> <td align=\"center\" class=\"newstyle\">".$row['City']."</td> <td align=\"center\" class=\"newstyle\">".$row['State']."</td> <td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td> </tr>"; } } else { echo "No results found"; } mysql_close($connect); ;
Instead of having a separate results page I would like to move them all into one page. This is possible isnt it?
ANd help or suggestions would be greatly appreciated.
Thanks! :-\
-
Can you add CSS into only 2 pages or do you have to set them to all pages?
-
When you need to make comsetic changes is that done in HTML and not PHP?
-
[code]<div align="center">
<center>
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="100%">
<div style="margin-left: 15pt;"><form name="search" action="spage2.php" method="post">
<p style="margin-left: 200">Search by Zip:
<input type="text" name="zipCode" size="20"> (example: 01922)
<br>
Search by State: <input type="text" name="state" size="20">
<input type="submit" size="20"> (example: NY for New York)
<br>
</p>
</form></div>
</td>
</tr>
</table>
</center>
</div>[/code]
Also I would like to have the results page show each result with an alternating background color. -
Why cant I paste my code in...I keep getting a connection error.
-
Hello, I am looking for some help. I have a website www.schylling.com, and I have a button for store locator.
Once you are on the store locator pages they are very ugly and have no real design to them.
I am not a php programer but I would like to know how I can dress this up a bit and also have the results page look
cleaner and match my site. Any help would be greatly appreciated.
Thank. -
Okay, that is where I need help. SO far the only PHP with databse I have ever made was a store locator where the customer just inputed a zipcode or state. Would I have to format some sort of table that housed the Product name for the drop down and another one for Product Color?
-
Hello, I am looking for information on how I can have a page on my site where people can register for special deals and also at the same time register their product. Then be able to harvest information from these registrants vie a database.
What I need is:
For the basic registration part:
Name:
Address:
email address:
Age Group: (A drop down list of age groups)
For the product registration:
Product Name : a drop down list of product choices
Product Color : another drop down list of choices
Registration #: They need to key this in.
I also need this to work even if the customer doenst register a product b ut just registers for newsletters.
Is there something like this around that i could use as a model?
ANy help would be great!
-
Somebody wrote this code for me like 3 years ago and I have nver chagned it.
PHP is not my strong suit as you can see.
But thank to all of you I am happy with the way it works now.
Thanks so much! You guys and gals are great! -
Now I have this error:
Parse error: parse error, unexpected T_LNUMBER, expecting ',' or ';' in /var/www/html/store_finder.php on line 252 -
Here is the error I get when I place this into a table:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /var/www/html/store_finder.php on line 247
Here is the code view [code]<div align="center">
<center>
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="100%"><?
// Page 1, the form
echo "<div style=\"margin-left: 15pt;\"><form name=\"search\" action=\"spage2.php\" method=\"post\">
<p style="margin-left: 200">Search by Zip:
<input type=\"text\" name=\"zipCode\" size="20"> (example: 01922)
<br>
Search by State: <input type=\"text\" name=\"state\" size="20">
<input type=\"submit\" size="20"> (example: NY for New York)
<br>
</p>
</form></div>";
?></td>
</tr>
</table>
</center>
</div>
[/code]{ -
Sorry about the double posting....my bad!
I was under the assumtion that if I used an html table and put all thatcode in the table it wouldnt work.
I have tried this and have gotten a lot of parser errors which I assumed was from the PHP code?
-
I have a store locatior on my website. I want to have it all centered on the page buit I cant figure out how.
Below is my input area where the customer would either put in theor zip code or state.
[code] <?
// Page 1, the form
echo "<div style=\"margin-left: 15pt;\"><form name=\"search\" action=\"spage2.php\" method=\"post\">
Search by Zip: <input type=\"text\" name=\"zipCode\"> (example: 01922)
<br>
Search by State: <input type=\"text\" name=\"state\"> <input type=\"submit\"> (example: NY for New York)
<br>
</form></div>";
?>[/code]
Here is the results area...which is on a differnt page. Here I have the same problem everything is flsuh left and I want it to be centered on the page like it was in its own table. Code is below:
[code]
<?
// Page two, search and display
$connect = mysql_connect("localhost", "XXXXX", "XXXXX");
$db = mysql_select_db("schylling_storelist", $connect);
$sql = "SELECT *
FROM STOREDATA
WHERE State = '".$_POST['state']."'
OR ZIP_Code = '".$_POST['zipCode']."'";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if($rows > 0) {
echo "<table border=\"1\">
<th align=\"center\newstyle\">Name</th>
<th align=\"center\">City</th>
<th align=\"center\">State</th>
<th align=\"center\">Sales Phone</th>";
while($row=mysql_fetch_array($result)) {
echo "<tr>
<td align=\"center\" class=\"newstyle\">".$row['Name']."</td>
<td align=\"center\" class=\"newstyle\">".$row['City']."</td>
<td align=\"center\" class=\"newstyle\">".$row['State']."</td>
<td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td>
</tr>";
}
}
else {
echo "No results found";
}
[/code]
Is there an easy way to do this? -
Here is my code taht I have for my results page. I would like to have it come out centered on the page instead of flush left.
<?
// Page two, search and display
$connect = mysql_connect("localhost", "XXXXX", "XXXXX");
$db = mysql_select_db("schylling_storelist", $connect);
$sql = "SELECT *
FROM STOREDATA
WHERE State = '".$_POST['state']."'
OR ZIP_Code = '".$_POST['zipCode']."'";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if($rows > 0) {
echo "<table border=\"1\">
<th align=\"center\newstyle\">Name</th>
<th align=\"center\">City</th>
<th align=\"center\">State</th>
<th align=\"center\">Sales Phone</th>";
while($row=mysql_fetch_array($result)) {
echo "<tr>
<td align=\"center\" class=\"newstyle\">".$row['Name']."</td>
<td align=\"center\" class=\"newstyle\">".$row['City']."</td>
<td align=\"center\" class=\"newstyle\">".$row['State']."</td>
<td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td>
</tr>";
}
}
else {
echo "No results found";
}
Also I have the input page code below, I would like to ahve this all lined up nice an center as well and I cant get it to look right:
<?
// Page 1, the form
echo "<div style=\"margin-left: 15pt;\"><form name=\"search\" action=\"spage2.php\" method=\"post\">
Search by Zip: <input type=\"text\" name=\"zipCode\"> (example: 01922)
<br>
Search by State: <input type=\"text\" name=\"state\"> <input type=\"submit\"> (example: NY for New York)
<br>
</form></div>";
?>
Can anyone please help?
help with placing query results into a table are on page
in PHP Coding Help
Posted
Could you please explain that? This piece of code was written for me quite a few years ago and then was just placed into a page.