I'm trying to pull all the records from the table class where classID is
not equal to the value of classID in the table assignment.
Currently, I have 'select class.classID, class.classDesc from class,
assignment where assignment.classID = class.classID and
assignment.assignmentID=$assidn'.
I don't know how you have it setup.
But you can create a XLS file on the fly using PHP
By using header...
header(Content-Type: application/vnd.ms-excel);
header(Content-Dispostion: attachemnt; filename='Project.xls');
header(Pragma: no-cache);
header(Expires: 0);
Then just
Okay, I am new to PHP but very good with many other scripting languages.
I use 'mysql_connect(localhost yada yada'
to connect to a database from the domain but I want to put this code on a
few sites and have it access one database on the primary domain.
How do I write that command? I
I'd really like to find a Linux distro that is a LAMP system right out
of the box.
(Linux, Apache, MySQL, PHP)
Are there any out there?
You should be able to activate all with Fedora and SuSe, from the disks.
You may still have to build PHP(on FC?), but IMO you'll want to do that
anyway
I'm using PHP with mySQL since a long time.
But now I got a question:
I need to generate a SQL-Statement to fetch rows with one DISTINCT
criteria.
To make things clear: I don't want to fetch a single DISTINCT column, I
want
to fetch the whole row, where one column is DISTINCT.
Can
accidentally replied only to karen.
The database queries all the sources at night after everyone has gone
home. That means the data was current as of yesterday. This little snippet
below returns yesterday's date, except that the first day of the month
returns 0 for the day. Now, I know why
I have some procedural code that i'm wanting to convert into classes(and
i'm a bit greeen to OOP), hopefully to offer them to the PHP community. I
keep all my config data in arrays of arrays, which i'd like to keep when i
move to a class model, but can't seem to find out the correct defintion
On Wed, 30 Jun 2004 14:20:52 -0400, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
I have some procedural code that i'm wanting to convert into classes(and
i'm a bit greeen to OOP), hopefully to offer them to the PHP community.
I
keep all my config data in arrays of arrays, which i'd like to
I'm using php addslashes to store data into MySQL and php stripslashes
when
pulling it back out, but I'm running into trouble when people enter HTML
code. Do you have any recommendations?
Here's an example of what I'm talking about:
input name=Title value=?php echo
How can I query a MySQL table to get the latest results from a date field?
Basically, I am inserting several records at a time at the end of each
week.
I want to have a page that displays the results for the last week only.
The date format in the field is -MM-DD
if you want the latest row
Hi there everyone,
Hello.
I've been looking on Google for PHP Javascript tutorials but I can't find
any. I'm new to Javascript but can use PHP for what I need. I was
hoping
someone would know of a tutorial that would show how to use PHP to get
2-3
datasets which javascript can then use
Hi. You left out the 'php' after the '?'. So it should read:
Actually this is most likely a register_globals issue. try.
$_GET['action'] or $_POST['action']. you'll only need to use ?php if
short_tags = off in your php.ini.
HTH
Jeff
?php
print $action;
print $Name;
?
See if that helps
Hello all,
Am I right in thinking I have very few options? I don't want to move
over to ASP (would that even help?) because it means learning VBScript and
I don't have a lot of time. Also, I can't use another database (e.g.
MySQL) cos the server admin is NOT helping me and won't install
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index
4...
Now this makes some sense; the manual says that
mysql_result ( resource result , int row )
will jump to row $row in the output but says nothing about returning me a
given fields.
Any other thoughts?
Hey
Hi, all --
I have some code which looks about like
if ( $_POST['signup']['referrer'] ) # a friend?
{
$q = select InvitedBy from customer where EMail
= '{$_POST['signup']['referrer']}' ;
$r = mysql_query($q,$dbro) ;
$row = mysql_fetch_array($r) ;
$i =
Thanks pepole.
I've tried but still does not work.
when I put the varaibles name between ' '
I found this error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING'.
I typed in this way
print INPUT TYPE='hidden' NAME='User_name'
VALUE='$_POST[UserName]';
hi,
header(Content-type: application/vnd-ms.word); is not what my customers
want. They may or may not want to save it in their harddisk.. but having
the
header at the beginning of my page will force them to save it in their
harddisk. Some of the customers just want to view it on the web while
$result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='\$preis\'
WHERE ID='\$id\');
//mysql_error($result);
Here you're escaping the $ and then the ', have you tried
$result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='{$preis}'
WHERE ID='{$id}');
with those escapes this is the
Hi there:
Hello,
I am looking for an open source and simple PHP script that will graph
(bar) a few MySQL fields. Does anyone have any recommendations?
I'd suggest the jpgraph OO lib. Very easy to get simple graphs up and
running. so long as you have gd/jpeg available to your php. With
No solutions or feedback?
:(
-Tom Reed
[EMAIL PROTECTED]
_
How do you select _all_ the images from Folder B? Can you show that
statement?
In every delete you're able to do against a database table, you should
first be able to run a select and basically replace
Do you set the content-type in the response header like in JSP and
servlets?
I've been reading the PHP Manual; where do you find stuff like this?
take a look at the header function
http://php.net/header
an example...ymmv
header(Content-type: application/vnd.ms-excel);
I am trying to update a database that I use to store user names and the
hashed values of passwords. The database name is Login, the table is
users.
I have the following commands in my php file.
@ $db=mysql_pconnect('localhost','apache','password');
mysql_select_db('Login');
I have a table:
CREATE TABLE `cashmire` (`id` smallint(3) unsigned NOT NULL auto_increment,
`itemcode` varchar(25) NOT NULL default '', `collection` char(2) NOT NULL
default 'cl',
`promotion` char(1) default 'n', `bestSeller` char(1) default 'n',
`newArrival` char(1) default 'n', `size`
Why is it when I have this ` tick mark in my query it works fine, but
when I remove them it I get an error?
___
This tells to mysql to NOT treat the word as the reserved word that it
_may_ be, but use it literally. and interval, i believe, is a reserved
word. It is much like escaping
I'm working on a project that takes the content of a URL and does stuff
with the content. I've managed to extract the target url's html, and am
using str_replace to fix links, stylesheets etc. However, i'm stumped when
it comes to processing the text content.
Would anyone know how to isolate
Gamze Baaran
On Thursday 04 March 2004 08:08, Rich Hutchins wrote:
Oh, and, normally, you reference the variables like so:
$_POST[varname].
I typically use the following syntax:
INSERT INTO tablename
VALUES('.$_POST[varone].','.$_POST[vartwo].');
IMO it is better to use the braces syntax:
insert into
An interesting thought. I tried this:
echo Term: $search, Returns: $arrayword, UserIP: $ipbr;
$logit = mysql_query(INSERT INTO log SET term='$search',
returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip');
echo Query Value: $logit;
And got this on the page:
Term: skater, Returns:
Ok guys, I found the problem. It's actually something I've run into
before. If you take a look at the query you'll notice that one of the
fields is named returns. When I created the test table with phpMyAdmin
it created it and everything seemed fine. Then I decided to try
something. I tweaked
When returning to the main page of my script sometimes I'll get the
following error:
Warning: mysql_fetch_array(): 8 is not a valid MySQL result resource in
/home/nick/http/search/includes/main.inc on line 13
This happens only AFTER the first element in the resource has been
processed.
using mysql as an example, this is what i do.
---UNTESTED CODE --
$sql = SELECT * FROM TABLE;
$res = mysql_query($sql) or die(mysql_error() . br.$sql);
$fp = fopen(file_to_create.csv, w);
while ($rs = mysql_fetch_row($res)) {
$write_string = \ . implode(\,\, $rs) . \ \n;
fwrite($fp,
http://www.php.net/mysq_list_fields
hth
Jeff
Shaun
you've just about got it in your question.
SELECT * FROM MyTable WHERE Field1='test' OR Field2='test2' ORDER BY
TIMSTAMP DESC LIMIT 1
hth
Jeff
Hey Todd.
I'm no guru...but have some familarity with these packages. i think you
could remove the php rpm with rpm --erase php* and then recompile. being
from other OS's myself, mainly solaris, i find it easier to build my own,
mainly b/c i know when it works and when it does not.(still a RH
the web process does not have access to write the directory that oyu're
moving the file to. in this case ./images/exec/. most likely you'll need
to either chmod o+w ./images/exec (give the world the write right) or
change the owner of that directoyr to be the web process. both come with
their
www.php.net/mail
redhat
you can use freetds (http://freetds.org) i think there is even an rpm...
Then you just use the mssql_* functions built into php
hth
Jeff
if you're using mysql
php.net/mysql_insert_id
if you're not, there may be a variant for you db
hth
Jeff
Webmaster
this is usually based on what your passing this function. it can be a
result of a bad query or just a bad variable. do you have the correct
variable that is holding a result of an ifx_query() call.
if you could post the prior lines of this that would probably make it
clearer.
also try
if you can connect via odbc, you can use php with it.
i just googled - paradox, database, php
and the first link will answer your question.
ps. Rosen your email bouncesunknown user.
error -- 550 5.1.1 [EMAIL PROTECTED]... User unknown
hth
jeff
- Forwarded by Jeffrey N Dyke/CORP/Keane
i'd be curious what your actual problem is?
here's a question though.,...would these ever work?.
snip
if ((!isset($_POST['edit'])) or ($_POST = )) {
$_SESSION['table'] = t_items;
call_user_func(db_retrieve);
} elseif ((isset($_POST['edit'])) or (!$_POST = )) {
/snip
You're basically
jpgraph does a fantastic job of this, and is very easy to use. I highly
reccomend it!!
http://www.aditus.nu/jpgraph/.
hth
Jeff
could you cast as a float/double before inserting? $number = (double)
$string;
don't know what would happen to the comma, but i assume it would just get
removed??
just a guess/thought
Jeff
sweet. thanks for hte correction. i try, sometimes i fail. :)
CPT John W.
if you want actual errors that PHP generates and not logic based errors,
then writing your own error handling function and calling it with
set_error_handler() at the top of your scripts may work for you. in your
function you'd just need to use $errorstr, $errorfile and $errline and log
it using
question/comment...
i don't use PEAR currently. but i noticed this class expects
register_globals=on and would therefore not to work on my system.
Or does another parent class take care of the translation between $form and
$_GET['form']?
Jeff
not to belabour this topicbut, that i know. i was just curious as to
why that class is written like that still?
it seems that if PEAR does this for you(extract), that _may_ be a security
concern for those that are not being security concious.
Not that i'm saying, or know, that PEAR does
this should fix ya..
http://www.mysql.com/doc/en/Resetting_permissions.html
hth
Jeff
Joffrey Leevy
lots of people seem to post/think different things, but each time Rasmus
posts to these lists, he says PHP/Apache2 is not a production ready combo.
if you search the PHP-INSTALL archives for his name or Apache2, you'll find
his posts.
hth
Jeff
--
PHP Database Mailing List
'tested' is the key. hopefully you don't test in production ;-) his
point has been that you may not notice the problems until the servers get
under heavy load.
i've got two such setups running myself. but not in production.
jeff
there are trim functions in both mysql and php.
both they are called the same...trim, ltrim and rtrim. trim takes off both
sides, and the r and l take the right and left respectively, but yes, this
is possible in the query.
http://www.mysql.com/doc/en/String_functions.html
php.net/trim
ahh, yes...but you didn't say mysql...sorrythey all have this function.
[EMAIL PROTECTED]
The crux of the problem seemed to be that i was ftp'ing files down from
remote servers(1 to 4 depending how many are currently active), saving them
locally and then parsing those files in the same script. When i removed
the ftp process from the code and broke the process out into two seperate
OS Solaris8
php4.3.2 and php 4.2.3. running as CLI from cron and command line.
I have a log file that i'm processing that i need to in turn insert only
certian fields into the database. I open the files using
file(filename.csv),which returns the array for me to process. i process
all the lines
do you just need a /
$AcceptedFolder= 'F:/';
Karen Resplendo
hmmm. thanks for this. the file actually does not have quoted entries
between the commas. it is just:
text,text,text . ,text \n
that does not take away from the assitance...gives me more things to think
about.
thank you.
jeff
$fieldarray = array(one,Two, three, four);
$line = \.implode(\,\,$fieldarray) .\;
this will print out one,Two,three,four
hth
jeff
$qry = SELECT id, name FROM a_table;
$result = mysql_query($qry) or die(mysql_error());
while ($rs = mysql_fetch_row($result)) {
$myarray[$rs[0]] = $rs[1];
}
is that waht you need?
hth
Jeff
I use Apache with PHP using MSSQL and MySQL at the same time...
You'd just need to connect to different databases, the platform should not
matter.
hth
Jeff
I have a query that is pulling user comments, supplied by via web
internface and creating a text file out of them. In these comments are all
sorts of carrige returns. I've tried stripping them out with the following
queries, but once imported into excel, the carrige returns are still there.
so
I have two tables and am running a simple join between them to get
questions and their repsective response averages from a survey. The
question table has 49 rows and the Response table has 126,732. I'd like to
cut down on the time its taking to run this specific query...as i'll be
running many
i new i forgot to include something.
here this is the ouput. it looks like its using none of my indexes in the
Response, which is where i would think it would need it the most.
+++---++-++++
| table | type | possible_keys |
Thanks Jeff!
You were correct the Question_Key was set second in the Primary key...i
changed that and the query went down to 2.41seconds. very nice.
Thanks for the help.
Jeff
ps. you're also correct about the LIKE, of course...that was being used
horribly. i'd forgoten it changed to an INT,
i asked this same question once and somehwere in the archives is a post by
John Holmes that shows an example of how mysql allows db joins. its from
last month i believe
http://marc.theaimsgroup.com/?l=php-db
but in short, mysql does support this using . db.table.field
hth
Jeff
couple possible problems.
1. register globals being off and you're using variables like $name instead
of $_POST['name'].
2. you're not asking that anything be written to the database, only
selecting
$insert=select * from $table;
$db_query=mysql_db_query($db_name,$insert);
3.
http://www.mysql.com/doc/en/mysqldump.html
John Ryan
you could first check for isset($_POST['keyword']) and then if that passes
check what keywords you have. or you could write an additional html tag to
the page like. input type=hidden name=keyword[] value=NA. This
would force the $_POST['keyword'] array to exist and then you'd have to
strip
couldn't this be accomplished with a Left Join? Depending on how your
tables are arranged you should be able to get all (sub)sub-names out and in
the same result set using the top_name with a Left Join. any key that
relates to the parent key would be returned.
it looks like you have them all in
the value will be what ever you set the value to be in your html tag.
intput type=checkbox name=color value=red
if checked $_POST['color'] will equal red. if unchecked, the index
'color' will not be in the $_POST array.
hth
Jeff
looks like you stopped putting commas after your fields at
$field_str .= formation = '$formation' ;
$field_str .= perfs = '$perfs' ;
$field_str .= event = '$event' ;
$field_str .= fluid = '$fluid' ;
hth
Jeff
I'd worry about the empty dates after. and use something like.
$qry = select date1, date2 from table;
$result = mysql_query($qry) or die(mysql_error());
while ($rs = mysql_fetch_row($result)) {
//this array could be built a number of ways, one is
$bookdate[] = array($rs[0],$rs[1]);
}
if
use mysqldump. you can dump all databases (--all-databases) or list them
individually.
http://www.mysql.com/doc/en/mysqldump.html
hth
Jeff
if its never entering hte test process maybe you're not holding what you
think you are in the arrays. each time through the loop, before the if
statemetn, just add a
print_r($shell[$cntr]) and/or print_r($grp[$cntr] == ). for that matter
you could print_r both arrays so you can see exactly what
if you're using php to generate this query you could use addslashes() to
the piece that is holding 11301201 0603A HKA 3902 #3708_JD's
AE Exp. this will escape the slashes making them \'
similarly if you're getting \' in your return values you can use
stripslashes()
www.php.net/addslashes
$_SERVER['HTTP_REFERER']
hth
jeff
Diana Cassady
to my knowledge this is not possible in MySQL. There are only joins at the
table level. I've been curious about this in the past myself, so if i'm
incorrect, i'm hoping to hear it via this post.
hth
jeff
do you get anything helpful if you set error_reporting(E_ALL) and rerun the
search. could this be a register_globals issue? can you print_r($_GET) or
print_r($_POST) depending on how you have defined the FORM action...and if
you can is there anything in those arrays?
hth
Jeff
if you're looking for a little more control over your documents, i'd try
this class. Its based on the WriteExcel Perl Module. Perl class docs can
be found
here---http://search.cpan.org/author/JMCNAMARA/Spreadsheet-WriteExcel-0.41/WriteExcel.pm.
I've found _very_ few things for my needs that
Sounds like you're on the right track. in the select list, add --
onChange=document.form.submit() -- this will submit the form when the
user selected the an option from the list, then you could catch the
submitted variable and pass it to the second drop down list and third and
so on. Realizing
This may or may not make sense for your issue. but if you have the whole
array in memory you can serialize() it and write the string that the
function returns to the file.
$fp = fopen(yourfilename.txt, w);
$my_array_s = serialize($my_array);
if (isset($fp)) {
fwrite($fp, $my_array_s);
}
SELECT DISTINCT(Unit) from TABLE_NAME;
[EMAIL PROTECTED]
personally, i had luck with the statement below, but have sent it to others
in the past and they had varying results. but give this a shot at the top
of your page that your PHP code is running on.
mssql_query(set textsize 65536);
hth
Jeff
if i understand your question. why not take a different approach. when the
form is submitted do your updates/inserts and then forward the page with
the header() function to another page, even if it is the same page, but
with a different set of variables set on the page, the idea being to remove
best way to tell is to place .'or die(mysql_error())' after any call to
mysql_query() to see what mysql is complaining about. personally I
sometimes declare the query first so i can echo that as well after the
msyql_error() function, so i can see the query that has just been
excecuted.
whoops, meant to include
thishttp://www.mysql.com/downloads/api-myodbc-3.51.html
[EMAIL PROTECTED]
one thinglooks like you need one more outer set of paren's to tie both
sets of the equation together.
query = SELECT *, ((Year(Now()) - Year(BDAY)) + ((DAYOFYEAR(Now())
-DAYOFYEAR(BDAY))/365)) as AGE FROM Katalog WHERE AGE = 31 AND AGE = 50
AND IS_MEM_EXP = 0 AND IS_OPEN = 1 ORDER BY
yep, sure is.
SELECT DISTINCT(Unit), Count(Unit) from TABLE GROUP BY Unit
hth
jd
[EMAIL PROTECTED]
if there are line feeds in the text, you can use the function nl2br($text);
www.php.net/nl2br
if you require more, you may have to add logic. around headers/titles
etc...
hth
jeff
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
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
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
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'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
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
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
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
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
1 - 100 of 189 matches
Mail list logo