Hello.
I have recently installed the freetds package and reconfigured PHP to
connect to MSSQL. I am running a simple join query on two tables and I get
the following error.
bWarning/b: Sybase error: 'REQ' is not a recognized OPTIMIZER LOCK
HINTS option. (severity 15) in myFile.php on line
No thats not it. I connected above this line. All of my errors come as
Sybase errors because of the install of freeteds used with the
--with-sybase=/path/to/freetds flag when i configure. It actually ended up
being a spacing problem where i had concatenated the query string. there
were two
everything you need to know.
http://www.php.net/manual/en/ref.mail.php
Hope this helps
jeff
Natividad
Someone, in their infinite wisdom, named some, not all of course, tables
and columns with spaces, i.e. BUSINESS AREA in a SQL server database that i
am working with. You can run lots of queries that return fine, but when I
run a query such as select * from REQ where BUSINESS AREA = '$var', i
Don't i agree! I didn't create this database. and I don't use spaces for
anything. that is always good pracice, but since these folks had...here is
what i found.
The [ ] notation, works fine on tables, i.e. [BUSINESS AREA] but when
you have a column with a space then use this notation
I love how this keeps getting answeredwere is just spelled wrong. it's
so funny that we all miss that though. i did a couple days ago and
responded with my own solution that didn't matter, b/c i still didn't spell
where correctly.
:)
I have have developed a statistics package that tracks user info(browser,
os, colors, heights, widths etc) as well as where and when they use my
various sites.
in the tables there are about 40 hits of aproximately 7,000 that the
broswer entry is PHP/2.0 and PHP/1.2 only.
Normally an entry looks
ok, i have a query that is like so
select distinct(id), MIN(time), MAX(time), count(page), ip,
(UNIX_TIMESTAMP(MAX(time)) - UNIX_TIMESTAMP(MIN(time))) from trainingHit
group by id
and i really want to sort on the time difference, but i get an error that
states invalid use of group function
all you have to do is put one query per line in the file, it may be hard to
read, but who cares.
and then it is as simple as.
$contents = file(sql.txt); //file function reads file into array
while (list ($qry)) = each($contents)) {
mysql_query($qry);
}
Just a thought
Jeff
although this goes without saying but in my petty need for completion, i
feel i must writethere is obviously SO much more that can be done where
i put the mysql_query($qry), whether it be updating, inserting, selecting
etc... but that can be a starting point.
i feel better, thank you for
is this from within the browser? if so, you'd need to open the file, read
the contents and execute the script. I don't knwo what 'source' does. but
i don't claim to know much either. i may not have heard of this.
if you just want to do it from a command line then you use a after your
login
I'm posting info into a SQL Server from a form, all has been working fine
inserting, updating and selecting information for months. I have recently
added a date field to the table with the type of datetime. It updates the
table in SQL Server fine, but it keeps pulling it back as this date [Feb
Hello. I was curious if any one is using PHP4.2x with SQLserver 7(or 2000)
and having luck with the datetime type. No matter the datetime in the
database PHP 4.1.2 is always returning Feb 06 2036 6:37AM . The insert is
correct, its only the select that this happens on.
There was a bug report,
Is this a issue with register _globals = off. try referencing it with
$_COOKIE['user_data'].
Also isn't 3600 only an hour. 60secs * 60mins? i think 6 weeks would
be... 151200 60 * 60 * 42days
does that work?
Jeff
I break up the search words using a function and then build a query based
on the search criteria. If it is multiple words, I use REGEXP for the
search.( I use a mysql database). then when there are multiple searches
you can format the query string like
SELECT show_name FROM table_of_shows
instead up supplying 'localhost' in your mysql_connect() function just use
the full name of the server i.e mysql_connect(www.domain.com $user,
$pass) you must ensure the port is open through the firewall, if
applicable, and that you have a user set up with that can access it from
another
has anyone had any expierence with the datetime field coming back from
MSSQL as someting along the lines of February 3, 2036 6:36AM. This happens
to me no matter the time in the database. PHP inserts it correctly, but
the select has a problem. I am using php4.1.2 and SqlServer 7.0.
Or is
add an... or die(mysql_error()) to the $resultm = mysql_query($sqlm);
statement and you'll have a lot more info for yourself, and the list if
you still need assistance.
If you are running Apache and have access to the httpd.conf file. Comment
out AddModule mod_autoindex.c and restart apache. if you like this for
some of your directories, then I'd follow Jason's advice. If you are using
IIS or another server, I'm sure the same option is available, but I'm
if you put quotes around the variable $PHP_SELF it should work...try this.
UPDATE $table SET pages = '.$PHP_SELF.' WHERE session = $holy_cow
hth
jd
Jas
if i'm reading right, you could use a join to get all of that info.
select users.group_id, user_id, user_name, groups.group_name from users
inner join groups on (groups.group_id = users.group_id) group by
users.group_id
parens not needed, it just makes it more legible.
that should give you an
I have five enum fields, all Y/N. There is now(last minute) a requirment to
report on all clients that said Y to more then one of the questions(its a
survey). Had i known about this requirement, i could have made them BIT
and had a simple 1/0 option and summed the fields to check the total
use select name = 'listbox1[]' multiple
this will send an array to your script.
|---|
| Jeff | KeaneIT - Presidents |
| Landing | Suite: 200 |
|Outside: 617 -517-1772 | |
| E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents |
|
Thanks for the responses. I got one earlier that did the trick. I wanted
to try as hard as i could from altering the table, as i was already using
the Y value in other reports...and here is a great solution.
this may help someone else. so I wanted to post it. I'll use it again, i'm
sure
if you are using mysql, it doesn't support the sub-select.
Wilmar Perez
unlink()
|---|
| Jeff | KeaneIT - Presidents |
| Landing | Suite: 200 |
|Outside: 617 -517-1772 | |
| E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents |
| Landing Medford, MA 02155 USA|
| ] |
if you mean the rows switching colors i use this. in this example i'm
getting data from mysql
$rs = 0;
for($i = 0; $i count($rs); ) {
while ($rs = mysql_fetch_array($result)) {
$bgcolor = ($i % 2) ? 'blue' : 'black';
//do stuff
$i++;
}
}
then $bgcolor goes
register_globals=off in your php.ini
turn it on, or use $_POST['FName']
|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
| Outside: 617 -517-1772 | E-mail: |
| [EMAIL PROTECTED]|
| [ Mailing: 10
For what its worth. I wrote to the MySql folks asking about a production
release date and the reply was that they consider the latest in Beta, and
according to them, that is 'production ready' as it has gone through adn
passed all their rigorous testing. Have I upgraded yet? No. But, I've
does the mysql section show up in phpinfo() ? is [shared] allowed in that
configure argument?
|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
| Outside: 617 -517-1772 | E-mail: |
| [EMAIL PROTECTED]
I think this is how it works.if you're using dbx then you need to
connect using dbx_connect and not mysql_connect
and i don't think that [shared] is a valid argument.
I only connect to mysql and M$Sql so i have configured to connect to those
specifiacally.
I would reconfigure using
i'd get rid of the space as well, or use brackets around the db name to
account for the space.
John W. Holmes
sorry i mis spoke, the brackets will help you in queries with tables and
columns that have spaces, not in the connect with actual dbs(at least i
don't think so).
- Forwarded by Jeffrey N Dyke/CORP/Keane on 10/14/2002 11:40 AM -
what are you passing for module(the first argument for dbx_connect) it
should be DBX_MYSQL, or mysql, if that fails, recompile without the shared
argument, and i bet that would work
I belive $_cookie is different then $_COOKIE
Jeff
Steve Dodkins
to upload use copy and the $_FILES array. then around mysql, I tend to
store the path in mysql and the images on the server. I personally don't
like to work with blobs and don't think it makes as much sense as they do
on the server. the space they take up in the db seems like a waste.
my
I am in the process of upgrading my UNIX hardware and moving web sites from
two different servers on to one server. I am curious as to opinions about
moving/replicating the databases and peoples experiences. For the two that
i have already done, i have taken a rather manual approach which was
thanks guys. that is how i planned to do it, but i wanted to hear this
from others. This is how i accomplished the other two moves. sometimes
you just want to see if anyone has a better way. and the file copy method
just seems to easy, it almost seems wrong ;-), but it doesn't stop me from
select distinct Date from table_name where name = 'Test';
Jeff
Chris Grigor
I think this is only available as an option if you are running on windows
based hardward, but if you are...i know i've seen it in the manual.
José Moreira
yes this works. if your code is going to remian on Unix you'll have to
install freetds (www.freetds.org). there are instructions on
www.php.net/mssql for install in the comments...
when you get to the site(freetds.org) I know it says Sysbase..but it is
what you're looking for.
hope this
I'm sure there are a hundred ways
$rs = 0; // record set array
for ($i = 0; $i count($rs); ) {
while($rs = mysql_fetch_array($result)) {
if ($i ==0 ) {
//do first thing
} else {
//do other things
}
$i++
}
Jeff
what was the error?
dwalker
how about a default value...so if you use a CHECKBOX_FIELD1 ENUM('Y', 'N')
DEFAULT N type of definition, then if box is not checked, then it will
deault to N otherwise a Y will override the default.
just a thoughtdont' know if it will work for you or not...
Jeff
it looks like you have defined $ADDDATE and it is not a posted variable.
what happens if you just have:
?php
$ADDDATE=date(Y-m-d);
mysql_query (INSERT INTO client (cl_add_date,
cl_first_name,
cl_last_name,
cl_company,
cl_phone,
cl_email,
cl_address,
cl_city,
cl_state,
did you restart apache?
epeloke@echoma
n.com (Edward
Hey arron...
can you send the the set cookie code and set up of your servers. this works
fine on a site that i'm working on. I have the https running as a
virtualhost in apachemust be an easy fix.
jeff
|---|
| Jeff | KeaneIT - Presidents |
| Landing |
you need the exact same parameters as you used to set the cookie.
http://www.php.net/manual/en/function.setcookie.php
Seabird
You're close, from what i can see
just remove teh [ ] after the userfile or account for the fact that it is
an array, but if you only have one file then you don't need it...and
secondly, you're not calling your file anythign...you need to provide it a
nameunless it defautls to the
Agreed. we prove day in and out that the answers are only an email
away...why would anyone go a different route. manual? whats a manual?
There are some brilliant people on this list, but some equally intelligent
people wrote some fine documentation.
isn't $order_index[$i] only one index? or is it multi dimensional?
Aaron Wolski
are you stating the session on on the other pages with session_start()?
what errors are you getting? if you check for session_is_registered
(user) on the other pages, what do you get?
can you send some code along, its hard to see what the issue may be without
it.
check out the date( ) function in mysql. a quick prelude of it
is.select date(date_col, %m/%d/%Y) from table...this will take
-mm-dd and return mm/dd/
using the [] makes your variable an array when it comes into php.
**snip**
else
{
print 'form name=sqlform method=post action=test.php?task=check
font class=look2Multiple Check:/font
select multiple name=icon[]
option value=falseFalse/option
option value=trueTrue/option
put it inside a preg_split where you say that [?KR] in the brackets are the
possible identifiers, and the brackets are required. that should work.
i.e $chunks = preg_split( /[?KR]/, $string[query]);
THis would also work with split.
Something like that might work for ya
hth
Jeff
The relationsionship can be maintained by window.opener from within the
child wildow - parent window, and the simply the name of the window you
assigned can be used when going from the parent window - child window.
hth
jeff
you can use the mysql date function and format it as you're pulling it out
of MySql
select date(column_name, %m/%d/%Y) from table;
this will return it formatted like 11/18/2002 or there are other options.
http://www.mysql.com/doc/en/Date_and_time_functions.html
this seems to be whar you're
whooops. I meant DATE_FORMAT. Sorry.
Jeffrey_N_Dyke
the id is definitely better. although creating an index on the email and
potentially the password would help. I had a table that was indexed off of
a random unique string and when i got to about 5+ rows updates were
taking about 4 seconds.
you can authenticate with the email and password,
do you have the persmissions set either for [EMAIL PROTECTED](which
would only work from remotehost.com) or username@'%' (which would work for
that username from any host)
hth
jeff
can a cookie be valid and be passed to/from -- http and https. I loose
the values from http - https. I can think of ways to fix this, but i
didn't know if there was a way in the basic setting/handling of cookies,
and the manual shows you how to but it says that a 1 for a secure argument
will
this little snippet works for me.
mssql_query(set textsize 65536);
HTH
Jeff
Adam Voigt
probably b/c of grants/rights
did you run a -- grant all on *.* to user@localhost ? or something of the
sort. or set up root to have access
can you connect via command line?
HTH
Jeff
that didn't cause me any issues on my install. why do you have to turn
that off. i'm not doubting you, just curious?
Jeff
SELPH,JASON
the function takes a certian number of required arguments(or parameters)
and you're not passing enough. For this funtion it only takes one, which
is the ldap resource link identifier. which was probably set in $var =
ldap_connect(ldap_server). here the resource link identifer would be
$var.
this can be done with Full Text Searchingdepending on DB compatability.
if you use mysql - http://www.mysql.com/doc/en/Fulltext_Search.html
HTH
Jeff
copy($_FILES['userfile']['tmp_name'],/real/path/to/$_FILES['userfile']
['name']);
what you really want is...
http://www.php.net/manual/en/features.file-upload.php
hth
jeff
did you compile PHP with --enable-mime-magic? if not, this extension will
not work. there are work arounds. one isa class that resides on
phpclasses.org that will give you a mime based on the file extension. and
i'm sure there are other ways
hth
jeff
SELECT DATE_FORMAT(NOW(), '%m/%d/%Y'); will out put 01/04/2003. replace
NOW() with you're column name.
check out hte mysql manual for all of the date variations.
hth
jeff
I agree with this method. i have not yet seen an advantage of storing
blobs in a database. Is there one? i'm sure those on this list would have
an opinion if there was one. personally, i like storing all this stuff on
the file system.
Jeff
i know this is a bit down the chain, but i'm trying to keep the message
strings in tact
but can't you set up your directory just like you set up your mysql Grants.
I have a directory that the web user owns, who is in its own group. so i
set the permisssions once, and its done. Also i don't
does this have anything to do with register_globals being off. are you
using $_POST['var_name']? or $_GET['var_name']?
can you send some code?
jeff
Jared
it seems to me that this is to much work for the output. not only will
ISPs add complexity, but since you are combining thee seperate items you
confining people to a single location. any laptop user may come in from
various ips and still be unique. I tend to stay with the information you
if you're looking to do math in sql, i'd look to the mysql manual. lots of
great examples. basically same answer for php. i'd start there...if you
don't find what you're looking for .google.
www.php.net/math
www.mysql.com
hth
Jeff
check out DATE_FORMAT in the mysql manual. and acually you'll want
year-month-day not year/month/day...if you're using the mysql defualt date.
DATE_FORMAT(NOW(), '%m/%d/%Y') - would return 01/22/2003
hth
jeff
i forget exactly how to use it, but look up TOP. although it does not
perform like LIMIT.
hth
Jeff
Grant, Dean
it IS 3306(in a default setup) that you'll need to allow traffic through
the firewall for this scenario. I have similar needs and that is the port
we open.
flash is server independent. if you call a flash file on another server it
is much like calling an image on another server.
yes, PHP can feed flash(info from a DB...to keep this on topic). And flash
can send back infomation to PHP via get and post variables(not sure about
the post). I've run
sorry i don't speak (spanish?)...but this means you have sent information
to the browser before the header() function call.
even a space at the top of the page, before the opening ?php tag will
cause this.
hth
jeff
hello. sorry to have tried to guess at the language. I've received a
couple emails, some nicer then others. i had no intention of insulting
anyone, i meant no offense.
unfortunately i could not read his statement but knew his issue, luckily he
is smarter then I am, and understood my reply.
Or if you want to change it when you're pulling out of mysql you can use
the DATE_FORMAT( ) function...
hth
jeff
John Krewson
You can take the selected items posted to your page and use in_array() to
search for the current item as your code creates the list. this is a chunk
of code that i use to do the same thing. I wrote this a long time ago, so
there may be better ways to do thisbut it works. ;-)
snip
if
This works as of 4.3 with fopen(https://myserver.com). but i dont' think
it works with file(https://myserver.com)...i may be wrong, of course.
HTH
Jeff
personally, i think solutions are always worthwhile, no matter how trivial.
that way when someone is searching the archives, they will find the
solution in the thread.
just my $.02
Jeff
if i'm understanding you correctly, you're looking for this???
nl2br()
http://www.php.net/manual/en/function.nl2br.php
John M.
www.phpclasses.org is your best bet. there are plenty. personally i use
this one..http://phpclasses.com/browse.html/package/32.html
check out his site for examples.
hth
jd
$qry = SELECT * FROM TABLE_NAME;
$result_set = mysql_query($qry) or die(mysql_error());
***this has to be called before any headers are written to the browser.
***
header(Content-type: application/csv);
header(Content-Disposition: attachement; filename=YOURFILENAME.csv);
while
may be missing the point. but
when you're brining down the page decide what records the user can and
can't delete and write javascript function(s) using php for the correct
scenario, I'd write a single js function that you'd pass one(many) PHP
variable(s) into, when building the page, after
mysql knows. this means your query failed, $command resulted in an invalid
result set. try adding: or die(mysql_error()); to any call to mysql_query
()so in your code use this:
$result = mysql_query($command,$mysqlHandle) or die(mysql_error());
- and -
$resultw =
how about \0. yours is a foward slash not an escape. though that may
just be your post you can also use an unquoted NULL.
hth
jeff
if it is truley csv, then use MYSQL's LOAD DATA INFILE syntax. granted
you've got to have ahold of the text file.its not out of the box, but
pretty close.
Woudl that work for you?
http://www.mysql.com/doc/en/LOAD_DATA.html
hth
Jeff
Do you have an 'or die(mysql_error())' statement following your
mysql_query($result) line. 99% of the time, this error means your query
failed. if it works on another serverare the fields the same, the
dbname, the tablename?
hth
jeff
you could change mysql to a few different date formats, but i don't _think_
that is one of them.
Why not just take care of a format change on the way out with DATE_FORMAT.
Also, if you store the date as one of the defualt date[time] values then
you have tons of functions that you can run against
you'll need to use $_GET['id'] or you'll need to set register_globals = On.
I would use the first method, and replace
$query = SELECT slug, content, contact, timestamp FROM news WHERE id
= '$id';
with --
$query = SELECT slug, content, contact, timestamp FROM news WHERE id = '.
$_GET['id'].';
i
If you have the standard table type installed
As you loop though though the arrays in PHP get ahold of the last ID
inserted via mysql_insert_id() and add it to an $inserted_array variable
and then at each insert check that the last insert was successful, and if
not send your db a bunch of
you can't use COL_NAME = NULL or COL_NAME = 'NULL' and get the desired
results , you have to check for IS NULL/ IS NOT NULLSo, change the
query to
SELECT * FROM TABLE WHERE MY_FIELD IS NULL or,
SELECT * FROM TABLE WHERE MY_FIELD IS NOT NULL
From my understanding when you check for
this may work, but i hesitate, i've _never_ had to use exit to get my code
to excecute a redirect. and i'm heavily reliant on this function.
did aarons fix work for you? i think you're problem lies elsewhere. as
i've just mocked the same thing on my server, but using 10 instead of
03...i'm on
that why i love this list.
thanks
John W. Holmes
is it possible that there is no referer. what happens if you link to this
page from another, ensuring there is a referer, will it display it then?
Jeff
i have a feeling oyu're not getting a mysql error but a PHP error??? you
have an odd number of parentheses and mysql_error will not have an closing
paren.
if that is the case, try this
mysql_query(INSERT INTO Boats (Make, Model, Serial,Stock, Extension,
Cust_Name, Store, Date) VALUES
1 - 100 of 189 matches
Mail list logo