Re: [PHP] mysql help (sorry, a bit OT)

2010-11-19 Thread Andre Polykanine
Hello Gary,

Actually, what I do here is the following: I create a subdomain called
beta.mysite.com (for me it's http://beta.oire.org/ and
http://beta.gviragon.org/ :-)). There I have a copy of my database and
all of my files. The only difference is the mysql_select_db in the
connect.php file.
There I can easily test everything I need (including PHP files and
MySql queries) without any danger to crash the main release).
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Gary php-gene...@garydjones.name
To: php-general@lists.php.net php-general@lists.php.net
Date: Tuesday, November 16, 2010, 3:35:12 PM
Subject: [PHP] mysql help (sorry, a bit OT)

Is there a way to check the syntax of a query, short of running it? I've
got an insert to do (but of course it's a valid question for any query
that changes the db contents) and would like to know that the sql I am
generating (in php - see! not so off-topic!) is correct. 

What I don't want to do is run it for testing (live system *sigh*) and
find out it is correct (it will change the db), but... I have to test it
to check that the syntax (at least) *is* correct.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql help (sorry, a bit OT)

2010-11-16 Thread a...@ashleysheridan.co.uk
It's always best practice to have a staging server for testing these sorts of 
things.

If in doubt, run it in a transaction, but don't commit it, I.e. roll it back. 
That way you'll see if it would run but nothing actually changes.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Gary php-gene...@garydjones.name
Date: Tue, Nov 16, 2010 13:35
Subject: [PHP] mysql help (sorry, a bit OT)
To: php-general@lists.php.net

Is there a way to check the syntax of a query, short of running it? I've
got an insert to do (but of course it's a valid question for any query
that changes the db contents) and would like to know that the sql I am
generating (in php - see! not so off-topic!) is correct. 

What I don't want to do is run it for testing (live system *sigh*) and
find out it is correct (it will change the db), but... I have to test it
to check that the syntax (at least) *is* correct.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysql help (sorry, a bit OT)

2010-11-16 Thread Tommy Pham
 -Original Message-
 From: Gary [mailto:php-gene...@garydjones.name]
 Sent: Tuesday, November 16, 2010 5:35 AM
 To: php-general@lists.php.net
 Subject: [PHP] mysql help (sorry, a bit OT)
 
 Is there a way to check the syntax of a query, short of running it? I've
got an
 insert to do (but of course it's a valid question for any query that
changes
 the db contents) and would like to know that the sql I am generating (in
php
 - see! not so off-topic!) is correct.
 
 What I don't want to do is run it for testing (live system *sigh*) and
find out
 it is correct (it will change the db), but... I have to test it to check
that the
 syntax (at least) *is* correct.
 

Gary,

