[PHP-DB] php db performance, db clusters

2001-03-28 Thread Jens Fisch

We are looking for PHP-database performance comparisons. Can someone point
out links?
Who has experience with high-traffic sites using - MySQL - MS-SQL,
especially in a clustered environment?

kind regards,

Jens Fisch ([EMAIL PROTECTED])


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] functions and using vars outside of them

2001-03-28 Thread olinux

I am wondering how to use a variable that is generated by a function ($query)
If you would please look at: http://phpbuilder.net/columns/laflamme20001016.php3?page=5
for an example of what i am trying to do.

the function will generate the query... but how do i make use of this?
i see that i will need to call the function 
skill_search($skills);

but this does not make the variables inside the function available.

thanks much,
olinux



Re: [PHP-DB] Take out one Data and show it in page

2001-03-28 Thread Johannes Janson

Hi,

hte first part after WHERE is the column name of your db.
if you want to search with name as a criteria you write:
selelct name, nickname from table where name=$name;

johannes

"Naga Sean" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I had a question here.
> How to pull up one database, and then view that row
> what I mean here is
>
> NO  NAME   AGE
> 1   JOHN   12
> 2   RYAN   23
> 3   JIM42
>
> I want to take JOHN out from database using URL
> www.example.com/template.php?name=JOHN
>
> here is my coding so far, and I know it's wrong, But will make you guys
had the idea what I want to do.
> Thanks
>
> ---
>
>  $db = mysql_connect("localhost", "user","pass");
> mysql_select_db("media",$db);
> $result = mysql_query("SELECT nickname,name FROM database WHERE
$myrow[2]=$name",$db);
> $myrow = mysql_fetch_row($result);
> ?>
>
>
> Your name $myrow[name], $myrow[age]
>
> _
> www.kaskus.com - FREE EMAIL SERVICE
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] help with a parse error

2001-03-28 Thread Doug Semig

Gee...all I looked at were the semicolons and the braces (those are what I
mess up on the most).

I guess it's a good thing I mentioned the space in the endif!  It turns out
that if you use that syntax, you cannot have a space there.

Doug

At 01:19 PM 3/29/01 +0930, Timothy Aslat wrote:
>Petra wrote:
>> I just subsribed to this list with the hope you can help me.
>
>We can try
>
>
>> echo(" Here are all the products in our database: :);  
add a " before the ; here
>> 
>> // Request the text of all the products
>> $result = mysql_query(
>> "select * from products");  !this is
line 52!!
>
>
>Your problem is the previous line, you are missing a " on the end of it
>
>Cheers
>
>Tim
>
>-- 
>| Disclaimer:| Timothy Aslat
[EMAIL PROTECTED] |
>| The sender of this email is a figment  | http://www.goodiesruleok.com
   |
>| of a deranged imagination and leaves it| Spyderweb Consulting
   |
>| to your own devices to decide whose... | P: 82270800M: 0401088479
   |



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] help with a parse error

2001-03-28 Thread Doug Semig

You didn't mention if the parse error was coming from PHP or from MySQL.
The PHP syntax looks okay to me at first glance (that is, a quick look
through indicates that there appears to be appropriate numbers of
semicolons and closing braces).

So perhaps the thing issuing the parse error is MySQL?  In that case, I'd
hazard a guess that you don't have a table named products.  Check the
spelling, capitalization, whether it's the plural "products" or the
singular "product."  What helps me say this is that the INSERT statement
above your line 52 inserts into a table called "JShistbau" and your SELECT
statement appears to pull data from a table called "products."  I'm not
saying that that's necessarily wrong, because it could very well be
perfectly valid.  But without knowing more about your database layout,
that's all I can think of.

