473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Passing parameters wml, php, mysql

Hi guys,

I want to basically take in a username and password and then check to see if its in the mySQL database. The problem is though that I can print the variables yet when I use then in the php query the resultSet is null. If I force the values though the resultSet is not null. If anyone has any ideas on how I can fix this can you let me know ASAP.

Any help would be greatly appreciated.

Heres my code:
[PHP]
print "<wml>\n";
print "<card title=\"home\" id = \"main\">\n";
print "<p align = \"center\">\n";
print "Username: <input name=\"username\" size = \"10\"/>\n";
print "</p>\n";
print "<p align = \"center\">\n";
print "Password: <input name=\"password\" size = \"10\"/>\n";
print "</p>\n";
print "<p align = \"center\">\n";
print "<a href=\"#results\">Submit</a>\n";
print "</p>\n";
print "</card>\n";

print "<card id=\"results\">\n";
print "<p>\n";
print "<u>$(username)</u>\n";
print "<u>$(password)</u>\n";
print "</p>\n";
$link_id = mysql_connect("xxxxx, "xxxxx", "xxxx");

if(mysql_select_db("xxxx", $link_id))
{
print "<p>Connected to MySQL database...</p>n";

$query = "SELECT cust_id FROM customer where username = '$(username)'";


$result = mysql_query($query,$link_id);
$num_rows = mysql_num_rows($result);
print "<p>$num_rows</p>n";
if($num_rows == 0)
{
print "<p>ERROR</p>n";
}
else
{
print "<p>OK</p>n";
}
}
else
{
print "<p>Error in connection....</p>n";
}


print "</card>n";
print "</wml>n"; [/PHP]

Thanks a million in advance,

Shauna
Mar 5 '08 #1
6 2215
markmcgookin
648 Expert 512MB
I have moved this to the PHP forum because I think you will get a better response here
Mar 5 '08 #2
Thanks for that Mark.
Mar 5 '08 #3
ronverdonk
4,258 Expert 4TB
You have to submit the user and password variables to the php script and from there 'catch' and validate them. You must therefore submit the form (you have no form defined), passing the userid/password. The process is something like.
Expand|Select|Wrap|Line Numbers
  1. IF form is submitted
  2.   get variables from $_POST array
  3.   check validity in database
  4.   if valid then continue other process
  5. EndIF
  6. FORM action=POST method=this script
  7.   INPUT username
  8.   INPUT password
  9.   SUBMIT
  10. EndFORM
Ronald
Mar 5 '08 #4
Hi,

Thanks for your reply. My problem now is that the form never submits. The code always prints no name. Here's my code:

[PHP]print "<wml>\n";
print "<card title=\"home\" id = \"main\">\n";
print "<onevent type=\"onenterbackward\">\n";
print "<refresh>\n";
print "<setvar name=\"username\" value=\"\"/>\n";
print "<setvar name=\"password\" value=\"\"/>\n";
print "</refresh>\n";
print "</onevent>\n";
print "<p align = \"center\">\n";
print "UsernameT: <input name=\"username\" size = \"10\"/>\n";
print "</p>\n";
print "<p align = \"center\">\n";
print "Password: <input name=\"password\" size = \"10\"/>\n";
print "</p>\n";
//print "<anchor>\n";
print "<do type=\"accept\" label=\"Submit\">\n";
print "<go method=\"post\" href=\"#results\">\n";
print "<postfield name=\"username\" value=\"$(username)\"/>\n";
print "<postfield name=\"password\" value=\"$(password)\"/>\n";

print "</go>\n";
print "</do>\n";
//print "</anchor>\n";

print "</card>\n";

//code to print data
print "<card title = \"checker\" id=\"results\">\n";

if (isset($_POST['submit']))
{
$name = $_POST["username"];
}
else
{
print "<p>no name</p>\n";
}
etc....[/PHP]
Mar 5 '08 #5
Hi,

I just wanted to let you know that I fixed my problem! Thanks again for your help. It was greatly apprecitated!!!!!


Shauna
Mar 5 '08 #6
ronverdonk
4,258 Expert 4TB
You are always welcome at the Scripts. See you next time.

Ronald
Mar 5 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Raju V.K | last post by:
I am developing a web site which requires a set og unique values be transferred between pages and server many times. There fore i decided to put the values in an array so that only one reference to...
0
by: Keith Wall | last post by:
Is there any way to pass mysql user variables on the command line? I'd like to do this to enable me to parameterised a mysql script. I'd like to be able to use a command line such as: mysql...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
11
by: Joey Martin | last post by:
I am passing a sql string thru my querystring for the next page to capture. example: www.xxxxxxxx.com/index.asp?str=select * from table where name like '%doe%' Passing a basic string works...
12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
1
by: Mikey G | last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL database and loads a table into a Dataset, and then displays that table information in a DataGrid on a...
4
by: B Squared | last post by:
I'm trying to pass a string from the current html page to one I'm calling. I've read (in the O'Reilly text) this involves using "?", but there's no example. For example, given I have a standard...
0
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a...
11
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.