RE: [PHP-DB] Dynamic SQL + result resource error

2001-07-09 Thread Mats Remman

Look at this snippet :
 $word = current($wordsarray); 
 next($wordsarray);
 $sql=$sql.$word);

if you have 2 words the sql would extend to
word1)word2) .. this is invalid sql syntax.

Change the 
while ($i  count($wordsarray)) 
{ 
$word = current($wordsarray); 
next($wordsarray);
$sql=$sql.$word);
$i++; 
}
bit into something like this
$sep = ;
foreach( $wordsarray as $v ) {
$sql .= $sep. $word ;
$sep =  OR band LIKE ;
}
$sql .= );

Then retry the queries.

oh and yes, include the mysql_query() as Mark Gordon mentioned.


Mats Remman
PHP Developer/Mysql DBA
Coretrek, Norway
+47 51978597 / +47 916 23566

 

 -Original Message-
 From: Matthew Loff [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 09, 2001 2:20 AM
 To: 'Ben Bleything'; 'Mark Gordon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Dynamic SQL + result resource error
 
 
 
 Ha ha... I should have meantioned Here's what it -should- be or
 something of the like. :)
 
 I suspect that was the only problem with his code, but perhaps there's
 something else there.
 
 
 -Original Message-
 From: Ben Bleything [mailto:[EMAIL PROTECTED]] 
 Sent: Sunday, July 08, 2001 8:13 PM
 To: 'Matthew Loff'; 'Mark Gordon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Dynamic SQL + result resource error
 
 
 Guess I'm just a big dumbass then, aren't I =P
 
 Oops.
 
 I suppose that would cause it to fail then, wouldn't it?
 
 =  Ben
 
 -Original Message-
 From: Matthew Loff [mailto:[EMAIL PROTECTED]] 
 Sent: Sunday, July 08, 2001 5:10 PM
 To: 'Ben Bleything'; 'Mark Gordon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Dynamic SQL + result resource error
 
 
 The code you're referencing is my modification of his original post. :)
 
 
 -Original Message-
 From: Ben Bleything [mailto:[EMAIL PROTECTED]] 
 Sent: Sunday, July 08, 2001 8:04 PM
 To: 'Matthew Loff'; 'Mark Gordon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Dynamic SQL + result resource error
 
 
 Sure he is.  Right here:
 
 $queryResult = mysql_query($sql);
 
 what exact error is occurring?
 
 -Original Message-
 From: Matthew Loff [mailto:[EMAIL PROTECTED]] 
 Sent: Sunday, July 08, 2001 5:00 PM
 To: 'Mark Gordon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Dynamic SQL + result resource error
 
 
 You aren't calling mysql_query() to execute the query.
 
 //$find is text box input
 $wordsarray = explode( ,$find); 
 $sql = SELECT bandname FROM bands WHERE (bandname
 LIKE ;
 $i = 0;
 while ($i  count($wordsarray)) 
 { 
 $word = current($wordsarray); 
 next($wordsarray);
 $sql=$sql.$word);
 $i++; 
 }
 print $sqlhr;
 
 $queryResult = mysql_query($sql);
 
 while ($myrow=mysql_fetch_row($queryResult))
 {
 print $myrow[0],p;
 }
 
 
 -Original Message-
 From: Mark Gordon [mailto:[EMAIL PROTECTED]] 
 Sent: Sunday, July 08, 2001 7:54 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Dynamic SQL + result resource error
 
 
 Why is this code generating an error when it outputs a
 valid SQL statement?  (there are no parse errors)
 
 //$find is text box input
 $wordsarray = explode( ,$find); 
 $sql = SELECT bandname FROM bands WHERE (bandname
 LIKE ;
 $i = 0;
 while ($i  count($wordsarray)) 
 { 
 $word = current($wordsarray); 
 next($wordsarray);
 $sql=$sql.$word);
 $i++; 
 }
 print $sqlhr;
 while ($myrow=mysql_fetch_row($sql))
 {
 print $myrow[0],p;
 }
 
 =
 Mark
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.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 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 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] Dynamic SQL + result resource error

2001-07-09 Thread Michael Rudel

Hi Mark,

... beside of what was mentioned be4, you have also
a logical error in the way you append to your $sql-
query in the while loop.

