Hi All
This is probably off-topic here and my only real excuse is that after
having searched google as well as both php and mysql sites/manuals I'm
no closer to an answer for something I'd like to get solved this
morning...
I have two database tables (mysql). One contains information about
image
G'day Peter
> I have a form with several date fields. I want to be able to
> set these by selecting from a calendar display. Does anyone
> know of any php function or code which would let me do this?
If you mean having some sort of pop-up calendar display that the user
can select a date from
> So, there is something in the new security of XP and Win 2K
> SP 3 that
> does not let the dll load and run. Ever since I loaded SP 3
> I have had
> problems - like many others!
Don't know about Win2k as I haven't tried it but Apache/PHP/MySQL is
working perfectly well on my Win XP laptop
> @MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); // this
> query doesn't work
Personally, I'd call it bad programming practice to do a database update
and not check to see if it worked or not. In this case, how are you
determining that the query did not work? Are you manually checkin
> $mysql query1
> result
> array[cityid][cityname]
>
> mysql query2
> result
> array[cityid][cityname]
>
> now what i want to do is kick out any doubles in my array
> and resort them alphebetically by cityname ?!
It's difficult to answer this question without knowing more about the
cont
> How do I create a drop down list that automatically
> generates a list of months for the next 12 months upto and including
this month
This would do it...
$month_name\n";
} else {
echo " $month_name\n";
}
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubs
> My question is this: is it possible to use
> autoincrement to generate
> the id's and still keep them sequential when I delete say,
> item 3 of 5.
Generally speaking, an auto-increment column will not fill gaps and keep
sequential orders. Your choice, basically, is to write your code
G'day CJ
> This is really a html more than a php question.
Yep, it probably is...
> Is it possible to have two buttons and have different
> actions for each button in the same form?
Yep, you can.
When you process your form in php you'll find that you have either
$first_submit_act
> Is there a way to get to know from which country a user is
> calling the webside with my php-script?
Probably only if you're going to ask them to tell you what country they
are in.
You can look at the resolved domain that they are coming from and it's
country code - this might be indicative
> You could rely somewhat of the time zone codes as you refer
> to them, the
> only issue is in some parts of the world
> this would include 10 countries at a time.
But what time zone are you getting? The time zone of the browser? The
time zone of the proxy cache that's in a possibly differ
> On another note, I have found that if I include (and use)
> the submit button
> everything works perfectly, HOWEVER if I just enter data and
> hit return then it messes up.
You could try including a hidden submit field like this:
For name="submit" change that to whatever name your norm
Hi Karl
First up, would you mind posting your messages in plain text instead of
html format? It's just a courtesy to the rest of us.
> does anyone have the code to where i can have the time
> printed on my home page like for example
>
> Monday, January 19, 2003
Sure, check out the date() fu
G'day Scott
> Just curious, is there a PHP function that will break up the
> string for us?
I'm not specifically having a go at you but more observing that some
people use this list as a first line of question rather than doing some
work themselves.
Assuming that I didn't already know what fu
> I have a conditional:
> if (a == b)
>
> a is the number 0, but b is a string "Friday August 22".
>
> The condition is evaluating as true, which is not what I want.
> What am I misunderstanding?
You're comparing a string to a number perhaps?
I tried this:
-8<-
$a = 0;
$b = "Frid
> i want to set up a form that will load values from a table
> and make them the
> "value" of the edit box... then when people press an update
> button then all
> of the stuff that changes from the record already in the table gets
> changed... anybody know how to make it where you can get th
> i am having a problem using tags by using current
> values kept in a mysql table. how do you get the values out of the
table and
> into a form so they show as the value= part of the tag?
Start by making a basic test:
";
?>
or you could try this:
Either should work.
Rinse and repe
> echo("| %s | %s | %s | %s | %s |", $array[id],
> $array[username],
> $array[password], $array[status], $array[notes]);
If you look at http://www.php.net/echo you'll see that echo
does not support this syntax. If you want to use this syntax
then you should probably be using some form of print
Karl,
> what is a winmail.dat file?
Is it too much to ask that you do some of this sort of thing for
yourself?
Here, I'll help you...
1. Connect to the Internet (if necessary)
2. Load a web browser
3. Navigate to http://www.google.com/
4. Type "what is a winmail.dat file" into the search b
> Can anybody help me with file uploading, again...
Have you tried using the fairly simple example that is given at
http://www.php.net/manual/en/features.file-upload.php yet? I've found
that starting with this example and then adding all the extras tends to
work well when you've got problems.
> i've written a secure PHP login script which will allow
> users to login to a
> directory such as this:
>
> smezone.com/members/index.php
>
> however, how do I restrict people from accessing HTML files in that
> directory (which they can easily do so by typing the URL into their
> brows
> What I want to do is have the registration form, on submit, check the
> data validity right then, if there is an error, redisplay
> the form with an * next to the field that is incorrect.
This is the code logic rather than the actual working code:
---Start of PHP Page---
1. Check for form h
> I have a string in this format:
> 2003-02-15 13:19:02
>
> I want to display it in a more readable format like
> Staurday, 11 Februardy,
> 2003, 13:19:02. How can I achieve that. I tried date()
> function but could
> not get what I wanted.
The date format above is a standard mysql date/t
> as a general rule of thumb, try to do as much
> checking as you can with
> JavaScript. For those checks such as "is the field a valid
> date", "is
> the field numeric" and so on, it is much faster to check on
> the client,
> than to send the data back to the server and check
> Right now, it's logging the client's IP, the page that
> they're viewing,
> the page that they came from, the time of the visit, and their system
> and browser info.
Ummm, you do understand that, for Apache at least, all of this
information can be made available through it's logging? You a
> Does anyone know of an intelligent way to establish a user's location
> (roughly) from either IP address or some other variable
> available to the
> server from the browser? (Other than polling the user)
Not really - the problems you face are:
1. Processing Delays - if you need to do who
> ***
> function write_string(count) {
>
> for ($x = 0; $x < $count; $x++) {
>
> echo " Row $x";
>
> }
>
> }
>
> $my_string = write_string(5);
>
> echo $my_string;
> ***
8<-Untested Code-8<-
f
> what doesn't work is after they login to Page 1, the
> redirect sends them to
> Page 2 and right back to Page 1 because the global session
> isn't staying
> registered.
Are you putting session_start() at the top of each page where you want
to be able to use the session stuff you've set
> I have a datetime field in one of my mysql tables...when
> displaying some of
> my records I want to display the date in the aforementioned
> datetime field,
> but if the date is today I want to display "today" instead.
> If the date is
> yesterday I want it to display that so I
> Do you charge by the page, script or by the hour (that would
> be nice).
We do this sort of thing in, basically, one of three ways...
1. Client gives us a budget and we give them a clear idea of what that
budget will get them.
2. Client gives us a good idea of what they want to achieve
> When I issue this command to remove any commas at end of string:
>
> $query = rtrim($query, ",");
>
> PHP give me an error saying "Wrong parameter count for
> rtrim()". How can
> this be? The online manual shows rtrim can accept two
> parameters. Shouldn't
> this work? I have PH
> Yes, I am afraid that regarding GPL I have to agree with
> Microsoft when they say it is a cancer. The problem is that if you
want to
> distribute something that incorporates GPL licensed components, your
> software also needs to be distributed as GPL and so it gets
contaminated.
> Thi
> What i want to do is delete the entire IDs and
> generate them again so that they are in one single
> order like 1,2,3,4,5... .like this.
I suspect that if your table, as you use it, needs this ordering then
you've got something wrong. It really shouldn't matter much what the
internal IDs
> Mmm.. think you misinterpreted my question...
>
>
> http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
>
> PASSWORD(str)
> how do you unPASSWORD(str) in PHP?
Basically, you don't.
Instead, what you do is use the password that was provided as user
input. You create a suitable
> is there some other easyer way to do in one line than this?:
>
> $fullname = $session["f_name"];
> $fullname .= " ";
> $fullname .= $session["l_name"];
$fullname = $session["f_name"] . " " . $session["l_name"];
CYA, Dave
--
PHP General Mailing List (http://www.php.net/)
To unsub
> I just upgraded to PHP 4.2.2 and am trying to make my sites work with
> register_globals turned OFF. I notice, however, that with
> register_globals turned off any variables I pass via the URL don't
seem to be
> recognized by the script it was passed to.
> I thought register_globals onl
I know I shouldn't do more to keep this going but I'll make this one,
and only, post.
> this all started when rasmus had a problem with the "click"
> in my original post
>From what I read, Rasmus made a correction to your opinion. You are
entitled to your opinion, but perhaps you should lear
> In my MySQL db I have a date-field on every entry looking like this :
> 2002-08-10
> When presented on a PHP page, I want it converted to
> "Saturday, Augusth
> 10th, 2002".
>
> How do I achieve that? I've been playing around with the
> date-command and
> strtotime-command but haven
> I've tried that, but as usual rtfm doesn't help me. I need
> concise examples
> :(
>
> How would I write this basic select query to get the date in
> my format
> (Saturday, August 10th, 2002)?
> SELECT datum FROM news_items
> (where "datum" is the date-stamp in "-MM-DD" format)
> How do you make a link in MySQL?
>
> I tried following code were the field "geluid" contains a
> link to a mp3
> while ($row=mysql_fetch_array($result))
> {
> echo "";
> echo $row[woord_nl]. ""
> . $row[woord_ost]. ""
> . $row[betekenis_nl]. ""
> . $row[geluid];
> echo "";
> }
> I'd like to implement on my web site an "whois" to know the
> information about a domain name (.com, org, )
There's an article about doing exactly this on devshed
(www.devshed.com/Server_Side/PHP/) that you could have a look at. Looked
like a pretty complete solution when I went looking
> while (list ($key, $val) = each ($info))
> {
>do stuff
> }
$count = 0;
$last = sizeof($info);
While (list($key, $val) = each($info))
{
if ($count == 0)
{
// first time through
}
if ($count == $last)
{
// last time through
}
// do stuff
$count++;
}
--
P
> I keep getting "Undefined variable: PHP_SELF" when using the
> following:
>
>
>
> Global variables are off... What am I doing wrong?
In current versions of PHP, $PHP_SELF is available if globals are on.
You'll need $_SERVER['PHP_SELF'] instead if you're keeping globals off.
CYA, Dav
> I've got a php form, that gathers certain information, and
> then passes that info on to a couple of shell scripts to
> move files around, create links, import data into some mysql
> databases via sql files, etc.
>
> The two shell scripts work fine when I'm logged in as root
> via t
> >SELECT COUNT(x) FROM table;
> >
> >Make 'x' equal to any column name in the table and add WHERE to the
> >clause as needed.
>
> err...all very well, but how do i retrieve the
> value afterwards?
> $sqlcom="select count(codigo) from comments where
> codigo=$id";
> And here is the error I get:
> -
> Warning: Unable to create
> '/home/thehobby/public_html/php/phpforums/uploads/': Is a
Does this directory exist? Does the user that your web server is
running as have permission to write files in this directory?
>
> I have, in my database, a bunch of dates stored like this:
> -M. Month is obviously the number of the month (5), not
> the name (May).
>
> I want to convert the format to MMM, (ex: May, 2002),
Do the conversion in MySQL - it'll save you grief in the long run...
SELECT DATE_F
> Ok so how do I sum up an entire column in my db?
> For example if one row is : 1 , the next is 2, and the next
> is 1 - I need to
> have a total of 4 and the be able to divide by the num_rows
>
> The problem I ma having is the "inside" row addition
If you're doing it on values from a d
> How do you alternate colors of the rows in a table inside a
> while statement
> when dealing with the output of data from a DB. I am sure
> it's something
> simple but I keep getting into some really long math thing...
For two alternating colours I normally do something like this:
$use
If you've typed your code in accurately then...
> $detailqry = "SELECT id, parentitemid, itemtypeid, itemstatusid,
[etc]
> $result = mysql_query($detailqry) or die("Failed finding
> task details");
somewhere in about here you want to have something like:
$sqldata = mysql_fetch_array($res
> ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY
> category, format.
Try this instead:
SELECT field1, field2, COUNT(*) AS field3 FROM TABLS GROUP BY
category,format
Now you'll find your count is available as 'field3'.
CYA, Dave
--
PHP General Mailing List (http://www.php.n
Doing stuff with || is always a good way to stuff up. In the case of
your example it will always evaluate to true.
> if ($A != $C || $B != $C) {
>
> I think, but im fairly new
This would work if you did this:
If (!($A == $C || $B == $C)) {
> > In perl, I would do this:
> >
> > unless (
> I am having trouble with a PHP script. I am not the one who
> made this and my knowledge on php is very little.
> I came across this php script
> www.canberra-wx.com/bomonster/bomonster01.php
Tried loading this and had too many page errors to figure out what you
are doing.
> www.canber
> Thats a Nice feaure you have, How do you do that?
I have a cron event on my server that grabs the relevant page from the
web site soon after it is updated (around 20 past each hour) using "lynx
-dump url" which then pipes the resulting page dump through grep to grab
just the line of data that
> I have 2 identical tables called "tmp_data" and "data". (on
> the same mysql database).
> What would be the simple and more convenient way to update
> table "data" with a row from table "tmp_data".
What about getting rid of "tmp_data" completely and adding an extra
column to your "data"
> I am the webmaster of the site, i pay for the server space,
> is that what you mean?
First up Simon, I deleted over a hundred lines of no longer relevant
content from your message including things like signatures. You should
probably trim messages down when you reply to them...
Next up, w
> I need a where clause in following situation:
>
> Say I want to query two tables: A and B. In table A there is field
> Afn, while in table B there are 3 fields: Bfn1, Bfn2 and
> Bfn3. I want
> to do a query, in which the where clause must do these things:
>
> if A.Afn=1, then che
> I send hidden variables from a form to a php. In the php
> I have the following code to convert the global vars sent:
>
> If (isset($_GET['foo']))
> $foo = $_GET['foo']
> else
> $foo = 0;
>
> But this only works using the "GET" method!
If you're sending the
> I have no interest in getting into a Win2K/Linux debate. There are
> strengths and reasons for using both systems.
Good for you, I was about to post something similar. For the record my
dev environment is a laptop with a Celeron 1.2/256MB/WinXP Pro and it's
running Apache, MySQL and PHP j
> if (is_readable("owner.php"))
> echo "READABLE";
> else
> echo "UNREADABLE";
> include ("owner.php");
> ?>
According to the manual, the results of is_readable() is cached. So, if
you've been testing this and have both readable and unreadable you may
have the wrong one c
> I am at my wits end at the moment. I am pulling a
> datetimestamp out of a database and attempting to
> get the year month and day out of it.
Do it in your sql query. Check out chapter 6 of the MySQL manual for
ways to manipulate dates.
Eg. $query = "select DATE_FORMAT(DTStamp, '%e %b
> >Song Table:
> >Song_id
> >A_id
> >Type
> >Name
> >Length
> >Lyrics
> >...
> >
> >That's my ideas on how to do it. There are many ways to do
> it, though.
> >
> Totally agree with what John says. If the lyrics are long
> (as I assume
> they will be) then I'd probably hive the
> Indeed, another problem I have is that if a single is on an
> album, which track it is on the album.
Off hand, I'd say that if you need this information as well (ie. You
want to recreate the "songs on album" list in the correct order) then
you need to extend one of your tables to include th
> Using PHP and a MySQL database, I want to grab the highest
> number in a particular column.
As is usual for questions like this, the answer is most likely that you
should do it in your sql query. In this case, something like this would
probably do it:
SELECT MAX(some_column) FROM some_tab
> post_max_size = 10M
> upload_max_filesize = 8M
> memory_limit = 8M
>
> As I said before, however.. even without throwing files
> there, my loop
> test code only spits out '01234', meaning that its only
> looping 5 times
> through the code before exiting... Does file handling only
> I'm currently working on a big photo album tool, and I want
> to provide user
> the ability to upload a lot of jpeg files in one time...
> The big problem with form is it's too slow...
>
> Does anyone know how to by-pass this ( with java or other
> tools )?
It's primarly slow bec
> For all those who don't know my question from yesterday, I
> have a form where I can upload up to 9 files at a time.
> Unfortunately, only the first 5 of those files are being
> uploaded at any given time.
I haven't specifically checked your program logic but I believe that
this is wher
> Just wanted to let everyone know:
>
> PHP version is 4.2.1
> Apache is 1.3.24
>
> Running WindowsXP Pro
Oh, yeah, that.
My dev environment is almost exactly the same.
CYA, Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi All
I'll start by saying that I've checked the online manual (and comments)
as well as having done a Google search on this with no success.
My problem is that files uploaded through a form are increasing in size.
For example, I upload an image that is 7658 bytes and the uploaded
version is 768
G'day David
> > My problem is that files uploaded through a form are
> > increasing in size.
> Doesn't that look like the EOL characters are being
> translated after the fashion of ftp ascii transfers?
> Maybe have a look at the two versions in a
> hex viewer and see if that is the cas
> To those of you that helped me with this problem I have spent time
> eliminating lines of code.. the problem was in the following line:
> if ($_SESSION["first_name"])
>
> the line should be like this
> if (ISSET($_SESSION["first_name"]))
The change that would induce this error is likely
> My OS is Windows XP Pro but the computer with admin
> privaliges is Windows
> 98. It's not software, it's hardware. It's built into the
> HUB of the LAN.
> There is some software to open ports but I'm not sure what
> it is or anything
> like that. Thanks for the help so far.
No offence
> Does anybody know of a SELECT QUERY that will select every
> other record of a
> table ? I want to do this so that I can display my products
> in 2 columns (I
> will also be using arrays of course).
Don't know of a select that'll do it, but then I don't really understand
why you'd want
> Sorry if this is an ignorant question, but I want to do one
> simple thing - create an empty MySQL-type database to upload
> to the server so I can start using PHP to access it... how
> can I do this? I don't really want to have to download the
> whole MySQL product just to create an e
> Am I correct in saying that none of the SQL functions in PHP
> can actually create a database file when no file existed
> before? In other words, an empty database file must exist
> before SQL functions can be called on it?
If you have appropriate access you can. You do need 'root' acc
> Also, if a person doesn't _know_ that PHP can create a
> database for you, how would they know that somewhere in the
> list of PHP functions is the answer to the problem? It would
> be foolish to expect someone to read the _whole_ of the
> documentation on MySQL or PHP just to see if t
> Here is scenario that I am working on but have a problem.
> I have 10 thumbnail images on the page with information for
> them created from database.
> (I am pulling more info about that image from database, but
> on this page I only display "Name of Image" and "Author of
> image
> echo "";
> echo" function pop1() {";
> echo" window.open(\"info.php?prod_id=$result[0]\"); }";
> echo "";
> I am calling this function in the following manner: echo" onclick=\"pop1();\"";
OK, I tend not to put javascript inside php echo statements as it
confuses things - which variables
> Anyone knows of a majordomo type mailing list made with php
> somewhere?
Why would you want to do that? If you need mailing list software you'd
be infinitely better off using one that already exists - if you need
features that it doesn't support (eg. A web front-end for majordomo)
then per
> I have a mysql database table of about 7000 images (they are
> not actually in the db, just references), as yet
> uncategorized. I need to put them online and allow my
> client to browse 12-18 thumbnails per page.
>
> what would be the most efficient method to code that with
> PHP?
> I got a mysql database, where two of the fields of a table
> record times as
> CHAR(8) in the format hh:mm:ss
This is one of those situations where having your database using the
most appropriate field types would help. When you've got it as CHAR
there's little you can do in the way of co
> > > Anyone knows of a majordomo type mailing list made with php >
> > Why would you want to do that? If you need mailing list software
> > you'd be infinitely better off using one that already exists - if
you
> > need features that it doesn't support (eg. A web front-end for
> > ma
> The minor problem is that it treats a "not-equals" sign,
> "<>", as an empty tag and strips it, unless it's explicitely
...etc...
Except, of course, that when writing html you are supposed to use
entities for any valid html stuff - ie. Use > and $lt; for > < and so
on. As you should also
> That sounds very close to what I'm trying to do. Is it
> necessary to reload the page every time a selection is made?
I've found examples of the javascript side of it on www.irt.org that
helped last time I did this sort of thing. The php/sql stuff is a
matter of figuring out what you nee
> I'm looking for e-commerce example (PHP+MySQL) so I don't
> start from zero and save some time.
You could try searching for "php mysql commerce" on any of the
following:
www.google.com
www.freshmeat.net
www.hotscripts.com
Where you'd probably find what you're looking for.
CYA, Dave
> Speaking of which. I was thinking about this this morning.
> Is there a part of the Unix timestamp that tells php what
> timezone to
> report.
You could use the gmt-based date manipulation to do this.
> Reason why I ask, is I would like to offset the unix
> timestamp relative
> to
> I am trying to feature a calendar on a web site. I would
> like it to display on a page and be able to change to
> another month when this is requested and display items for
> the general public. I want the client to be able to go into
> the database and update the items and those item
> The directory and file name:
> museum/trees/admin/upload2.php
>
> The directory I want to store the uploaded file is:
> museum/landmark/photos/
I've found that if you need more control over directory paths than
something fairly simple then you're often best off just declaring a s
> I do beg your pardon... But does PHP not have GOTO command?
Why do you need one? In my experience, going right back to BASIC over
10 years ago, it's rarely _necessary_ to have a goto.
In php I suspect you'd get similar functionlity out of either include()
for creating functions.
Not using
> somefile.php
> $apple = 'green';
> $pear = 'yellow';
> ?>
>
> callfile.php
> include 'somefile.php';
> echo "Apples are $apple and Pears are $pear"; \\ which would
> return the
> line with green and yellow in the correct spots.
> ?>
>
> But when I just do
>
> include 'som
> Being relatively new to php, I discovered the following
> after about 2 hours of debugging last night and was wondering why???
>
> I had the following code:
>
> if ( $num_results = 0 )
> {
> echo "no records found";
> }
> else
> {
> for ($i=0; $i < $num_results; $i++)
> What Im trying to do here is not inside PHP nor MySQL books
> I have. I need to query the DB to look the max result in a
> column. That is, if I have affiliate members with ID going
> from 1 to 10, get the query to know that the last member
> added was 10 so I can add member 11 witho
> I have a db field, type varchar, that is actually a 'date'
> string formatted as dd-mm-. I used type 'varchar' (rather than
> type 'date') since I had to accomplish other things with it.
> Now, however, I do need to extract the Year (the last four
> digits in the array).
Ummm, are
> I would like to have a column returned in a query that tells
> you which record I'm looking at? Sort of like an
> auto_increment? IOW, the query results would look like:
>
> record first last
>
> 1 johndoe
> 2 joe blow
> 3 carol fisher
>
> Th
> It has just occured to me though that if I'm to list maybe
> 100 news items with descriptions it means alot of memory
> right because i have 100 items containing:
> date
> title
> text (could be any length)
>
> I will use su
> I have a JavaScript function that onChange of a list box,
> takes the value of an option and grabs data from a MySQL
> table. My problem is how do I use the JavaScript var in my
> sql statement?
Javascript is client-side, php is server-side. The only way to get
something that happens i
> I have a string something like "10.2.3"
> I want to be able to use the "." as a delimiter to reference
> the elements (10, 2, and 3).
> My thought was to create an array, using "." as the
> delimiter. Is there a function that will create an array out
> of a string, using a delimiter y
> echo "i = $i";
> for($c=1;$c<=$i;$c++){
> echo "team_number $team_number_$c";
> echo "sub1_$c = $sub1_$c";
> echo "sub2_$c = $sub2_$c";
> echo "sub3_$c = $sub3_$c";
> echo "sub4_$c = $sub4_$c";
> echo "sub5_$c = $sub5_$c";
> }
> }
Perhaps this:
Ech
> $query = "select count(*) from users where "
You are asking for a count() in your query. This will always give you
one row returned with a count. If you really want to do this you should
probably have:
$query = "select count(*) as usercount from users where"
Then you can do your te
> user input, which is not always reliable, has to be in the correct
format.
What I've done for things like this is to have three separate select
form elements. The first for selecting a day of the month. The second
for selecting a month and the third for selecting a year. I usually set
the
> Okay, let's say I want to send a user to a certain webpage...
>
> usually I would use...
>
> include("website.php");
>
> but, if i want to send a user to a website along with a
> variable like...
>
> $temp = "website.php?var=".$var;
> include($temp);
>
> ...this doesn't work.
1 - 100 of 202 matches
Mail list logo