[PHP-DB] Re: if else question

2002-04-07 Thread phplists

I've always done it like this:

$count = mysql_num_rows( $result );
if( $count == 0 ) then doomething();

But there may be a better way..

In yours it appears you are testing for anything in mysql_num_rows($result)
and a value of 0 in mysql_num_rows($ret). I may be misundertanding you. Do
you mean to test for the value of both to be 0? If that's the case, I was
under the impression that it would have to be if( $foo == 0 AND $bar == 0 )
then doSomething(); but I could be wrong..

Later,

Bob

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> Just wondering if something like this is valid. If not how can I make it
> valid?
>
> if (mysql_num_rows($result) and (mysql_num_rows($ret) == 0)
>
> Thanks
> Jennifer
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>



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




[PHP-DB] Re: Multiple selects?

2002-04-08 Thread phplists

Are you talking about something that will display a list of products like
this page:

http://survivalherbs.com:8080/order/index.php?command=viewCategory&category=
Herbal+Remedies

These are all gathered from the database with one SELECT statement then put
together in the table with a while loop.. Is that what you're talking about?
If so, I have the code for it. I wrote the cart that is hosted on that page
and can post some code from it if you would like..

Thanks,

Bob Weaver

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> You are probably getting tired of me asking questions but I have another
and
> will try to keep them down from now on.
>
> If I have let's say five items with different id's, image's and so forth
how
> do I display all items on one page. Do I have to use multiple selects
> or is there another easier way?
>
> Also what if I have 5 items that I can buy with id's
> 1, 2, 3, 4 and 5 and lets say that I bought items 2 and 5 but not 1, 3 and
4
> how do I display 2 and 5 but let's say I don't know the id's.
>
> I used
>
> $id = $HTTP_GET_VARS["id"]
>
>
> to buy them and have tried to use it to display them but I have to know
the
> id's in order to make it work with multiple selects.
>
> Am I being making sense here? Kinda doesn't make sense to me and I know
what
> I am trying to say but I don't think it worked.
>
> A good tutorial or help would be appreciated.
>
> Thanks
> Jennifer
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>



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




[PHP-DB] Re: Stroing info in a variable

2002-04-08 Thread phplists

This is what I have.. I think it's along the same lines as what you are
asking.. If not, just ignore my drunken ramblings.. It isn't with oci stuff
but if it's similar to what you need then you should be able to convert it
over..

$result = $database->query( "SELECT * FROM contacts WHERE cartId='$cartId'
ORDER BY lastName, firstName" );
while( $data = $database->fetchRow( $result ) )
{
echo( "$data->lastName, $data->firstNamemailto:$data->emailAddress\">$data->emailAddress\n" );
}

Now from what I understand of your question, you could remove the while so
you had $data = $database->fetchRow( $result ); then use if() tests to
compare $data->varName values.. If you wanted to compare values in different
rows, then I guess you could leave the while loop and just replace the
echo() with your if() tests..

Sorry if I missed the point of your question.. I hope this helps though..

Later,

Bob Weaver

"Pusta" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am really new at this PHP stuff, so please go easy on me.  I am trying
to
> query the database and then store the result of the query into a variable
to
> compare to another variable.  This is for a login function so for example:
>
> $c1 = ociparse($db, "select ssn from schema.table where ssn = $password");
> ociexecute($c1);
>
> my question is how can I store what's in the field ssn into a variable?
>
> Thanks,
>
> Pusta
>
>



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




[PHP-DB] Re: Multiple selects?

2002-04-08 Thread phplists

This is whole main() function.. I'm sure you didn't need all this but I
wasn't sure what to send without possibly leaving out something important..
So here it is:

function main( $category = "" )
{
global $database, $PHP_SELF, $settings, $secure, $PHPSESSID, $items,
$cartId;
 $inventory = $database->result( "SELECT * FROM inventory WHERE
cartId='$cartId'" );
//Get all the products
 $products = $database->query( "SELECT * FROM products WHERE
cartId='$cartId' AND category=\"$category\" AND status='checked' ORDER BY
idNumber, headline, price" );

 $category = stripslashes( $category );
 if( $category ) echo( "$category\n" );

 //only display the product links if you are viewing a category or there is
products
 //that aren't in a category
 if( $category or $database->numRows( $products ) )
 {
  echo( "\n" );
  if( sizeof( $items ) ) echo( "View Cart\n" );
  if( sizeof( $items ) ) echo( " | " );
  if( sizeof( $items ) ) echo( "Check Out\n" );
  if( sizeof( $items ) and $category != "" ) echo( " | " );
  if( $category != "" ) echo( "Back\n" );
  echo( "   \n" );
 }

 //begin nested tables
 echo( "\n" );
 echo( "\n" );

 if( $category or $database->numRows( $products ) )
 {
  //only display the product headings if you are viewing a category or there
is products
  //that aren't in a category
  echo( "IDHeadline<
b>PriceQty
DiscountsQuickAdd\n" );
 }

 if( $category )
 {
  //if you are viewing a category with no products in it
  if( !$database->numRows( $products ) ) echo( "There are no products in this category\n" );
 }

 $count = 0; //for alternating row colors
 while( $product = $database->fetchArray( $products ) )
 {
  $bgColor = $settings['bgColor'];
  if( $count % 2 ) $bgColor = $settings['oddColor'];

  $img = "";
  if( $product[thumbnail] and $product[thumbnail] != "none" )
  {
   $img = "\n";
  }

  $font = "";
  $link = "\n";
  echo( "$link$product[idNumber]$img\n" );
  echo( "$link$product[headline]\n" );
  echo( "$font\$" .
sprintf( "%.2f", $product[price] ) . "\n" );
  echo( "\n" );
if( $inventory->trackInventory and !$inventory->allowOrder
and ( $product[inventory] <= 0 or (string)$product[inventory] == "out" ) and
(string)$product[inventory] != "exclude" )
{
$buttonType = "button";
$warning = "onClick=\"alert( 'Inventory is out on
this product.  Please try back later.' );\"";
}
else {
$buttonType = "submit";
}

  if( $product[discOneQty] and $product[discOneQty] != 0 ) echo "$product[discOneQty]+ @ \$" .
sprintf( "%.2f", $product[discOnePrice] ) . " ea\n";
   else echo " \n";
  if( $product[discTwoQty] and $product[discTwoQty] != 0 ) echo
"$product[discTwoQty]+ @ \$" . sprintf( "%.2f", $product[discTwoPrice] ) . "
ea\n";
   else echo "\n";
echo( " \n" );
  $count ++;
 }

 if( !$category ) displayCategories( $settings );

 echo( "\n" );

 if( $settings[returnLink] )
 {
  print "$settings[returnLinkName]\n";
 }

 echo( "$settings[textAfter]\n" );

 printPage();
}

Hopefully this helps.. Let me know if you have any questions about it..

Later,

Bob Weaver

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Bob,
>
> That would be just about what I am looking for.
>
> And I wouldn't mind seeing the code you have.
>
> Thanks
> Jennifer
> <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Are you talking about something that will display a list of products
like
> > this page:
> >
> >
>
http://survivalherbs.com:8080/order/index.php?command=viewCategory&category=
> > Herbal+Remedies
> >
> > These are all gathered from the database with one SELECT statement then
> put
> > together in the table with a while loop.. Is that what you're talking
> about?
> > If so, I have the code for it. I wrote the cart that is hosted on that
> page
> > and can post some code from it if you would like..
> >
> > Thanks,
> >
> > Bob Weaver
> >
> > "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi all,
> > >
> > > You are probably getting tired of me asking questions but I have
another
> > and
> > > will try to keep them down from now on.
> > >
> > > If I have let's say five items with different id's, image's and so
forth
> > how
> > > do I display all items on one page. Do I have to use multiple selects
> > > or is there another easier way?
> > >
> > > Also what if I have 5 items that I can buy with id's
> > > 1, 2, 3, 4 and 5 and lets say that I bought items 2 and 5 but not 1, 3
> and
> > 4
> > > how do I display 2 and 5 but let's say I don't know the id's.
> > >
> > > I used
> > >
> > > $id = $HTTP_GET_VARS["id"]
> > >
> > >
> > > to buy them and have tried to use it to display them but I have to
know
> > the
> > > id's in order to make it work with multiple selects.
> > >
> > 

[PHP-DB] Re: insert syntax

2002-04-10 Thread phplists

These guys probably have one for you.. "If you give a man a fish..." (as was
stated earlier in the week)

http://www.mysql.com/doc/I/N/INSERT.html

Later,

Bob Weaver

"Marc S. Bragg" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there:
>
> Can canyone give me a basic insert statement to insert into two or more
> tables, variables and data from one form; i.e., insert the input into
> two or more tables at the "same" time?
>
> thanx
>
> --
> Marc S. Bragg
> [EMAIL PROTECTED]
> Bialecki & Bragg, PC
> p: 610-444-7508
> f: 610-444-7548
>
> http://www.chescolawyers.com/BB
> "Legal Directory, Services & Consumer Information for Chester County"
>
>
>



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




[PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread phplists

I don't know that I could help much with your statement.. But you mentioned
doing if() statements in SQL queries.. Well, my programmer always writes
them into PHP scripts then just runs them from there.. Then he can include
if() conditions, or whatever else he needs.. Just a quick little
cust_import_utility.php script..

--For what it's worth..

Bob

"Andy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there,
>
> I do have a sql statement where I could need some help on.
>
> There are 3 tables: provinces, cities, countries
> The result should be city, province, country but only if province is
> available. If not just display city and country.!
>
> Lets say we are searching for madrid.
>
> I did build following statement:
>  SELECT c.city, c.ID, p.province, co.country FROM cities c, provinces
p,
> countries co WHERE c.city like 'madrid%' AND p.province_id = c.province_id
> AND p.country_code = c.country_code AND c.country_code = co.country_code
> ORDER BY country , province limit 0, 10
>
>
> Works fine as long as there is a province for this city. But
unfortunatelly
> my db does not have for all countries provinces. But there is a madrid in
> spain.
> so I would like to change this querry to return madrid in spain even if
the
> province is unknown, but also if the province exists (in this case with
the
> name of the province)
>
> Maybe there is a way to do if statements in sql??
>
> Thanx for any help
>
> Andy
>
>
>



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




[PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread phplists

The above post may be unclear.. What he did was used if() statements to
compare whatever and generate the query differently based on what he found..

$lotsOdata = $database->result( "SELECT * FROM someTable" );
$count = mysql_num_rows( $lotsOdata );
while( $count > 0 ) {
if( $lotsOdata[city] != "philly" ) {
$sql = $database->query( "INSERT INTO otherTable $thisData" );
}
else if( $this[thing] = $that ) {
$sql = $database->query( "UPDATE someVar SET thisValue =
$thatData" );
}
}

I hope this makes sense, and it's all correctly written.. I'm pretty new at
this myself so I may have some bugs..

Later,
Bob Weaver

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I don't know that I could help much with your statement.. But you
mentioned
> doing if() statements in SQL queries.. Well, my programmer always writes
> them into PHP scripts then just runs them from there.. Then he can include
> if() conditions, or whatever else he needs.. Just a quick little
> cust_import_utility.php script..
>
> --For what it's worth..
>
> Bob
>
> "Andy" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi there,
> >
> > I do have a sql statement where I could need some help on.
> >
> > There are 3 tables: provinces, cities, countries
> > The result should be city, province, country but only if province is
> > available. If not just display city and country.!
> >
> > Lets say we are searching for madrid.
> >
> > I did build following statement:
> >  SELECT c.city, c.ID, p.province, co.country FROM cities c,
provinces
> p,
> > countries co WHERE c.city like 'madrid%' AND p.province_id =
c.province_id
> > AND p.country_code = c.country_code AND c.country_code = co.country_code
> > ORDER BY country , province limit 0, 10
> >
> >
> > Works fine as long as there is a province for this city. But
> unfortunatelly
> > my db does not have for all countries provinces. But there is a madrid
in
> > spain.
> > so I would like to change this querry to return madrid in spain even if
> the
> > province is unknown, but also if the province exists (in this case with
> the
> > name of the province)
> >
> > Maybe there is a way to do if statements in sql??
> >
> > Thanx for any help
> >
> > Andy
> >
> >
> >
>
>



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




[PHP-DB] Re: Closing curly brackets?

2002-04-12 Thread phplists

Maybe change mysql_fetch_array($ret) to mysql_fetch_row($ret)?  Not sure but
I've used that before to do what appears to be similar while loops..
Wouldn't the data still get retrieved in array form with that? If I'm wrong,
feel free to publicly ridicule me..

Later,

Bob Weaver

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi everyone,
>
> I originally posted this in general by mistake.
>
> I have a question about this code. The way it sits now it always shows the
> last record in the database table.
> In other words if the user has 6 items, like:
> item id 1
> item id 2
> item id 5
> item id 6
> item id 7
> item id 8
>
> it will only show the last record item id 8.
>
> I believe it has something to do with the first while statement's closing
> curly bracket placement
> but I can't seem to get it in the right place.
>
> Can someone spot the mistake and show me how to fix it.
> see also comments in code.
>
>
>
> $id = $HTTP_GET_VARS["id"];
>
>
> $query = "SELECT id, name, image, quantity, type FROM
> {$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
> $ret = mysql_query($query);
>  while($row = mysql_fetch_array($ret))
> {
> $iid = $row['id'];
> $image = $row['image'];
> $name = $row['name'];
> $quantity = $row['quantity'];
> $type = $row['type'];
>
>
> if($iid == $id)
> {
> $display_block =" 2>$name$quantity$type";
> echo "$display_block";
> if($type == "food")
> //if book or weapon is present then set an option and include in the form
> later
> {$thisoption="Feed my pet\n";
> }else{
> //if any other type is present then set a blank
> $thisoption="";}
> }
> }
>
>
>
> //check if form has been submitted
> if($submit){
>
>if($sort == 'shop')
>  {
>  echo "This item has been taken care of";
>
> // We are selecting user id to insert into the users items.
> $db="SELECT  uid FROM {$config["prefix"]}_users WHERE
> uid={$session["uid"]}";
> $ret = mysql_query($db);
> while(list($db)=mysql_fetch_row($ret))
> { $user = $db;
> echo "Your user ID is $user";
> }
>
>
> echo "You have $quantity of this item and it's id is $iid";
>
>
> }
> // it seems like the first while statement's closing curly bracket should
go
> //here but if I put it here I get a parse error.
> }else{
> //if the form has not been submitted run the following
>
>
> ?>
> " METHOD="post">
> 
> 
> Put in my shop
> Put into my Footlocker
> Discard this item
> Donate this item
> 
> 
> 
>  }
> //if I put the first while statement's closing curly bracket here it works
> except it prints multiple dropdown lists on the page and only prints the
> first item id 1.
>
> I have tried the bracket in numerous places but I can't find the right
spot.
>
> Thanks in advance
> Jennifer
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>



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




[PHP-DB] Re: Advice for dataupload

2002-04-12 Thread phplists

Hey, if the databases contain the same data, why don't you just have them
use one database. Just set up MySQL with a user on the internet server that
the intranet system uses to connect to it with.. Do it over SSL and it would
be secure then. Wouldn't that be somewhat simpler and less time consuming? I
mean if they are meant to contain the same data anyway...

Later,
Bob Weaver

"Hayan Al Mamoun" <[EMAIL PROTECTED]> wrote in message
000101c1de13$d9e9af00$5e00a8c0@cybernation">news:000101c1de13$d9e9af00$5e00a8c0@cybernation...
> Dear all,
> I have two design-identical database, one on my intranet, the other on the
> internet, is there any procedure that Synchronizes the content of two
> databases?
> I'm using PHP applications and MySQL Database, WindowsNT4 IIS
>
> Please advice
>
> Best Regards
> Hayan
>



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




[PHP-DB] Re: mysql_num_rows

2002-04-13 Thread phplists

I ran into the same problem on a script yesterday.. It turns out that one of
the vars in my mysql_connect() command wasn't assigned.. It gave me no
indication of this so I hadn't thought to look there.. I just happened to be
reading back through the whole page to see what I could find and noticed
that I hadn't set the var at the top..

Something else that I noticed in your code is that there doesn't seem to be
a mysql_select_db() call.. Unless that is somewhere else in the code and
just not shown here, you'll need it I believe..

Just a couple thoughts,

Bob Weaver

"Luke Kearney" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello All,
> I am struggling to understand why my query throws an error the code as
below
>
> $link = mysql_connect ( "db.localhost.org", $user , $pass );
> if ( ! $link )
>  die ( "Couldn't Connect to Mysql Server" );
>  print "Sucessfully connect to server ";
>  $query = "select * from users "
>   ."where screen_name='$screen_name' "
> ." and passwd=password('$passwd')";
>  $result = mysql_query($query, $link);
>  if (mysql_num_rows($result) >0 )
>
> When executed you get a little message back like this one
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/share/doc/apache/trial/authmain.php on line 20
>
> What does this generally mean as I have noted that others use this syntax
so
> what is my issue ?
>
> Any help or pointers to references would be most appreciated.
>
> Thanks
>
> Luke K
>
>



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




[PHP-DB] Re: mysql_num_rows

2002-04-13 Thread phplists

$link = mysql_connect ( "db.localhost.org", $user , $pass ) or die (
"Couldn't Connect to Mysql Server" );
$db = mysql_select_db( $dbname, $link );
$query = "SELECT * FROM users WHERE screen_name = '$screen_name' AND ...

That should work..

Bob

"Luke Kearney" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello All,
> I am struggling to understand why my query throws an error the code as
below
>
> $link = mysql_connect ( "db.localhost.org", $user , $pass );
> if ( ! $link )
>  die ( "Couldn't Connect to Mysql Server" );
>  print "Sucessfully connect to server ";
>  $query = "select * from users "
>   ."where screen_name='$screen_name' "
> ." and passwd=password('$passwd')";
>  $result = mysql_query($query, $link);
>  if (mysql_num_rows($result) >0 )
>
> When executed you get a little message back like this one
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/share/doc/apache/trial/authmain.php on line 20
>
> What does this generally mean as I have noted that others use this syntax
so
> what is my issue ?
>
> Any help or pointers to references would be most appreciated.
>
> Thanks
>
> Luke K
>
>



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




[PHP-DB] Re: MySQL to Email and Line Breaks

2002-04-13 Thread phplists

You need a wrap= within your textarea.. You may need a couple if the
browsers haven't come together on it yet.. But you can check it out here:

http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm

Just scroll down to wrap and check it out..

BTW, this seems like HTML help rather than PHP help..

Later,

Bob Weaver

"Jeff Oien" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a form where someone enters the body of an email message
> into a  part of a form to be sent out to a list. Then a script
> retrieves the body and sends it via email. However I can't get line breaks
> to show up (I'm using MS Outlook) even if I enter the \n into the textarea
> form and those \n show up in the database data. I must be missing
> something. Thanks for any help.
> Jeff Oien



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




Re: [PHP-DB] Re: MySQL to Email and Line Breaks

2002-04-13 Thread phplists

On the wrap= option, I have an HTML reference that mentions that IE4 used
wrap=" off | physical | virtual".. i don't know if it supports it still but
you might try it..

Bob
"Jeff Oien" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I tried wrap=hard already. I should have mentioned that. Sorry if this is
> off topic.
> Jeff Oien
>
> > You need a wrap= within your textarea.. You may need a couple if the
> > browsers haven't come together on it yet.. But you can check it out
here:
> >
> > http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm
> >
> > Just scroll down to wrap and check it out..
> >
> > BTW, this seems like HTML help rather than PHP help..
> >
> > Later,
> >
> > Bob Weaver
> >
> > "Jeff Oien" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I have a form where someone enters the body of an email message
> > > into a  part of a form to be sent out to a list. Then a
script
> > > retrieves the body and sends it via email. However I can't get line
breaks
> > > to show up (I'm using MS Outlook) even if I enter the \n into the
textarea
> > > form and those \n show up in the database data. I must be missing
> > > something. Thanks for any help.
> > > Jeff Oien
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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




[PHP-DB] Re: MySQL to Email and Line Breaks

2002-04-14 Thread phplists

Hey, couldn't you just send the text as HTML and it would retain any
formatting?

Bob

"Jeff Oien" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a form where someone enters the body of an email message
> into a  part of a form to be sent out to a list. Then a script
> retrieves the body and sends it via email. However I can't get line breaks
> to show up (I'm using MS Outlook) even if I enter the \n into the textarea
> form and those \n show up in the database data. I must be missing
> something. Thanks for any help.
> Jeff Oien



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




[PHP-DB] Re: Delete from mysql table is there a way to....

2002-04-15 Thread phplists

I'm not sure how to change DELETE statements in this fashion, but is there a
way maybe to run an OPTIMIZE TABLE query every so often in your PHP script..
I don't imagine you'd want it running too often since it locks the table you
run it on, but maybe on the reload of $PHP_SELF or something.. It can take a
while to run on tables with lots of data, so it may not be the best option
anyway.. Just a thought though.. Ooh, maybe a PHP script run from a cron job
every couple hours or something even??

Later,

Bob Weaver

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
> I'm not sure if my first post showed up so I am going to post it again and
I
> apologize if it shows up twice.
>
> Is there a way to delete a record from a mysql table without fragmenting
the
> db?
>
> Here is the query I am using and it does a horrible job. Fragment city.
>
>
>
> if ($quantity == 0)
>  {
> $gone = mysql_query("DELETE FROM {$config["prefix"]}_my_items WHERE
> uid={$session["uid"]} AND id = '$item'");
>   }
>
>
>
>
> Thanks
> Jennifer
>
>
> --
> The sleeper has awaken
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>



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




[PHP-DB] Re: Delete from mysql table is there a way to....

2002-04-15 Thread phplists

Maybe if you ran the delete query, then the optimize table query immed
after, it wouldn't take such a long time.. I would imagine if you had quite
large tables though, it could still take some time.. And if users are
connecting over the internet, you don't want too may delays..

If the user doesn't need any specific feedback about the delete command, you
could do a low priority delete.. That's sketchy at best though from what I
could gather in the manual and around. It just queues the query until the
database is done with everything but it sounds like it might release the
user/client to go on with what they're doing..

You might also check into truncate.. The mysql manual talks about it
briefly.. I guess it's an Oracle thing that mysql supports.. It sounds like
it would keep things clean but sounds slow possibly..

Later,

Bob

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
> I'm not sure if my first post showed up so I am going to post it again and
I
> apologize if it shows up twice.
>
> Is there a way to delete a record from a mysql table without fragmenting
the
> db?
>
> Here is the query I am using and it does a horrible job. Fragment city.
>
>
>
> if ($quantity == 0)
>  {
> $gone = mysql_query("DELETE FROM {$config["prefix"]}_my_items WHERE
> uid={$session["uid"]} AND id = '$item'");
>   }
>
>
>
>
> Thanks
> Jennifer
>
>
> --
> The sleeper has awaken
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>



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




RE: [PHP-DB] Multiple table select, but still returning row if no record exists in second table?

2002-10-31 Thread phplists
The query should look similar to this:
SELECT table1.col as [column_a],
table2.col as [column_b]
FROM table1
LEFT JOIN (or LEFT OUTER JOIN) table2
ON table2.some_key_col = table1.some_key_col ... for all required keysWHERE 
 


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



RE: [PHP-DB] Multiple table select, but still returning row if no record exists in second table?

2002-10-31 Thread phplists
The query should look similar to this:

SELECT table1.col as [column_a],
  table2.col as [column_b]
FROMtable1
LEFT JOIN (or LEFT OUTER JOIN) table2
ON table2.some_key_col = table1.some_key_col ... for all required keys
WHERE  


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