[PHP-DB] Re: help needed.

2010-03-18 Thread Nadim Attari

Hello,

Maybe these can help. Web Server on CD:

http://ampstart.ly-le.info/
http://www.stunnix.com/
http://www.server2go-web.de/
http://www.indigostar.com/microweb.php

PHP EXE Compiler/Embedder : http://www.bambalam.se/bamcompile/

p.s.: Make sure you encode your PHP codes before distributing...


Vinay Kannan wrote:

Hello Guys,

I am developing an application, which would have a front end in Flash, and
the backend would be MySQL, now what I am thinking is to package this as an
exe file, similar to WAMP, which installs everything, So my exe should have
all my files, the MySQL data dump and should auto install PHP, APACHE,
MySQL, can something like this be done, i am sure it can be done, but how do
I do it, any guidelines please?

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

Re: [PHP-DB] Re: [PHP] the opposite of a join?

2007-10-03 Thread Nadim Attari

Zoltán Németh wrote:

2007. 10. 3, szerda keltezéssel 05.21-kor [EMAIL PROTECTED] ezt írta:
  

I have a company table and a contacts table.  In the contacts table, there
is a field called companyID which is a link to a row in the company table.

 


What is the easiest way to query the company table for all the company rows
whose ID is NOT linked to in the contact table? Basically, the opposite of a
join?




maybe something like

SELECT * FROM company WHERE (SELECT COUNT(*) FROM contact WHERE
company_id = company.company_id)=0

it's not very efficient, but I don't have any better idea. someone else?

greets
Zoltán Németh

From the Manual

   *

 If there is no matching record for the right table in the |ON| or
 |USING| part in a |LEFT JOIN|, a row with all columns set to
 |NULL| is used for the right table. You can use this fact to find
 records in a table that have no counterpart in another table:

 mysql SELECT table1.* FROM table1
 -LEFT JOIN table2 ON table1.id=table2.id
 -WHERE table2.id IS NULL;
 


 This example finds all rows in |table1| with an |id| value that is
 not present in |table2| (that is, all rows in |table1| with no
 corresponding row in |table2|). This assumes that |table2.id| is
 declared |NOT NULL|.

Here it goes:

select company.* from company left join contacts on company.companyId = 
contacts.companyId where contacts.companyId IS NULL


Hope it helps...

Nadim Attari
Alienworkers.com

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



[PHP-DB] Re: MySQL - Unable to run service

2006-03-15 Thread Nadim Attari
Hello,

I'm not being rude but it is a good thing to do before coming here:

http://www.google-is-my-best-friend.com (Jusk kidding...)

Here you go
http://www.google.com/search?hl=enq=%22Error+1067%22+%2B+mysqlbtnG=Search

Some picks:
- http://forums.mysql.com/read.php?11,11388,11388
- http://www.experts-exchange.com/Databases/Mysql/Q_21045378.html

And please, give more specific info about your problem...

Best Regards,
Nadim Attari
Alienworkers.com



Ralph Brickley wrote:
 I have been using MySQL for quite some time and am now running Server 4.1. I
 have been developing custom web-based software for a customer and recently
 moved their server to a different machine. I have everything running
 smoothly EXCEPT for mySQL. Any time I try to start the service I get an
 error:
 
 Error 1067: Unable to start service on Local Computer.
 
  
 
 Anyone have an idea about that? That user logged in is the comp
 administrator.
 
  
 
  
 
 Ralph E. Brickley
 
 AE Security and Electronics
 
 (503) 472-6439 / (877) 472-6439
 
 (503) 519-3914 Cell
 
 (503) 472-3570 Fax
 
 [EMAIL PROTECTED]

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



[PHP-DB] Re: MySQL - Unable to run service

2006-03-15 Thread Nadim Attari
Another link:
http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/Windows_upgrading.html

Regards,
Nadim Attari
Alienworkers.com