Look: letz say, $find is The Fields of the Nephilim,
so your $wordsarray would be:

0 == The
1 == Fields
2 == of
3 == the
4 == Nephilim

in your while-loop, you append every array-entry to
your $sql with $word).

So your whole SQL-Statement would read:

SELECT bandname FROM bands WHERE (bandname LIKE The)Fields)of)the)Nephilim)

This statement will result in error !

Try this 1:

/
//$find is text box input
$wordsarray = explode( ,$find);

$sql = SELECT bandname FROM bands WHERE bandname  '';

while ( list( $key, $word ) = each( $wordsarray ) )
{ 
   $sql .=  OR bandname like '%.$word.%';
}
echo $sql.hr;

$queryResult = mysql_query($sql);

while ( $myrow = mysql_fetch_assoc( $queryResult ) )
{
   echo p .$myrow[bandname]. /p.\n;
}
/

Hope this helps ;)

Greetinx,
  Mike

Michael Rudel 
- Web-Development, Systemadministration -

Besuchen Sie uns am 20. und 21. August 2001 auf der
online-marketing-düsseldorf in Halle 1 Stand E 16
___

Suchtreffer AG 
Bleicherstraße 20 
D-78467 Konstanz 
Germany 
fon: +49-(0)7531-89207-17 
fax: +49-(0)7531-89207-13 
e-mail: mailto:[EMAIL PROTECTED] 
internet: http://www.suchtreffer.de 
___ 



 -Original Message-
 From: Mark Gordon [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 09, 2001 1:54 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Dynamic SQL + result resource error
 
 
 Why is this code generating an error when it outputs a
 valid SQL statement?  (there are no parse errors)
 
 //$find is text box input
 $wordsarray = explode( ,$find); 
 $sql = SELECT bandname FROM bands WHERE (bandname
 LIKE ;
 $i = 0;
 while ($i  count($wordsarray)) 
 { 
 $word = current($wordsarray); 
 next($wordsarray);
 $sql=$sql.$word);
 $i++; 
 }
 print $sqlhr;
 while ($myrow=mysql_fetch_row($sql))
 {
 print $myrow[0],p;
 }
 
 =
 Mark
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.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 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: ereg_replace

2001-07-09 Thread

In article [EMAIL PROTECTED], Olinux O wrote:

What I'm doing is using ereg_replace in this form:
$LargeString = ereg_replace(tag.*/tag,
replacement, $LargeString);
but what I get is the string with the replacement in a
way I don't actually want. It replaces the part of the
string that begins with THE FIRST TAG tag and that
ends with THE LAST TAG /tag. 


Dunno of its helping but we had a simular prob. I wrote a small class that
allows us to check for allowed tags.

code

   class declarations .

$allowedtags = array(

'br'  = '[br]',
'p'   = '[p]',
'/p'  = '[/p]',
'strong'  = '[strong]',
'/strong' = '[/strong]',
'b'   = '[b]',
... etc...


while ( list ($key, $val)  = each($allowedtags)) {
$trans = str_replace ($key, $val, $trans);
}

$trans = strip_tags(stripslashes($trans));

reset($allowedtags);

while ( list ($key, $val)  = each($allowedtags)) {
$trans = str_replace ($val, $key, $trans);
}

return $trans;
/

Regards,

Hans



-- 
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] Income on the Net!

2001-07-09 Thread Noel Hadfield

Here is an opportunity that you can take up FREE. If you join as an 
affiliate, we'll teach you how to build a profitable business on the 
Internet, using our system to create an income stream and earn income 
globally, 24 hours a day.

Don't let this opportunity slip past you - our organization is already well 
over 1 million strong and growing at around 6,000 each day! Join us and 
let's work together to get a share of all those members.

Just hit:

mailto:[EMAIL PROTECTED]?Subject=Opportunity

To be removed from this list, hit:

mailto:[EMAIL PROTECTED]?Subject=Remove

-- 
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: Login Help

2001-07-09 Thread Johannes Janson

Hi,

[...]
Now, if i hit enter again it will say:
Please fill out all fields to proceed.
Sorry, username is already taken, please choose another.
There seems to be a problem with the database.

So this is the problem?

[...]
Here is my code:

htmlhead
titleRegister/title/head
body
form method=post action=? echo $PHP_SELF; ?
table cellpadding=2 cellspacing=0 border=0
tdUsername:/tdtdinput type=text name=username size=10/tdtr
tdPassword:/tdtdinput type=password name=password
size=10/tdtr
tdEmail:/tdtdinput type=text name=email size=15/tdtr
td /tdtdinput type=submit name=submit value=register/td
/table/form
/body
/html
?php
include'dbcon.inc';
if(isset($submit)) {
dbConnect('login');

// Make sure all fields are filled out
if ($username== or $password== or $email==) {
echo(Please fill out all fields to proceed.br);

--exit;
}

You need to add an exit; to tell PHP to terminate the if-loop.
If oyu don't do so the rest of the script is executed and thus
the empty usrname and password are entered. That's why you
get usrname already taken after the second submit.


// Make sure there is not the same name in the database
$query = SELECT COUNT(*) FROM user WHERE name = '$username';
$result = mysql_query($query);
if (!$result) {
echo(There seems to be a problem with the database.br);
}
if (mysql_result($result,0,0)0) {
echo(Sorry, username is already taken, please choose another.br);

--exit;
}

here again. but if your username is unique entering it to the DB won't
work anyway and you could leave it, but I think it is cleaner to put
it there.

You could also put the whole processing into a seperate script and then use
header(...)s to redirect back to the loginscreen.

hope it helps
Johannes




-- 
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: ereg_replace

2001-07-09 Thread Søren Nielsen

 What I'm doing is using ereg_replace in this form:
 $LargeString = ereg_replace(tag.*/tag,
 replacement, $LargeString);
 but what I get is the string with the replacement in a
 way I don't actually want. It replaces the part of the
 string that begins with THE FIRST TAG tag and that
 ends with THE LAST TAG /tag.

Use preg_raplace and make it ungreddy using ? :
$LargeString = preg_replace(|tag.*?/tag|,replacement,
$LargeString);

Regards,
Soeren



-- 
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] image resizing

2001-07-09 Thread Adv. Systems Design

Is there a way of sizing image resolution on the fly?

TIA

Luis

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.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]