By the way, (and it shouldn't matter...) but have you also tried removing
the space in the "end if;" (part of your larger if:-else:-endif;
statement)?  I personally don't use that alternative syntax, so I don't
know if the space matters.

Doug

At 01:22 PM 3/29/01 +1000, Petra wrote:
>
>hi 
>
>I just subsribed to this list with the hope you can help me.
>
>I am working on this code and I get a parse error in line 52 which is ...
>
>I been going through it over and over and can't find a glue.
>
>Has anyone out there a solution for me  please?
>I am a beginner in PHP and like to hear about anything I need to know.
>
>Kindest Regards
>
>Petra
>[EMAIL PROTECTED]
>
>
>else:
>// Connect to the database server
>$dbcnx = @mysql_connect("localhost", "root", "");
>if (!$dbcnx) {
>echo( "Unable to connect to the " .
>   "database server at this time." );
>exit();
>}
>
>//Select the products database
>if (! @mysql_select_db("JShistbau") ) {
>echo ( "Unable to locate the Product " .
>   "database at this time." );
>exit();
>}
>
>// If a Product has been submitted,
>// add it to the database.
>if ("SUBMIT" == $submitproduct) {
>$sql = "INSERT INTO JShistbau SET " .
>   "cdescription='$productdescription', " .
>   "cdateavailable=CURDATE()";
>if (mysql_query($sql)) {
>   echo("Your Product has been added.");
>} else {
>   echo("Error adding submitted product: " .
>mysql_error(). "");
>}
>}
>echo(" Here are all the products in our database: :);
>
>// Request the text of all the products
>$result = mysql_query(
>   "select * from products");  !this is line 52!!
>if (!$result) {
>   echo("Error performing query: " .
> mysql_error() . "");
>   exit();
>}
>
>// Display the text of each product in a paragraph  
>while ( $row = mysql_fetch_array($result) ) {
>   echo("" . $row["cdescription"] . "");
>}
>
>//When clicked, this link will load this page
>//with the product submission form displayed.
>echo("" .
>   "Add a Product!");
>
>end if;
>?>
>
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] help with a parse error

2001-03-28 Thread Timothy Aslat

Petra wrote:
> I just subsribed to this list with the hope you can help me.

We can try


> echo(" Here are all the products in our database: :);     add a " 
>before the ; here
> 
> // Request the text of all the products
> $result = mysql_query(
> "select * from products");  !this is line 52!!


Your problem is the previous line, you are missing a " on the end of it

Cheers

Tim

-- 
| Disclaimer:| Timothy Aslat [EMAIL PROTECTED] |
| The sender of this email is a figment  | http://www.goodiesruleok.com   |
| of a deranged imagination and leaves it| Spyderweb Consulting   |
| to your own devices to decide whose... | P: 82270800M: 0401088479   |

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] help with a parse error

2001-03-28 Thread Petra


hi 

I just subsribed to this list with the hope you can help me.

I am working on this code and I get a parse error in line 52 which is ...

I been going through it over and over and can't find a glue.

Has anyone out there a solution for me  please?
I am a beginner in PHP and like to hear about anything I need to know.

Kindest Regards

Petra
[EMAIL PROTECTED]


Unable to connect to the " .
"database server at this time." );
exit();
}

//Select the products database
if (! @mysql_select_db("JShistbau") ) {
echo ( "Unable to locate the Product " .
"database at this time." );
exit();
}

// If a Product has been submitted,
// add it to the database.
if ("SUBMIT" == $submitproduct) {
$sql = "INSERT INTO JShistbau SET " .
"cdescription='$productdescription', " .
"cdateavailable=CURDATE()";
if (mysql_query($sql)) {
echo("Your Product has been added.");
} else {
echo("Error adding submitted product: " .
mysql_error(). "");
}
}
echo(" Here are all the products in our database: :);

// Request the text of all the products
$result = mysql_query(
"select * from products");  !this is line 52!!
if (!$result) {
   echo("Error performing query: " .
 mysql_error() . "");
   exit();
}

// Display the text of each product in a paragraph  
while ( $row = mysql_fetch_array($result) ) {
   echo("" . $row["cdescription"] . "");
}

//When clicked, this link will load this page
//with the product submission form displayed.
echo("" .
"Add a Product!");

end if;
?>





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Take out one Data and show it in page

2001-03-28 Thread Naga Sean

I had a question here.
How to pull up one database, and then view that row
what I mean here is

NO  NAME   AGE
1   JOHN   12
2   RYAN   23
3   JIM42

I want to take JOHN out from database using URL
www.example.com/template.php?name=JOHN

here is my coding so far, and I know it's wrong, But will make you guys had the idea 
what I want to do.
Thanks

---




Your name $myrow[name], $myrow[age]

_
www.kaskus.com - FREE EMAIL SERVICE

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] how do I connect to MSSQL and mySQL with PHP4 and Linux?

2001-03-28 Thread Darryl Friesen

> I see this FreeTDS thing (www.freetds.org), but do I really need that?
> I don't even know what it is really? The 'FAQ' is not very informative for
a
> 'novice'.
> It seems like some extra layer of minutiae that I don't want to deal with.
>
> Isn't there some way to compile PHP "--with-mssql" just like there is
> "--with-mysql"?

No.

> And there are all these built in mssql_connect() etc functions in PHP
> already, how would FreeTDS effect that?

It lets you use them.

There are two ways to talk to an SQL server, ODBC (in which case you'd use
the odbc_* functions) or TDS (using the sybase_* or mssql_* functions).
You'll need support installed on your linux box for at least one of these
protocols.

All the unix based ODBC stuff I've seen also _requires_ software to be
installed on your SQL server.  TDS does not; think of it as the 'native'
protocol spoken by the MS SQL server (and Sybase servers actually).  It's
_way_ easier than ODBC (I never could get ODBC support installed and working
on our Digital Unix machines). FreeTDS is a free, open source implementation
of the TDS protocol.

>I guess I was hoping this would be simple, like mySQL connectivity was...

It's no more work than MySQL.  In order to compile PHP with MySQL support,
you first had to install MySQL.  In order to talk to a Sybase or MS SQL
server, you need to install TDS.

FreeTDS is very easy to install.  You should be able to install FreeTDS and
recompile PHP in under an hour.  The only tricky part is knowing what port
the SQL server listens on (the default is 1433).

