I'm trying to figure out a way to do a more efficient join on four tables.
The main table is products, with the other tables being common options for
the products. It's pretty well normalized, but am I doing these joins
properly or is there a more efficient way? This looks pretty ugly to me.
Hi,
I used to store SQL code for a transaction
directly in the PHP script which used it. It was
stored as a string. However, now I want to store
it in the database and assign it to the same
string that held it before. Not very clear, so
heres an example :
Before:
$sql_variable = "select
would unset() help @ all ?
as in unset($thevariables) or do u need the variables ?
Neil
- Original Message -
From: Matthew Walden <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 31, 2002 10:34 PM
Subject: [PHP-DB] Using actual variable values after retreiving from
I have an empty field in a mysql database table which needs to have text
inserted when my client answers an email. The code is as follows
$query = 'UPDATE submissions SET answers = "$array[answer]" where id = "$id"
';
// $query = $query . " where id = $id ";
// echo ("The query is: $query\n"
Assume query looks OK when you echo it? You're not seeing a literal "$id",
are you?
Does an id exist for $id? Is it numeric or char?
Check mysql_affected_rows() - what does it return?
Miles Thompson
At 02:07 PM 1/31/2002 +, Alex Francis wrote:
>I have an empty field in a mysql database tabl
Hi,
I am trying to do a left join on a "master" table, but I don't want to pull
all the records from this table. Can anyone tell me the syntax for using a
WHERE or equivalent on the master table before left joining the slave table?
Is this possible, or do I have to pull all the records from the
What is $array[answer]. Should that be $array[$answer] ?
-Original Message-
From: Alex Francis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 8:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Adding to an empty field
I have an empty field in a mysql database table which need
What is $array[answer]. Should that be $array[$answer] ?
Second, change to:
$query = 'UPDATE submissions SET answers = \"".$array[$answer]."\" where id
= \"$id\"";
Ya gotta quote that text.
-Original Message-
From: Alex Francis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 200
First, don't try to force JOIN to do something that is is not designed to
do. Use WHERE to restrict your query.
Try:
SELECT t.team_name,t.flight_id,p.player_fname,p.player_lname
FROM team t
LEFT JOIN player p ON
t.team_id=p.player_team_id
WHERE t.flight_id=p.player_flight_id && p.player_s
Still having problems
$array[answer] is passed from a previous page with this page.
Answer:
Submit
Answer");?>
Have tried changing to array[$answer] on both pages without any luck.
Changed the code to:
$query = "UPDATE submissions SET answers = \"".$array[$answer]."\" where id
= \"$id\"";
and
First, you cannot have something called:
That is, array[answer] is illegal and ignored. you can use:
Then, search through $array[] for values.
Help us to help you...post your HTML and your code. We promise not to steal
it and use it ourselves
-Original Message-
From: Alex Francis
Ok, I hate to ask this again but I am having a hard time developing a
connection class to be reused. I need to be able to just connect to the
database for several pages because I have multiple queries per page.
Unfortunately I do not know enough about php to effictively do this. I have
read a fe
Ok well I am in a little over my head with a connection class that I can use
over and over for multiple queries against a mysql db on one page. I have
read a few tutorials on the subject of how to use class files but I still
dont understand php enough to know how to make a connection class that
s
Ok, I am having a hard time coming up with a mysql connection class that
simply allows me to setup a require(db_connection.inc) at the top of my php
pages that allows a consistent connection to the mysql db and allows
multiple queries thoughout the php page in question. I have read a few
tutorial
Your solution sounds good. That's what I use too.
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Problem: hosts "http://www."; and "https://secure."; of the same domain need
> to work with the same browser session_id. This is a
> login/authenticate/redirect
$table_name = "my_table";
$timestamp_field = "date_posted"; /* or something similar */
$max_records = 5;
$sql = sprintf("SELECT * FROM %s ORDER BY %s DESC LIMIT %d", $table_name,
$timestamp_field, $max_records):
$result = mysql_query($sql);
/* ... */
Dave Carrera <[EMAIL PROTECTED]> wrote in m
Jas...
What errors are you getting? What do you have inside your db_connection.inc
file? Do you have the path for db_connection.inc inside the require()
function correct?
Give us more insights to be able to find out what the problem is..
Gurhan
-Original Message-
From: jas [mailto:[EMA
Ok how can I find some good resources on how to create a db connection class
that doesnt go over my head? I need to be able to connect to a mysql
database as the page loads and thoughout the page run 6 separate queries on
different fields. please help!
jas
--
PHP Database Mailing List (http:
on 1/26/02 1:21 AM, jas at [EMAIL PROTECTED] appended the following bits
to my mbox:
> Ok, I am having a hard time coming up with a mysql connection class that
> simply allows me to setup a require(db_connection.inc) at the top of my php
> pages that allows a consistent connection to the mysql db
It seems that my insert statement doesn't want to cooperate.. I used the
same format as in Julie Meloni's book. I know, sometimes, her code doesn't
always work either.
here it is:
$sql = "INSERT INTO Jobs (id, Industry, Other, JobTitle, Description,
Location, Date)
VALUES
(\"\",
\"$id\", \"
OOps... second question...
I wanted to do a search of text documents that are inserted into the
database.
1. What is the best data type for large amounts of text, like 2000
characters. I thought BLOB, but I could be wrong...
2. Within the above text, I wanted to search via keywords. How woul
On Friday 01 February 2002 02:42, Todd Williamsen wrote:
> It seems that my insert statement doesn't want to cooperate.. I used the
> same format as in Julie Meloni's book. I know, sometimes, her code doesn't
> always work either.
>
> here it is:
>
> $sql = "INSERT INTO Jobs (id, Industry, Other
And the problem is...
You are trying to insert 8 values into 7 fields. You begin your VALUES with
"", but there is not field specified for it.
Don't blame Meloni here until you've proven her wrong.
-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, Janu
I pulled that code right out of her book...same thing
-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 1:02 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] 2 Questions... INSERT and searching records
And the problem i
Remove the \"\".
Next, whenever you have a problem with a query, print mysql_error() as part
of your die() statement. Finally, print your $sql to ensure that it
contains what you expect.
-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 200
huh?
You open the connection once for the page and then you CAN make multiple
queries to it from the same page. Why are you trying to create a class to
do this (unless it's simply an intellectual exercise to create a class)?
-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
S
Hello,
I have PHP 4.0.6 compiled as an Apache 1.3.20 module with OCI and MySQL
on RedHat 6.2. Things work nicely, except for the following situation:
When connecting to the remote Oracle server, if the server happens to be
down or unavail, I get, what appears to be, re-inclusion, even though
Well it was acutally so that I can create a content management system for my
employer. Another gentleman helped me with it and it is working great I
simply created a file *.php with all my connection commands then did a
require on the page(s) that needed to query the db to pull information about
This seems quite familiar for me. Does this has to do whit chaos?
Anyway, i think i'm getting the idea, but it would be a better to see the
whole code. (at least for me)
good luck,
andrés
>thx again for helping me
>In fact i think the solution you gave me isn t not much faster as the while
I have a loop process that reads a record out of a flat file, stores the
data for a given record in an array, writes the record to the db, resets the
data in the array, then iterates again thru the loop. Not every record has a
value for each field. For example,
Not every record has a value for th
I just added phpMyAdmin to a new Apache Server, and I'm getting this error:
cannot load MySQL extension,
please check PHP Configuration.
I did some research on the web, but couldn't come up with a solution to this
error and couldn't find anyone listing it.
Does anyone know if this is a problem
Frank,
As yet no response from Garry, but I wanted to ask:
You already have DateTable set up (presumably), so extending its application into a
relationship with the
breeding table is no big deal. Given that one suggestion was that Garry could consider
storing monthly
statistics in another table
Ca va Etienne,
> well in fact i think i haven t be very clear with the goal i need to get.
> let me detail this to you frm the beginning to the end...
=the goal is still not clear to me, and if you want to critique this response, or ask
a further question, it
would help me to know what on earth
Hi there, currently writing an e-CRM system for an intranet using PHP on
Win32 and MS-SQL. This system needs to be scalable but more importantly
there will be anything up to 400 users (unlikely, but the max amount) using
the same records (updating information about customers etc) and I worry tha
Hi there,
PHP4.0.6 on IIS / Windows 2000 works fine with SQL Server 2000 (I have teste
this quite throughly) I don't know about unicode fields however as I don't/
haven't used them in any of my databases. I know that varchar fields have a
few issues (can't retrieve more that 255 characters, you
Hi php developers:
I have created a website for a house renting company with an administration
tool. Using this tool, managers can add, modify and delete data in a mysql
database.
They can also upload some pictures of the houses they rent. The way i do
this is by taking them to the list of house
Hi Ollie,
Thank you for your reply.
I was mistaken. I am using PHP 4.1.1 loaded as a CGI. I am using Apache
because I am from a Solaris/Linux background, and I know how to use it
better. I don't feel comfortable enough with IIS to secure it down (with
all that NIMDA and CodeRed floating aroun
No worries, there's an "IIS-Lockdown" Tool available from Microsoft if you
want to play around with IIS - and not have to worry about code red etc (you
still need to keep it regularly updated patches wise though - I guess thats
the advantage of apache).
The sample script is fine - thats how I got
Yeah, I create a simple table with simple char data type. Works great.
No, sorry, I don't know T-SQL. I've just started using MSSQL. I've only
used MySQL, and even that was using very simple queries. Once I have a
better understanding of MSSQL, I will probably pick up the T-SQL book.
Thanks.
Hi,
I am trying to access the MySQL function TO_DAYS() from PHP.
>From MySQL I can type in: SELECT TO_DAYS('2000-1-1') AS bar;
and I get:
++
| bar|
++
| 730485 |
++
1 row in set (0.00 sec)
>From PHP, I have tried:
$sql="SELECT TO_DAYS(2001-01-01) AS bar";
$res
you have changed the command from when you do it in mysql to when you do it
in php - you are leaving out the "'" quote marks around the date you are
passing :)
// $sql="SELECT TO_DAYS(2001-01-01) AS bar";
should be
// $sql="SELECT TO_DAYS('2001-01-01') AS bar";
HTH
beau
// -Original M
Good day to all.
I tried the following code from PHP's manual
if (isset($submit))
{
if ($submit == "Save")
{
echo "$im_file";
$tok = strtok($im_file, "\\");
while ($tok)
{
echo "$tok";
$tok = strtok ("\\");
}
}
}
I have the string $im_file ="C:image.jpg" and I want to
42 matches
Mail list logo