Code Comments
Programming Forum and web based access to our favorite programming groups.Sorry for a probably dumb question, but what am I doing wrong here?
$offset = 1;
$query = "SELECT titles,artist FROM tracks LIMIT $offset,10";
$result = msql_query($query);
This will fail and I can't understand why.
The query will work fine as follows:
mysql_query("SELECT titles,artist FROM tracks LIMIT 1,10");
Another question I have is how do you test for the existence of a
query_string variable? Or a form var for that matter. ex.
localhost/mypage.php?id=103
In my code how do I test if that variable was passed? I get an error if I
try to access it any way in my code. I used the $_GET('id') statement.
I see some variables used in examples that I can find no reference to in the
manual such as $TEXT['mypage-attrib1'] and there are some more I guess
special variables like this that I do not see in the global variables. Am I
not reading the correct thing? Any guidance would be appreciated.
TIA,
jrg
Post Follow-up to this message*** jg wrote/escribió (Tue, 23 Mar 2004 11:26:57 GMT):
> This will fail and I can't understand why.
Try to find out:
$result = msql_query($query) or die(mysql_error());
> The query will
> Another question I have is how do you test for the existence of a
> query_string variable? Or a form var for that matter. ex.
> localhost/mypage.php?id=103
There are many ways. I normally use this, but I'm not claiming it's the
best:
if($_GET['id']!=''){
..
}
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Post Follow-up to this messageUhhh... try replacing "$result = msql_query($query)" with "$result =
mysql_query($query)" ...
Maybe writing the command properly could do the work, lol
"jg" <jrg@nospam-weirdcat.com> a écrit dans le message de
news:5aV7c.393$vK5.243@news01.roc.ny...
> Sorry for a probably dumb question, but what am I doing wrong here?
>
> $offset = 1;
> $query = "SELECT titles,artist FROM tracks LIMIT $offset,10";
> $result = msql_query($query);
>
> This will fail and I can't understand why.
> The query will work fine as follows:
> mysql_query("SELECT titles,artist FROM tracks LIMIT 1,10");
>
> Another question I have is how do you test for the existence of a
> query_string variable? Or a form var for that matter. ex.
> localhost/mypage.php?id=103
> In my code how do I test if that variable was passed? I get an error if I
> try to access it any way in my code. I used the $_GET('id') statement.
> I see some variables used in examples that I can find no reference to in
the
> manual such as $TEXT['mypage-attrib1'] and there are some more I guess
> special variables like this that I do not see in the global variables. Am
I
> not reading the correct thing? Any guidance would be appreciated.
>
> TIA,
> jrg
>
>
>
>
>
Post Follow-up to this messageHi Oliver, thanks for the reply but that is just a typo in my post, the actual code is $result = mysql_query($query). I must be missing some fundmental understanding here as this makes no sense to why this doesn't work. I echo the $query to the page just to check and it looks ok. jrg "Olivier Bellemare" <__NOSPAM__olivier.bellemare__NOSPAM__@cgocable.ca> wrote in message news:tVV7c.181838$2g.111189@charlie.risq.qc.ca... > Uhhh... try replacing "$result = msql_query($query)" with "$result = > mysql_query($query)" ... > > Maybe writing the command properly could do the work, lol > > > "jg" <jrg@nospam-weirdcat.com> a écrit dans le message de > news:5aV7c.393$vK5.243@news01.roc.ny... I > the Am > I > >
Post Follow-up to this messageThanks Alvaro,
That allows me to check for the existence of a variable and read a variable
in the querystring. I cannot however seem to access the form variables with
the $_GET. What method should I use to read these form variables?
TIA,
jrg
"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in
message news:1m8vav7rs796.1aukdf45qryps$.dlg@40tude.net...
> *** jg wrote/escribió (Tue, 23 Mar 2004 11:26:57 GMT):
>
> Try to find out:
>
> $result = msql_query($query) or die(mysql_error());
>
>
>
> There are many ways. I normally use this, but I'm not claiming it's the
> best:
>
> if($_GET['id']!=''){
> ...
> }
>
>
> --
> --
> -- Álvaro G. Vicario - Burgos, Spain
> --
Post Follow-up to this messagePerhaps your form has been submitted with the post method, check $_POST[ ]. If that's not the solution try $HTTP_POST_VARS[] and $HTTP_GET_VARS[ ], this depends on your PHP version. If you use the GET method, you should see the variable in the adressbar of your browser (unless you use frames). "jg" <jrg@nospam-weirdcat.com> schreef in bericht news:MhW7c.512$c5.214@news02.roc.ny... > Thanks Alvaro, > That allows me to check for the existence of a variable and read a variable > in the querystring. I cannot however seem to access the form variables with > the $_GET. What method should I use to read these form variables? > > TIA, > jrg > > "Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in > message news:1m8vav7rs796.1aukdf45qryps$.dlg@40tude.net... > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.