If you use a current version of the MySQL workbench, the tool can send
complete SELECT, UPDATE, INSERT, DELETE statement, with all the fields, to
the query window for the selected table.  That way you'll know that you have
the proper field (name and quoted with `).  Add that to what Ash suggested
of having a local copy of the database, you'll have little or no chance of
breakage in the app because of a silly SQL syntax error ;)

Regards,
Tommy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql help..

2006-02-24 Thread ganu ullu
Hi all,

I installed a opensource php project, and now is working fine for me.
Now that project has some 40-50 MySQL tables..

now I want to change something in that but the I am not able to get the DB
flow..
Is any body knows any tool by which we can create/make the relationship
diagram like we are doing in SQLserver or Access..

To understand the DB is very tough... any body knows how I can create the
relationship diagram from that .SQL file...

thnx to alll...


Re: [PHP] mysql help..

2006-02-24 Thread John Nichel

ganu ullu wrote:

Hi all,

I installed a opensource php project, and now is working fine for me.
Now that project has some 40-50 MySQL tables..

now I want to change something in that but the I am not able to get the DB
flow..
Is any body knows any tool by which we can create/make the relationship
diagram like we are doing in SQLserver or Access..

To understand the DB is very tough... any body knows how I can create the
relationship diagram from that .SQL file...

thnx to alll...



I built my web site in php, can anyone hold my hand and find me a tool 
to analyze my server logs?


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql help..

2006-02-24 Thread chris smith
Ask the open-source project for help. They will be able to answer your
questions better than we can.

On 2/25/06, ganu ullu [EMAIL PROTECTED] wrote:

 Hi all,

 I installed a opensource php project, and now is working fine for me.
 Now that project has some 40-50 MySQL tables..

 now I want to change something in that but the I am not able to get the DB
 flow..
 Is any body knows any tool by which we can create/make the relationship
 diagram like we are doing in SQLserver or Access..

 To understand the DB is very tough... any body knows how I can create the
 relationship diagram from that .SQL file...

 thnx to alll...




Re: [PHP] mysql help..

2006-02-24 Thread Tom Rogers
Hi,

Saturday, February 25, 2006, 5:53:23 AM, you wrote:
gu Hi all,

gu I installed a opensource php project, and now is working fine for me.
gu Now that project has some 40-50 MySQL tables..

gu now I want to change something in that but the I am not able to get the DB
gu flow..
gu Is any body knows any tool by which we can create/make the relationship
gu diagram like we are doing in SQLserver or Access..

gu To understand the DB is very tough... any body knows how I can create the
gu relationship diagram from that .SQL file...

gu thnx to alll...

Try DbDesigner4, it will reverse engineer an existing database as much as it 
can.

http://fabforce.net/

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-30 Thread Burhan Khalid
Curt Zirzow wrote:
* Thus wrote Chris Jernigan ([EMAIL PROTECTED]):
Hi everyone,
 

What's the problem? I have one week to do this. Oh, and did I mention that I
know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
MSSQL. And to top it off, the site in question contains over 300 .cfm files!
Does anyone have any idea how I could pull this off?

rename all files to .php and set the web server to parse .php files
as coldfusion.
lmao @ that one.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-30 Thread Galen
Yeah, I'd say it's completely hopeless in a week. PHP is a totally 
different language than ColdFusion. SQL and MySQL may be different. The 
databases alone, as others have mentioned, could easily be a week even 
if you're experienced. Moving BOTH databases and scripting languages 
will probably mean you have to more reimplement, not just duplicate 
exact. Certain features may exist in your current database and not in 
MySQL, making it impossible to port your database as-is and requiring 
massively more function.

If you really want this thing done and don't know what you're doing, 
try giving yourself 6 months. Or more. And a very long read through the 
PHP and MySQL documentation. And lots of posts to the php list when you 
can't figure things out.

You could also try outsourcing your code. If ALL you want is an exact 
copy in PHP, I bet there are plenty off off-shore (well, off the U.S. 
shore) companies willing to do it for a very reasonable rate. I can't 
speak for their design and how easy the code will be to work with, but 
that would be the way to do it fast and cheap (well, relatively cheap). 
But it better be important, because I bet it would be massively cheaper 
to buy another ColdFusion license than to try and re-implement 
ColdFusion in PHP on this scale!

Please post back here and let us know what happened with this. I'm 
guessing you posted feeling pretty freaked out after your boss pushed 
you to do this. Or perhaps you just thought that ColdFusion and PHP 
were very similar and there was some kind of converter or easy process, 
like going from GIF to PNG or something. Unfortunately, that's just not 
the case. If you come back and ask smaller, more specific questions, 
preferably somewhat pre-researched (just spend 3 minutes googling), we 
can help and we promise not to group-lynch you :)

-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Chris Jernigan
Hi everyone,

Ok, I need serious help. I have been handed a project by my boss to convert
an existing site that was built using ColdFusion / SQL into a site that will
use PHP / mySQL. The site relies heavily on calls to the database for
everything from site content, to an admin area where you can edit that
content, to a news ticker, to the actual navigation of the site.

What's the problem? I have one week to do this. Oh, and did I mention that I
know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
MSSQL. And to top it off, the site in question contains over 300 .cfm files!

Does anyone have any idea how I could pull this off?

Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
one week isn't enough time to retool a site of this proportion. Especially
considering that I don't understand any of the code that I'm staring at.

I've been a web designer for about five years now. Notice I said designer
not developer. I want to learn PHP / mySQL but in order to complete this
project I also need to understand ColdFusion in order to replicate the site
functionality. Any advice on what I should do?

Thanks in advance for your help,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread John Nichel
Chris Jernigan wrote:
Hi everyone,
Ok, I need serious help. I have been handed a project by my boss to convert
an existing site that was built using ColdFusion / SQL into a site that will
use PHP / mySQL. The site relies heavily on calls to the database for
everything from site content, to an admin area where you can edit that
content, to a news ticker, to the actual navigation of the site.
What's the problem? I have one week to do this. Oh, and did I mention that I
know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
MSSQL. And to top it off, the site in question contains over 300 .cfm files!
Does anyone have any idea how I could pull this off?
Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
one week isn't enough time to retool a site of this proportion. Especially
considering that I don't understand any of the code that I'm staring at.
I've been a web designer for about five years now. Notice I said designer
not developer. I want to learn PHP / mySQL but in order to complete this
project I also need to understand ColdFusion in order to replicate the site
functionality. Any advice on what I should do?
Thanks in advance for your help,
Chris
Tell your boss it's an unrealistic goal.  Even for a seasoned PHP 
programmer with a firm grasp on MySQL, something of this scope is 
unrealistic for a single person.  Scoping out the db schema alone could 
take a week or more (depending on the size of your db).  That doesn't 
even take into account migrating your data from MSSQL to MySQL once your 
MySQL db is set up, or writing all the php code from scratch (PEAR 
libraries would help speed up the process, but now you bring in the OOP 
learning curve).

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Jay Blanchard
[snip]
Tell your boss it's an unrealistic goal.  Even for a seasoned PHP 
programmer with a firm grasp on MySQL, something of this scope is 
unrealistic for a single person.  Scoping out the db schema alone could 
take a week or more (depending on the size of your db).  That doesn't 
even take into account migrating your data from MSSQL to MySQL once your

MySQL db is set up, or writing all the php code from scratch (PEAR 
libraries would help speed up the process, but now you bring in the OOP 
learning curve).
[/snip]

I agree...the situation you describe is a recipe for disaster.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Daniel Clark
I've used Cold Fusion for years.  However one week at 100 hours might not
be enough time to covert everything to PHP and mySQL.


 Hi everyone,

 Ok, I need serious help. I have been handed a project by my boss to
 convert
 an existing site that was built using ColdFusion / SQL into a site that
 will
 use PHP / mySQL. The site relies heavily on calls to the database for
 everything from site content, to an admin area where you can edit that
 content, to a news ticker, to the actual navigation of the site.

 What's the problem? I have one week to do this. Oh, and did I mention that
 I
 know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
 MSSQL. And to top it off, the site in question contains over 300 .cfm
 files!

 Does anyone have any idea how I could pull this off?

 Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
 one week isn't enough time to retool a site of this proportion. Especially
 considering that I don't understand any of the code that I'm staring at.

 I've been a web designer for about five years now. Notice I said
 designer
 not developer. I want to learn PHP / mySQL but in order to complete this
 project I also need to understand ColdFusion in order to replicate the
 site
 functionality. Any advice on what I should do?

 Thanks in advance for your help,
 Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Ammar Ibrahim
Tell your boss to get a life :)
I'm working on converting a large web application from ColdFusion/MsSQL 
to PHP/MySQL. This web app is almost around 3 million lines of code :| I 
was wondering if there exists a tool similiar to ASP2PHP to convert 
ColdFusion code to PHP. But anyway, the way ColdFusion is used to write 
web sites makes writing this application extermely hard.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Stephen Lake
Yeah tell your boss to get stuffed and that your not old enough yet to have
a stroke ;)

There is absolutely no way no one knowlegable and experienced in both
languages can do it in a week no less a non programmer either

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Travis Low
Here's what you do.   Assume 10-hour work days.  Obviously, you want to start 
with the schema.  That's pretty darn important, so allow yourself a whole day 
for that.

You have four days left.  Oh wait -- you will probably have to work the weekend 
for this one.  So you have six days left.  That's 60 hours, or 3600 minutes. 
You have 300 files, so you can't spend more than 12 minutes per file.  Wait, 
you said OVER 300, so try to keep it to 10 minutes per file.  To play it safe, 
spend no more than 8 minutes per file -- that way, you have a little extra time 
in case something unexpected comes up.

It might be easier to buy a CFM-to-PHP converter.  You can get those at most 
Kmart stores.  They're usually next to the bacon stretchers and smoke-shifters.

Hope this helps!
cheers,
Travis
Chris Jernigan wrote:
Hi everyone,
Ok, I need serious help. I have been handed a project by my boss to convert
an existing site that was built using ColdFusion / SQL into a site that will
use PHP / mySQL. The site relies heavily on calls to the database for
everything from site content, to an admin area where you can edit that
content, to a news ticker, to the actual navigation of the site.
What's the problem? I have one week to do this. Oh, and did I mention that I
know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
MSSQL. And to top it off, the site in question contains over 300 .cfm files!
Does anyone have any idea how I could pull this off?
Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
one week isn't enough time to retool a site of this proportion. Especially
considering that I don't understand any of the code that I'm staring at.
I've been a web designer for about five years now. Notice I said designer
not developer. I want to learn PHP / mySQL but in order to complete this
project I also need to understand ColdFusion in order to replicate the site
functionality. Any advice on what I should do?
Thanks in advance for your help,
Chris
--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Curt Zirzow
* Thus wrote Chris Jernigan ([EMAIL PROTECTED]):
 Hi everyone,
 
 What's the problem? I have one week to do this. Oh, and did I mention that I
 know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
 MSSQL. And to top it off, the site in question contains over 300 .cfm files!
 
 Does anyone have any idea how I could pull this off?

rename all files to .php and set the web server to parse .php files
as coldfusion.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Tim Traver
Oh my god...I'm crying...
what the heck is a bacon stretcher ?
t
At 03:52 PM 5/28/2004, Travis Low wrote:
Here's what you do.   Assume 10-hour work days.  Obviously, you want to 
start with the schema.  That's pretty darn important, so allow yourself a 
whole day for that.

You have four days left.  Oh wait -- you will probably have to work the 
weekend for this one.  So you have six days left.  That's 60 hours, or 
3600 minutes. You have 300 files, so you can't spend more than 12 minutes 
per file.  Wait, you said OVER 300, so try to keep it to 10 minutes per 
file.  To play it safe, spend no more than 8 minutes per file -- that way, 
you have a little extra time in case something unexpected comes up.

It might be easier to buy a CFM-to-PHP converter.  You can get those at 
most Kmart stores.  They're usually next to the bacon stretchers and 
smoke-shifters.

Hope this helps!
cheers,
Travis
Chris Jernigan wrote:
Hi everyone,
Ok, I need serious help. I have been handed a project by my boss to convert
an existing site that was built using ColdFusion / SQL into a site that will
use PHP / mySQL. The site relies heavily on calls to the database for
everything from site content, to an admin area where you can edit that
content, to a news ticker, to the actual navigation of the site.
What's the problem? I have one week to do this. Oh, and did I mention that I
know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
MSSQL. And to top it off, the site in question contains over 300 .cfm files!
Does anyone have any idea how I could pull this off?
Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
one week isn't enough time to retool a site of this proportion. Especially
considering that I don't understand any of the code that I'm staring at.
I've been a web designer for about five years now. Notice I said designer
not developer. I want to learn PHP / mySQL but in order to complete this
project I also need to understand ColdFusion in order to replicate the site
functionality. Any advice on what I should do?
Thanks in advance for your help,
Chris
--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Daniel Clark
That's funny Travis !

Here's what you do.   Assume 10-hour work days.  Obviously, you want to start 
with the schema.  That's pretty darn important, so allow yourself a whole day 
for that.

You have four days left.  Oh wait -- you will probably have to work the weekend 
for this one.  So you have six days left.  That's 60 hours, or 3600 minutes. 
You have 300 files, so you can't spend more than 12 minutes per file.  Wait, 
you said OVER 300, so try to keep it to 10 minutes per file.  To play it safe, 
spend no more than 8 minutes per file -- that way, you have a little extra time 
in case something unexpected comes up.

It might be easier to buy a CFM-to-PHP converter.  You can get those at most 
Kmart stores.  They're usually next to the bacon stretchers and smoke-shifters.

Hope this helps!

cheers,

Travis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session php mysql ,,,,help

2003-07-17 Thread Dante O. Cabrera H.
Hi everybody

I want to start a session after a user validation, I
have my variable I want to register : $login
the code to start my session is:

session_name();
session_start();
session_register('login');
session_encode();
$url=Location: mypage.php?PHPSESSID=.$PHPSESSID;
header($url);

?

after I run this php program I got:

Warning: Cannot send session cache limiter - headers
already sent(outputstarted /home/web/validacion.php:8)
in /home/web/validacion.php on line 47

Warning: Cannot add header information - headers
already sent by (output started
/home/web/validacion.php:8) in
/home/web/validacion.php on line 51

*
you , you yes you can you help me.?

Thank you 


=
_
Atte. 
Dante Omar Cabrera Heredia
Telf: 97189724
_

___
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [mysql]help with displaying table {off subject}#2

2003-03-03 Thread Karl James
Title: Message



hey guys 

just wanted to know as usual it was user 
error
i had thought i had something stored in the 
tables 
but apparently i did not.

i apologize for 
the noobie question.

thanks

special thanks 
to jason.

ultimatefootballleague.com/index.php
[EMAIL PROTECTED]



[PHP] PHP/MySQL help?

2003-01-12 Thread Steven M
What am i doing wrong with the script below? What i am trying to do is check
whether the newtest field has a 0 or a  1 value then redirect the user to
a different page based on the answer.

I am then trying to add 2 to the value in the points field of my database
and then  to set the newtest field value to 1 so the user is directed to
the second of the two pages if they click the link again

My database is MySQL and the connection details are correct and stored in an
external script.  I have missed out the PHP tags on the code below in case
that interferes with how it appears on the list.  I really would appreciate
any help with this as i am a newbie to MySQL and PHP and am finding it a
really steep learning curve.  Thanks.

Steven M
---
include 'db.php';

$result = mysql_query(SELECT newtest FROM users WHERE 14 = '$0');
list($number) = mysql_fetch_row($result);
mysql_close();

if($number==0)
{mysql_query(UPDATE users SET points = '$+2' WHERE 14 = '$0');
mysql_query(UPDATE users SET newtest = '$1' WHERE newtest = '$0');
header(Location: redirect1.php);
}
elseif($number==1)
{
header(Location: redirect2.php);
}
else
{
header(Location: error.php);
}
---




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL help?

2003-01-12 Thread Johannes Schlueter
Hi Steven,

On Sunday 12 January 2003 23:58, Steven M wrote:
 include 'db.php';

 $result = mysql_query(SELECT newtest FROM users WHERE 14 = '$0');
 list($number) = mysql_fetch_row($result);

Here you are closing your conenction to the MySQL-Server:
 mysql_close();

 if($number==0)

But here you need it again:
 {mysql_query(UPDATE users SET points = '$+2' WHERE 14 = '$0');
 mysql_query(UPDATE users SET newtest = '$1' WHERE newtest = '$0');

So remove the mysql_close() if it don't work: Post the error message!

johannes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL help?

2003-01-12 Thread Steven M
Hi Johannes

Thanks for the help.  I have taken out the mysql_close() and it looks like
it is submitting ok (ie no error messages) but it is not updating the
database when i check it.  Any ideas?

Thanks.

Steven
Johannes Schlueter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi Steven,

On Sunday 12 January 2003 23:58, Steven M wrote:
 include 'db.php';

 $result = mysql_query(SELECT newtest FROM users WHERE 14 = '$0');
 list($number) = mysql_fetch_row($result);

Here you are closing your conenction to the MySQL-Server:
 mysql_close();

 if($number==0)

But here you need it again:
 {mysql_query(UPDATE users SET points = '$+2' WHERE 14 = '$0');
 mysql_query(UPDATE users SET newtest = '$1' WHERE newtest = '$0');

So remove the mysql_close() if it don't work: Post the error message!

johannes



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP/MySQL help?

2003-01-12 Thread Timothy Hitchens \(HiTCHO\)
Hmm from your code below:

FROM users WHERE 14 = '$0'

What is 14 it isn't a field I would hope!!


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Steven M [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, 13 January 2003 9:28 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP/MySQL help?
 
 
 Hi Johannes
 
 Thanks for the help.  I have taken out the mysql_close() and 
 it looks like it is submitting ok (ie no error messages) but 
 it is not updating the database when i check it.  Any ideas?
 
 Thanks.
 
 Steven
 Johannes Schlueter [EMAIL PROTECTED] wrote in message 
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Steven,
 
 On 
 Sunday 12 January 2003 23:58, Steven M wrote:
  include 'db.php';
 
  $result = mysql_query(SELECT newtest FROM users WHERE 14 = '$0');
  list($number) = mysql_fetch_row($result);
 
 Here you are closing your conenction to the MySQL-Server:
  mysql_close();
 
  if($number==0)
 
 But here you need it again:
  {mysql_query(UPDATE users SET points = '$+2' WHERE 14 = '$0'); 
  mysql_query(UPDATE users SET newtest = '$1' WHERE newtest = '$0');
 
 So remove the mysql_close() if it don't work: Post the error message!
 
 johannes
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL help?

2003-01-12 Thread Steven M
I thought i read somewhere that you could refer to the field by number.  Was
i wrong? It doesn't seem to make a difference anyway.  It still doesn't
work.  Here's the code with words instead of numbers.  I'd be grateful if
you could let me know if there are any obvious errors.

Best wishes.

Steven M

include 'db.php';

$result = mysql_query(SELECT newtest FROM users WHERE newtest = '$0');
list($number) = mysql_fetch_row($result);

if($number==0)
{mysql_query(UPDATE users SET points = '$+2' WHERE newtest = '$0');
mysql_query(UPDATE users SET newtest = '$1' WHERE newtest = '$0');
header(Location: redirect1.php);
}
elseif($number==1)
{
header(Location: redirect2.php);
}
else
{
header(Location: error.php);
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP/MySQL help?

2003-01-12 Thread Timothy Hitchens \(HiTCHO\)
You can't use numbers as vars:

$1 etc are illegal syntax for PHP



Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Steven M [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, 13 January 2003 10:04 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP/MySQL help?
 
 
 I thought i read somewhere that you could refer to the field 
 by number.  Was i wrong? It doesn't seem to make a difference 
 anyway.  It still doesn't work.  Here's the code with words 
 instead of numbers.  I'd be grateful if you could let me know 
 if there are any obvious errors.
 
 Best wishes.
 
 Steven M
 
 include 'db.php';
 
 $result = mysql_query(SELECT newtest FROM users WHERE 
 newtest = '$0');
 list($number) = mysql_fetch_row($result);
 
 if($number==0)
 {mysql_query(UPDATE users SET points = '$+2' WHERE newtest = 
 '$0'); mysql_query(UPDATE users SET newtest = '$1' WHERE 
 newtest = '$0');
 header(Location: redirect1.php);
 }
 elseif($number==1)
 {
 header(Location: redirect2.php);
 }
 else
 {
 header(Location: error.php);
 }
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL help?

2003-01-12 Thread Steven M
Oops...many thanks for that.  Sorry, i am extremely new to this.

Best wishes.

Steven M



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/mySQL help or advice

2002-10-13 Thread Marco Tabini

There are a few PHP calendars:

http://www.cascade.org.uk/software/php/calendar/index.php

for example, that you can start from. It should be relatively easy then
to write a small table that contains just one field:

Date (datetime)

All you do is insert a row in the db for each day that is booked and
then whenever you have to check just hit the database: if there is a row
corresponding to the day you're checking, then the day is booked,
otherwise it isn't.

This is kind of the short version, but hopefully it should give you
enough to get going!

Cheers,


Marco

On Sun, 2002-10-13 at 07:48, Ray Healy (Data Net Services) wrote:
 Hi All
 
 I have been trying to write a database and scripts for a calendar that shows which 
days are booked and have failed at each point.
 
 What i would like it to do is to show a calendar which have the dates that are 
booked in a cell which are colour coded (say red) when it is unavailable and say 
white when available.
 
 The admiministartor should be able to enter multiple dates at a time (say a holiday 
is booked for 5 days). perhaps a section for nortes that is only available for admin 
use only would be handy.
 
 An option to view 2 months at a time or perhaps the whole year would also be nice.
 
 I have downloaded various scripts and tried to write my own but I cannot seem to be 
able to enter multiple dates or colour code the output.
 
 Can anyone help me or perhaps someone already has a script  database that does this 
and would be willing to share.
 
 Otherwise it there a script already out there that will do this - all the one that I 
can find seem to do too much by allowing multiple users and storing a lot more data 
which is something I do nort need.
 
 Any help would be appreciated as I am tearing my hair out at the moment.
 
 Thanks for your time
 
 Ray Healy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP/mySQL help or advice

2002-10-13 Thread Ray Healy \(Data Net Services\)

Hi All

I have been trying to write a database and scripts for a calendar that shows which 
days are booked and have failed at each point.

What i would like it to do is to show a calendar which have the dates that are booked 
in a cell which are colour coded (say red) when it is unavailable and say white when 
available.

The admiministartor should be able to enter multiple dates at a time (say a holiday is 
booked for 5 days). perhaps a section for nortes that is only available for admin use 
only would be handy.

An option to view 2 months at a time or perhaps the whole year would also be nice.

I have downloaded various scripts and tried to write my own but I cannot seem to be 
able to enter multiple dates or colour code the output.

Can anyone help me or perhaps someone already has a script  database that does this 
and would be willing to share.

Otherwise it there a script already out there that will do this - all the one that I 
can find seem to do too much by allowing multiple users and storing a lot more data 
which is something I do nort need.

Any help would be appreciated as I am tearing my hair out at the moment.

Thanks for your time

Ray Healy



[PHP] New to PHP/mySQL - Help on script

2002-08-26 Thread Ray Healy \(Data Net Services\)

Thanks for everyones help yesterday but nI have come up against a problem
(as I am new). I have created my document as detailed below with notes. I
can see from the form that I have connected to the server, accessed the
correct database, created the statment and executed it. The problem is how
to display the information - as far as I can understand from yesterday if
the result is 0 then the villa is available. So what I need to do is if the
result = 0 display villa available and if the result is greater than 0 then
display villa not available . I know that the variables are getting to the
query as if I change the echo $result; to $sql;  and key in 3 as the id and
2 dates in the form I get the following:

SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
villa_id = ('3')

So, corrcet me if I am wrong but the query is working its just i cannot see
anything. I have spent hours on this today, reading books and looking at the
list. I hope that once I have done one good script I can then start to
understand it and create more :-)

Thanks for all your help


Ray


html
 body
 ?php

 if ($submit) {

 // open connection to database

 $db = mysql_connect(localhost, matrix, matrix);

 // pick database to use

 mysql_select_db(matrix,$db);

 // create the SQL statement

 $sql = SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
booking_end AND villa_id = ('$place');

 // execute the SQL statement

 $result = mysql_query($sql);

 // display the information

 echo $result;

} else{

 // display form

 ?
 form method=post action=?php echo $PHP_SELF?
 Villa id number:input type=Text name=placebr
 Start date:input type=Text name=book_start_datebr
 End date:input type=Text name=book_end_datebr
 input type=Submit name=submit value=Search information
 /form
 ?php
 }
  // end if
 ?
 /body
 /html



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] New to PHP/mySQL - Help on script

2002-08-26 Thread Adam Williams

you need

$query = SELECT COUNT(*) as count FROM bookings WHERE ('2002-04-04')
BETWEEN booking_start AND booking_end OR ('2002-04-10')BETWEEN
booking_start AND booking_end AND villa_id = ('3')

$villa = mysql_query($query);

while ($result = mysqul_result($villa))
{
echo We have $result[count] villas booked;
}

and do the same again but change the statement to villa_id = 0

Adam

On Mon, 26 Aug 2002, Ray Healy (Data Net Services) wrote:

 Thanks for everyones help yesterday but nI have come up against a problem
 (as I am new). I have created my document as detailed below with notes. I
 can see from the form that I have connected to the server, accessed the
 correct database, created the statment and executed it. The problem is how
 to display the information - as far as I can understand from yesterday if
 the result is 0 then the villa is available. So what I need to do is if the
 result = 0 display villa available and if the result is greater than 0 then
 display villa not available . I know that the variables are getting to the
 query as if I change the echo $result; to $sql;  and key in 3 as the id and
 2 dates in the form I get the following:

 SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
 booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
 villa_id = ('3')

 So, corrcet me if I am wrong but the query is working its just i cannot see
 anything. I have spent hours on this today, reading books and looking at the
 list. I hope that once I have done one good script I can then start to
 understand it and create more :-)

 Thanks for all your help


 Ray


 html
  body
  ?php

  if ($submit) {

  // open connection to database

  $db = mysql_connect(localhost, matrix, matrix);

  // pick database to use

  mysql_select_db(matrix,$db);

  // create the SQL statement

  $sql = SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
 booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
 booking_end AND villa_id = ('$place');

  // execute the SQL statement

  $result = mysql_query($sql);

  // display the information

  echo $result;

 } else{

  // display form

  ?
  form method=post action=?php echo $PHP_SELF?
  Villa id number:input type=Text name=placebr
  Start date:input type=Text name=book_start_datebr
  End date:input type=Text name=book_end_datebr
  input type=Submit name=submit value=Search information
  /form
  ?php
  }
   // end if
  ?
  /body
  /html






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: New to PHP/mySQL - Help on script

2002-08-26 Thread Richard Lynch

Thanks for everyones help yesterday but nI have come up against a problem
(as I am new). I have created my document as detailed below with notes. I
can see from the form that I have connected to the server, accessed the
correct database, created the statment and executed it. The problem is how
to display the information - as far as I can understand from yesterday if
the result is 0 then the villa is available. So what I need to do is if the
result = 0 display villa available and if the result is greater than 0 then
display villa not available . I know that the variables are getting to the
query as if I change the echo $result; to $sql;  and key in 3 as the id and
2 dates in the form I get the following:

SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
villa_id = ('3')

So, corrcet me if I am wrong but the query is working its just i cannot see
anything. I have spent hours on this today, reading books and looking at the
list. I hope that once I have done one good script I can then start to
understand it and create more :-)

Thanks for all your help


Ray


html
 body
 ?php

 if ($submit) {

 // open connection to database

 $db = mysql_connect(localhost, matrix, matrix);

Add or error_log(mysql_error()) to the end of this, so if your database
goes down or something you'll have a record of it in your Apache log.


 // pick database to use

 mysql_select_db(matrix,$db);

Same here in case some goofball deletes the whole matrix database or
something.


 // create the SQL statement

 $sql = SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
booking_end AND villa_id = ('$place');

Get rid of all the () except for count(*).

The rest of them are bogus.

 // execute the SQL statement

 $result = mysql_query($sql);

 // display the information

 echo $result;

NO.

$result is *NOT* your information.

If your SQL is broken, you'll get nothing output here.

You should again have:
or error_log(mysql_error()) at the end of the mysql_query() statement.

If everything goes well, though, $result *still* won't be the information
you want.

It will be a result identifier

That's a fancy way of saying it's like a little ticket at the meat counter
in your grocery store so you know whose turn it is.

You need to use http://php.net/mysql_fetch_row (or similar functions) to get
your actual data.

In this case, since you only get one answer, I would just use:

echo mysql_result($result, 0, 0);

to see the answer you want.

Actually, it will be more like this:

$taken = mysql_result($result, 0, 0);
if ($taken){
  echo Villa $place is not available between $book_start_date and
$book_end_dateBR\n;
}
else{
  echo Villa $place is available from $book_start_date to
$book_end_dateBR\n;
}

mysql_query() never returns your actual data -- It only returns an
identifier so you can go get your data.



} else{

 // display form

 ?
 form method=post action=?php echo $PHP_SELF?
 Villa id number:input type=Text name=placebr
 Start date:input type=Text name=book_start_datebr
 End date:input type=Text name=book_end_datebr
 input type=Submit name=submit value=Search information
 /form
 ?php
 }
  // end if
 ?
 /body
 /html




-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP+MySQL=Help(?)

2001-10-31 Thread Justin French

Hi,

from this command line test:
 select imglocation,height,width from img where imgname='alfstag1'

it looks to me like your imgname field is *characters* rather than *numbers*.

when ever I'm doing something like this (eg WHERE firstName=justin), I
do it with a LIKE statement, rather than with a =.

example:
$query = SELECT imglocation,height,width FROM img WHERE imgname LIKE \$getimg\;


So, I'd recommend giving that a try.  From my understanding (limited) of
MySQL, use = in the case of $id=2, and LIKE in the case of firstName
LIKE justin.


Justin French

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-31 Thread Kurt Lieber

On Wednesday 31 October 2001 02:32 am, you wrote:
 So, I'd recommend giving that a try.  From my understanding (limited) of
 MySQL, use = in the case of $id=2, and LIKE in the case of firstName
 LIKE justin.

Um...you *can* do that, but I don't think you want to.  Using LIKE means that 
MySQL has to do a lot more searching on all your database records.  Instead 
of searching for an exact match, where it can look at things like string 
length, first characters and other simple criteria, it now has to evaluate 
the entire contents of the field in case there's a possible match somewhere 
in the string.  Much, much slower.

So, yes it works, but you pay a performance price for it. 

--kurt

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-31 Thread turtle

.
Thanks to Kurt and Justin for the help offered on this simple (now that it
is working) problem.

I do not know where my stumbling block was but after a good nights rest and
some coffee this morning I have this and the GetImageSize function
incorporated..  I will list the code incase someone finds problems or a
simpler way to go with it but it does seem to work well (at least on the
local host)

?
mysql_connect('localhost')or die (Could not connect);
mysql_select_db('img760')or die (Could not select database);
$results = mysql_query (select imglocation from img where imgname like
'$getimg');
$row = mysql_fetch_array($results);
$imglocation = $row['imglocation'];
$size = GetImageSize ($imglocation);
?

Display within the html doc is:

img src=? echo $imglocation ? ? echo $size[3]; ?

Again thanks for all of your patience and help

Mike




-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-31 Thread turtle

.
Thank you for the heads up on using like.  I was wondering since there will
be 2 similar variables from each page var1 var2 (identical except for the
number).  I programmed in DataFlex for about 6 years back in the late 80's
early 90's but have not done anything db wise in over 8 years  I still
do not know where the problem was (maybe syntax or spelling)

Again, thank you for all of your help...

Mike

Kurt Lieber [EMAIL PROTECTED] wrote in message
E15yxVD-0005ls-00@z8">news:E15yxVD-0005ls-00@z8...
 On Wednesday 31 October 2001 02:32 am, you wrote:
  So, I'd recommend giving that a try.  From my understanding (limited) of
  MySQL, use = in the case of $id=2, and LIKE in the case of firstName
  LIKE justin.

 Um...you *can* do that, but I don't think you want to.  Using LIKE means
that
 MySQL has to do a lot more searching on all your database records.
Instead
 of searching for an exact match, where it can look at things like string
 length, first characters and other simple criteria, it now has to evaluate
 the entire contents of the field in case there's a possible match
somewhere
 in the string.  Much, much slower.

 So, yes it works, but you pay a performance price for it.

 --kurt



-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-31 Thread Kurt Lieber

On Wednesday 31 October 2001 07:45 am, turtle wrote:
 img src=? echo $imglocation ? ? echo $size[3]; ?

Glad we could help.  Also, you can re-write the above so you don't have to 
define two sets of ?php ? tags by doing the following:

?php

print img src=\$imglocation\ $size[3];

?


Not a big deal here, but if you start writing multiple lines of HTML code, 
you probably don't want to enclose each PHP variable in its own set of ?php 
? tags.

Also, I tried to send you a couple suggestions off-list last night, but your 
email bounces -- I'm guessing the new owner of netobjects doesn't have their 
mail server set up to accept the correct email address.  Just FYI.

--kurt

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-31 Thread turtle

.
Thank you Kurt,

The day for the server to be move from Cal to Fla is the 31st  (today)
I would image that it is somewhere in transit at the present time...

Will send you an email with another address you can respond to...

Thanks for all of your help
Mike


Kurt Lieber [EMAIL PROTECTED] wrote in message
E15yy3N-0005qE-00@z8">news:E15yy3N-0005qE-00@z8...
 On Wednesday 31 October 2001 07:45 am, turtle wrote:
  img src=? echo $imglocation ? ? echo $size[3]; ?

 Glad we could help.  Also, you can re-write the above so you don't have to
 define two sets of ?php ? tags by doing the following:

 ?php

 print img src=\$imglocation\ $size[3];

 ?


 Not a big deal here, but if you start writing multiple lines of HTML code,
 you probably don't want to enclose each PHP variable in its own set of
?php
 ? tags.

 Also, I tried to send you a couple suggestions off-list last night, but
your
 email bounces -- I'm guessing the new owner of netobjects doesn't have
their
 mail server set up to accept the correct email address.  Just FYI.

 --kurt



-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread turtle

I am trying to pass a variable to a popup window, to do a search in a
database, and display an image based on the results...  Here is what I have
messed up so far (this is the 1st time I have used php/mysql  no
userID/Pswd on local host)

The script that passes the variable (variable does pass to 2nd html doc)

script language=Javascript!--
function popImg1() {
window.open('../../assets/img760/img.php?getimg=alfstag1','img','toolbar=0,l
ocation=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,copyhist
ory=0,width=800,height=600,left=0,top=0')
//--
/script

The php/mysql connect  search (have tested the connect and it works db
name=img760 table=img)

?
$link = mysql_connect('localhost')or die (Could not connect);
mysql_select_db('img760')or die (Could not select database);
$query = select ('imglocation','height','width') from img where
imgname=$getimg;
$imglocation = 'imglocation';
$height = 'height';
$width = 'width';
?

The display of the image

td align=centera href=javascript:void(0) img src=? echo
$imglocation ? width=? echo $width ? height=? echo $height ?
border=0/a/td

I have been able to pass these variables directly in the url and display the
image. trying to do it with a DB look up all I get in the code is the
literal not the variable (img scr=imglocation width=widthetc) ...

Where am I going wrong?  I have fiddled and changed until I have about
exhausted the possibilities... (Apache server on Win2k if it makes any
difference should not...)

What is a good reference book on PHP/MySQL... ???  I have one but obviously
it was a bad choice (title/author to remain unspoken. forever)

Thanks
Mike









-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread Kurt Lieber

On Tuesday 30 October 2001 10:13 am, turtle wrote:

 ?
 $link = mysql_connect('localhost')or die (Could not connect);
 mysql_select_db('img760')or die (Could not select database);
 $query = select ('imglocation','height','width') from img where
 imgname=$getimg;
 $imglocation = 'imglocation';
 $height = 'height';
 $width = 'width';
 ?

You need to read the manual on the mysql functions.

Specifically, functions like mysql_fetch_array, mysql_fetch_row, 
mysql_result.  You're setting $imglocation to a string, not a returned result 
from mysql.  You need to use one of the three functions I mentioned to retun 
an actual mysql result.

--kurt

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread turtle

.
No reading that section of the manual did me no good.  I do not understand
other than I cannot store the results as a variable.

Is there any of what I have done that is usable?

A recommendation for a book that covers this would be helpful...  the manual
on this area is way to abbreviated for someone who has only used PHP for 2
weeks.

Mike


Kurt Lieber [EMAIL PROTECTED] wrote in message
E15ydj6-0003KZ-00@z8">news:E15ydj6-0003KZ-00@z8...
 On Tuesday 30 October 2001 10:13 am, turtle wrote:

  ?
  $link = mysql_connect('localhost')or die (Could not connect);
  mysql_select_db('img760')or die (Could not select database);
  $query = select ('imglocation','height','width') from img where
  imgname=$getimg;
  $imglocation = 'imglocation';
  $height = 'height';
  $width = 'width';
  ?

 You need to read the manual on the mysql functions.

 Specifically, functions like mysql_fetch_array, mysql_fetch_row,
 mysql_result.  You're setting $imglocation to a string, not a returned
result
 from mysql.  You need to use one of the three functions I mentioned to
retun
 an actual mysql result.

 --kurt





-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread Kurt Lieber

On Tuesday 30 October 2001 11:58 am, turtle wrote:
 No reading that section of the manual did me no good.  I do not understand
 other than I cannot store the results as a variable.

yes, you can. 


 Is there any of what I have done that is usable?

yes, there is. see below.  It's probably not solid enough to cut 'n' paste, 
but it at least shows you how to get return results from mysql.

 A recommendation for a book that covers this would be helpful...  the
 manual on this area is way to abbreviated for someone who has only used PHP
 for 2 weeks.

Beginning PHP4 by Wrox



?
 $link = mysql_connect('localhost')or die (Could not connect);
 mysql_select_db('img760')or die (Could not select database);
 $query = select imglocation,height,width from img where
imgname=$getimg; //you haven't defined $getimg anywhere that I can see
// also need to enclose it in quotes: '$getimg'
  $results = mysql_fetch_array($query); //new line
 $imglocation = $reults['imglocation']; 
 $height = $results['height'];
 $width = $results['width'];
?

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread turtle

.
It is starting to make sense.  I see the correlation between the manual
example and the code you show.  Surprisingly (and equally confusing) the
book I have also uses a while loop with mysql_fetch_array to display a list.

The getimg variable comes in from the javasript function on the other page
embedded in the url:
window.open('../../assets/img760/img.php?getimg=alfstag1')
the variable content is the field (imgname) that I use to find the record.

I have been passing all of the variables manually via the url but it would
be best if I used a database as there are around 400 to show and changes in
a db are easier than in the html head.

This may be the problem as I now get supplied argument not valid mysql
result on this line.
$query = select imglocation,height,width from img where imgname='$getimg';

Thank you for taking the time with me on this.  I will see if I can find the
remaining problems and get to coding the 400+ pages that I need to get this
into.

It looks like I might be able to use the GetImageSize function to do this
same thing?  maybe?  All I am doing is getting the location (url) of an
image and its height and width for an img src=  statement.  maybe I am
making this into a bigger job than necessary??  I think I have been working
on it too long today and I need a long walk.

Anyway, thank you again for taking the time and for the book recommendation.

Mike


Kurt Lieber [EMAIL PROTECTED] wrote in message
E15yfMr-0003fP-00@z8">news:E15yfMr-0003fP-00@z8...
 On Tuesday 30 October 2001 11:58 am, turtle wrote:
  No reading that section of the manual did me no good.  I do not
understand
  other than I cannot store the results as a variable.

 yes, you can.


  Is there any of what I have done that is usable?

 yes, there is. see below.  It's probably not solid enough to cut 'n'
paste,
 but it at least shows you how to get return results from mysql.

  A recommendation for a book that covers this would be helpful...  the
  manual on this area is way to abbreviated for someone who has only used
PHP
  for 2 weeks.

 Beginning PHP4 by Wrox



 ?
  $link = mysql_connect('localhost')or die (Could not connect);
  mysql_select_db('img760')or die (Could not select database);
  $query = select imglocation,height,width from img where
   imgname=$getimg; //you haven't defined $getimg anywhere that I can
see
 // also need to enclose it in quotes: '$getimg'
   $results = mysql_fetch_array($query); //new line
  $imglocation = $reults['imglocation'];
  $height = $results['height'];
  $width = $results['width'];
 ?



-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread Kurt Lieber

On Tuesday 30 October 2001 02:53 pm, you wrote:
 It is starting to make sense.  I see the correlation between the manual
 example and the code you show.  Surprisingly (and equally confusing) the
 book I have also uses a while loop with mysql_fetch_array to display a
 list.

You would use a while loop if/when you have multiple records to retrive.  
From your original code example, it seemed as though you would only have one 
record.  (though, for safety's sake, you should code a LIMIT into your sql 
statement)


 This may be the problem as I now get supplied argument not valid mysql
 result on this line.
 $query = select imglocation,height,width from img where
 imgname='$getimg';

Two things to try:

1.  Run that exact query on a mysql command line, substituting whatever 
variable name you're trying to pass in the URL.  Often times, I find that I 
tihnk I have a PHP problem when, in fact, I screwed up my query syntax 
somewhere.

2.  Explicitly define $getimg as something you know to be a valid image.  If 
that works, then you know it isn't getting passed from the url properly.  

 It looks like I might be able to use the GetImageSize function to do this
 same thing?  maybe?  All I am doing is getting the location (url) of an
 image and its height and width for an img src=  statement.  maybe I
 am making this into a bigger job than necessary??  I think I have been
 working on it too long today and I need a long walk.

Actually, yes you can.  

$myImgSize = getImageSize('/unix/path/to/my/file.jpg'); should return the 
image sizes in an array.  You should then be able to do something like:

img src=file.jpg $myImgSize[3]

Which should automatically include height/width parameters.  (see this 
function on the php site for more info -- also, that's untested, off-the-cuff 
code I just wrote.  Might not work perfectly. :)

--kurt

-- 
PHP General 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] PHP+MySQL=Help(?)

2001-10-30 Thread turtle


Kurt Lieber

 You would use a while loop if/when you have multiple records to retrive.
 From your original code example, it seemed as though you would only have
one
 record.  (though, for safety's sake, you should code a LIMIT into your sql
 statement)


Yes I only need one image location with height and width from the db file



  This may be the problem as I now get supplied argument not valid mysql
  result on this line.
  $query = select imglocation,height,width from img where
  imgname='$getimg';

 Two things to try:

 1.  Run that exact query on a mysql command line, substituting whatever
 variable name you're trying to pass in the URL.  Often times, I find that
I
 tihnk I have a PHP problem when, in fact, I screwed up my query syntax
 somewhere.



Doing a command line query at a mysql prompt brings back the correct data
select imglocation,height,width from img where imgname='alfstag1'
returns:
./alf_760stag1.jpg (the image location)
544 (the height)
760 (the width)

 2.  Explicitly define $getimg as something you know to be a valid image.
If
 that works, then you know it isn't getting passed from the url properly.

  It looks like I might be able to use the GetImageSize function to do
this
  same thing?  maybe?  All I am doing is getting the location (url) of an
  image and its height and width for an img src=  statement.  maybe
I
  am making this into a bigger job than necessary??  I think I have been
  working on it too long today and I need a long walk.

 Actually, yes you can.

 $myImgSize = getImageSize('/unix/path/to/my/file.jpg'); should return the
 image sizes in an array.  You should then be able to do something like:

 img src=file.jpg $myImgSize[3]

 Which should automatically include height/width parameters.  (see this
 function on the php site for more info -- also, that's untested,
off-the-cuff
 code I just wrote.  Might not work perfectly. :)

 --kurt

I found the GetImageSize while digging around the manual and tried to work
it in without success.  I have so far this evening re-written this with
separate mysql_connect, mysql_select_db, and mysql_query functions and
tested after each and that is as far as I can get without errors.  I have
tried mysql_fetch_array, mysql_fetch_object, and mysql_fetch_row...  all
have failed for some reason  I am testing with an if (variable) set message
then echo each message in the body...  Here is a URL of a page where I pass
the same variables manually and use them in the popup to give you an idea of
what I am trying do to with a database holding this info
http://www.bronze-gallery.com/French_Sculptors/Alfred_Barye/Stag_Scratching/
stag_scratching.html click on either image to get to the php popup this
declares and passes the 3 variables in the url.

so far the light bulb has not clicked on. The php4 book you recommended
is on order

Mike





-- 
PHP General 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] MySql Help

2001-09-11 Thread Jared Mashburn



Hello, 
I have a database with 4 Columns  


|ID|First|Second|Third|



I am tring to run a query On the First Column and place the data into an
array.  The problem that I am running into 
Is that there are doubles, triples, and sometimes more of the same name
in that column.  Each name represents something differnet in the 
Second and Third and when I run a simple query  (select first from
table) I get (expectedly) all of the names in the Column doubles and
all.  My question is , is there a way to select from a database and only
select one of each name from the column?

Example.

Data Data
Data
Data
Data
Data1Data1
Data1
Data2Data2
Data2
Data2
Data2

Thanks for any advice.

Jared


-- 
PHP General 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] MySql Help

2001-09-11 Thread Alnisa Allgood

At 12:31 PM -0600 9/11/01, Jared Mashburn wrote:

I am tring to run a query On the First Column and place the data into an
array.  The problem that I am running into
Is that there are doubles, triples, and sometimes more of the same name
in that column.  Each name represents something differnet in the
Second and Third and when I run a simple query  (select first from
table) I get (expectedly) all of the names in the Column doubles and
all.  My question is , is there a way to select from a database and only
select one of each name from the column?


SELECT DISTINCT field1 FROM table1 ORDER BY field1

Alnisa
-- 
   .
Alnisa  Allgood
Executive Director
Nonprofit Tech
(ph) 415.337.7412  (fx) 415.337.7927
(url)  http://www.nonprofit-techworld.org
(url)  http://www.nonprofit-tech.org
(url)  http://www.tech-library.org
   .
Nonprofit Tech E-Update
mailto:[EMAIL PROTECTED]
   .
applying technology to transform
   .

-- 
PHP General 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] Mysql help

2001-09-10 Thread Roman

In mysql database i have 5 tables, their names are :

db
user
host
tables_priv
columns_priv

I know which information are in tables (db,user,tables_priv, columns_priv)
and I know for what serve this tables but i don't know some information
about table host ? Please send me some information about this table.


Thank you.

roman



-- 
PHP General 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] Mysql help

2001-09-10 Thread David Robley

On Mon, 10 Sep 2001 16:33, Roman wrote:
 In mysql database i have 5 tables, their names are :

 db
 user
 host
 tables_priv
 columns_priv

 I know which information are in tables (db,user,tables_priv,
 columns_priv) and I know for what serve this tables but i don't know
 some information about table host ? Please send me some information
 about this table.


 Thank you.

   roman

This is a mysql problem, not PHP. Try

http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#User_Account_Management


-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   He who places head in sand, will get kicked in the end!

-- 
PHP General 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] MySql help #1

2001-08-03 Thread elias

Miles,

The LIMIT works great with UPDATE too.

Miles Thompson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Come on, you're pushing SQL in directions it's not supposed to go! It is
 set oriented after all.
 So it's experimentation time. I've never tried, but as LIMIT works on a
 SELECT, try it on an update. And let us know what happened.
 Miles

 At 10:30 AM 8/2/01 +0200, elias wrote:
 How can I update only N fields from the database?
 
 usually we do:
 
 UPDATE table1 SET field='VALUE' WHERE condition1
 
 now I want to update fields with a certain condition but only X fields
out N
 total fields.
 
 ie:
 
 id   value
 --- ---
 1a
 2b
 3c
 4d
 5e
 
 how can i update such like:
 UPDATE table1 SET {only 2 records} value='aa'
 so I have any two fields now have the 'aa' value
 
 
 
 
 
 --
 PHP General 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 General 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] MySql help #1

2001-08-03 Thread Miles Thompson


Come on, you're pushing SQL in directions it's not supposed to go! It is 
set oriented after all.
So it's experimentation time. I've never tried, but as LIMIT works on a 
SELECT, try it on an update. And let us know what happened.
Miles

At 10:30 AM 8/2/01 +0200, elias wrote:
How can I update only N fields from the database?

usually we do:

UPDATE table1 SET field='VALUE' WHERE condition1

now I want to update fields with a certain condition but only X fields out N
total fields.

ie:

id   value
--- ---
1a
2b
3c
4d
5e

how can i update such like:
UPDATE table1 SET {only 2 records} value='aa'
so I have any two fields now have the 'aa' value





--
PHP General 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 General 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] Mysql Help #2

2001-08-03 Thread Tom Carter

Depends what is to happen to the array afterwards, but in general no.

An interesting thing is to put timing method calls around a block of code in
question, you will find something like this (depending upon size of db)
takes somehting like 0.005 seconds. Timing things can be useful measures of
a pages overhead (one page on a site I hvae currently takes almost 2 seconds
on average to build...eek!)

elias [EMAIL PROTECTED] wrote in message

- Original Message -
From: elias [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 02, 2001 9:31 AM
Subject: [PHP] Mysql Help #2


 Hi again.

 $result = mysql_query(SELECT id FROM table);
 $id_array = array();

 while ($r = mysql_fetch_array($result))
$id_array[] = $r[id];

 // now $id_array[] is an array of IDs that was grabbed from the database.

 Any faster and/or better approache to build the $id_array?



 --
 PHP General 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 General 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] MySql help #1

2001-08-03 Thread elias

the structur is like:
 id, item name, items in stock , frogserialnumber, status
 1,  frog,  7, 002121, Reserved
2,  frog,  7, 101011, Free
1,  frog,  7, 212001, Free

that's why I want to mark only N entries Reserved,

Lawrence Sheed [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]
...
 Have you thought about your database design carefully?

 You might want to create a column for item count

 eg

 id, item name, items in stock
 1,  frog,  7

 if, say a customer orders 3 frogs, decrement the items in stock by 3.

 Just an idea...

 Do you know about database normalization?  How is the database designed?



 -Original Message-
 From: elias [mailto:[EMAIL PROTECTED]]
 Sent: August 2, 2001 6:32 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySql help #1


 Someone purchased items from my site let's say 3 items out of 5 total. All
 items are the same. I just want to update 3 items status to Reserved.
 When he buy he just tell how many and not which ones.

 Lawrence Sheed [EMAIL PROTECTED] wrote in message

[EMAIL PROTECTED]">news:[EMAIL PROTECTED]
 ..
  Sounds like a strange request, what are you trying to do?
 
  I don't think you can do this directly in mysql, but you could build an
  array of results in php.
 
  eg something like (crappy code below)
 
  //Grab results
  $db = mysql_connect($db_domain, $db_user,$db_password);
  mysql_select_db($db_databasename,$db);
  $sqlquery=select ID from table1 where condition1;
  $result = mysql_query ($sqlstring,$db);
  $count=0;
  while ($resultset = mysql_fetch_array ($result)) {
  $array[$count]=$resultset [ID];
  $count++;
  }
 
 
  for ($count=0;$count2;$count++){
  update table1 set field='VALUE' WHERE ID=.$array[$count];
  $result = mysql_query ($sqlstring,$db) or die (mysql_error());
  }
 
  -Original Message-
  From: elias [mailto:[EMAIL PROTECTED]]
  Sent: August 2, 2001 4:30 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] MySql help #1
 
 
  How can I update only N fields from the database?
 
  usually we do:
 
  UPDATE table1 SET field='VALUE' WHERE condition1
 
  now I want to update fields with a certain condition but only X fields
out
 N
  total fields.
 
  ie:
 
  id   value
  --- ---
  1a
  2b
  3c
  4d
  5e
 
  how can i update such like:
  UPDATE table1 SET {only 2 records} value='aa'
  so I have any two fields now have the 'aa' value
 
 
 
 
 
  --
  PHP General 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 General 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 General 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] MySql help #1

2001-08-02 Thread elias

How can I update only N fields from the database?

usually we do:

UPDATE table1 SET field='VALUE' WHERE condition1

now I want to update fields with a certain condition but only X fields out N
total fields.

ie:

id   value
--- ---
1a
2b
3c
4d
5e

how can i update such like:
UPDATE table1 SET {only 2 records} value='aa'
so I have any two fields now have the 'aa' value





-- 
PHP General 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] Mysql Help #2

2001-08-02 Thread elias

Hi again.

$result = mysql_query(SELECT id FROM table);
$id_array = array();

while ($r = mysql_fetch_array($result))
   $id_array[] = $r[id];

// now $id_array[] is an array of IDs that was grabbed from the database.

Any faster and/or better approache to build the $id_array?



-- 
PHP General 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] MySql help #1

2001-08-02 Thread Lawrence . Sheed

Sounds like a strange request, what are you trying to do?

I don't think you can do this directly in mysql, but you could build an
array of results in php.

eg something like (crappy code below)

//Grab results
$db = mysql_connect($db_domain, $db_user,$db_password);
mysql_select_db($db_databasename,$db);
$sqlquery=select ID from table1 where condition1;
$result = mysql_query ($sqlstring,$db);
$count=0;
while ($resultset = mysql_fetch_array ($result)) {
$array[$count]=$resultset [ID];
$count++;
}


for ($count=0;$count2;$count++){
update table1 set field='VALUE' WHERE ID=.$array[$count];
$result = mysql_query ($sqlstring,$db) or die (mysql_error());
}

-Original Message-
From: elias [mailto:[EMAIL PROTECTED]]
Sent: August 2, 2001 4:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySql help #1


How can I update only N fields from the database?

usually we do:

UPDATE table1 SET field='VALUE' WHERE condition1

now I want to update fields with a certain condition but only X fields out N
total fields.

ie:

id   value
--- ---
1a
2b
3c
4d
5e

how can i update such like:
UPDATE table1 SET {only 2 records} value='aa'
so I have any two fields now have the 'aa' value





-- 
PHP General 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 General 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] MySql help #1

2001-08-02 Thread elias

Someone purchased items from my site let's say 3 items out of 5 total. All
items are the same. I just want to update 3 items status to Reserved.
When he buy he just tell how many and not which ones.

Lawrence Sheed [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]
...
 Sounds like a strange request, what are you trying to do?

 I don't think you can do this directly in mysql, but you could build an
 array of results in php.

 eg something like (crappy code below)

 //Grab results
 $db = mysql_connect($db_domain, $db_user,$db_password);
 mysql_select_db($db_databasename,$db);
 $sqlquery=select ID from table1 where condition1;
 $result = mysql_query ($sqlstring,$db);
 $count=0;
 while ($resultset = mysql_fetch_array ($result)) {
 $array[$count]=$resultset [ID];
 $count++;
 }


 for ($count=0;$count2;$count++){
 update table1 set field='VALUE' WHERE ID=.$array[$count];
 $result = mysql_query ($sqlstring,$db) or die (mysql_error());
 }

 -Original Message-
 From: elias [mailto:[EMAIL PROTECTED]]
 Sent: August 2, 2001 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] MySql help #1


 How can I update only N fields from the database?

 usually we do:

 UPDATE table1 SET field='VALUE' WHERE condition1

 now I want to update fields with a certain condition but only X fields out
N
 total fields.

 ie:

 id   value
 --- ---
 1a
 2b
 3c
 4d
 5e

 how can i update such like:
 UPDATE table1 SET {only 2 records} value='aa'
 so I have any two fields now have the 'aa' value





 --
 PHP General 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 General 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] MySql help #1

2001-08-02 Thread Lawrence . Sheed

Have you thought about your database design carefully?

You might want to create a column for item count  

eg

id, item name, items in stock 
1,  frog,  7

if, say a customer orders 3 frogs, decrement the items in stock by 3.

Just an idea...

Do you know about database normalization?  How is the database designed?



-Original Message-
From: elias [mailto:[EMAIL PROTECTED]]
Sent: August 2, 2001 6:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] MySql help #1


Someone purchased items from my site let's say 3 items out of 5 total. All
items are the same. I just want to update 3 items status to Reserved.
When he buy he just tell how many and not which ones.

Lawrence Sheed [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]
...
 Sounds like a strange request, what are you trying to do?

 I don't think you can do this directly in mysql, but you could build an
 array of results in php.

 eg something like (crappy code below)

 //Grab results
 $db = mysql_connect($db_domain, $db_user,$db_password);
 mysql_select_db($db_databasename,$db);
 $sqlquery=select ID from table1 where condition1;
 $result = mysql_query ($sqlstring,$db);
 $count=0;
 while ($resultset = mysql_fetch_array ($result)) {
 $array[$count]=$resultset [ID];
 $count++;
 }


 for ($count=0;$count2;$count++){
 update table1 set field='VALUE' WHERE ID=.$array[$count];
 $result = mysql_query ($sqlstring,$db) or die (mysql_error());
 }

 -Original Message-
 From: elias [mailto:[EMAIL PROTECTED]]
 Sent: August 2, 2001 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] MySql help #1


 How can I update only N fields from the database?

 usually we do:

 UPDATE table1 SET field='VALUE' WHERE condition1

 now I want to update fields with a certain condition but only X fields out
N
 total fields.

 ie:

 id   value
 --- ---
 1a
 2b
 3c
 4d
 5e

 how can i update such like:
 UPDATE table1 SET {only 2 records} value='aa'
 so I have any two fields now have the 'aa' value





 --
 PHP General 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 General 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 General 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] mysql help!! urgent!

2001-03-15 Thread Richard Lynch

 Warning: Unable to jump to row 0 on MySQL result index 2 in
 /home/sites/site3/web/showthumb on line 71

 --here is my code

Change it to look like this:

 $connetion = mysql_connect("localhost","cel34243","s2343223") or
die($php_errormsg);
 $query = "select images from celeb where name=\"$dir.\" ";
 $result = mysql_db_query("celebzone", $query) or die(mysql_error());
 $imagesnum= mysql_result($result,  "images");

You are missing an argument there...
You need a row number in front of "images".
Also, you probably don't have any rows that matched your criteria, so asking
for the first row (row 0) is bad.


--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General 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] mysql help!! urgent!

2001-03-10 Thread McShen

hi

i get this message when i am trying to load some data from mysql.

Warning: Unable to jump to row 0 on MySQL result index 2 in
/home/sites/site3/web/showthumb on line 71

--here is my code
$connetion = mysql_connect("localhost","cel34243","s2343223");
$query = "select images from celeb where name=\"$dir.\" ";
$result = mysql_db_query("celebzone", $query);
$imagesnum= mysql_result($result,  "images");

can you please tell me why?

Thank you.



-- 
PHP General 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] MYSQL HELP!!!

2001-02-24 Thread Felipe Lopes

Hi!
Here I am again...I have a problem to insert user name, password and 
host into mysql...I'd like to know what commands I need to do that 
(since the command to start mysql on my computer) so that way I won't be 
able to do anything wrong!
Thank you

Felipe Lopes
MailBR - O e-mail do Brasil -- http://www.mailbr.com.br
Faça já o seu. É gratuito!!!

-- 
PHP General 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]