Re: [PHP] select statement with variables ???

2005-12-21 Thread Jochem Maas
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

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jay Blanchard
[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

Re: [PHP] select statement with variables ???

2005-12-21 Thread Jochem Maas
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

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jay Blanchard
[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

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jim Moseby
> > 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

Re: [PHP] select statement with variables ???

2005-12-21 Thread Robin Vickery
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

[PHP] select statement with variables ???

2005-12-20 Thread Anasta
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'"; full script below Edit and Submit changes "> Title: "> -- PHP General Mailing List (http://www.php.net/) To uns

Re: [PHP] select statement

2005-05-08 Thread Richard Lynch
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

Re: [PHP] select statement

2005-05-08 Thread Josip Dzolonga
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

Re: [PHP] select statement

2005-05-08 Thread Andy Pieters
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

Re: [PHP] select statement

2005-05-05 Thread Prathaban Mookiah
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

Re: [PHP] select statement

2005-05-05 Thread bala chandar
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

[PHP] select statement

2005-05-05 Thread Anasta
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` varchar(15) NOT NULL default '', `status` varchar(10) NOT NUL

Re: [PHP] select statement

2002-05-16 Thread Jason Wong
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

RE: [PHP] select statement

2002-05-16 Thread John Holmes
, May 16, 2002 7:20 AM > To: [EMAIL PROTECTED] > Subject: [PHP] select statement > > 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 ?? > > > th

[PHP] select statement

2002-05-16 Thread Wilbert Enserink
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 ?? thx. Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTE

Re: [PHP] SELECT statement

2001-02-13 Thread Michael McGlothlin
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

RE: [PHP] SELECT statement

2001-02-13 Thread Peter Houchin
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

RE: [PHP] SELECT statement

2001-02-13 Thread PHPBeginner.com
-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&#x

RE: [PHP] SELECT statement

2001-02-13 Thread PHPBeginner.com
: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 2:30 PM To: PHP MAIL GROUP Subject: [PHP] SELECT statement Hi, Can you have a SELECT statement (using mysql) that goes something like $sql="SELECT id && email FROM table WHERE user='$user' and pass=&#

Re: [PHP] SELECT statement

2001-02-12 Thread David Robley
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

RE: [PHP] SELECT statement

2001-02-12 Thread Philip Olson
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

RE: [PHP] SELECT statement

2001-02-12 Thread Peter Houchin
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

Re: [PHP] SELECT statement

2001-02-12 Thread David Robley
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

Re: [PHP] SELECT statement

2001-02-12 Thread Philip Olson
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

[PHP] SELECT statement

2001-02-12 Thread Peter Houchin
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