Post by spdavis » Tue Aug 19, 2014 6:15 am

Calling php/html coders !!

I have a total 'blank' on this one. Something which I normally get my head around in moments. However, right now this really simple and embarrassing problem has beat me ! :-[

To explain...

I have created a PHP form that requires two inputs in order to pull a product correctly from a database. This works fine. That is to say. 'IF' I enter the both inputs 'correctly', then obviously, I get a good reply !!

However, (and this is the embarrassing bit). I can not sort out how to check if -

1) A user enters nothing. This is an error, how do I test for this?
2) A user enters both inputs but one or both are not correct, so database match. How do I say this?

Something like -
check input1 and input2...
IF input = nothing {
report error, invite user try again..
}
else
IF input input1 and or input2 <> any database match {
report error, invite user try again..
}

I assume if input1 and input2 are correct, program continues to next processing stage...


The form inputs from form.php are -
$searchName = $_GET['keyname'];
$searchDate = $_GET['keydate'];


And the SQL term used in search mysql database via a php script called search.php is -

Code: Select all

$search = $_POST['Search']; 
$sql = mysql_query("SELECTstock.Product_SKU,
stock.Product_Colour,
stock.Product_Supply,
stock.Product.Size
stock.Instock_Date
FROM
stock
WHERE
stock.Product_SKU, = '$searchName' AND
stock.Instock_Date_Date = '$searchDate'");
Once the above SQL query returns a correct (matching) input, the idea is to then generate a qrcode that contains the database elements pulled. So clearly, untill then, no image should be shown until a correct query match is true. This means user is redirected back to logon page, until enquiery inputs are matched in database.

I should know this. But it's early hours in the morning GMT and my brain is dead all but the reality. ANY help would be VERY welcome..

New member

Posts

Joined
Wed Jan 30, 2013 9:52 am
Who is online

Users browsing this forum: No registered users and 104 guests