delete across multiple tables problem

2003-07-12 Thread Craig Westerman
I'm trying to help a friend with this. When I run this everything is fine

SELECT * from clicks, urls WHERE clicks.url=urls.url AND urls.description IS
NULL

The clicks table has 31 instances of url that match 5 instances of url in
the urls table.

When I run the following I get a syntax error

DELETE * from clicks, urls WHERE clicks.url=urls.url AND urls.description IS
NULL

What am I doing wrong?

Thanks Craig


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MySQL - PHP - Banner ad click through tracker

2002-05-01 Thread Craig Westerman

Does anyone here have a PHP script that will store banner ad click throughs
in a MySQL database?

If not, is anyone here interested in doing this project?

Thanks

Craig 
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL counter for HIGH traffic site

2002-04-14 Thread Craig Westerman

I'm needing counter for site that receives 80 to 120 hits a minute at peak
load. Many I
have tried cause excessive server load and need to be deactivated or they
lose data and return to zero without warning. All tried so far have been
written in Perl writing to a file.

Anyone here know of a counter that would handle HIGH traffic with little
added server load? Would using MySQL to store count be of any benifit?

Would Perl or PHP be faster for writing count to MySQL?

Thanks

Craig 
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL - check for existing data

2002-03-16 Thread Craig Westerman

I have a db table that receives weather data several times a day via a php
script and cron job. Sometimes the data is duplicated for a certain time
window.

11:50 44 degree
11:50 44 degree
11:40 45 degree
11:30 46 degree
11:20 46 degree
11:10 45 degree

I do not want the duplicate data for the 11:50 time slot to be inserted into
my table. Is there a common method used to check if data already exists in a
db table and if so to cancel the data insertion? What is this called? Is
this demonstrated in the MySQL book or documentation. If I knew what this
was called, I might have better luck finding solution.

Thanks

Craig 
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




data from service into MySQL

2002-03-05 Thread Craig Westerman

I'm retrieving data from a data service. 
This is the ENTIRE source code of the URL they let me receive:


symbolRHAT/symbol
price6.82/price
date3/4/2002/date
time3:59pm/time
change0.32/change
change_percent/change_percent
open6.59/open
high6.99/high
low6.53/low
volume932400/volume


How can I insert the data values into fields in MySQL ?

Thanks

Craig 
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




mysql php - while loops

2002-02-26 Thread Craig Westerman

The following lists 12 items from a fruits table.

$results = mysql_query(SELECT ID, date, appleprice, orangeprice, pearprice
FROM fruits);
while ($data = mysql_fetch_array($results))
{
?
p?=$data[date]? - ?=$data[appleprice]? -
?=$data[orangeprice]? - ?=$data[pearprice]?/p
?
}

How would I modify the loop to display 4 items then a row of fruit images
then 4 more items then another row of different fruit images and then
finally finish the loop displaying the final 4 items?

Thanks

Craig 
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Paul DuBois - Thank You

2002-02-25 Thread Craig Westerman

for the EXCELLENT index in your MySQL book. I developed several questions
this morning and was able to find answers to all easily using the index in
your book.

Much appreciated.

Craig 
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL php - assigning date variables

2002-02-25 Thread Craig Westerman

$query = 
mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%');
// returns all items in database


$query = 2001-01-01
mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%');
// returns all rows that have 2001-01-01 as the date


What is proper way to define a variable to include all dates newer than
1995-01-01?
$query = ???

What is proper way to define a variable to include all dates older than
1995-01-01?
$query = ???

What is proper way to define a variable to include all  dates between
1995-01-01 and 1998-12-31?
$query = ???


Everything I tried gives me an error. This has to be simple, but I must be
overlooking something. Where would I find the answer?

Thanks

Craig 
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL php - assigning date variables

2002-02-25 Thread Craig Westerman

SQL statement are:

 What is proper way to define a variable to include all dates newer than
 1995-01-01?
 $query = ???

select * from table where date  '1995-01-01'

 What is proper way to define a variable to include all dates older than
 1995-01-01?
 $query = ???

select * from table where date  '1995-01-01'


 What is proper way to define a variable to include all  dates between
 1995-01-01 and 1998-12-31?
 $query = ???

select * from table where date  '1998-12-31' and date  '1995-01-01'

Regards,
Dan