Nadim Attari wrote:
 Hello,
 
 I'm not being rude but it is a good thing to do before coming here:
 
 http://www.google-is-my-best-friend.com (Jusk kidding...)
 
 Here you go
 http://www.google.com/search?hl=enq=%22Error+1067%22+%2B+mysqlbtnG=Search
 
 Some picks:
 - http://forums.mysql.com/read.php?11,11388,11388
 - http://www.experts-exchange.com/Databases/Mysql/Q_21045378.html
 
 And please, give more specific info about your problem...
 
 Best Regards,
 Nadim Attari
 Alienworkers.com

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



[PHP-DB] Re: WAMP

2006-03-15 Thread Nadim Attari
Hello,

I use XAMPP locally to test my scripts.. i haven't tested it online.
Have a look: http://www.apachefriends.org

Regards,
Nadim Attari
Alienworkers.com

Kinfe Tadesse wrote:
 Hello,
  
 Can any one recommend me a well-tested package containing Apache, MySQL
 and PHP all in one for Windows? I want to use my computer as a client
 and a web server at the same time. Is there any problem with that?
  
  
 Thank you very much.
  
 Best regards,
  
 Kinfe T.

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



Re: [PHP-DB] Shrinking gifs.. .

2005-06-23 Thread Nadim Attari
Hello, i've got this in the comments:

START

emilus at galeria-m dot art dot pl (30-Sep-2004 10:02)

To resize or copy image (gif [with gd=2.0.28] or png) with transparency.

-Take current transparency color
-create a new image with palette like old one and fill new image with
transparent color
-set transparent color
-copy resized image

$colorTransparent = imagecolortransparent($im);
$im2 = imagecreate($new_w,$new_h);
imagepalettecopy($im2,$im);
imagefill($im2,0,0,$colorTransparent);
imagecolortransparent($im2, $colorTransparent);
imagecopyresized($im2,$im,0,0,0,0,$new_w,$new_h,$imsx,$imsy);

START

Thanks Martin for the tips..

Regards,
Nadim Attari

