Jump to content

supanoob

Members
  • Posts

    342
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

supanoob's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I have the following code, and it is not working for some reason. I have echoed the $sql and that it showing fine, then its not showing as any results etc when i echo them, any idea why it may be? if ($_GET['step'] == 'search' && $_GET['action'] == 'submit') { $search = $_POST['searchcriteria']; $searchtype = $_POST['search']; if ($search == '') { echo "No search criteria entered."; die(); } $sql="SELECT userid, firstname, secondname, day, month, year, postcode FROM users WHERE $searchtype LIKE $search"; //-run the query against the mysql query function echo "$sql"; $result=mysql_query($sql); echo "<br><br>result:$result<br>"; //-count results $numrows=mysql_num_rows($result); echo "rows found: $numrows<br>"; echo "<p>" .$numrows . " results found for " . $search . "</p>"; //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $firstname=$row['firstname']; $secondname=$row['secondname']; $userid=$row['userid']; $day=$row['day']; $month=$row['month']; $year=$row['year']; $postcode=$row['postcode']; //-display the result of the array echo "<ul>\n"; echo "<li>$firstname $secondname (DOB: $day/$month/$year) $postcode</a></li>\n"; echo "</ul>"; } } Thanks in advance.
  2. So i have a database with a list of Towns and their relevant postcode letters (DN = Doncaster, S = Sheffield etc) i want to be able to find out what town they're from, using the postcode they have submitted, but i'm unsure on how to break away the characters before the first number in the postcode..... so for example someone submits DN2 6PJ how to do break away the DN so i can return Doncaster or the same if it was S1 4QJ how would i break away the S to return sheffield?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.