Thanks for the reply Dan,
I don't think that will do what I need. I want to assign my query to a
variable and have the variable inserted into the query statement. See my
script below. If I change the query statement as you show, the rest of the
script will need to be rewritten as $query is used throughout. I'm not able
yet to do that. :(

Any help would be appreciated.

Thanks

Craig 
[EMAIL PROTECTED]


?
$db_addr = 'localhost'; // address of MySQL server.
$db_user = 'root';  // Username to access server.
$db_pass = 'abc123';// Password access server.
$db_name = 'db1';   // Name of database to connect to.
$connect = @mysql_connect($db_addr, $db_user, $db_pass);
$query = ;

if (!($connect)) // If no connect, error and exit().
{
echo(pUnable to connect to the database server./p);
exit();
}

if (!(@mysql_select_db($db_name))) // If can't connect to database, error
and exit().
{
echo(pUnable to locate the $db_name database./p);
exit();
}

if (!($limit)){
$limit = 3;} // Default results per-page.
if (!($page)){
$page = 0;} // Default page value.
$numresults = mysql_query(SELECT * FROM table1 WHERE date LIKE '%. $query
.%'); // the query.
$numrows = mysql_num_rows($numresults); // Number of rows returned from
above query.
if ($numrows == 0){
echo(No results found matching your query - $query); // bah, modify the
Not Found error for your needs.
exit();}

$pages = intval($numrows/$limit); // Number of results pages.

// $pages now contains int of pages, unless there is a remainder from
division.

if ($numrows%$limit) {
$pages++;} // has remainder so add one page

$current = ($page/$limit) + 1; // Current page number.

if (($pages  1) || ($pages == 0)) {
$total = 1;} // If $pages is less than one or equal to 0, total pages is 1.

else {
$total = $pages;} // Else total pages is $pages value.

$first = $page + 1; // The first result.

if (!((($page + $limit) / $limit) = $pages)  $pages != 1) {
$last = $page + $limit;} //If not last results page, last result equals
$page plus $limit.

else{
$last = $numrows;} // If last results page, last result equals total number
of results.

//escape from PHP mode.
?
html
head
titleSearch Results for ?=$query?/title
/head
body
centerh2Search Results for ?=$query?/h2/center
table width=100% border=0
 tr
  td width=50% align=left
Results b?=$first?/b - b?=$last?/b of b?=$numrows?/b
  /td
  td width=50% align=right
Page b?=$current?/b of b?=$total?/b
  /td
 /tr
 tr
  td colspan=2 align=right
nbsp;
  /td
 /tr
 tr
  td colspan=2 align=right
Results per-page: a
href=?=$PHP_SELF??query=?=$query?page=?=$page?limit=55/a | a
href=?=$PHP_SELF??query=?=$query?page=?=$page?limit=1010/a | a
href=?=$PHP_SELF??query=?=$query?page=?=$page?limit=2020/a | a
href=?=$PHP_SELF??query=?=$query?page=?=$page?limit=5050/a
  /td
 /tr
/table
?
//Go back into PHP mode.

// Now we can display results.
$results = mysql_query(SELECT * FROM table1 WHERE date LIKE '%. $query
.%' ORDER BY date ASC LIMIT $page, $limit);
while ($data = mysql_fetch_array($results))
{
?
p?=$data[date]? - ?=$data[abc]? - ?=$data[def]? -
?=$data[ghi]?/p
?
}
?
p align=center
?
if ($page != 0) { // Don't show back link if current page is first page.
$back_page = $page - $limit;
echo(a
href=\$PHP_SELF?query=$querypage=$back_pagelimit=$limit\back/a
\n);}

for ($i=1; $i = $pages; $i++) // loop through each page and give link to
it.
{
 $ppage = $limit*($i - 1);
 if ($ppage == $page){
 echo(b$i/b \n);} // If current page don't give link, just text.
 else{
 echo(a href=\$PHP_SELF?query=$querypage=$ppagelimit=$limit\$i/a
\n);}
}

if (!((($page+$limit) / $limit) = $pages)  $pages != 1) { // If last page
don't give next link.
$next_page = $page + $limit;
echo(a
href=\$PHP_SELF?query=$querypage=$next_pagelimit=$limit\next/a\n);}
?
/p
/body
/html



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL Load Data Infile

2002-02-22 Thread Craig Westerman

I have a table that has following fields

id (auto increment)
date
appleprice
orangeprice
pearprice

When I try to LOAD DATA INFILE with this file using comma as field delimiter
and newline as end of row

2000-01-04,281.08,5.27,430.05
2000-01-05,280.06,5.14,421.98
2000-01-06,279.99,5.13,408.59
2000-01-07,281.72,5.14,415.79
2000-01-10,281.32,5.17,415.80
2000-01-11,282.83,5.16,416.36
2000-01-12,281.64,5.14,419.70
2000-01-13,283.27,5.11,421.50
2000-01-14,283.25,5.13,429.09
2000-01-17,284.99,5.10,430.91
2000-01-18,285.75,5.10,432.21

it only writes to one row in the table and seems to be adding the id fields
and date fields. pearprice field is empty. This is result of the one row
affected

id   date   appleprice orangeprice pearprice
127   2028-01-08   5.27 430.05

Is my data formated incorrectly? Help!

Can someone please show me example of their mysql data in a working
situation?

Thanks Craig


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Connect question

2002-02-20 Thread Craig Westerman

Below is two scripts. The first one connects fine. The second gives the
following error.

Parse error: parse error in /usr/www/users/abc/connect.php on line 1

What is the problem with the second script? Thanks in advance - Craig

#1 - Works
---
HTML
HEAD
TITLE Our List of Jokes /TITLE
HEAD

BODY
?php
// Connect to the database server
$dbcnx = @mysql_connect(localhost, root, DWZ9bBXe);
if (!$dbcnx) {
echo( PUnable to connect to the . database server at this time./P );
exit();
}
// Select the jokes database
if (! @mysql_select_db(jokes) ) {
echo( PUnable to locate the joke . database at this time./P );
exit();
}
?
P Here are all the jokes in our database: /P
BLOCKQUOTE
?php

// Request the text of all the jokes
$result = mysql_query(SELECT JokeText FROM jokes);
if (!$result) {
echo(PError performing query:  . mysql_error() . /P);
exit();
}
// Display the text of each joke in a paragraph
while ( $row = mysql_fetch_array($result) ) {
echo(P . $row[JokeText] . /P);
}
?
/BLOCKQUOTE
/BODY
/HTML
---
---

#2 Errors
---
html
head
titleConnect to a MySQL Server/title
/head

body
?php

$dbcnx = @mysql_connect(localhost, root, DwZ9bBXe);

if ($dbcnx != FALSE)
{
 print The connection to the server was made successfully.;
}
else
{
 print The connection to the server failed.;
}

mysql_close($dbcnx);

?

/body
/html


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MS Excel to MySQL upload macro?

2001-08-17 Thread Craig Westerman

I have data I create daily in MS Excel. I need to insert this data into
MySQL data base on my web server every night. Does anyone here have a VB
technique to upload to MySQL from Excel via a macro?

Thanks

Craig 
[EMAIL PROTECTED]