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? Are the

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); to

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() . br\n; exit(); } My bet is that you need to concatenate $query = SELECT

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

2005-12-21 Thread Jochem Maas
side-question Jay how come you though concating would give a different result to interpolation? /side-question 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 =

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

2005-12-21 Thread Jay Blanchard
[snip] side-question Jay how come you though concating would give a different result to interpolation? /side-question [/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,

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

2005-12-21 Thread Jochem Maas
Jay Blanchard wrote: [snip] side-question Jay how come you though concating would give a different result to interpolation? /side-question [/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

[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 ? $id=$_POST['id']; $cat=$_POST['cat']; $db=flash_software; $link = mysql_connect('localhost'); if (! $link) die(Couldn't

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: ?php session_start(); include(connect.php); $uname=$_SESSION['username']; $user_balance=mysql_query($sql); $sql = Select FROM users

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 you

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 not know ?

[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

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` varchar(15)

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 Why doesnt this work, it shows

[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

RE: [PHP] select statement

2002-05-16 Thread John Holmes
: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 ?? thx. Wilbert - Pas de Deux Van Mierisstraat 25

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 Open

RE: [PHP] SELECT statement

2001-02-13 Thread PHPBeginner.com
lto:[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='$pass'"; and if you can't is

RE: [PHP] SELECT statement

2001-02-13 Thread Peter Houchin
r shows up but again email does not } ? /body /html -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 4:59 PM To: Peter Houchin Cc: PHP MAIL GROUP Subject: RE: [PHP] SELECT statement A possible way to find out : $result = mysql_query($

Re: [PHP] SELECT statement

2001-02-13 Thread Michael McGlothlin
"); // 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 } ? /body /html -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent

[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

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 statement

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, you normally

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 id

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 ...