Re: another php question




ZeldorBlat wrote:
> Looks pretty good so far.
>
> You can check if a form variable represents a numeric string by using
> is_numeric(). It's a little bit clearer and probably a little bit
> faster than using ereg().
>
> You've already got the code in place to check that the fields are not
> empty and that $mobile contains only numbers. So the only thing left
> is to lookup $code in the database. The next section might look
> something like this (pseudocode):
>
> $sql = "select count(*) items from code_table where code = '$code'";
> //Run the query
> if (items == 0) {
> header( "Location: http://www.mysite.com/badcode.php"; );
> }
>
> //Send email
> //delete the row from the database


Thanks for this but I still can't get my head around this:


So i add:


$username="username";
$password="password";
$database="databasename";

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");


$sql = "select count(*) items from tablename where code = '$code'";
//Run the query
if (items == 0) {
header( "Location: http://www.mysite.com/badcode.php"; );

}




What do I need to add to the above to deal with the bit about checking
that the $code value entered through the form, exists in the
'tablename' table. Because if I just insert as is I end up getting
redirected to the badcode page even though the coses are in the table
on the database.


1. Plus then I have the problem of deleteing the codes from the table
on the database if there is a match!
2. Also even if the user gets redircted to either the badcode,
badnumber or blanks pages, the email action keeps getting sent. How can
I set this so that the email doesn't get sent unless noblanks, good
mobile and good code?


Thanks for your help. I'm learning slowly!

.



Relevant Pages

  • Re: ADO parameters are not recognized by SQL Server Mobile 3.1
    ... Erik Ejlskov Jensen, Mobile App Dev MCTS ... I can successfully query the .sdf database file from Delphi, ... using the ADO Insert query or the following ADO Command ...
    (microsoft.public.sqlserver.ce)
  • Re: SQL Mobile 2005 better performance ?
    ... You need SQL 2005 Management Studio, which comes with SQL 2005 Developer. ... You connect to your SQL Mobile database, then run a query. ...
    (microsoft.public.sqlserver.ce)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
    (microsoft.public.access.conversion)