Feel free to email me if you need more help.

By the way, I understand there are major issues with SQL2000 server.  In
that case, ODBC might be a better choice.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] managing large result sets

2001-03-28 Thread php3

Addressed to: "houston" <[EMAIL PROTECTED]>
  [EMAIL PROTECTED]

** Reply to note from "houston" <[EMAIL PROTECTED]> Wed, 28 Mar 2001 
12:14:51 -0600

>
> I have to deal with displaying result sets that could potentially be quite
> large.  It would be bad form to drop 10,000 rows into a browser table so I
> need a strategy for dealing with this possibility.
>
> It's obviously not a big deal to limit the output but what is the typical
> strategy for handling   behavior?  It seems terribly
> inefficient to requery for a subset each time.  I suppose that I could dump
> the entire result set to a text file keyed to the session but that raises
> the problem of garbage collection with potentially large files.  Anyone have
> experience with this problem?

It may seen inefficient, but a new query each time is the way to handle
it.  If you are using MySQL look at the LIMIT clause.


   SELECT whatever FROM someTable LIMIT start, count

Start is the record number of the first entry to return.
Count is how many to return.

I believe you will find this is not as inefficient as it may seem as it
is a common thing to do and the people who wrote MySQL know it.  I
believe you can count on the database to cache the result set for you,
and handle garbage collection if you don't hit it often enough.




Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Select Database number & show it

2001-03-28 Thread David Balatero

I believe this is what you want:

SELECT * FROM mydatabase LIMIT 0,5

---
David Balatero
[EMAIL PROTECTED]
---

-Original Message-
From: Naga Sean [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 5:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select Database number & show it


Friends,

Can you tell me how to select database between 1-5
and then show it to the web.

ex :
 1 xx
 2 xx
 3 xx
 4 xx
 5 xx
 6 xx
 7 xx
 8 xx
 9 xx
10 xx

I think it's easy, but I'm a beginner here. so I don't know how to do that.


Thanks

Regards,
Naga


_
www.kaskus.com - FREE EMAIL SERVICE

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Select Database number & show it

2001-03-28 Thread Naga Sean

Friends,

Can you tell me how to select database between 1-5
and then show it to the web.

ex :
 1 xx
 2 xx
 3 xx
 4 xx
 5 xx
 6 xx
 7 xx
 8 xx
 9 xx
10 xx

I think it's easy, but I'm a beginner here. so I don't know how to do that.


Thanks

Regards,
Naga


_
www.kaskus.com - FREE EMAIL SERVICE

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Stuart J. Browne

> I use MySQL 3.22.23 but I just had a hunt about on the web and I found
> a posting that confirmed your findings - I.E: auto_increment starts at
> 1!!
>
> I stand corrected!

The reasoning behind this a colleague of mine recently informed me of..

When an insert occurs, the new record is given the value of '0'.  The
auto-increment occurs once the insert is complete.

If you use a 0 value in the auto_increment'd field, and you do a table
modification (done this once or twice), you'll find you 0'd field jumped up
to the next auto_increment value.

bkx

--MySQL Documentation extract--
An integer column may have the additional attribute AUTO_INCREMENT. When you
insert a value of NULL (recommended) or 0 into an AUTO_INCREMENT column, the
column is set to value+1, where value is the largest value for the column
currently in the table. AUTO_INCREMENT sequences begin with 1. See section
23.4.30 mysql_insert_id(). If you delete the row containing the maximum
value for an AUTO_INCREMENT column, the value will be reused with an ISAM
table but not with a MyISAM table. If you delete all rows in the table with
DELETE FROM table_name (without a WHERE) in AUTOCOMMIT mode, the sequence
starts over for both table types. NOTE: There can be only one AUTO_INCREMENT
column per table, and it must be indexed. MySQL Version 3.23 will also only
work properly if the auto_increment column only has positive values.
Inserting a negative number is regarded as inserting a very large positive
number. This is done to avoid precision problems when numbers 'wrap' over
from positive to negative and also to ensure that one doesn't accidently get
an auto_increment column that contains 0. To make MySQL compatible with some
ODBC applications, you can find the last inserted row with the following
query:

SELECT * from tbl_name WHERE auto_col IS NULL
--End Documentation--: manual_Reference.html#IDX839





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] how do I connect to MSSQL and mySQL with PHP4 and Linux?

2001-03-28 Thread Daevid Vincent

I run Apache, PHP4, RH Linux, and mySQL currently. Everything is fine.
What I need to do is get Microsoft SQL Server in there as well.

I see this FreeTDS thing (www.freetds.org), but do I really need that?
I don't even know what it is really? The 'FAQ' is not very informative for a
'novice'.
It seems like some extra layer of minutiae that I don't want to deal with.

Isn't there some way to compile PHP "--with-mssql" just like there is
"--with-mysql"?
And there are all these built in mssql_connect() etc functions in PHP
already, how would FreeTDS effect that?

