I've got a piece of script that works that looks like this:
_______________ _______________ _______________ ______________
$username="daed alus_admin";
$password="test ";
$database="daed alus_db";
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT * FROM user WHERE username='daeda lus";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
_______________ _______________ _______________ ______________
I want to change it to this so that I can use a variable from a session at a later date:
_______________ _______________ _______________ ______________
$schque="daedal us"
$username="daed alus_admin";
$password="test ";
$database="daed alus_db";
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT * FROM user WHERE username='$schq ue";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
_______________ _______________ _______________ ______________
But as soon as I change the criteria of the WHERE to $schque the page stops working and comes up blank, i've tried it without the ' round it but it still doesn't work, I'm really confused any help would be appriecated.
3 1346
I've got a piece of script that works that looks like this:
_______________ _______________ _______________ ______________
$username="daed alus_admin";
$password="test ";
$database="daed alus_db";
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT * FROM user WHERE username='daeda lus";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
_______________ _______________ _______________ ______________
I want to change it to this so that I can use a variable from a session at a later date:
_______________ _______________ _______________ ______________
$schque="daedal us"
$username="daed alus_admin";
$password="test ";
$database="daed alus_db";
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT * FROM user WHERE username='$schq ue";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
_______________ _______________ _______________ ______________
But as soon as I change the criteria of the WHERE to $schque the page stops working and comes up blank, i've tried it without the ' round it but it still doesn't work, I'm really confused any help would be appriecated.
use
$a=$_REQUEST['$schque'];
$query="SELECT * FROM user WHERE username='$a'";
use
$a=$_REQUEST['$schque'];
$query="SELECT * FROM user WHERE username='$a'";
Thanks this works perfectly, I owe you one.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: James A. Donald |
last post by:
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified to read
"no variable or argument declarations are necessary."
Surely that means that if I misspell a variable name, my program will
mysteriously fail to work with no error message.
If you don't declare variables, you can inadvertently re-use an
variable used in an enclosing context when you don't intend to, or
|
by: Anders Borum |
last post by:
Hello!
I've come across a strange error that occurs, when you try to return a
nodelist from a variable with a choose/where/otherwise statement.
I'm not quite sure whether it's a bug or simply lack of W3C support. All I
know is, that this Xsl document works with the current implementation of
MSXML V4.0 SP2 if transformed using e.g. VB6. I'm told by the compiler at
runtime, that "the expression should evaluate to a nodeset" (the...
|
by: Richard Hollenbeck |
last post by:
Help! I don't know why this isn't working:
Private Sub Combo9_Change()
Dim UsersCourseSelection As String
UsersCourseSelection = Me("Combo9").Value
Combo13.Visible = True
'the following SQL thing is all on one line in the actual code.
|
by: Shapper |
last post by:
Hello,
I am declaring a variable in my aspx.vb code as follows:
Public Class catalogue
Public productid As String
Private Sub Page_Load
...
I have an image button where I call the following function:
|
by: Russ Chinoy |
last post by:
Hi,
This may be a totally newbie question, but I'm stumped.
If I have a function such as:
function DoSomething(strVarName) {
.....
}
| |
by: weston |
last post by:
I've got a piece of code where, for all the world, it looks like this
fails in IE 6:
hometab = document.getElementById('hometab');
but this succeeds:
hometabemt = document.getElementById('hometab');
Has anyone ever seen anything like this before, or am I dreaming?
|
by: Phillip Vong |
last post by:
I'm a newbie using VS2005 to learn and test. I'm testing against the
Northwind DB.
I created a simple variable called "myVariable" and I assigned it the
character "c". I want my SQL query to use this variable in the "Where"
statement where it will pull up all names with the letter "c" in it. How do
I pass this variable on the the WHERE statement? I thought all I had to do
was use the <% %> with my variable inside and that would work...
|
by: strawberry |
last post by:
In the function below, I'd like to extend the scope of the $table
variable such that, once assigned it would become available to other
parts of the function. I thought 'global $table;' would solve this but
it's clear that I'm misunderstanding $variable persistence. I posted a
similar enquiry over at alt.php.mysql, but I guess this is a more
appropriate forum because the problems I'm having relate to PHP.
Any help appreciated.
...
|
by: istillshine |
last post by:
When I control if I print messages, I usually use a global variable
"int silent". When I set "-silent" flag in my command line
parameters, I set silent = 1 in my main.c.
I have many functions that may print some messages.
foo(...)
{
if (!silent)
|
by: Looch |
last post by:
All,
I'm trying to output but I can only get (brackets for clarity) when using the code below.
How can I "break" into the query variable in the InsertName method to
add the name parameter to the variable query?
public class MyClass
{
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |