ValdouaD Posted May 7, 2010 Share Posted May 7, 2010 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); ; Quote Link to comment Share on other sites More sharing options...
tomfmason Posted May 7, 2010 Share Posted May 7, 2010 You don't close the table. Also you should sanitize the user input. As it stands this script is vulnerable to sql injection Quote Link to comment Share on other sites More sharing options...
ValdouaD Posted May 7, 2010 Author Share Posted May 7, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.