Blank page on basic php, mysql search

When I press the search button I get a blank screen. Can anybody tell me why?

search.php

<html>
  <head>
    <title>Search</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  <body>
    <form name="refsearch" method="post" action="searchresults.php">
      <input name="search" type="text" size="25" maxlenth="8" />
      <input type="submit" name="submit" value="search" />
    </form>
  </body>
</html>

searchresults.php

<?php
    $db = mysql_connect("xxxxxx","xxxx","xxxxxx") or die("Cannot connect to server");
    mysql_select_db("xxxxx",$db) or die("Cannot connect to the database");

    if (!isset($_POST['search'])) {
    }

    $search_sql = "SELECT * FROM admin WHERE Ref Like '%".$_POST['search']."%'";
    $search_query = mysql_query($search_sql);

    if (mysql_num_rows($search_query) != 0) {
        $search_rs = mysql_fetch_assoc($search_query);
?>

<?php
        if (mysql_num_rows($search_query) != 0) {
            do  {
?>

<p><?php echo $search_rs['firstname']; ?></p> 

<?php
            } while ($search_rs = mysql_fetch_assoc($search_query));
        }  else  {
            echo "Card Number Not on Database" ;
        }
    }
?>

<?php
error_reporting(E_ALL);
?>

sorry forgot to say I get the "We have no customers with that refrence card number " message back when I put in an incorrect ref but when I put in one thats on the database I just get a blank screen

You are using deprecated code. You need to use PDO or Mysqli. I have provided a complete working PDO database to get you up and running in minutes. If you still have a prblem after that we will be glad to help. We cannot support obsolete code.

http://www.phphelp.com/forum/the-occasional-tutorial/beginners-pdo-bumpstart-code-use-it-now!

youll have to exuse me im brandnew to webdesign in general. I downloaded the pdo_bumpstart and read the readme text went into mysql administration.

then new database

but I dont have the option for naming the database. It just gets a generic name.

Am I way off track ?

Just change the database name in config.php to the name of your database.

Right, installed, So I just edit this I take it.?

none of the add user, view details, edit user or delete user buttons work in select users and I would like a search box instead of dropdown.

Could anyone help me with this?

Just edit it how you want. The other buttons purposely don’t do anything. This is just a basic framework to get you up and running with PDO

oh ok, thanks. Im still confused about what PDO is?

Im doing this for an indoor 5-aside football company that I work for. its just a record of customers.

so I searched for “search edit add and delete mysql database”.

was my intension to get these codes running then wrap basic looking tables ect round them. Does this sound crazy?

this is the feilds that I took from the paper form

Ref
FirstName
Surname
Address
Postcode
Tel
Email
Facebook
Ice
EFirstName
ESurname
ERelationship
EAddress
EContactNo1
EContactNo2
EContactNo3
PlayingDay
StartFrom
Ending
Times1
Times2
Times3
CardHolder
Note

Try this

http://bit.ly/1oFye5o

Sponsor our Newsletter | Privacy Policy | Terms of Service