AW: [PHP-DB] image resizing

2001-07-09 Thread Stefan Siefert

There are several possibilities to do this... first PHP has the possibility
to use the GD - Libs (which doesn't support Gif's because of licence
problems). The second (and in my opinion better) posibility is ImageMagick
which are some programs to modify pictures (you have to call them externaly
from your php - scripts) (www.imagemagick.org). I think, I have seen several
Tutorials to do so (PHP/ImageMagick) but on the fly.. I don't find them in
my bookmarks now...

Hope this helps,

Stefan Siefert

-Ursprungliche Nachricht-
Von: Adv. Systems Design [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 9. Juli 2001 16:04
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] image resizing


Is there a way of sizing image resolution on the fly?

TIA

Luis

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.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 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] mysql_fetch_array problem

2001-07-09 Thread BrianSander

Greetings,

I'm experiencing the strangest problem and I was wondering if anyone
else has had the same problem.

I have a fairly simple script setup that queries a mySQL database and
displays the records in a HTML table. Everything works fine except it
keeps omitting the first record. Running the query directly on the
database returns 3 records but only 2 are displayed in the table.

I just upgraded to PHP 4.0.6 and I'm still having the problem. I've also
tried using mysql_fetch_array and mysql_fetch_object, both produce the
same results. The first record is left out every time.

Any idea as to what the problem might be?


Thanks. 

-- 
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] Use of Like

2001-07-09 Thread Gabriel

Can anyone tell me a way to simulate the command LIKE in mySQL query´s,

Thanks in advance,

Gabriel.




--
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] mysql_fetch_array problem

2001-07-09 Thread bleythbe

I was having the same problem for a while... although, I
was using this:

for($i=0;$imysql_num_rows($result);$i++)
doStuffTo(mysql_result($result, $i, foo);

If I remember correctly... it has to do with zero-based
indexing versus 1-based indexing.  Now... I think I
fixed it by using = instead of just .  But, it has
been a while so I could be totally off =

Good luck,
Ben

Quoting BrianSander [EMAIL PROTECTED]:

 Greetings,
 
 I'm experiencing the strangest problem and I was
 wondering if anyone
 else has had the same problem.
 
 I have a fairly simple script setup that queries
 a mySQL database and
 displays the records in a HTML table. Everything
 works fine except it
 keeps omitting the first record. Running the
 query directly on the
 database returns 3 records but only 2 are
 displayed in the table.
 
 I just upgraded to PHP 4.0.6 and I'm still
 having the problem. I've also
 tried using mysql_fetch_array and
 mysql_fetch_object, both produce the
 same results. The first record is left out every
 time.
 
 Any idea as to what the problem might be?
 
 
 Thanks. 
 
 -- 
 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] Use of Like

2001-07-09 Thread Boget, Chris

 Can anyone tell me a way to simulate the command LIKE in 
 mySQL query´s,

Simulate it where?  In a SQL database?  Another kind of database?
Programatically?

Chris



[PHP-DB] Re: mysql_fetch_array problem

2001-07-09 Thread Philip Olson

What's your code look like, something like this?

$result = mysql_query(SELECT name FROM tablename);
while ($row = mysql_fetch_array($result)) {

print Name : . $row['name'] . br\n;
}

The above is the most standard way at least.  Share your appropriate 
snippet of code, could be a few reasons.

Regards,
Philip

Briansander wrote:

 Greetings,
 
 I'm experiencing the strangest problem and I was wondering if anyone
 else has had the same problem.
 
 I have a fairly simple script setup that queries a mySQL database and
 displays the records in a HTML table. Everything works fine except it
 keeps omitting the first record. Running the query directly on the
 database returns 3 records but only 2 are displayed in the table.
 
 I just upgraded to PHP 4.0.6 and I'm still having the problem. I've also
 tried using mysql_fetch_array and mysql_fetch_object, both produce the
 same results. The first record is left out every time.
 
 Any idea as to what the problem might be?
 
 
 Thanks.



-- 
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] Submiting forms to mySQL

2001-07-09 Thread James Wharton

I would like to have a three frame webpage. The data entry would be in the
main frame while the edit delete and submit buttons would be in
another frame. Is this possible? I thought that you could only submit things
between the form/form tags. (not things in different html or php files)



-- 
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] Submiting forms to mySQL

2001-07-09 Thread Tom Hodder


You can use the TARGET attribute of the form that would be in the
edit,delete,submit frame to make the main page process the form variables.

ie clicking on submit in the edit frame would send the vales
var1=ffefevar2=gfregr, etc etc, to the main frame.

alternatively you could use the javascript onSubmit events to manage which
form gets what.

Regards

Tom


-Original Message-
From: James Wharton [mailto:[EMAIL PROTECTED]]
Sent: 09 July 2001 20:36
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Submiting forms to mySQL


I would like to have a three frame webpage. The data entry would be in the
main frame while the edit delete and submit buttons would be in
another frame. Is this possible? I thought that you could only submit things
between the form/form tags. (not things in different html or php files)



--
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] IBM DB2 on Linux with PHP is very slow

2001-07-09 Thread news.php.net


Hi,

does someone has a DB2 UDB from IBM working with
PHP in a production envirement ? How is the performance?

For a relaunch of our existing production system running
on IBM DB2 on serveral IBM RS/6000 servers we tested
the performance of connecting PHP to this database.

And what can I say: It's very slow. For example:
A simple SELECT Query giving 100 records as result
takes about 6 until 10 seconds(!!!) when using PHP.

In detail: Connecting to Database lasts about 0.01 - 0.05 seconds (so, 10
ms - 50 ms),
sending the query (odbc_exec... ) lasts about the same time.

Then the bottleck: reading each record with odbc_fetch_into lasts
between 0.02 till sometimes 2 (two seconds!!!).

Now maybe you guess it's a problem of the DB2? We tested
the same query on the same server with a simple java-servlet with
jdbc, and the whole thing (connecting, query, and getting all records)
lasts about 0.09 till 0.2 seonds

So PHP is almost 300% till 500% slower!! I searched all
newsgroups and I found some people that has/had the same
problems.

We couldn't solve that problem by removing the TCP/IP
Problem of DB2 (setting some value ...mgnr = 1, i don't
remember it's name :-))).

No our CEO says, we should code the application in JAVA,
but that seems a very poor solution for us. So my question:
Does anybody had similar problems and solved it? Or is
anybody willing to help us? Maybe we can find some other
companies/people that also want to connect to DB2 with
a good performance, and we could improve the DB2 functions
of PHP or writing our own??

Or whats with other databases: are there similar problems
with Oracle??? Oralce would be a great idea, but we
spent some huge amount on the db2 so maybe it's
no good idea to put the db2 into the trashcan and buy
oracle for thousands of dollars. What's with Postgres? Our
problem is that we must store 10 million records a month,
and the database shouldn't have a problem with this.

Thank you for reading this, and maybe someone
can help,

Kind regards,
Christian Szardenings





-- 
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] Use of Like

2001-07-09 Thread Bob Hall

Can anyone tell me a way to simulate the command LIKE in mySQL query¥s,

Thanks in advance,

Gabriel.

Sir, you can use either LIKE or REGEXP. If you are coming to MySQL 
from an MS product, use % in place of * when using LIKE. For more 
information, look in the language section of the MySQL online manual.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
MySQL list magic words: sql query database

--
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] a simple question

2001-07-09 Thread Brad Lipovsky

can somebody help me with the following code:


function multi_word($title) {

 $array = explode ( , $input);
 $number = count ($array);

  if ($number  1) {
   return true;
  } else{
   return false;
  }

}

 if ($category) {
 $Query = SELECT * from $TableName WHERE ((category)=$category);
 } else {
  if ($title) {
   if (multi_word($title)) {
   print one word at a time for now;
   die();
  } else {
  $Query = SELECT * from $TableName WHERE title LIKE '%$title%';
  }
 }
}

when i try to pass in a multi-word string it doesnt print anything.  I have
tested the function and I know it works allright... if anyone could help
that would be great.

Brad



-- 
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] testing ODBC + MSSQL connection locally

2001-07-09 Thread Frank M. Kromann

Hi,

 I would like to begin learning ODBC. Will I be able to set this up on my
 single local machine?

The ODBC functions are build in when you are running PHP on a Windows Box. If you are 
running on a (nix box you have to compile PHP with support for ODBC.

 Also, What about connecting to MS SQL server remotely? Will i simply need an
 IP Port and user/pass?

If The MS SQL Server is configured to use TCP/IP you can use this to communicate with 
the server. If the Server uses named pipes you can uses this from a Windows box only.

The MSSQL Server can be accessed using ODBC or the native mssql_* functions. You can 
enable the mssql functions by uncommenting ;extension=php_mssql.dll in php.ini. This 
requires that you are running on Windws and you install the client tools from MS SQL 
Server on yor PHP box.

With ODBC and native MSSQL you can access remote or local databases.

- Frank
 
 Thank you
 
 olinux
 
 





-- 
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] Alternating Values

2001-07-09 Thread Jeff Oien

I'm trying to figure out the best way to do this.

People will be signing up online and their info will be put into
a database. They will be assigned a room and each successive
person will be assigned a different room. There are different categories
for each group of people also. So there will be:

Group1
-Rm101
-Rm102
-Rm103

Group2
-Rm300
-Rm301

etc. 

They need to have an equal amount of people in each room so
the first person in Group1 would Rm101, next person Rm102 etc.

Would it be best to retrieve the last person from the Group, find
out what room number they have, then if last in Group1 is Rm101, 
this person be assigned Rm102 with that equation being in the PHP
script? If that's the case would I retrieve all the records for Group1 and
find the largest ID (auto_increment type)? Thanks.
Jeff Oien

-- 
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] a simple question

2001-07-09 Thread Frank M. Kromann

Hi Brad,

Your parameter is named $title and you are converting a variable called $input to an 
array.

You could catch this type of errors if you change the setting for error_reportiong in 
php.ini.

- Frank

 can somebody help me with the following code:
 
 
 function multi_word($title) {
 
  $array = explode ( , $input);
  $number = count ($array);
 
   if ($number  1) {
return true;
   } else{
return false;
   }
 
 }
 
  if ($category) {
  $Query = SELECT * from $TableName WHERE ((category)=$category);
  } else {
   if ($title) {
if (multi_word($title)) {
print one word at a time for now;
die();
   } else {
   $Query = SELECT * from $TableName WHERE title LIKE '%$title%';
   }
  }
 }
 
 when i try to pass in a multi-word string it doesnt print anything.  I have
 tested the function and I know it works allright... if anyone could help
 that would be great.
 
 Brad
 
 
 
 -- 
 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] New to PHP and MySQL