on this page:
http://www.php.net/manual/en/ref.mssql.php
there is an example on how to compile everything, but it still shows freeTDS
in there.

I looked through the archives:
http://marc.theaimsgroup.com/?l=php-db&w=2&r=2&s=mssql+mysql&q=b
but didn't find anything remotely useful.

I guess I was hoping this would be simple, like mySQL connectivity was...

Thanks in advance,

Daevid.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Copy data from one mysql table to another?

2001-03-28 Thread Brian Hardwick

do something like -

1. make a third table indentical to table svt_members. lets call it
svt_members_temp.

2. load the svt_members_temp table with the merged values.

"Insert into svt_members_temp(key_svt_members, phone, etc,etc,etc)
Select phone.key_svt_members, phone.phone, svt_members.etc, svt_members.etc,
svt_members.etc
>From svt_members, phone
Where svt_members.key_svt_members = phone.key_svt_members"

3. cross your fingers (or backup)

4. empty the contents of the original table.
"delete from svt_members"

5. load the data back into the real table.

"Insert into svt_members(key_svt_members, phone, etc,etc,etc)
Select svt_members_temp(key_svt_members, phone, etc,etc,etc)"

- brian hardwick

-Original Message-
From: Bob Stone [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 3:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Copy data from one mysql table to another?


Dear PHP Helpers,

I cannot find any documentation on how to copy the
data from one mysql table to another, i.e. table1,
columnx to table2, columnx.

Can you recommend a way?

Here is the situation.

I have one table called "phone" with two columns. The
first column is called "key_svt_members," the second
is called "phone."

I have a second table called "svt_members." This table
has 17 columns including "key_svt_members" and
"phone." The phone column in this table is currently
empty.

I wish to copy the data that is in phone, phone into
svt_members.

Can you recommend a method?

Thanks in advance,

Bob Stone

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Copy data from one mysql table to another?

2001-03-28 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Bob Stone) wrote:

> I cannot find any documentation on how to copy the
> data from one mysql table to another, i.e. table1,
> columnx to table2, columnx.

See the mysql documentation of the "insert into" syntax for how to use a 
trailing "select" statement to get the values to be inserted.  In a single 
statement you can select the data from one table and insert it into 
another.  Example: "insert into table2 (p_key,data) select p_key,data from 
table1 where p_key >100 and data !='garbage'"

(This also works for "replace into" and "create table" statements, BTW.  
Nifty, eh? )

-- 
CC

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Copy data from one mysql table to another?

2001-03-28 Thread Bob Stone

Dear PHP Helpers,

I cannot find any documentation on how to copy the
data from one mysql table to another, i.e. table1,
columnx to table2, columnx.

Can you recommend a way?

Here is the situation.

I have one table called "phone" with two columns. The
first column is called "key_svt_members," the second
is called "phone."

I have a second table called "svt_members." This table
has 17 columns including "key_svt_members" and
"phone." The phone column in this table is currently
empty.

I wish to copy the data that is in phone, phone into
svt_members.

Can you recommend a method?

Thanks in advance,

Bob Stone

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] global vars

2001-03-28 Thread olinux

nevermind, sorry
it was a stupid comma in my sql query...
what i have is very sool tho, so if you would like the script its great!
i derived it, almost entirely from Dan LaFlamme's NOT working script at
http://phpbuilder.com/columns/laflamme20001016.php3

olinux

- Original Message -
From: "olinux" <[EMAIL PROTECTED]>
To: "PHP-DB" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 28, 2001 2:06 PM
Subject: [PHP-DB] global vars


I am working with global variables and functions, specifically calling a
function inside another function.
I checked the online docs and don't see any problems with what i have... i
declare the table_name as global inall functions

What I am trying to do is DELETE all entries for a uid before INSERTING the
new skills
my insert_skills() calls the function to DELETE entries and then the
function that creates the INSERT query

the lookup_skills table columns looks like this.
   |   id   |   uid   |   skills_id   |


here are a couple excerpts from my code:

table_name = "lookup_skills";
...

function insert_skills($uid, $skills) {
global $table_name;
   purge_lookup($table_name, "1");

   $query = create_checkbox_query($skills, $table_name, "1");

...

function purge_lookup($table, $uid) {
global $table_name;
  $q = "DELETE FROM $table, WHERE uid = $uid";
  mysql_query($q);
}

...

function create_checkbox_query($arr, $table, $uid) {
global $table_name;
   $q = "INSERT INTO $table (uid, skill_id) VALUES";
   foreach ($arr as $check) {
 $q .=  " ( $uid , $check )" . ",";
   }
   return substr($q, 0, -1);
}

insert_skills("1", $skills);

thanks much,
olinux




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Apostraphe's etc..

2001-03-28 Thread Randall Barber

Here is the script:



I want to insert apostrophe's into my little database.  For instance the user enters 
this in the fields provided:

My Title's Name

This body text hasn't got nothing.

My Name's Cool

The resulting SQL string is this:

INSERT INTO news ( EDATE, TITLE, BODY, EUSER ) VALUES ( DATE(), "My Title's Name", 
"This body text hsn't got nothing.", "my Name's Cool" ) 

I'm trying to insert into TEXT fields in Access 2000.
Using Access's SQL builder (Query thingy) it indicates that you can surround fields in 
"" that have ' in them without the need for escaping.

Here is the error:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] '' is not a valid name. 
Make sure that it does not include invalid characters or punctuation and that it is 
not too long., SQL state 37000 in SQLExecDirect in C:\PMPCWEB\mail\addnewsitem.php on 
line 17