Martin Norland a écrit dans le message
 nikos wrote:
  Thank you Martin
  I install new gd, reconfigure php and now is running OK.
 
  But, it was a mass to realize that shortening gifs results to loss
  transparency(!).
 [snip]

 imagecolortransparent()

 That function will set the transparent color in an image (only one per
 image).  If you read the description carefully it says that it will
 return the existing one if you don't specify a new color...

 so:
 $transparent_color = imagecolortransparent($uploaded_img);
 imagecolortransparent($thumbnail, $transparent_color);

 That should get you and Nadim what you're looking for, assuming things
 work as promised (I've never used it myself).

 If you need to work with pngs and the likes, imagecolorexactalpha /
 imagecolorclosestalpha - requires GD 2.01 and PHP 4.0.6
 (imagecolorallocatealpha requires PHP 4.3.2 though, oddly enough)

 cheers,
 -- 
 - Martin Norland, Sys Admin / Database / Web Developer, International
 Outreach x3257

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



Re: [PHP-DB] Shrinking gifs.

2005-06-22 Thread Nadim Attari
nikos a écrit dans le message

 But, it was a mass to realize that shortening gifs results to loss
 transparency(!).

Yea TRUE ! The background is black ! You will get the same result when
creating PNG thumbnails !

In fact imagecreate and imagecreatetruecolor both [quoted from the
manual] ... returns an image identifier representing a BLACK image of size
x_size by y_size.
Question:

Does anyone have a script / piece of code that keeps transparency after
creating the thumbnail ?

Regards,
Nadim Attari

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



[PHP-DB] Re: String manipulation

2005-05-01 Thread Nadim Attari
http://www.php.net/manual/en/function.substr.php

Full String Documentation
http://www.php.net/manual/en/ref.strings.php

Regards,
Nadim

 Hi there everyone,



 I'm working with a mysql Db where I have a single string that I have to
 split into 2 strings, the first character is the first name and I have
that
 split off into it's own variable, but what I need to know is what's the
best
 method to read the string again BUT ignore the first letter as that is
 already copied into $firstname?  So basically I have $firstname defined
from
 the one string, but I have to define $lastname from the SAME string value
as
 the one I used for $firstname, BUT ignoring the first letter but I'm not
 sure what the best method is to achieve this?



 Any help would be very appreciated.



 Chris

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



[PHP-DB] Re: retrieve enum values

2005-04-15 Thread Nadim Attari
$descRS = mysql('describe theTableName theEnumColumn');
list($fld_name, $fld_type, $fld_null, $fld_key, $fld_default, fld_extra) =
mysql_fetch_row($descRS);
mysql_free_result($descRS);

// Values you will be interested: $fld_type (and $fld_default perhaps)
// $fld_type will be equal to = enum('1', '2', '3')

$enumValuesArr = split(',', str_replace(', , substr($fld_type, 5, -1)));

echo 'select';

foreach ($enumValuesArr as $enumValue) echo option
value='$enumValue'$enumValue/option

echo '/select';

-

Hope it gonna help!

Regards,
Nadim Attari,
Alienworkers.com
-

 Hi!

 I have a column type enum in mysql.
 At the moment the possible values are 1,2 and 3.

 I make a form for my user to modify that value, something like:
 select
 option value='1'1/option
 option value='2'2/option
 option value='3'3/option
 /select

 I may need to add a value 4 to the enum, and in that case I would like to
 avoid modifying the code.

 I would like to know it it is possible to have something like:
 select possible_enum_values from table ...
 and then having a loop through these values.
 I can't select distinct values in that column because one value may not
 exist yet and I don't want to have fake records.

 I found that in the mysql doc and was wondering if there is an already
 implemented php function intsead of having to parse:
  If you want to determine all possible values for an ENUM column, use
SHOW
 COLUMNS FROM tbl_name LIKE enum_col and parse the ENUM definition in the
 second column of the output.

 Any idea?

 Melanie

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



[PHP-DB] Re: variable and MySQL

2005-03-14 Thread Nadim Attari
 I'd like to use   $get_question_data[xxx_name_en]

 $get_question_data[$test_name_en]
 $get_question_data[{$test}_name_en]
 ${get_question_data[$test_name_en]}

try this ... $get_question_data[{$test}_name_en]

Hope it works...

Nadim Attari

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



[PHP-DB] Re: insertion problem (2)

2005-03-09 Thread Nadim Attari
 $uu=mysql_query(insert into voters2
('id','username','constnum','name','fname','gname','lname')values('$T10','$T
1','$T11','$T4,'$T5','$T6','$T7'));

$sql = insert into voters2
(id,username,constnum,name,fname,gname,lname)values('$T10','$T1','$T11','$T4
,'$T5','$T6','$T7');
$uu=mysql_query($sql);

 $uu2=mysql_query(insert into voters2
('sex','birth_day','email','password') values('$D1','$T9','$T8','$T2'));

$sql = insert into voters2 (sex,birth_day,email,password)
values('$D1','$T9','$T8','$T2');
$uu2=mysql_query($sql);

Try this. Hope it gonna work.

And for the next time, when you ask a question, please include all of the
details which are relevant to your question.
Good things to mention in your post include:
  a.. URL's
  b.. Keywords
  c.. A good description of the problem
  d.. Troubleshooting steps you have already taken
Also, please give your question a relevant subject. robots.txt syntax
question is a good subject. Please help is not a good subject.

Regards,
Nadim Attari

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



[PHP-DB] Re: donwload listed dir

2005-02-16 Thread Nadim Attari
http://www.chrispederick.com/work/php/source/file/file.php


It Clown [EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 Hi All,

 How would i create links dynamicaly for each file that has
 been listed in a dir?

 Regards
 __
 http://www.webmail.co.za the South African FREE email service

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



[PHP-DB] Re: characters problem

2004-12-16 Thread Nadim Attari
 $myquery=INSERT INTO `$table` (`comments`) VALUES ('$mycomments');

$mycomments = addslashes($mycomments);
$myquery = INSERT INTO $table (comments) VALUES ('$mycomments');

See:

http://www.php.net/addslashes

Hope it solves the problem.

nadim attari

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



[PHP-DB] Re: Database Error submitting form

2004-08-31 Thread Nadim Attari
You get this notice because when the form is displayed, it means the data
has not been sent, hence $_POST is empty!

Add isset() in front of every $_POST and $_GET
Example:

if (isset($_POST['pp']  $_POST['pp'] != 'addpost')

---

You may also add this line at the very top of the page!
This line will not give the notice - even if isset() is not added!

?php error_reporting(0); ?

Hope it helps!

Nadim Attari

[EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 Dear Friends,
 My form was working on localhost, without any error and was writing to
 database, however, now on server, over the internet, it does write to
database,
 there is no problem of connection or writng to database.

 Still it gives this shabby error.
 Any Guidance, please.

 --

 
 Notice: Undefined index: pp in
 \\premfs15\sites\premium15\mrpeace\webroot\replytopost.php on line 7
 --- 
 Code of the script
 -
 ?php
 //connect to server and select database; we'll need it soon
 $conn = mysql_connect(orf-kster.com, mr, p) or die(mysql_error());
 mysql_select_db(mr,$conn)  or die(mysql_error());

 //check to see if we're showing the form or adding the post
 if ($_POST['pp'] != addpost) {
// showing the form; check for required item in query string
if (!$_GET['post_id']) {
 header(Location: topiclist.php);
 exit;
}

//still have to verify topic and post
$verify = select ft.topic_id, ft.topic_title from forum_posts as fp
left
 join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id =
 $_GET[post_id];
$verify_res = mysql_query($verify, $conn) or die(mysql_error());
if (mysql_num_rows($verify_res)  1) {
//this post or topic does not exist
header(Location: topiclist.php);
exit;
} else {
//get the topic id and title
$topic_id = mysql_result($verify_res,0,'topic_id');
$topic_title = stripslashes(mysql_result($verify_res,
 0,'topic_title'));

print 
html
head
titlePost Your Reply in $topic_title/title
/head
body
h1Post Your Reply in $topic_title/h1
form method=post action=\$_SERVER[PHP_SELF]\
pstrongYour E-Mail Address:/strongbr
input type=\text\ name=\post_owner\ size=40 maxlength=150

PstrongPost Text:/strongbr
textarea name=\post_text\ rows=8 cols=40
wrap=virtual/textarea

input type=\hidden\ name=\op\ value=\addpost\
input type=\hidden\ name=\topic_id\ value=\$topic_id\

Pinput type=\submit\ name=\submit\ value=\Add Post\/p

/form
/body
/html;
}
 } else if ($_POST[pp] == addpost) {
//check for required items from form
if ((!$_POST['topic_id']) || (!$_POST['post_text']) ||
 (!$_POST['post_owner'])) {
header(Location: topiclist.php);
exit;
}

//add the post
$add_post = insert into forum_posts values ('', '$_POST[topic_id]',
 '$_POST[post_text]', now(), '$_POST[post_owner]');
mysql_query($add_post,$conn) or die(mysql_error());

//redirect user to topic

exit;
 }
 ?
 

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



[PHP-DB] Re: E-mail as HTML

2004-08-26 Thread Nadim Attari
 In PHP, how do I submit data by e-mail as HTML to a specified address? And
where can I find samples of that in http://www.php.net/ ?

HTML Mime mail at phpGuru
http://www.phpguru.org/static/mime.mail.html

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



[PHP-DB] Re: I have a CR-LF problem when pulling stuff out of my DB

2004-08-23 Thread Nadim Attari
 function RemoveWhiteSpaces($str = '')
 {
  $search = array ('([\r\n])');
  $replace = array (\n);
  $str = preg_replace ($search, $replace, $str);
  return $str;
 }

Just a thought:

1. Read contents of the file (file() and implode() in php) so that the
contents are contained in an array
2. foreach (lines as linenum = line) line = RemoveWhiteSpaces(line);
3. fwrite back to file

that's a rough idea..

hope it helps,

nadim attari
==

This may not be exaxtly PHP-DB related but it is a result of screwing
something up grin.

I pulled a bunch of data from a DOS formatted tab seperated file and now I
am
dumping back out into a text file (on linux).

So, as you can imagine, I ended up with a bunch of ^M throughout the file.
I
plan on fixing this.  The solution is easy enough.  I just need to remember
to open the text files in vim and save as unix files.

However, I now have an immediate need.  I want to open these five files in
vim
and find and replace the ^M in every instance.  I know how to find and
replace (:g/find//s/replace/g).  But I cannot get the ^M in the string.  If
I
actually hit ctrl-m it reads as a return; if I type ^M using the shift-6
then it looks for the actual characters.

Can anyone help?

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



Re: [PHP-DB] Deleting older records

2004-08-13 Thread Nadim Attari
 Okay I have a timestamp field how do I create a query to delete all
entries
 older than an hour.  Timestamp field is set by now() function.

DELETE FROM tblDownloadTrack WHERE `timestamp` 
TIME_TO_SEC(DATE_SUB(NOW( ), INTERVAL 1 HOUR))

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



[PHP-DB] Re: Good books on sql / mysql

2004-08-11 Thread Nadim Attari
http://sudhirmangla.i6networks.com/books/database.htm
http://www.maththinking.com/boat/computerbooks.html


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



[PHP-DB] mySQL Parse Error

2004-03-22 Thread Nadim Attari
Hi,

I have a table:

CREATE TABLE `cashmire` (`id` smallint(3) unsigned NOT NULL auto_increment,
`itemcode` varchar(25) NOT NULL default '', `collection` char(2) NOT NULL
default 'cl',
`promotion` char(1) default 'n', `bestSeller` char(1) default 'n',
`newArrival` char(1) default 'n', `size` varchar(15) default NULL, `colour`
varchar(30) default NULL,
`image` varchar(7) default NULL, `currency` char(3) default 'MRS', `price`
mediumint(8) unsigned NOT NULL default '0', `description` text, `purchased`
smallint(3) unsigned default NULL,
PRIMARY KEY (`id`), UNIQUE KEY `itemcode` (`itemcode`), ) TYPE=MyISAM;

When i run this SQL:

insert into cashmire ('itemcode', 'collection', 'promotion', 'bestSeller',
'newArrival', 'size', 'color', 'image', 'currency', 'price', 'description',
'purchased') values ('31474', 'cl', 'n', 'n', 'y', 'S-M-L-XL', 'AQ-BL-EC',
'', 'MRS', '8400', 'Long sleeve chunky roll neck cardigan (12 ply) with high
ribbed welt and turn-back cuffs, authentic coconut buttons', '0')

I get:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''itemcode',
'collection', 'promotion', 'bestSeller', 'newArriva

I can't understand... tried googling but still no answer!

Can someone help me please,

regards,

nadim attari

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



Re: [PHP-DB] mySQL Parse Error

2004-03-22 Thread Nadim Attari
 You should not have quotes around the column names.
Yea. that was the problem...

'color' a was trivial error !

i got it at home after office hours!!! Seems that a break is necessary when
things go wrong !!!

Thnx

Nadim Attari

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



[PHP-DB] Scrollbar + javaScript

2004-03-15 Thread Nadim Attari
Hello,

This is much an HTML/javaScript problem (and not PHP). Your help is
appreciated!

Is there a way to know (e.g. through javaScript) whether scrollbar is
active?

Problem:

I have a window in which there is a table. if there is much contents, a
vertical scrollbar appears; if little content the scrollbar does not appear.
My problem is that i would like to know whether the scrollbar is here or
not; hence adjust the width of the table (and colums) accordingly! I have
disabled horizontal scrollbar (overflox-x: hidden in CSS).

Thx,

Nadim Attari
Alienworkers.com
Mauritius

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



Re: [PHP-DB] Scrollbar + javaScript

2004-03-15 Thread Nadim Attari
 Hello Nadim,

 This is entirely different from PHP and databases, so please pick the
 right list for these kind of questions. The matter can be handled with
 JavaScript (which is a client-side scripting language, while PHP and
 databases are server side).

 Please use google and you will find your solution.

 Regards,

 Filip de Waard

Hi,

My sincere apologies. In fact I sent this to a different forum (PHP at
OVH)... dunno how it ended here.

Again my sincere apologies.

Best Regards,
Nadim Attari

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



[PHP-DB] Re: mktime question

2004-02-10 Thread Nadim Attari
http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#IDX1342

insert into tbl (timeCol) values (now())

when you retrieve the time from mySQL, you format it the way you want and
then display it !!!

http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#IDX1357

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



[PHP-DB] Re: MySQL Field length

2003-12-16 Thread Nadim Attari
 Hi,

 What is the maximum length for the name of a column in MySQL?

 Thanks for your help

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Legal_names

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



[PHP-DB] Re: Images and PHP

2003-08-21 Thread Nadim Attari
PHP
http://www.php.net/manual/en/ref.image.php

ImageMagick
http://www.imagemagick.org/www/identify.html

PEAR: Imagick
http://pear.php.net/package-info.php?package=imagick



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



[PHP-DB] Re: Multiple same values only wanting one

2003-07-15 Thread Nadim Attari
 How do I select * from a table, but I do not want it to return the same
 value if two fields are the same.  Example

- DISTINCT
- GROUP BY



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



[PHP-DB] Re: A complex query problem

2003-07-04 Thread Nadim Attari
From MS-SQL Server Manual:
A subquery is a SELECT query that returns a single value and is nested
inside a SELECT, INSERT, UPDATE, or DELETE statement, or inside another
subquery. A subquery can be used anywhere an expression is allowed.

Unfortunately you do not have Sub-queries in mySQL ...
Try this script...

?php
$link = mysql_connect('localhost', 'root', '') or die('Could not
connect');
mysql_select_db('test') or die('Could not select database');

// Declare vars..
$sports = $graduation = $both_activities = array();

// Get all the schools where there is Sports
$sql = select distinct sid from school_highlight_details where hid =
'2';
$result = mysql_query($sql) or die(Query failed);
while (list($school_id) = mysql_fetch_row ($result)) $sports[] =
$school_id;
mysql_free_result($result);

// Get all the schools where there is Graduation
$sql = select distinct sid from school_highlight_details where hid =
'4';
$result = mysql_query($sql) or die(Query failed);
while (list($school_id) = mysql_fetch_row ($result)) $graduation[] =
$school_id;
mysql_free_result($result);

// Find common in both..
 $both_activities = array_intersect($sports, $graduation);
 $condition = '(';
 foreach($both_activities as $anything = $school_id) $condition .=
$school_id, ;
 $condition = substr($condition, 0, -2) . ')';

 $sql = Select sID, school_name FROM school where sID in $condition;
 $result = mysql_query($sql) or die(Query failed);
while (list($sID, $school_name) = mysql_fetch_row ($result)) echo $sID.
$school_namebr;
mysql_free_result($result);

mysql_close($link);
?

If you are using mySQL 4, read on UNION ...

(SELECT a FROM table_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM table_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10)
ORDER BY a;



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



[PHP-DB] Re: How to get PHP to download web contents

2003-07-03 Thread Nadim Attari
 How would you get PHP to download a file such as a web page and put it in
a string?

From the manual:
$html = implode ('', file ('http://www.example.com/'));

Note: As of PHP 4.3.0 you can use file_get_contents() to return the contents
of a file as a string.



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



[PHP-DB] Re: HELP PLEEASSSEE

2003-06-30 Thread Nadim Attari
 select size=1 name=area
 .
 while($row = mysql_fetch_array($result))
 {
 ?
 option value=?=$row['area']??=$row['area']?/option
 ?
 .
---

USE QUOTES

 .
while($row = mysql_fetch_array($result))
{
?
option value=?=$row['area']??=$row['area']?/option
?
}
 .



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