Re: [PHP-DB] Re: delete message function

2011-06-14 Thread Simcha Younger
On Tue, 14 Jun 2011 00:50:39 -0500
Chris Stinemetz chrisstinem...@gmail.com wrote:

 On Tue, Jun 14, 2011 at 12:31 AM, Chris Stinemetz
 chrisstinem...@gmail.com wrote:
  I created the below delete function, but it doesn't seem to be working
  correctly. When I enter the correct password it get my echo Incorrect
  Password Did not Delete! When I leave the password blank the message
  will delete from mysql table.
 
  Am I missing something??

 
 $result = mysql_query(SELECT Title, Password FROM mbmsgs WHERE ID
 = {$_REQUEST['Msg']};);
 extract(mysql_fetch_array($result), EXTR_PREFIX_ALL, 'msg');
 
 if (isset($_POST['Password'])) {
 if (sha1($_POST['Password']) != $msg_Password) {
 echo Incorrect password did not delete!;
 exit;
 }

It sounds like the password is not set in the database. What do you get if you 
dump the result of your first query?
Also, you should avoid extract, it litters your code with dead and untraceable 
variables. Use $array['msg_Passowrd'] instead.

-- 
Simcha Younger simcha.youn...@gmail.com

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



Re: [PHP-DB] jpgraph and mysql passing array

2011-03-24 Thread Simcha Younger
On Wed, 23 Mar 2011 15:59:50 -0500
Chris Stinemetz chrisstinem...@gmail.com wrote:

 Hello,

 ?php
 
 echo You Selected the following:brMarket = $term brCell_Sector =
 $term2brTimestamp = $term3br; ?

note the closing PHP tag above, and now 
 
this line here, is not in php, and does not echo the php variables.
 
 img src=bandingGraph.php?$datax=$row[Distance]$datay=$row[MBusage];
 // I think this is where I am having issues.
 


try instead 
?php 
echo 'img 
src=bandingGraph.php?datax='.$row[Distance].'datay='.$row[MBusage].'';
?
-- 
Simcha Younger sim...@syounger.com

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



Re: [PHP-DB] Re: Stuck in apostrophe hell

2010-08-04 Thread Simcha Younger

 paul_s_john...@mnb.uscourts.gov wrote:

  
  THE INPUT:
  
  $sql_insert_registration = sprintf(INSERT INTO
Registrations (
  Class_ID,
  prid,
  Registrant,
  Company,
  Phone,
  Email
)
  VALUES (
  $_POST[Class_ID],
  $_POST[prid],
  '%s',.

You need double-quotes here, 
 \%s\,

  parseNull($_POST['Company']).,
  '$_POST[Phone]',
  '$_POST[Email]'
  ), mysql_real_escape_string($_POST['Registrant']));
  


-- 
Simcha Younger sim...@syounger.com

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



Re: [PHP-DB] Trying to make site map

2010-01-03 Thread Simcha Younger
 
 ($Namebr);
   
   
   }
   
   }
   
   }
 
 The results I am getting are incomplete, it only pulls one page per  
 level instead of all the pages per level, Like this:
 Page1, Page 2, Page3
 it skips Page4.
 
 When I remove the request for the third level, then I get:
 Page1,Page2,Page4  Which is correct up to that point. It breaks  
 apart when I try to go on the third level.
 
 Any ideas how I can get this to work? In the end there will be 5 levels.
 Thanks
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
Simcha Younger sim...@syounger.com

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



RE: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Simcha Younger

If there is only one search term - soup your where statement would be:
Where `name` like 'soup'

But you need two matches, and the terms are soup, vegetarian. Try:
Where GROUP_CONCAT('name') like 'soup'
AND GROUP_CONCAT('name') like 'vegetarian'
group by taggings.id

You probably awnt a LEFT JOIN instead of a 

Simcha Younger

-Original Message-
From: Catharsis [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2008 1:41 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Delicious style Tags table


So I am having difficulty thinking of how to make this select query.  I have
two tables that mimic tags similar to flickr, delicious etc.  They are
defined below



CREATE TABLE IF NOT EXISTS `taggings` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `tag_id` int(11) NOT NULL,
  `taggable_id` int(11) NOT NULL,
  `taggable_type` varchar(255) collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `index_taggings_on_tag_id_and_taggable_id_and_taggable_type`
(`tag_id`,`taggable_id`,`taggable_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE IF NOT EXISTS `tags` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `unique_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


Just to explain the taggings table, tag_id points directly to the tag table,
taggable_id is the id of the item you have tagged in another table.  The
taggable_type is string reference to the table that the item you tagged sits
in, so in the exaplme below it would be a table called 'recipes'


So, say you have 2 items each with the same tag but one item as two tags. 
For instance a two soup Recipes could be tagged with 'soup' but only one of
them is vegetarian.  So Recipe 1 has the tag 'soup' and recipe 2 has 'soup'
and 'vegetarian'


I want to be able to pass my SQL the word 'soup' and it return both records
in taggings table which will point to both recipes.  However if I want just
vegetarian soups then I only want it to return the one record.  I hope that
is understandable


What I have currently (below) is just a simple join.  Which obviously
doesn't work.  I just cant think how to piece these two tables together to
get the records I want.

SELECT `tags`.*, `taggings`.* FROM `tags`
 JOIN `taggings` ON tags.id = taggings.tag_id WHERE (name IN ('vegetarian',
'soup'))




-- 
View this message in context:
http://www.nabble.com/Delicious-style-Tags-table-tp19433010p19433010.html
Sent from the Php - Database mailing list archive at Nabble.com.

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.169 / Virus Database: 270.6.20/1666 - Release Date: 11/09/2008
07:03


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



RE: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Simcha Younger

I did a little testing, and this should work better:

Select...
From...
group by taggings.id
HAVING GROUP_CONCAT('name') like 'soup'
AND GROUP_CONCAT('name') like 'vegetarian'


Simcha Younger

-Original Message-
From: Catharsis [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2008 6:44 PM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Delicious style Tags table




Simcha Younger-2 wrote:
 
 If there is only one search term - soup your where statement would be:
   Where `name` like 'soup'
 
 But you need two matches, and the terms are soup, vegetarian. Try:
   Where GROUP_CONCAT('name') like 'soup'
   AND GROUP_CONCAT('name') like 'vegetarian'
   group by taggings.id
 

You might be onto something, couldn't get your suggestion to work out the
box but after looking at the docs

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_grou
p-concat



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



RE: [PHP-DB] Date Translation in MySQL

2008-08-05 Thread Simcha Younger
Select * FROM ... WHERE DAYOFWEEK(datecol)=7

-Original Message-
From: Ben Miller [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 05, 2008 8:10 PM
To: PHP. DB Mail List
Subject: [PHP-DB] Date Translation in MySQL

I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week.  My dates are stored in the DB in
-MM-DD HH:MM:SS format.  Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.5.12/1592 - Release Date: 05/08/2008
06:03


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