Here is the other method I have tried:

INSERT INTO news ( EDATE, TITLE, BODY, EUSER ) VALUES ( DATE(), 'My Title\'s Name', 
'This body text hasn\'t got nothing.', 'My Name\'s Cool' ) 

With this error:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing 
operator) in query expression ''My Title\'s Name', 'This body text hasn\'t got 
nothing.''., SQL state 37000 in SQLExecDirect in C:\PMPCWEB\mail\addnewsitem.php on 
line 17


I give.. Anyonve have some ideas for me please?
Thanks in advance
RDB



[PHP-DB] global vars

2001-03-28 Thread olinux

I am working with global variables and functions, specifically calling a function 
inside another function.
I checked the online docs and don't see any problems with what i have... i declare the 
table_name as global inall functions

What I am trying to do is DELETE all entries for a uid before INSERTING the new skills
my insert_skills() calls the function to DELETE entries and then the function that 
creates the INSERT query

the lookup_skills table columns looks like this.
   |   id   |   uid   |   skills_id   |


here are a couple excerpts from my code:

table_name = "lookup_skills";
...

function insert_skills($uid, $skills) {
global $table_name;
   purge_lookup($table_name, "1");

   $query = create_checkbox_query($skills, $table_name, "1");

...

function purge_lookup($table, $uid) {
global $table_name;
  $q = "DELETE FROM $table, WHERE uid = $uid";
  mysql_query($q);
}

...

function create_checkbox_query($arr, $table, $uid) {
global $table_name;
   $q = "INSERT INTO $table (uid, skill_id) VALUES";
   foreach ($arr as $check) {
 $q .=  " ( $uid , $check )" . ",";
   }
   return substr($q, 0, -1);
}

insert_skills("1", $skills);

thanks much,
olinux




[PHP-DB] managing large result sets

2001-03-28 Thread houston

I have to deal with displaying result sets that could potentially be quite
large.  It would be bad form to drop 10,000 rows into a browser table so I
need a strategy for dealing with this possibility.

It's obviously not a big deal to limit the output but what is the typical
strategy for handling   behavior?  It seems terribly
inefficient to requery for a subset each time.  I suppose that I could dump
the entire result set to a text file keyed to the session but that raises
the problem of garbage collection with potentially large files.  Anyone have
experience with this problem?

Thanks--Houston



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] My first question: PHP won't update MySQL

2001-03-28 Thread Terry Romine

You don't seem to do an insert with the new data.

Terry

On Wednesday, March 28, 2001, at 11:19 AM, Timothy D. Arnold wrote:

> I believe that the problem is in the following batch of code...
>
> Thanks,
>
> Tim
> [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] My first question: PHP won't update MySQL

2001-03-28 Thread Timothy D. Arnold

Hello,

I am new to PHP as well as this list.  I have taken another page that does work and 
tried to modify it to use
a new MySQL table ("story").  I haven't made any major changes, but the new page does 
not work.

Here is the page that works: http://phenon.com/nothing/favorite_color.php
Here is the page that does not: http://phenon.com/nothing/story_edit.php

I believe that the problem is in the following batch of code...

Thanks,

Tim
[EMAIL PROTECTED]




  Edit Story:";

$sql = "SELECT * FROM story WHERE id=$id";

$result = mysql_query($sql);

$myrow = mysql_fetch_array($result);

 $id = $myrow["id"];

$title = $myrow["title"];

$body = $myrow["body"];


?>





   
  
   
Title
   

  
  
 
Story:
   

  
  
   
 
   

  
 

  


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] post method

2001-03-28 Thread olinux

just change the FORM action attribute to

action="http://www.web.com/comunidad/directorio/directio.php"

olinux

- Original Message -
From: "Gaby" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 28, 2001 5:04 AM
Subject: [PHP-DB] post method


Hi world ,

How does PHP receive a POST request ?

I need receive a page that I call like from a form using post method ,

For exemple :

http://www.web.com/comunidad/directorio/directorio.asp">

Nombre:


Is not the same like :

http://www.web.com/comunidad/directorio/directorio.asp?botones='Buscar'&nomb
re='xxx'   ???

I know it works with GET method.
How I can emmulate a post form  from code ?

Thanks in advance

Gaby
http://www.atrivia.com




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] post method

2001-03-28 Thread Gaby

Hi world ,

How does PHP receive a POST request ?

I need receive a page that I call like from a form using post method , 

For exemple :

http://www.web.com/comunidad/directorio/directorio.asp">

Nombre:


Is not the same like :

http://www.web.com/comunidad/directorio/directorio.asp?botones='Buscar'&nombre='xxx'   
???

I know it works with GET method.
How I can emmulate a post form  from code ?

Thanks in advance

Gaby
http://www.atrivia.com




RE: [PHP-DB] Re: Record Numbering - was SELECT MAX(ID) PLUS 1

2001-03-28 Thread Rubanowicz, Lisa

Thanks Steve,
I will go back to using separate tables - Thanks
Lisa

-Original Message-
From: Steve Farmer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 12:12 PM
To: Rubanowicz, Lisa; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Record Numbering - was SELECT MAX(ID) PLUS 1


Hi Lisa,

At 4:40 AM -0600 28/3/01, Rubanowicz, Lisa wrote:
>Can anyone help me on this one
>Lisa

[snip]

>
>  >
>>  Here is the story.  I have a small web site running from mySQL.
Initially
>
>I
>  > had it all in different tables then an ASP colleague said I should do
it
>it
>  > one table and use SELECT MAX(sub_id) etc.


Well although MYSql is not truly a relational database your ASP 
colleague does not seem to know a lot about database design !!

If it was me I would use extra tables for the first few levels...

You can use a self referencing table (which is what you are trying to 
do) but IMHO the extra tables approach provides more speed and 
flexibility.

Otherwise I can't see a reason why the query you are trying should not
work..

a better and (usually) faster approach is to use another table to 
store the record numbers eg..

Table - record_numbers

RECNUM_PKEY  (Primary Key) (this holds the Table ID or Key eg "L1", "L2"
etc)
RECNUM_VALUE (holds the next record number)

you could easily write a php function to get the next record number 
for any table..

This may be overkill for your project but it is very flexible .

HTH
Steve

-- 
---
"Minds are like parachutes, they work best when open"
Support free speech; visit http://www.efa.org.au/

Heads Together Systems Pty Ltd http://www.hts.com.au
Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



[PHP-DB] Re: Record Numbering - was SELECT MAX(ID) PLUS 1

2001-03-28 Thread Steve Farmer

Hi Lisa,

At 4:40 AM -0600 28/3/01, Rubanowicz, Lisa wrote:
>Can anyone help me on this one
>Lisa

[snip]

>
>  >
>>  Here is the story.  I have a small web site running from mySQL.  Initially
>
>I
>  > had it all in different tables then an ASP colleague said I should do it
>it
>  > one table and use SELECT MAX(sub_id) etc.


Well although MYSql is not truly a relational database your ASP 
colleague does not seem to know a lot about database design !!

If it was me I would use extra tables for the first few levels...

You can use a self referencing table (which is what you are trying to 
do) but IMHO the extra tables approach provides more speed and 
flexibility.

Otherwise I can't see a reason why the query you are trying should not work..

a better and (usually) faster approach is to use another table to 
store the record numbers eg..

Table - record_numbers

RECNUM_PKEY  (Primary Key) (this holds the Table ID or Key eg "L1", "L2" etc)
RECNUM_VALUE (holds the next record number)

you could easily write a php function to get the next record number 
for any table..

This may be overkill for your project but it is very flexible .

HTH
Steve

-- 
---
"Minds are like parachutes, they work best when open"
Support free speech; visit http://www.efa.org.au/

Heads Together Systems Pty Ltd http://www.hts.com.au
Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




FW: [PHP-DB] SELECT MAX(ID) PLUS 1

2001-03-28 Thread Rubanowicz, Lisa