2001-07-09 Thread leo g. divinagracia iii

assuming you have a DB setup with a table for the guestbook, just do a
standard query.

now the steps can be long and wordy.  but essentially, you open a
connection to the DB server.  you make a link to the DB.  you then pass
an SQL query via PHP to Mysql.  then it stores the result into an array
that you can then process.

best thing to do is get a book that has PHP and Mysql into it.

Beginning PHP from WROX.com had me started really well.  then i got a
PHP and Mysql book that just answered all my questions.


[EMAIL PROTECTED] wrote:
 
 Hi there,
 
 I'm new to PHP and MySQL - coming from ACCESS and ASP.  Can someone please let me 
know - in simple terms :-) how to search a DB?  I have written a guestbook which 
works fine, but I would like my users to be able to search it for a word or phrase 
and i'm not totally sure how to go about it.
 
 Thanks for any and all help anyone :-)

-- 
Leo G. Divinagracia III
[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] myisamchk always report table not close properly

2001-07-09 Thread Osman Omar

Hi,

I use php to update my MySQL database. After I run php script, I check
my table using myisamchk
and myisamchk always report  a warning

warning: 1 clients is using or hasn't closed the table properly.

I check my scripts and I always use mysql_close() at the end of the script.

Any idea how to avoid this warning?

thanks


-- 
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] parsing checkbox array without [] and selecting all boxes

2001-07-09 Thread olinux

Hey all,

The end result of all of this should be similar to an online email client
like hotmal, or yahoo where  you can select a number of messages to be
deleted.

I have a form that when generated, the html looks similar to this:

===

input type=checkbox name=broker value=1
input type=checkbox name=broker value=2
input type=checkbox name=broker value=3
input type=checkbox name=broker value=4
input type=checkbox name=broker value=5

input type=button value=Check All
onClick=this.value=check(this.form.broker)

===

I am trying to create a script that will delete each checked box. I can get
this script to work by adding '[]' to 'broker'  The reason for each name
being the same and not using the '[]' is because I want to be able to use a
javascript that selects all boxes. Is there a way to do this. Or better yet,
does anyone have a jscript that will work with the [] characters?

Thanks
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]




RE: [PHP-DB] parsing checkbox array without [] and selecting all boxes

2001-07-09 Thread Beau Lebens

don't your checkboxes act like radio buttons when you check them if they all
have the same name?

i would do something like

form name=mail_boxes action= method=
?php

// How ever many checkboxes you want
$number_of_checkboxes = 5;
for ( $this_check = 0; $this_check  $number_of_checkboxes; $this_check++ )
{
echo input type=\checkbox\ name=\broker: . $this_check . \
value=\$this_check\\n;
}

?

script language=JavaScript
!--

function check_all( num_boxes ) {
for ( this_box = 0; this_box = num_boxes; this_box++ ) 
document.mail_boxes['broker:' + this_box].checked = true;
}

// --
/script


input type=button name=checkall value=Select All
onClick=javscript:check_all(?php $numberof_checkboxes ?);


That's all completely untested, but it might work :P

// -Original Message-
// From: olinux [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 10 July 2001 7:43 AM
// To: php-db
// Subject: [PHP-DB] parsing checkbox array without [] and selecting all
// boxes
// 
// 
// Hey all,
// 
// The end result of all of this should be similar to an online 
// email client
// like hotmal, or yahoo where  you can select a number of 
// messages to be
// deleted.
// 
// I have a form that when generated, the html looks similar to this:
// 
// ===
// 
// input type=checkbox name=broker value=1
// input type=checkbox name=broker value=2
// input type=checkbox name=broker value=3
// input type=checkbox name=broker value=4
// input type=checkbox name=broker value=5
// 
// input type=button value=Check All
// onClick=this.value=check(this.form.broker)
// 
// ===
// 
// I am trying to create a script that will delete each checked 
// box. I can get
// this script to work by adding '[]' to 'broker'  The reason 
// for each name
// being the same and not using the '[]' is because I want to 
// be able to use a
// javascript that selects all boxes. Is there a way to do 
// this. Or better yet,
// does anyone have a jscript that will work with the [] characters?
// 
// Thanks
// 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 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]