Jay Blanchard wrote:
[snip]
Jay how come you though concating would give
a different result to interpolation?
[/snip]
It is not really a different result, it is just something that I am in the
habit of doing. The "concat or not to concat" question has fueled many a
holy war. I concat, others d
[snip]
Jay how come you though concating would give
a different result to interpolation?
[/snip]
It is not really a different result, it is just something that I am in the
habit of doing. The "concat or not to concat" question has fueled many a
holy war. I concat, others do not. I am used to see
Jay how come you though concating would give
a different result to interpolation?
Jay Blanchard wrote:
[snip]
$query=" SELECT title FROM $cat WHERE id='$id'";
[/snip]
echo $query; // does it look right to you?
Alway throw an error when in question
if(!($result = mysql_query($query, $conn
[snip]
> $query=" SELECT title FROM $cat WHERE id='$id'";
[/snip]
echo $query; // does it look right to you?
Alway throw an error when in question
if(!($result = mysql_query($query, $connection))){
echo mysql_error() . "\n";
exit();
}
My bet is that you need to concatenate
$query = "SELEC
>
> Can someone tell me why this select is wrong please---ive
> tried everything.
> the $cat is the tablename .
>
>
> $query=" SELECT title FROM $cat WHERE id='$id'";
>
>
Apparently, either $cat or $id is not the value you think it is. First, I
would try changing
$result=mysql_query($query
On 12/21/05, Anasta <[EMAIL PROTECTED]> wrote:
> Can someone tell me why this select is wrong please---ive tried everything.
> the $cat is the tablename .
You've tried *everything* ?
Why do you think it's "wrong"? Did you get an error message of some kind?
What do you see if you echo $query? Ar
On Sun, May 8, 2005 3:20 pm, Josip Dzolonga said:
> On нед, 2005-05-08 at 23:16 +0200, Andy Pieters wrote:
>> Notes:
>> * just because it comes from SESSION doesn't mean that it cannot be
>> spoofed.
>> That's why you should escape uname before including it in a query.
>
> Is there something I do n
On ÐÐÐ, 2005-05-08 at 23:16 +0200, Andy Pieters wrote:
> Notes:
> * just because it comes from SESSION doesn't mean that it cannot be spoofed.
> That's why you should escape uname before including it in a query.
Is there something I do not know ? :). As far as I know, it can be
spoofed only if
On Thursday 05 May 2005 10:10, Anasta wrote:
> Why doesnt this work, it shows the username but not the balance of the
> users money.here is the mysql table:
>
> include("connect.php");
> $uname=$_SESSION['username'];
> $user_balance=mysql_query($sql);
> $sql = "Select FROM users ,user_balance WHE
Maybe the query should be
select user_balance FROM users WHERE user_id="$uname";
Prathap
-- Original Message ---
From: "Anasta" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 16:10:35 +0800
Subject: [PHP] select statement
> Why doesnt this work, it shows
On 5/5/05, Anasta <[EMAIL PROTECTED]> wrote:
> Why doesnt this work, it shows the username but not the balance of the users
> money.here is the mysql table:
>
> CREATE TABLE `users` (
> `user_id` int(11) NOT NULL auto_increment,
> `username` varchar(15) NOT NULL default '',
> `password` varc
On Thursday 16 May 2002 19:19, Wilbert Enserink wrote:
> Hi all,
>
>
> I want to select some records with e.g. ID's 1,3,7 and 8
> How can this be done best?
>
> is it: SELECT * FROM myTable WHERE ID=1,3,7,8 ??
Is this a PHP question?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
O
Nothing to do with PHP...
SELECT * FROM myTable WHERE ID IN (1,3,7,9);
If you're using MySQL, read the manual:
http://www.mysql.com/documentation/mysql/bychapter/
---John Holmes...
> -Original Message-
> From: Wilbert Enserink [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002
L PROTECTED]\">webmaster
>
> ");
> // if successful then do this
> if ($num == 1) {
>
>
>
> include "quote2.php"; //has a hidden field referencing the user & the email
> address .. user shows up but again email does not
> }
>
&g
ebmaster
");
// if successful then do this
if ($num == 1) {
include "quote2.php"; //has a hidden field referencing the user & the email
address .. user shows up but again email does not
}
?>
-Original Message-
From: Philip Olson [mailto:[EMAIL PROTEC
-Original Message-
From: Peter Houchin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 2:51 PM
To: PHP MAIL GROUP
Subject: RE: [PHP] SELECT statement
ok I've changed my code to
$sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass
Yeah, sure you can:
$sql="SELECT id, email FROM table WHERE user='$user' and pass='$pass'";
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Peter Houchin [mailto:[EMAIL PROTEC
On Tue, 13 Feb 2001 16:20, Peter Houchin wrote:
> ok I've changed my code to
>
> $sql = "SELECT id, email FROM users WHERE user='$user' and
> pass='$pass'"; but still no joy can any one suggest why?
>
> (& Yes email is a field in the table)
>
> Peter
>
> > Hi,
> >
> > Can you have a SELECT stateme
A possible way to find out :
$result = mysql_query($sql) or die(mysql_error());
Does it say anything? mysql_error() is your friend, it can be printed
anywhere within the script and will print the last mysql error. So
perhaps :
print mysql_error();
Right before the query or ...
Regar
ok I've changed my code to
$sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'";
but still no joy can any one suggest why?
(& Yes email is a field in the table)
Peter
> Hi,
>
> Can you have a SELECT statement (using mysql) that goes something like
>
> $sql="SELECT
On Tue, 13 Feb 2001 16:00, Peter Houchin wrote:
> > Hi,
>
> Can you have a SELECT statement (using mysql) that goes something like
>
> $sql="SELECT id && email FROM table WHERE user='$user' and
> pass='$pass'";
>
> and if you can't is there a away around this?
>
> Thanks
>
> Peter
In SQL queries
Assuming you want to select both id and email from table, use commas :
SELECT id,email FROM ...
Also, check out this basic SQL tutorial :
http://www.sqlcourse.com/
It's fairly useful.
regards,
Philip
On Tue, 13 Feb 2001, Peter Houchin wrote:
> Hi,
>
> Can you have a SELECT stateme
22 matches
Mail list logo