Can anyone help me on this one
Lisa
-Original Message-
From: Walter [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 28, 2001 10:55 AM
To: Rubanowicz, Lisa
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1


Are tables are to differnet, so you don't have anything on my code
 
Sorry

- Original Message - 
From: Rubanowicz, Lisa   
To: 'Walter'   ; Rubanowicz, Lisa
  
Sent: Wednesday, March 28, 2001 10:57 AM
Subject: RE: [PHP-DB] SELECT MAX(ID) PLUS 1

HI Walter,
Could you please send me an excerpt of your code so I can see is my PHP
syntax incorrect.
Thanks Walter
Lisa

-Original Message-
From: Walter [ mailto:[EMAIL PROTECTED] 
]
Sent: Wednesday, March 28, 2001 10:09 AM
To: Rubanowicz, Lisa
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1


I think that your tables aren't good, my site have to menu's and submenu's
but i don't have that problem

- Original Message - 
From: Rubanowicz, Lisa   
To: 'Walter'   
Sent: Wednesday, March 28, 2001 10:40 AM
Subject: RE: [PHP-DB] SELECT MAX(ID) PLUS 1


I can't use auto_increment on two fields in the same table!! 
pg_id is auto_increment 
Lisa 

-Original Message- 
From: Walter [ mailto:[EMAIL PROTECTED] 
] 
Sent: Wednesday, March 28, 2001 9:42 AM 
To: Rubanowicz, Lisa 
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1 


Why don't you use the auto_increment fucntion in MySQL self? 

- Original Message - 
From: Rubanowicz, Lisa <[EMAIL PROTECTED]> 
To: <[EMAIL PROTECTED]> 
Sent: Wednesday, March 28, 2001 10:17 AM 
Subject: [PHP-DB] SELECT MAX(ID) PLUS 1 


> Hi All, 
> I have been driven maad with this now for about a week and have looked

> all around for the answer but seem to get sent off in a tangent any time I

> get close.  My SELECT statement seems to be right when I run it in 
> MySQLFront but to add 1 in PHP .. 
> 
> Here is the story.  I have a small web site running from mySQL.  Initially

I 
> had it all in different tables then an ASP colleague said I should do it 
it 
> one table and use SELECT MAX(sub_id) etc. 
> The site has obviously main navigation links Products, Freight Software, 
> Small to Medium businesses and News etc.  along the top of the site. But 
for 
> each of the first three I want "Sub Links" (Products 1, Products 2, 
Products 
> 3 etc)  So I have a table like so 
> 
> pg_id (auto_increment) 
> page_id (gives the type of page - one of the main six links) 
> page_name 
> sub_id (I need this to be 1, 2, 3 etc depending on how many pages they add

> to each section through a web form) 
> sub_name (Clickable text for sub link) 
> 
> Of course there are many other fields (Title of page, Content of page, IMG

> for page etc) 
> My problem is when I do a SELECT MAX(sub_id) AS sub_id_max WHERE page_id =

> $page_id  I can't seem to get that figure in PHP and add 1 to it 
> (increment).  If I could do this, I would then do my INSERT INTO etc to 
add 
> a new Sub Page for that section. 
> I obviously can get the page_id in 'cause I am passing it over from the 
> previous page. 
> 
> Can I do this or do I need to separate it out.  I have redesigned the 
(very 
> small) database 3 times now but the logic of it has me stumped.  Ideally I

> would like to be able to keep it all in one table, but you guys know best.

> 
> Could you please send me the four or five lines of code to do the above as

> it must be something with the SYNTAX 
> Thanks in advance 
> All the bEst 
> Lisa 
> 
> Lisa Rubanowicz 
> Case ITC, 
> Navan, Ireland 
> Tel: #353 (0)46 77663 
> 
> [EMAIL PROTECTED] < mailto:[EMAIL PROTECTED]
 > 
> 
> 
> 




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Russ Michell

I use MySQL 3.22.23 but I just had a hunt about on the web and I found 
a posting that confirmed your findings - I.E: auto_increment starts at 
1!!

I stand corrected!


Russ

#---#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Fai

The version you use may be lower than 3.23 because auto_increment sequence
number begin at 1 for MySQL version up to 3.23.

"Russ Michell" <[EMAIL PROTECTED]> ?
news:[EMAIL PROTECTED]...
> I may be semi-new to this MySQl lark but I'm sure auto_increment starts
> at 0.
>
> Russ
>
> #---#
>
>  "Believe nothing - consider everything"
>
>   Russ Michell
>   Anglia Polytechnic University Webteam
>   http://gertrude.sipu.anglia.ac.uk/webteam
>   [EMAIL PROTECTED]
>   +44 (0)1223 363271 ext 2331
>
>   www.theruss.com
>
> #---#
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Russ Michell

I may be semi-new to this MySQl lark but I'm sure auto_increment starts 
at 0.

Russ

#---#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] auto_increment in mysql

2001-03-28 Thread Fai

In mysql, the auto_increment start at 1 default,
But, how can I make the auto_increment start at 0?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Help Export Excel to MySQL database

2001-03-28 Thread Johannes Janson

Hi,

you can save it as .csv or as a tab-delimited .txt file.
then via "load data infile 'path/to/file' into table YourTable"
if you use windwos the "\" has to be escaped by another "\"
like this "C:\\path\\to\\file"

Johanens

""John"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
99ra37$dj8$[EMAIL PROTECTED]">news:99ra37$dj8$[EMAIL PROTECTED]...
> how to export the text files to Msql database ?
> My database now in Excel format.
> what type of file should  I saved
>
> I will insert the file in MySQL
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] checkbox data

2001-03-28 Thread Russ Michell

olinux:

I have some checkboxes that are generated on the fly that represent a 
person signing up for an activity:


";

//On the page this form is submitted to I pick the results up thus:

while(list($key) = each($signup)) {

//Start off SQL query - inserting available values into $table

$query = mysql_query("INSERT INTO $table 
(activity,username,email,signedup4,theDate) VALUES 
('$id','$username','$ipemail','$key','$completeDate')");

$list = "";
$list .= "'";
$list .= "$key";
$list .= "'"; 
$list .= "";
$resultText = "Thanks $username! Your 
selection has been recorded succesfully!";
}
//end-while


HTWI (Hope That Was Informative) - New FLA (Four Letter Acronym)

Russ

#---#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] fetch array problems.

2001-03-28 Thread Russ Michell

Felix:

Depending on what you're trying to do try either of these:

//Check to see if $color is in DB:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
$color = mysql_num_rows($result);

//If query didn't die, check to see if there is a result for this query:
if($color != 0) {
echo "";
}
else{
echo "Some error message.";
}

//Print $color to page:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
while($row = mysql_fetch_array($result)) {
$color = $row['color_1'];
echo "";
}

Try that little pup on for size...

Russ


#---#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Update query problem (Oracle)

2001-03-28 Thread Steve Farmer

Hi Francesco,

Probably the easiest way is to load the records from table 2 into an 
array and then lopp through updatign table 1

HTH
Steve

At 9:37 AM +0200 28/3/01, Francesco D'Inzeo wrote:
>Hi everyone.
>
>The scenario:
>
>Table1  Table2
>Field_01, <- Same as -> Field_01,
>Field_02, <- Same as -> Field_02,
>Field_03, <- Same as -> Field_03,
>Field_04, <- Same as -> Field_04,
>Field_05,   Field_05,
>Field_06,   Field_06,
>Field_07,   Field_07,
>Field_08,   Field_08,
>Field_09,   Field_09,
>Field_10,   Field_10,
>Field_11,
>Field_12,
>Field_13,
>Field_14,
>Field_15,
>Field_16,
>Field_17,
>
>Table1 contains lot of records but Table2 contains just a few.
>The first 4 fields identify records that are common to the 2 tables.
>
>My problem is to write a query that updates for example
>Table1.Field_11 with Table2.Field_06
>Table1.Field_14 with Table2.Field_09
>Table1.Field_15 with constant char 'A'
>Table1.Field_16 with SYSDATE
>
>only for records that are both present on the 2 tables.
>Regards.
>
>---
>"On a day not different than the one now dawning, Leonardo drew the
>first strokes of the  Mona Lisa, Shakespeare  wrote the first words
>of  Hamlet, and  Beethoven began working on his Ninth Symphony, and
>Windows98  aaarrrggghhh crashed for the n'th time"
>---
>  Francesco D'Inzeo
>  WinTech S.r.l.
>  Via Lisbona 7
>  35127 PADOVA (Italy)
>  Tel.   (+39)-(0)49-8703033
>  Fax.   (+39)-(0)49-8703045
>  Mobile (+39)-(0)348-2867140
>  e-mail [EMAIL PROTECTED]
>
>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
---
"Minds are like parachutes, they work best when open"
Support free speech; visit http://www.efa.org.au/

Heads Together Systems Pty Ltd http://www.hts.com.au
Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] fetch array problems.

2001-03-28 Thread Felix Kronlage

On Wed, Mar 28, 2001 at 01:08:35AM -0700, John Starkey wrote:

>  .. ';
> I can't get $color[color_1] to return a value. It's in the db and
> color_1 is a valid table containing a hex value. This is my first
> attempt at using assoc. arrays.

I'm not sure right now, but try $color["color_1"] to access the assoz.
array...(dunno, if it makes a difference)
-fkr
-- 
gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0  8A48 0D31 9BD3 D9AC 74D0 
  |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE  |
  |all your base are belong to us  |  shame on me  | fkr@IRCnet | 

 PGP signature


[PHP-DB] SELECT MAX(ID) PLUS 1

2001-03-28 Thread Rubanowicz, Lisa

Hi All,
I have been driven maad with this now for about a week and have looked
all around for the answer but seem to get sent off in a tangent any time I
get close.  My SELECT statement seems to be right when I run it in
MySQLFront but to add 1 in PHP ..
 
Here is the story.  I have a small web site running from mySQL.  Initially I
had it all in different tables then an ASP colleague said I should do it it
one table and use SELECT MAX(sub_id) etc.
The site has obviously main navigation links Products, Freight Software,
Small to Medium businesses and News etc.  along the top of the site. But for
each of the first three I want "Sub Links" (Products 1, Products 2, Products
3 etc)  So I have a table like so
 
pg_id (auto_increment)
page_id (gives the type of page - one of the main six links)
page_name
sub_id (I need this to be 1, 2, 3 etc depending on how many pages they add
to each section through a web form)
sub_name (Clickable text for sub link)
 
Of course there are many other fields (Title of page, Content of page, IMG
for page etc)
My problem is when I do a SELECT MAX(sub_id) AS sub_id_max WHERE page_id =
$page_id  I can't seem to get that figure in PHP and add 1 to it
(increment).  If I could do this, I would then do my INSERT INTO etc to add
a new Sub Page for that section.
I obviously can get the page_id in 'cause I am passing it over from the
previous page.
 
Can I do this or do I need to separate it out.  I have redesigned the (very
small) database 3 times now but the logic of it has me stumped.  Ideally I
would like to be able to keep it all in one table, but you guys know best.
 
Could you please send me the four or five lines of code to do the above as
it must be something with the SYNTAX
Thanks in advance
All the bEst
Lisa

Lisa Rubanowicz 
Case ITC, 
Navan, Ireland 
Tel: #353 (0)46 77663

[EMAIL PROTECTED]